|
40 | 40 | ord('}'): '\\PYGZcb{}'} |
41 | 41 |
|
42 | 42 | # used if Pygments is available |
| 43 | +# MEMO: no use of \protected here to avoid having to do hyperref extras, |
| 44 | +# (if in future code highlighting in sectioning titles is activated): |
| 45 | +# the definitions here use only robust, protected or chardef tokens, |
| 46 | +# which are all known to the hyperref re-encoding for bookmarks. |
| 47 | +# The " is troublesome because we would like to use \text\textquotedbl |
| 48 | +# but \textquotedbl is *defined to raise an error* (!) if the font |
| 49 | +# encoding is OT1. This however could happen from 'fontenc' key. |
| 50 | +# MEMO: the Pygments escapes with \char`\<char> syntax, if the document |
| 51 | +# uses old OT1 font encoding, work correctly only in monospace font. |
| 52 | +# MEMO: the Pygmentize output mark-up is always with a {} after. |
43 | 53 | _LATEX_ADD_STYLES = r''' |
44 | | -% Sphinx additions |
45 | | -% use textcomp quote to get a true single quote |
46 | | -\renewcommand\PYGZsq{\textquotesingle} |
| 54 | +% Sphinx redefinitions |
| 55 | +% Originally to obtain a straight single quote via package textcomp, then |
| 56 | +% to fix problems for the 5.0.0 inline code highlighting (captions!). |
| 57 | +% The \text is from amstext, a dependency of sphinx.sty. It is here only |
| 58 | +% to avoid build errors if for some reason expansion is in math mode. |
| 59 | +\def\PYGZbs{\text\textbackslash} |
| 60 | +\def\PYGZus{\_} |
| 61 | +\def\PYGZob{\{} |
| 62 | +\def\PYGZcb{\}} |
| 63 | +\def\PYGZca{\text\textasciicircum} |
| 64 | +\def\PYGZam{\&} |
| 65 | +\def\PYGZlt{\text\textless} |
| 66 | +\def\PYGZgt{\text\textgreater} |
| 67 | +\def\PYGZsh{\#} |
| 68 | +\def\PYGZpc{\%} |
| 69 | +\def\PYGZdl{\$} |
| 70 | +\def\PYGZhy{\sphinxhyphen}% defined in sphinxlatexstyletext.sty |
| 71 | +\def\PYGZsq{\text\textquotesingle} |
| 72 | +\def\PYGZdq{"} |
| 73 | +\def\PYGZti{\text\textasciitilde} |
47 | 74 | \makeatletter |
48 | | -% use \protected to allow \PYG in \caption |
| 75 | +% use \protected to allow syntax highlighting in captions |
49 | 76 | \protected\def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+{\PYG@do{#2}}} |
50 | 77 | \makeatother |
51 | 78 | ''' |
|
0 commit comments