PythonTeX: Fast Access to Python from within LaTeX
Why TeX - LaTeX Stack Exchange recommends it
TeX - LaTeX Stack Exchange users link it when someone asks how PythonTeX works or needs a quick overview of the run-latex, run-script, run-latex workflow.
Recommended by 1 people across 1 different months, 2013 to 2024.
What it is
A conference talk by PythonTeX author Geoffrey M. Poore on running Python code from inside LaTeX documents. It covers how PythonTeX works, its multi-step compile process, and how it compares with tools like Sweave and SageTeX.
What people said
Recommends Foad · 2024-05 · TeX - LaTeX Stack Exchange · on “Best Practices for Integrating Computer Algebra Systems (CAS) into LaTeX Documents”
Here [this video] is also an interesting talk about PythonTeX, but there is also mentions of R's Sweave , Sympy Tex, and others...
Cites DJP · 2013-04 · TeX - LaTeX Stack Exchange · on “PythonTeX rendering problem”
I haven't used PythonTeX but I've used similar packages (SageTeX) which give the same ?? unless you process it in 3 stages: run latex on the document (the output will be the question marks you've seen) and a special file will be created (with sage it's a .sage file). Next, run the script/program on that special file. Finally, latex the document again. Question marks should be gone if the code was valid. I googled up this video [this video] on PythonTeX where the author mentions the 3 step process at the 9:30 mark. Have you done the 3 step process?
Cites BenB · 2013-05 · TeX - LaTeX Stack Exchange · on “Pythontex workflow with LyX”
I've recently learned about PythonTeX [LINK] ( Conference presentation [this video] ). It's a tool that lets you execute python code in your LaTeX documents. This is useful for, e.g., creating matplotlib figures inside your TeX document. According to the manual (available at the Github link above), to compile documents, one needs to run latex, run an included python script, then run latex again. Can I set up LyX to execute this all for me?
Cites DeBARtha · 2021-04 · TeX - LaTeX Stack Exchange · on “Package to parse C/C++ code in LaTex document and output in the original document”
I am a beginner in writing code in LaTeX (and I use LyX). Being a student of statistics, I use R and have already used the Rnw(knitr) module to output the result of an R code chunk in the output pdf (using the traditional Sweave syntax). As stated by Yihui Xie here [LINK] , 'knitr extracts R code in the input document, evaluates it and writes the results to the output document'. Out of curiosity, I surfed the internet a bit and found pythontex [LINK] and as stated by Geoffrey Poore in here [LINK] , 'PythonTeX executes code in LaTeX documents and allows the output to be included in the original document. It supports Python as well as Bash, JavaScript, Julia, Octave, Perl, R, Raku (Perl 6), Ru