[Matrix-SIG] Running python from latex

Pearu Peterson pearu@ioc.ee
Tue, 18 May 1999 16:22:53 +0300 (EETDST)


On Mon, 17 May 1999, David Ascher wrote:

> On Mon, 17 May 1999, Pearu Peterson wrote:
> 
> > I wrote a LaTeX package runpython.sty. Using this one can run Python code
> > from LaTeX, display the code and also the results in latex verbatim
> > environment. So, it can be useful in writing documentation
> > and examples for python codes.
> 
> FYI, did you follow the discussion in the DOC-sig a few months back?  
No.
> http://www.python.org/pipermail/doc-sig/1999-March/000650.html
> http://www.python.org/pipermail/doc-sig/1999-March/000651.html
Now I have, thanks for the references!

LaTeXPy.py seems to be a nice job (LaTeXPy however did not work on the
first run for me: 'from PyLaTeX.LaTeXPy import main' gave an error).

Now that we have two things doing similar things, allow me to point out
some good points in runpython.sty:
  First, it is small. Nevertless, it does (approximately) the same job as
LaTeXPy.py (I have not fully compared the possibilities of both
approaches).
  Second, you don't have to call python on a latex document. The final
dvi document is obtained by running only 'latex --shell-escape' (which
then calls python when needed and the results of the python call are
included "dynamically"). This seems to be more natural (but it is a
matter of taste).

Pearu