GasTeX: Graphs and Automata Simplified in
TeX
version 2.7
Last update: January 15, 2005
JasTeX
:
the long-awaited graphical interface in Java
for GasTeX.
It was developped for GasTeX 2.3 and has no tools to draw the new
macros (polygons, curves, ...) introduced in GasTeX 2.4.
Here is a modified version by
Pierre Moro. It is compatible with java 1.4 and 1.5 and it comply to
the new syntax of \drawline.
New in version 2.7 (02/05/04)
gastex is now compatible with the xcolor package which allows very
useful color expressions such as red!50!blue!60!white.
New in version 2.6 (23/04/04)
Improved precision of some computations.
New in version 2.5 (17/04/04)
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:
\begin{picture}(100,35)(-50,0)\nullfont
...
\end{picture}
\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.
Introduction and examples
GasTeX is a set of LaTeX macros which allow to draw very easily
graphs, automata, nets, diagrams, etc... under the picture environment
of LaTeX. A picture with gastex basically consists of nodes and edges.
Here are a few examples of pictures that are easily defined with
gastex.
and a whole lot of automata
examples by Jean-Éric Pin.
Download
In order to use gastex you should download the following files:
- gastex.sty which contains the
definition of all the TeX macros (this file could be
in your working folder or where others .sty files are),
- gastex.pro which contains all the
postscript procedures (this file could be in
your
working folder but it is best placed where the tex.pro file is),
- gastex.ps which is just a readable
version of gastex.pro. This file is not needed. It is only provided for
those who want to have a look at the postscript procedures.
- ex-gastex.tex some examples to
learn gastex
and
to test your installation
- gastex may be used with beamer in order to
produce very
nice animated slides. You have to compile the file through
latex-dvips-ps2pdf (not pdflatex). Here is an example: ex-beamer-gastex.tex and ex-beamer-gastex.pdf .
A Debian package for gastex is available here thanks to Thomas Skora.
Documentation
There is no real documentation for gastex. The best is to learn by
examples (see above and the file ex-gastex.tex.
See also the file gastex.sty where all macros are documented,
Feedback
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).
Remarks
- pdflatex and gastex : gastex does not work with pdflatex since it
produces
postscript code which cannot be interpreted by a pdf viewer.
Solution: Use latex and then ps2pdf.
I don't know whether it is possible to
translate my postscript code into pdf code. The problem is that I'm
using postscript to make some computations and not only to draw the
picture. I would appreciate the help of a pdf guru on this. -
This new version of gastex has been completely rewritten. It is
much more powerful than version 1.0. You need to use a compatible mode
if you wish to use old pictures with this new version. See the files gastex.sty and ex-gastex.tex
to learn more about this compatibility.
- The perl script GasTeX1to2.pl
allows
you to translate most gastex 1.0 pictures to gastex 2.0 syntax. Just
use
this perl script as a filter on your file.
- gastex mainly generates postscript so the pictures cannot be
seen
with a dvipreviewer. One should use a postscript printer or a
postscript
previewer (which usually allows also to print on nonpostscript
printers).
- I have only tested gastex with dvips.
- If you have problems with colors try adding the option dvips when
calling the package color: \usepackage[usenames,dvips]{color}. It may
not be the default in all systems.
- In case you need the old version, it is still available here .
History since version 2.0
version 2.4:
(New:
12/08/03)
- added the macro \rpnode to allow nodes
whose shape is a regular polygon defined by its radius, its number of
sides and an angle for the first point.
- added the possibility to have arrows at the
tail of edges and lines. For this, the following new parameters are
provided:
ATnb, ATdist, ATangle, ATlength, ATLength
- added the macro \drawpolygon to draw a
polygon defined by a list of points.
- added the macro \drawrpolygon to draw a
regular polygon defined by its radius, its number of sides and an angle
for the first point.
- added the macro \drawline to draw a broken
line defined by n points.
- added the parameter "arcradius" in order to
have arcs instead of sharp angles for
polygons and broken lines.
The default is arcradius=0 for sharp angles.
- added the macro \drawcurve to draw a
continuous curve going through n points.
- added the macro \drawccurve to draw a
continuous closed curve going through n points.
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: (05/05/02)
- Added the parameter ELdistC (y or n)
allowing to specify whether the distance (ELdist) is between the center
(y) of the label and the edge or between the side (n) of the label and
the edge. The behaviour of previous gastex versions corresponds to the
setting (n) which is therefore the default.
- Added the macro \drawqbpedge allowing to specify the auxiliary
point of a quadratic Bezier curve with two angles instead of the
absolute coordinates required by \drawqbedge.
- Added parameters sxo, syo, exo, eyo (offsets in \unitlength).
They define offsets for the virtual starting and ending points of an
edge with respect to the centers of the starting and ending nodes.
- Improved drawing for arrowheads (in gastex.pro). First, the
direction of the arrowhead is better for curved edges. Second, when
several arrowheads are drawn they follow the curve. Previously, they
followed the tangent at the ending point of the edge which was bad for
curved edges.
version 2.2:
(03/01/02)
- Added the options slide and paper to the
package.
In order to get the default settings for
slides, use
\usepackage[slide]{gastex}
The default settings for papers is obtained with
\usepackage[paper]{gastex}
or
- Added new option loopCW to define whether
loops are in clockwise direction or not.
- Fix a TeX error (Arithmetic overflow) that
occurred when using \drawedge(A,B){} with two nodes A and B having the
same coordinates.
Now, in this case, an error message is issued
in the log and the macro \drawedge(A,B){} is ignored.
version 2.1:
- New macros to draw directly circles,
rectanges, ovals, lines and bezier curves.
\drawcircle, \drawrect, \drawoval,
\drawline, \drawqbezier, \drawcbezier
All these macros uses gasset options and in
particular:
Nframe, Nfill, linecolor, fillcolor, dash,
AHnb, etc...
- Compatibility mode for pspictpg up to v0.6
Fix the bug which occured sometimes when using
Nw=0,Nh=0.
version 2.01:
- Fix an error that occured in v2.0 when
using Nfill=y without defining previously fillgray or fillcolor.
The following default setting has been added.
\gasset{fillgray=0,Nfill=n} % Not filled but
black if filled
Known problems
and (hopefully) solutions
- GasTeX and German (21/10/99):
Frank Goertzen (frank.goertzen@unibw-muenchen.de) has reported that
when using gastex together with german an error may occur when running
dvips if the german package is loaded first.
Solution: load gastex before german:
\usepackage{gastex}
\usepackage{german}
I have no idea concerning the cause of this error.
- Zero width or height (07/03/00): A postscript error may
occur when using Nw=0,Nh=0.
Solution: Use a small value instead of 0, e.g. Nw=0.1,Nh=0.1
Fixed in version 2.1
- gasset and tabular (27/10/00):
Using gasset inside a tabular or an array produces an error. (03/01/02)
The reason is that I'm using the "&" symbol
as a marker in order to process gasset options.
Solution: Include the whole picture
inside an mbox.
\begin{tabular}{c}
\mbox{\begin{picture}(10,20)(-5,-5)
\gasset{ELdist=0}
\node(A)(0,0){1}\drawloop(A){$a$}
\end{picture}}
\end{tabular}
- pdflatex and gastex: gastex does
not work with pdflatex since it produces postscript code which cannot be interpreted by a pdf viewer.
Solution: Use latex and then ps2pdf.