Abstract¶
PythonTeX is a new LaTeX package that provides access to the full power of Python from within LaTeX documents. It allows Python code entered within a LaTeX document to be executed, and provides access to the output. PythonTeX also provides syntax highlighting for any language supported by the Pygments highlighting engine.
PythonTeX is fast and user-friendly. Python code is separated into user-defined sessions. Each session is only executed when its code is modified. When code is executed, sessions run in parallel. The contents of stdout and stderr are synchronized with the LaTeX document, so that printed content is easily accessible and error messages have meaningful line numbering.
PythonTeX simplifies scientific document creation with LaTeX. Plots can be created with matplotlib and then customized in place. Calculations can be performed and automatically typeset with NumPy. SymPy can be used to automatically create mathematical tables and step-by-step mathematical derivations.