[pstricks] Drawing flowchart with pst-node

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Mon Feb 17 18:53:55 CET 2003


Martin Buchmann schrieb:

> I would love to have a real markup solution like:
> 
> \DoLoop{#1}{#2}{#3}

there are several possibilities to get such a structure.
\DoLoop may have an optional parameter which is passed to
\pspolygon and \psline

Herbert

\documentclass{article}
\usepackage{pst-node}
\newcommand{\DoLoop}[4][]{%
	\begin{pspicture}(-1.5,-0.75)(1.5,0.75)
		\pspolygon[#1](-1,-0.75)(-1.5,-0.25)(-1.5,0.25)(-1,0.75)%
				(1,0.75)(1.5,0.25)(1.5,-0.25)(1,-0.75)(-1,-0.75)
		\psline[#1](0,0.75)(0,-0.75)
		\psline[#1](-1.5,0)(0,0)
		\rput(-0.75,0.325){#2}
		\rput(0.75,0){#3}
		\rput(-0.75,-0.325){#4}
	\end{pspicture}%
}

\newlength\breite
\newcommand{\strukbox}[2]{%
\settowidth{\breite}{#1}
\addtolength{\breite}{0.1\breite}
\psframebox%
{\parbox{\breite}{\centering #2}}}

\pagestyle{empty}
\begin{document}
     \begin{center}
	\begin{psmatrix}[rowsep=0.5cm,colsep=0.8cm]
	    % the flowchart
	    \\
	    \psdiabox{\itshape logical\_expr} \\
	    \strukbox{Statement 1}{Statement 1 Statement 2} \\
	    \\
		\DoLoop[linecolor=red]{Blah1}{Blah2}{Blah3}		
		\\
	    % the links
	    \ncline{->}{1,1}{2,1}
	    \ncline{->}{3,1}{5,1}
	    \ncline{->}{5,1}{6,1}
	    \ncline{->}{2,1}{3,1}>{.TRUE.}
	    \ncbar{->}{2,1}{4,1}
	    \naput[npos=0.8]{.FALSE.}
	\end{psmatrix}
     \end{center}

\end{document}



More information about the PSTricks mailing list