[OS X TeX] pushdown automata?

Michael Sharpe msharpe at ucsd.edu
Mon Jan 19 07:13:52 CET 2009


On Jan 18, 2009, at 5:46 PM, Art Werschulz wrote:

> Hi.
>
> Any suggestions for drawing pushdown automata using TiKZ (or some  
> other LaTeX-friendly package)?  Something like the following (which  
> will only look good in a monospaced font):
>
> +---------+
> | State   |-------+
> | control |       |
> +---------+       V
>    |	       +---------------+
>    |          | a | a | b | b |
>    |          +---------------+
>    V
>  +---+
>  | x |
>  +---+
>  | y |
>  +---+
>  | z |
>  +---+
And, for those of the pstricks persuasion, we have:

%&latex
%!TEX TS-program = latex
\documentclass{article}
\usepackage{pst-node}
\begin{document}
\psset{arrowscale=2}
\begin{psmatrix}
\psframebox{\parbox[b]{.7in}{\centering State\\Control}}\\
\psframebox[framesep=0pt]{\vtop{\offinterlineskip 
\hbox{\psframebox{\hbox to .7cm{\strut\hfil x\hfil}}}
\hbox{\psframebox{\hbox to .7cm{\strut\hfil y\hfil}}}
\hbox{\psframebox{\hbox to .7cm{\strut\hfil  z\hfil}}}}}
&\psframebox[framesep=0pt]{\psframebox{\strut a}\psframebox{\strut a} 
\psframebox{\strut b}\psframebox{\strut b}}
\ncline[arrows=->]{1,1}{2,1}
\ncangle[arrows=->,angleB=90]{1,1}{2,2}
\end{psmatrix}
\end{document}

Michael



More information about the macostex-archives mailing list