[pstricks] Drawing state diagrams

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Wed Feb 16 21:07:05 CET 2005


Runar Gjelsvik wrote:

> This works OK, BUT, the circles are of different sizes and that doesn't
> look to good. I've tried to add mnodesize but it has no affect.
> 
> I've managed to change the size of the circles by using:
> 
> \psmatrix[mnode=C,radius=1cm,colsep=1] 
> 
> But in this case the text disappears, I only get white cirles.

the default for C

Herbert


\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-node}
\SpecialCoor
\pagestyle{empty}

\newlength\LWord\settowidth\LWord{LoadFrame}
\def\xst#1{\makebox[\LWord]{#1}}

\begin{document}

\psmatrix[mnode=circle,colsep=1,radius=10mm]
& & & \xst{ReadADC} \\
\xst{LoadFrame} & &  \xst{Idle} \\
& & & \xst{StoreRegs} \\
\endpsmatrix
\psset{shortput=nab,arrows=->,labelsep=3pt}
\small
\ncarc[arcangle=40,border=3pt]{2,3}{1,4}
\ncarc[arcangle=80,border=3pt]{1,4}{3,4}
\ncarc[arcangle=40,border=3pt]{3,4}{2,3}
\ncarc[arcangle=40,border=3pt]{2,3}{2,1}
\ncarc[arcangle=40,border=3pt]{2,1}{2,3}

\psmatrix[mnode=C,colsep=1,radius=.5\LWord]
& & & [name=ReadADC] \\[0pt]
[name=LoadFrame] & &  [name=Idle] \\
& & & [name=StoreRegs] \\
\endpsmatrix
\psset{shortput=nab,arrows=->,labelsep=3pt}
\small
\rput(ReadADC){ReadADC}\rput(Idle){Idle}
\rput(LoadFrame){LoadFrame}\rput(StoreRegs){StoreRegs}
\ncarc[arcangle=40,border=3pt]{2,3}{1,4}
\ncarc[arcangle=80,border=3pt]{1,4}{3,4}
\ncarc[arcangle=40,border=3pt]{3,4}{2,3}
\ncarc[arcangle=40,border=3pt]{2,3}{2,1}
\ncarc[arcangle=40,border=3pt]{2,1}{2,3}

\end{document}




-- 
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes




More information about the PSTricks mailing list