![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|
Classes | |
| class | LatexEmbeddedLexer |
| class | LatexFormatter |
Functions | |
| escape_tex (text, commandprefix) | |
| _get_ttype_name (ttype) | |
Variables | |
| str | DOC_TEMPLATE |
| str | STYLE_TEMPLATE |
| Small explanation of the mess below :) | |
pygments.formatters.latex
~~~~~~~~~~~~~~~~~~~~~~~~~
Formatter for LaTeX fancyvrb output.
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
| str pip._vendor.pygments.formatters.latex.DOC_TEMPLATE |
| str pip._vendor.pygments.formatters.latex.STYLE_TEMPLATE |
Small explanation of the mess below :)
The previous version of the LaTeX formatter just assigned a command to each token type defined in the current style. That obviously is problematic if the highlighted code is produced for a different style than the style commands themselves.
This version works much like the HTML formatter which assigns multiple CSS classes to each tag, from the most specific to the least specific token type, thus falling back to the parent token type if one is not defined. Here, the classes are there too and use the same short forms given in token.STANDARD_TYPES.
Highlighted code now only uses one custom command, which by default is \PY and selectable by the commandprefix option (and in addition the escapes \PYZat, \PYZlb and \PYZrb which haven't been renamed for backwards compatibility purposes).
\PY has two arguments: the classes, separated by +, and the text to render in that style. The classes are resolved into the respective style commands by magic, which serves to ignore unknown classes.
The magic macros are:
Tip: to read this code, print it out in substituted form using e.g.
print STYLE_TEMPLATE % {'cp': 'PY'}