pythontex – Run Python from within a document, typesetting the results
The package allows you to enter Python code within a LaTeX document, execute the code, and access its output in the original document. There is also support for Bash, JavaScript, Julia, Octave, Perl, R, Raku (Perl 6), Ruby, Rust, and SageMath.
Code is only executed when it has been modified, or when it meets user-specified criteria. Code may be divided into user-defined sessions, which automatically run in parallel.
Errors and warnings are synchronized with the LaTeX document, so that they refer to the document's line numbers. External dependencies can be tracked, so that code is re-executed when the data it depends on is modified. PythonTeX also provides syntax highlighting for code in LaTeX documents via the Pygments syntax highlighter.
The package provides a depythontex utility. This creates a copy of the document in which all Python code has been replaced by its output. This is useful for journal submissions, sharing documents, and conversion to other formats.
Quellen | /macros/latex/contrib/pythontex |
Dokumentation | |
Repository | https://github.com/gpoore/pythontex |
Version | 0.18 2021-06-06 |
Lizenzen | The LaTeX Project Public License 1.3 |
Copyright | 2012–2021 Geoffrey M. Poore |
Betreuer | Geoffrey Poore |
Enthalten in | TeX Live als pythontex MiKTeX als pythontex |
Themen | Callback |
Siehe auch | perltex |
Herunterladen des vollständigen Inhalts dieses Pakets in einem Zip-Archiv (1.7M).
Ankündigungen
Vorschläge
Vielleicht sind auch die folgenden Pakete von Interesse.
- hybrid-latex: Allow active Python code in LaTeX documents
- latexalpha2: Embed Mathematica code and plots into LaTeX
- runcode: Execute foreign source code and embed the result in the pdf file
- pynotebook: pynotebook presents (raw, Markdown or Python) codes (and execution with LuaLaTeX) as in a Jupyter Notebook
Bewertungskommentare