[pstricks] Loop controlled by postscript variable
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Sun May 1 21:45:40 CEST 2016
Am 29.04.2016 um 10:02 schrieb Poul Riis:
> How can I make a postscript variable control the number of repetitions
> of a loop?
That is not possible. You can define the complete loop
on PostScript level.
Herbert
> 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}
>
>
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/
>
More information about the PSTricks
mailing list