8000 PDF build via xelatex transforms straight double quotes into curly ones (smartquotes being turned off) · Issue #6886 · sphinx-doc/sphinx · GitHub
[go: up one dir, main page]

Skip to content

PDF build via xelatex transforms straight double quotes into curly ones (smartquotes being turned off) #6886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jfbu opened this issue Dec 4, 2019 · 0 comments

Comments

@jfbu
Copy link
Contributor
jfbu commented Dec 4, 2019

Consider following source

Test
====

"versions" 'version'

And

latex_engine = 'xelatex'
smartquotes = False

in conf.py. On make latexpdf we find in PDF output curly quotes ”versions” ’version’

Note that the latex file itself does correctly contain "versions" 'version'
Environment info

  • OS: Mac
  • Python version: 3.7.5
  • Sphinx version: 2.x
  • Sphinx extensions: none
  • Extra tools: TeXLive 2019

This is reminiscent to #5179 (which was lualatex specific) and the fix as #5790 works.

In contrast, straight double quotes remains with pdflatex straight in PDF output as long as \usepackage[T1]{fontenc} is used, which is Sphinx default. Thus xelatex/lualatex behaves differently on same latex input.

But 'version' in input will give ’version’ in PDF for all engines (not tested Japanese). I am surprised that this has not been raised as issue so far, I need to investigate a bit, keeping it separate. With the default smartquotes = True the output will have the expected typographical curly quotes‘version’ (and “versions”) expected for English language.

@jfbu jfbu added this to the 2.3.0 milestone Dec 4, 2019
@jfbu jfbu changed the title PDF build via xelatex transforms straight double quotes into curly ones (smartquotes being turned off)) PDF build via xelatex transforms straight double quotes into curly ones (smartquotes being turned off) Dec 4, 2019
jfbu added a commit to jfbu/sphinx that referenced this issue Dec 4, 2019
Closes: sphinx-doc#6886

It is difficult to understand why fontspec _by default_ turns straight
double quotes " into ” i.e. right curly ones, calling this "TeX
ligature", but that's life and fortunately fontspec also provides a way
to turn this off. With this workaround also a straight ' in LaTeX file,
(i.e. a straight ' in source and smartquotes = False was used) will not
become a curly quote and this is an advantage compared to the pdflatex
situation.

We suppress TeX Ligatures also for \ttfamily (used in code-blocks) but
that appears to be already the case with fontspec although user manual
does not seem explicit (and no list of what exactly the TeX Ligatures
are is to be found in fontspec user documentation, one has to go into
its source code). (the fact that Pygmentize escapes the " to \char`\"
TeX mark-up would not by itself prevent the transformation into a curly
double quote, it is because fontspec does not apply this transform to
monospace typeface that it did not show).
@tk0miya tk0miya closed this as completed in bc15575 Dec 8, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant
0