# Welcome to pylatexenc’s documentation!

[pylatexenc version: 2.10]

A simple LaTeX parser providing latex-to-unicode and unicode-to-latex conversion.

Quick example:

    >>> from pylatexenc.latex2text import LatexNodes2Text
    >>> latex = r"""\textbf{Hi there!} Here is \emph{an equation}:
    ... \begin{equation}
    ...     \zeta = x + i y
    ... \end{equation}
    ... where $i$ is the imaginary unit.
    ... """
    >>> print(LatexNodes2Text().latex_to_text(latex))
    Hi there! Here is an equation:

        ζ = x + i y

    where i is the imaginary unit.

And the other way around:

    >>> from pylatexenc.latexencode import unicode_to_latex
    >>> text = "À votre santé!"
    >>> print(unicode_to_latex(text))
    \`A votre sant\'e!

You can also use these utilities directly in command line, e.g.:

    $ echo 'À votre santé!' | latexencode
    \`A votre sant\'e!

# Documentation

Contents:

- Simple Parser for LaTeX Code
  - The main LatexWalker class
  - Exception Classes
  - Data Node Classes
  - Parsing helpers
  - Legacy Macro Definitions (for pylatexenc 1.x)
- Specifying definitions for the parser
  - Macro and environment definitions
  - Macro arguments parser
  - Argument parser for verbatim LaTeX constructs
  - Latex Context “Database”
- Simple Latex to Text Converter
  - Custom latex conversion rules: A simple template
  - Latex to Text Converter Class
  - Define replacement texts
  - Obsolete members
- Encode Unicode to LaTeX
  - Unicode to Latex Conversion Class and Helper Function
  - Specifying conversion rules
  - Compatibility with pylatexenc 1.x
- Changes
  - pylatexenc 2.10
  - pylatexenc 2.9
  - pylatexenc 2.8
  - pylatexenc 2.7
  - pylatexenc 2.6
  - pylatexenc 2.5
  - pylatexenc 2.4
  - pylatexenc 2.3
  - pylatexenc 2.2
  - pylatexenc 2.1
  - pylatexenc 2.0
  - pylatexenc 1.x

# Indices and tables

- Index

- Module Index

- Search Page