# Which package can be used to draw automata?

I'm looking for a LaTeX package which helps drawing automata problems. I googled and found A package for drawing automata and graphs (Version 0.4). But I'm not sure is this package a standard one, or there are some better alternatives. Any suggestion?

-
This manual might help you : tug.org/pracjourn/2007-1/joshi/joshi.pdf, only 19 pages and easy to follow. :-) –  xport Jun 15 '11 at 4:48
@xport: Thanks a lot. –  Chan Jun 15 '11 at 10:24
as an alternative u can use GasTeX –  M.K. Dadsetani Apr 24 '13 at 14:10
In its current form this is more a comment. Please add some content. A minimal working example (MWE) and perhaps an image of example output would be good. Note also, that GasTeX is included in both MiKTeX (full installation) and TeX Live, and obviously uploaded on CTAN. –  Speravir Apr 24 '13 at 15:26
This would be a very interesting answer if you could give an example of how it is used (ideally a working example together with a graphic), as the other answerers have done for their recommendations. –  Charles Stewart Apr 25 '13 at 8:53

TiKZ has a whole library for drawing automata:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{automata,positioning}
\begin{document}
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
\node[state,initial] (q_0)   {$q_0$};
\node[state] (q_1) [above right=of q_0] {$q_1$};
\node[state] (q_2) [below right=of q_0] {$q_2$};
\node[state,accepting](q_3) [below right=of q_1] {$q_3$};
\path[->]
(q_0) edge  node {0} (q_1)
edge  node [swap] {1} (q_2)
(q_1) edge  node  {1} (q_3)
edge [loop above] node {0} ()
(q_2) edge  node [swap] {0} (q_3)
edge [loop below] node {1} ();
\end{tikzpicture}
\end{document}


-
I love that picture ^_^! Very nice and clear, thanks a lot. –  Chan Jun 15 '11 at 10:24
I second @Alan on Tikz. I used vaucanson-g for some time and IMHO it lacks lots of features in which Tikz is quite trivial to achieve. The Tikz manual has great examples on how to tweak automata drawings. –  Paulo Cereda Jun 15 '11 at 11:02
I tried this example, and in the output file there isn't the automata. What i have in the output document is the string start, where letters s and t are covered with a scribble. Why i get this result? –  frenk Mar 21 at 8:46
@frenk I would suspect this is due to using a DVI previewer. Does the PDF file created look the same way if you open it in a PDF previewer? –  Alan Munn Mar 21 at 22:19
No ^^, thanks. In pdf it works! –  frenk Mar 22 at 10:27

using xy-pic package available at ctan for automata diagrams.

\documentclass[12pt]{article}
\usepackage[all]{xy}
\begin{document}
\xymatrix@ur@!R=2pc{%
*+<1pc>[o][F-]{q_0}  \ar@(l,l)[]^<<<<{start} \ar@/^/[r]^0  \ar@/_/[d]_1
& *+<1pc>[o][F-]{q_1} \ar@(ul,ur)[]^{0}  \ar@/^/[d]^1 \\
*+<1pc>[o][F-]{q_2} \ar@(dr,dl)[]^{1} \ar@/_/[r]_0
& *+<1pc>[o][F=]{q_3} }
\end{document}

-
I've got to be honest: that is the most Perl-y syntax I've ever seen from TeX. I know this is an old post, but could you explain the syntax a little bit if you have time? :) –  Sean Allred Jun 26 at 1:11
@SeanAllred To be frank with you, even i don't remember the syntax, it's highly abstract unlike tikz, I was trying to practice at that time of posting answer. For a quick learning you may refer to this nice presentation. math.arizona.edu/~swig/documentation/xypic/Xypic.pdf and more detailed at userguide –  texenthusiast Jun 30 at 0:32