PythonTeX is a LaTeX package that allows Python code in a LaTeX document to be executed. This makes possible reproducible documents that combine analysis with the code required to perform it. Writing such documents can be more efficient because code is adjacent to its output. Writing is also less error-prone since results may be accessed directly from within the document, without copy-and-pasting. This paper provides an overview of PythonTeX, including Python output caching, dependency tracking, synchronization of errors and warnings with the LaTeX document, conversion of documents to other formats, and support for languages beyond Python. These features are illustrated through an extended, step-by-step example of reproducible analysis performed with PythonTeX.

Keywords:reproducible sciencereproducible documentsdynamic report generation