LaTeX parser and pstricks generator in python

Laurent Claessens moky.math at gmail.com
Sun Feb 14 13:16:28 CET 2010


Hi all.

I just put online a first version of two tools that combine LaTeX and
python.

The first one, phystricks[1], is a python module intended to generate
pstricks code. The main features are
* you don't have to know pstricks (but you need to have some basics in
python)
* you have python instead of LaTeX as backend programming language
* the bounding box is automatically computed
* thanks to Sage[5], you have a direct access to the derivative of
functions (and much more). Thus, for example, tangent and normal
vectors to any (cartesian/polar/parametric) plots are easy to draw.
* eps export is possible in order to be more pdfLaTeX friendly.

The documentation[3] contains many examples of figures created with
phystricks. Download the file phystricks-doc.pdf[4]

In a somewhat near future, I plan to add interaction with LaTeX :
reading the .aux file, I can import the values of LaTeX's counters in
python. You should be able to draw a line whose angular coefficient is
the number of the last equation ;)
That feature should also improve the computation of the bounding box
in taking into account the LaTeX labels that one put in the picture.

That lead me to the second tool I put online ...

The second, LaTeXparser[2], is a simple LaTeXparser in python. Given a
tex file, the features are
* answer to the questions : what are the defined macros ? among of
them, which are actually used ? with what arguments ?
* substitute \input{...} by the content of the file
* read the .aux file and take information about the values \label and
\ref


Every comments (and patches) are much welcome !

Have a good day
Laurent


[1] http://www.gitorious.org/phystricks
[2] http://www.gitorious.org/latexparser
[3] http://www.gitorious.org/phystricks-doc
[4] http://www.gitorious.org/phystricks-doc/phystricks-doc/trees/master
[5] http://sagemath.org/



More information about the Python-list mailing list