## #StackBounty: #compiling #emacs #auctex #pythontex How to let AUCTeX launch automatically pythontex.py script

### Bounty: 100

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?

Get this bounty!!!

## #StackBounty: #compiling #emacs #auctex #pythontex How to let aucTeX lunch automatically pythontex.py script

### Bounty: 100

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 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 binded 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 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 painfull 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?

Get this bounty!!!