Commits

Georg Brandl committed 92577b1

Closes #636: Keep straight single quotes in literal blocks in the LaTeX build.

  • Participants
  • Parent commits 3b1c667
  • Branches stable

Comments (0)

Files changed (3)

 Bugs fixed
 ----------
 
+* #636: Keep straight single quotes in literal blocks in the LaTeX build.
 * #1419: Generated i18n sphinx.js files are missing message catalog entries
   from '.js_t' and '.html'. The issue was introduced from Sphinx-1.1
 * #1363: Fix i18n: missing python domain's cross-references with currentmodule

sphinx/highlighting.py

 \newcommand\PYGZcb{\char`\}}
 '''
 
+# used if Pygments is available
+# use textcomp quote to get a true single quote
+_LATEX_ADD_STYLES = r'''
+\renewcommand\PYGZsq{\textquotesingle}
+'''
+
 parsing_exceptions = (SyntaxError, UnicodeEncodeError)
 if sys.version_info < (2, 5):
     # Python <= 2.4 raises MemoryError when parsing an
         if self.dest == 'html':
             return formatter.get_style_defs('.highlight')
         else:
-            return formatter.get_style_defs()
+            return formatter.get_style_defs() + _LATEX_ADD_STYLES

sphinx/texinputs/sphinx.sty

 \RequirePackage{parskip}
 % For parsed-literal blocks.
 \RequirePackage{alltt}
+% Display "real" single quotes in literal blocks.
+\RequirePackage{upquote}
 
 % Redefine these colors to your liking in the preamble.
 \definecolor{TitleColor}{rgb}{0.126,0.263,0.361}