I’ve mentioned before that one of my favorite implementation techniques is finite state machines. I started using them for communication protocol implementations but soon discovered that they could be applied to several sorts of problems. It’s easy enough to sketch out a state diagram on paper and code from that but what happens when you want to document the FSM?
I’ve always used the Graphviz dot command language to draw high quality digital versions of the state diagrams but it’s hard to get the placement exactly right and looking good. Alexander L. Hayes, a Ph.D.Student at Indiana University Bloomington, has a short guide on using Tikz to draw the diagrams.
The good news is that the diagrams look really great and don’t seem very hard to specify (although you can fine tune the results). Take a look at the link to see what I mean. The bad news is that neither Hayes’ guide or the relevant chapter of the TikZ and PGF Manual that he points at does a very good job of explaining the language and how to use it. They are, rather, a set of examples. Fortunately, state diagrams aren’t very complex and you can probably figure out what you need to do from those examples.
If you need to typeset some state diagrams, take a look at Hayes’ guide and section 19 of the manual. Tikz seems like an easy way to get the job done.