I need to use the pythontex
package that I find very useful if someone has to do some calculation before inserting the results in LaTeX. So Here is an example:
\documentclass{article}
\usepackage{pythontex}
\begin{document}
If we add five to eight we get \py{5+8}.
\end{document}
I am used to typeset my LaTeX documents in Emacs with AUCTeX. To compile the document I generally use the the keys C-c C-a
which are bound to the AUCTeX command TeX-command-run-all
described in the AUCTeX manual as:
Compile the current document until an error occurs or it is finished. If compilation finishes successfully, run the viewer at the end.
But with the example provided above I get this result:
As we can see the result of the python calculation has been replaced by ?? . This is because as described in the pythontex package manual :
Compiling a document with pythontex involves three steps: 1) running a LaTeX-compatible tex engine; 2) running pythontex.py script; 3) and finally running the TeX engine again.
The second step is not automatically performed by the TeX-command-run-all
command so I need to leave momentarily Emacs, open a terminal (I am on GNU/Linux) and type pythontex <myfile.tex>
, and return to Emacs to run again TeX-command-run-all
. As we can easily imagine it is somewhat painful to do this seven times.
The question: How to configure AUCTeX in a way that when I call TeX-command-run-all
the pythontex.py
script is automatically launched so there is no need any more to use a terminal and execute the script manually?
.latexmkrc
file like this one: ctan.math.utah.edu/ctan/tex-archive/support/latexmk/…. See also the discussion at github.com/gpoore/pythontex/issues/132. – John Palmieri Aug 8 '19 at 18:30C-h v emacs-version RET
)? – Arash Esbati Aug 11 '19 at 18:55