Fast Access to Python from within LaTeX
|License:||LPPL (LaTeX code) and BSD 3-Clause (Python code)|
PythonTeX provides fast, user-friendly access to Python from within LaTeX. It allows Python code entered within a LaTeX document to be executed, and the results to be included within the original document. It also provides syntax highlighting for code within LaTeX documents via the Pygments syntax highlighter.
PythonTeX also provides support for Ruby, Julia, and Octave. Support for additional languages is coming soon.
pythontex.pdf for detailed installation instructions, or use the installation script for TeX Live and MiKTeX. See
pythontex_quickstart.pdf to get started, and
pythontex_gallery.pdf for examples of what is possible with PythonTeX.
depythontex utility creates a copy of a PythonTeX document in which all Python code has been replaced by its output. This plain LaTeX document is more suitable for journal submission, sharing, or conversion to other document formats. See
pythontex_gallery.html and the accompanying conversion script for an example of a PythonTeX document that was converted to HTML via
depythontex and Pandoc.
If you use PythonTeX in your writing and research, please consider citing it in any resulting publications. Currently, the best paper to cite is the one published in the 2013 SciPy proceedings.
(Full release history is available here.)
- All commands for working with code inline are now robust, via
\newrobustcmd. Among other things, this allows commands like
\pyto work in standard captions that have not been redefined to avoid protection issues.
syncpdbto v0.2, which provides better list formatting.
- The default working directory is now the main document directory instead
of the output directory. Using the output directory was a common source
of confusion for new users and was incompatible with plans for future
development. Old documents in which the working directory was not
specified will continue to use the output directory, but PythonTeX will
print an upgrade message; new documents will use the new setting. The
output directory may be selected as the working directory manually, or
with the shorthand
- Standardized version numbering by removing the "v" prefix from the stored
version numbers in Python variables and LaTeX macros. Standardized the
PythonTeX scripts by renaming
Objectives for future releases
- Improve support for macro programming with PythonTeX. Add
depythontexsupport for user macros.
- Improve system for adding other languages.
stderrsynchronization. Simplify support for multiple languages.
- Add finer-grained control. Work toward
reruncontrol of execution at the session level, and control of whether
strerrare displayed at the command/environment level.
- Refactor to separate the code-management core from LaTeX-related features, so that the core can be used with other document formats (for example, markdown) in a manner similar to Sweave.