[pstricks] Loop controlled by postscript variable
Poul Riis
poul.riis at skolekom.dk
Fri Apr 29 10:02:37 CEST 2016
How can I make a postscript variable control the number of repetitions of
a loop?
In the example below it should be the variable 'numberofnumbers',
something like
\psLoop{numberofnumbers}{
\pstVerb{/ylow yhigh def /yhigh yhigh somenumbers 1 get add def}
\psframe*[linecolor=Cornsilk1](!0 ylow)(!10 yhigh)
\psframe[linecolor=black](!0 ylow)(!10 yhigh)
}
(which does not work)
Poul Riis
\documentclass{article}
\usepackage{amsmath}
\usepackage[x11names]{xcolor}
\usepackage{pstricks-add}
\usepackage{multido}
\begin{document}
\pstVerb{/somenumbers [20 10 15 30] def
/numberofnumbers somenumbers length def
/ylow 0 def
/yhigh somenumbers 0 get def}
\begin{psgraph}[xAxisLabel=$(1)$,yAxisLabel=$(2)$,ticksize=0
0,linewidth=0.5pt,labels=none]{->}(0,0)(0,0)(100,100){10cm}{10cm}
\psframe*[linecolor=Cornsilk1](!0 ylow)(!10 yhigh)
\psframe[linecolor=black](!0 ylow)(!10 yhigh)
\pstVerb{/ylow yhigh def /yhigh yhigh somenumbers 1 get add def}
\psframe*[linecolor=Cornsilk1](!0 ylow)(!10 yhigh)
\psframe[linecolor=black](!0 ylow)(!10 yhigh)
\pstVerb{/ylow yhigh def /yhigh yhigh somenumbers 1 get add def}
\psframe*[linecolor=Cornsilk1](!0 ylow)(!10 yhigh)
\psframe[linecolor=black](!0 ylow)(!10 yhigh)
\end{psgraph}
\end{document}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20160429/6666d849/attachment.html>
More information about the PSTricks
mailing list