GasTeX: Graphs and Automata Simplified in TeX

version 3.0

Last update: Jul. 11, 2014
Remark: The new version of pgf (e.g., from TeXLive-2014) is not compatible with auto-pst-pdf (on which GasTeX rely when compiling with pdflatex). The problem occurs during the auxiliary latex compilation needed by pst-pdf. The package pgf should not be loaded during this auxiliary latex compilation. The (temporary) solution is to avoid loading the package using ifpdf.
The problem is more serious if you are using beamer since it loads pgf automatically. My solution is to revert to TeXLive-2013. This should be easy if you did not remove the old distribution. On a mac, go to preferences -> TeX Distribution.

Download and Installation

The last version of GasTeX is always available here. It consists of the following two files.
Remark: Version 2.8 of GasTeX is available here on CTAN since the end of 2006. So it should be available by default on your system unless your TeX installation is really old. The new version should be available on CTAN soon. Meanwhile, you should download the necessary files above.

Usage and package options



Package options

Thanks to the packages pst-pdf and auto-pst-pdf, GasTeX is now fully compatible with pdflatex. This feature is controlled with two options pdflatex and recompilepics as explained below.

gpicture and gusepicture

Pictures should be defined inside a gpicture environment allowing the same source file to be compiled both with pdflatex and with latex+dvips(+ps2pdf). The (depreciated) picture environment may still be used only if compilation is with latex+dvips(+ps2pdf). One may safely replace all picture environments with gpicture, even when using latex+dvips(+ps2pdf).


There is no real documentation for the macros provided by GasTeX.
The best is to learn by examples (see below).
See also the file gastex.sty where all macros are documented.


I hope you will find gastex helpful. Let me know if you have any problem or suggestion to improve gastex.
If you are using gastex, I'd like to know it so please send me an email and if you wish I'll let you know about new versions if any (I don't intend to spend much time in the near future).

History since version 2.0

Version 3.0: (2013/10/01)

Many changes in this release.

Version 2.9: (2010/09/23)

As suggested by Jean Berstel, it is now possible to set independently the width and the height of a loop with the two new parameters loopwidth and loopheight. The parameter loopdiam simply sets loopwidth and loopheight to the same value. See the example here.

Version 2.8: (2006/11/26)

Packaged for CTAN.

Version 2.7: (2004/05/02)

gastex is now compatible with the xcolor package which allows very useful color expressions such as red!50!blue!60!white.

Version 2.6: (2004/04/23)

Improved precision of some computations.

Version 2.5: (2004/04/17)

The horizontal shifts that one gets sometimes (e.g. with overlays in presentations) should no more occur provided \nullfont is used inside the picture environment:
\selectfont is automatically used by gastex for node or edge labels.
I found this solution looking in the package pgf (portable graphics format) by Till Tantau.
I also recommend his excellent beamer package for laptop presentations.

Version 2.4: (2003/08/12)

All these macros use gasset parameters and in particular: Nframe, Nfill, linecolor, fillcolor, dash, ... Uncompatibility: The macro \drawline was introduced in version 2.1 to draw a line between two points. The new version allows to draw a line defined by an arbitrary number of points but the syntax is different. It was \drawline(x1,y1,x2,y2) and it is now \drawline(x1,y1)(x2,y2).

Version 2.3: (2002/05/05)

Version 2.2: (2002/01/03)

Version 2.1:

Version 2.01:


Known problems and (hopefully) solutions

About LSV