[pstricks] How do you do if then?
David Arnold
dwarnold45 at suddenlink.net
Sat Mar 7 16:29:21 CET 2009
Brilliant!
Thanks.
D.
On Mar 6, 2009, at 10:43 PM, Herbert Voss wrote:
David Arnold schrieb:
> This produces a 2 by 4 arrow of boxes. I'd like the first row to have
> four boxes, but the second row to stop at three boxes. This shoud use
> some sort of if then statement, I would imagine, to limit the second
> row to three boxes. How do you use if then in pstricks to get what I
> want?
\documentclass{article}
\usepackage{pstricks-add}
\def\Box{\psframebox{\rule{3mm}{0pt}\rule{0pt}{3mm}}}
\def\putBox(#1,#2){\rput(#1,#2){\rnode{p#1#2}{\Box}}}
\begin{document}
\begin{pspicture}(1,0.5)(4,2.5)
\multido{\iRow=1+1}{2}{%
\multido{\iCol=1+1}{4}{%
\ifnum\iRow=1 % for lowest row
\ifnum\iCol=4 % and last column do nothing
\else\putBox(\iCol,\iRow)\fi
\else\putBox(\iCol,\iRow)\fi}}
\ncbox[linearc=0.35,nodesep=0.2,linecolor=blue]{p11}{p31}
\ncbox[linearc=0.35,nodesep=0.2,linecolor=blue]{p12}{p32}
\end{pspicture}
\end{document}
Herbert
_______________________________________________
PSTricks mailing list
PSTricks at tug.org
http://tug.org/mailman/listinfo/pstricks
More information about the PSTricks
mailing list