A LaTeX package that allows Python code entered within a TeX document to be executed, and the output to be included in the original document.
Python TeX HTML
Latest commit 65be8ca Jul 21, 2016 @gpoore v0.15
Failed to load latest commit information.
pythontex v0.15 Jul 21, 2016
pythontex_gallery v0.15 Jul 21, 2016
pythontex_quickstart v0.15 Jul 21, 2016
test updated existing and created new test documents; updated Julia and Oc… Jul 20, 2016
NEWS.rst v0.15 Jul 21, 2016
README.rst v0.15 Jul 21, 2016




Fast Access to Python from within LaTeX

Author:Geoffrey Poore
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, Octave, Sage, Bash, and Rust. Support for additional languages is coming soon.

See pythontex_quickstart.pdf to get started, and pythontex_gallery.pdf for examples of what is possible with PythonTeX. PythonTeX is included in TeX Live and MiKTeX and may be installed via the package manager. See pythontex.pdf for detailed installation instructions if you want to install the current development version, or use the installation script for TeX Live and MiKTeX.

The 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.

Citing PythonTeX

If you use PythonTeX in your writing and research, please consider citing it in any resulting publications. The best and most recent paper is in Computational Science & Discovery (doi:10.1088/1749-4699/8/1/014010). You may also cite the paper in the 2013 SciPy proceedings.