Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.

Without the `full` option, code is formatted as one “Verbatim“ environment, like this:

.. sourcecode:: latex

\PY{k}{def }\PY{n+nf}{foo}(\PY{n}{bar}):

The special command used here (“\PY“) and all the other macros it needs are output by the `get_style_defs` method.

With the `full` option, a complete LaTeX document is output, including the command definitions in the preamble.

The `get_style_defs()` method of a `LatexFormatter` returns a string containing “\def“ commands defining the macros needed inside the “Verbatim“ environments.

Additional options accepted:


The style to use, can be a string or a Style subclass (default:


Tells the formatter to output a "full" document, i.e. a complete
self-contained document (default: ``False``).


If `full` is true, the title that should be used to caption the
document (default: ``''``).


If the `full` option is enabled, this is the document class to use
(default: ``'article'``).


If the `full` option is enabled, this can be further preamble commands,
e.g. ``\usepackage`` (default: ``''``).


If set to ``True``, output line numbers (default: ``False``).


The line number for the first line (default: ``1``).


If set to a number n > 1, only every nth line number is printed.


Additional options given to the Verbatim environment (see the *fancyvrb*
docs for possible values) (default: ``''``).


The LaTeX commands used to produce colored output are constructed
using this prefix and some letters (default: ``'PY'``).
*New in Pygments 0.7.*

*New in Pygments 0.10:* the default is now ``'PY'`` instead of ``'C'``.


If set to ``True``, enables LaTeX comment lines.  That is, LaTex markup
in comment tokens is not escaped so that LaTeX can render it (default:
``False``).  *New in Pygments 1.2.*


If set to ``True``, enables LaTeX math mode escape in comments. That
is, ``'$...$'`` inside a comment will trigger math mode (default:
``False``).  *New in Pygments 1.2.*

name is referenced in 0 repositories


    name = 'LaTeX'