Merge pull request #3527 from jfbu/fixdoublequotes

Protect TeX double quotes ligatures in inline literals (refs #3507)
This commit is contained in:
Jean-François B 2017-03-10 09:24:23 +01:00 committed by GitHub
commit 94e9d3e28b
3 changed files with 15 additions and 1 deletions

View File

@ -438,6 +438,14 @@ Let us now list some macros from the package file
the new macros are wrappers of the formerly hard-coded ``\texttt``, the new macros are wrappers of the formerly hard-coded ``\texttt``,
``\emph``, ... The default definitions can be found in ``\emph``, ... The default definitions can be found in
:file:`sphinx.sty`. :file:`sphinx.sty`.
- macros for directional double quotes: pairs of straight double quote ``"``
in reST source are converted into LaTeX mark-up
``\sphinxquotedblleft{}`` and ``\sphinxquotedblright{}`` which default to
`````\ ````` and ``''`` (i.e. the TeX mark-up for directional double
quotes via font ligaturing mechanism.)
.. versionadded:: 1.5.4
Formerly, produced TeX was directly with `````\ ````` and ``''``.
- paragraph level environments: for each admonition type ``<foo>``, the - paragraph level environments: for each admonition type ``<foo>``, the
used environment is named ``sphinx<foo>``. They may be ``\renewenvironment`` used environment is named ``sphinx<foo>``. They may be ``\renewenvironment``
'd individually, and must then be defined with one argument (it is the heading 'd individually, and must then be defined with one argument (it is the heading

View File

@ -1243,6 +1243,10 @@
\protected\def\sphinxstyleabbreviation {\textsc} \protected\def\sphinxstyleabbreviation {\textsc}
\protected\def\sphinxstyleliteralintitle {\sphinxcode} \protected\def\sphinxstyleliteralintitle {\sphinxcode}
% LaTeX writer uses macros to hide double quotes from \sphinxcode's \@noligs
\protected\def\sphinxquotedblleft{``}
\protected\def\sphinxquotedblright{''}
% stylesheet for highlighting with pygments % stylesheet for highlighting with pygments
\RequirePackage{sphinxhighlight} \RequirePackage{sphinxhighlight}

View File

@ -2209,7 +2209,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_Text(self, node): def visit_Text(self, node):
text = self.encode(node.astext()) text = self.encode(node.astext())
if not self.no_contractions and not self.in_parsed_literal: if not self.no_contractions and not self.in_parsed_literal:
text = educate_quotes_latex(text) text = educate_quotes_latex(text,
dquotes=("\\sphinxquotedblleft{}",
"\\sphinxquotedblright{}"))
self.body.append(text) self.body.append(text)
def depart_Text(self, node): def depart_Text(self, node):