<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<style type="text/css">
<!--
body{margin-left:10px;margin-right:10px;margin-top:10px;margin-bottom:10px;}
-->
</style>
</head>
<body marginleft="10" marginright="10" margintop="10" marginbottom="10">
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#000000" style="font-family:Arial;font-size:10pt;color:#000000;">How can I make a postscript variable control the number of repetitions of a loop?</font></div>
<br />
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#000000" style="font-family:Arial;font-size:10pt;color:#000000;">In the example below it should be the variable 'numberofnumbers', something like</font></div>
<br />
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#006600" style="font-family:Arial;font-size:10pt;color:#006600;">\psLoop{numberofnumbers}{</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#006600" style="font-family:Arial;font-size:10pt;color:#006600;">                \pstVerb{/ylow yhigh def /yhigh yhigh somenumbers 1 get add def}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#006600" style="font-family:Arial;font-size:10pt;color:#006600;">                \psframe*[linecolor=Cornsilk1](!0 ylow)(!10 yhigh)</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#006600" style="font-family:Arial;font-size:10pt;color:#006600;">                \psframe[linecolor=black](!0 ylow)(!10 yhigh)</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#006600" style="font-family:Arial;font-size:10pt;color:#006600;">}</font></div>
<br />
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#000000" style="font-family:Arial;font-size:10pt;color:#000000;">(which does not work)</font></div>
<br />
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#000000" style="font-family:Arial;font-size:10pt;color:#000000;">Poul Riis</font></div>
<br />
<br />
<br />
<br />
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">\documentclass{article}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">\usepackage{amsmath}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">\usepackage[x11names]{xcolor}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">\usepackage{pstricks-add}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">\usepackage{multido}</font></div>
<br />
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">\begin{document}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">        \pstVerb{/somenumbers [20 10 15 30] def</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                     /numberofnumbers somenumbers length def</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                     /ylow 0 def</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                     /yhigh somenumbers 0 get def}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                    </font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">        \begin{psgraph}[xAxisLabel=$(1)$,yAxisLabel=$(2)$,ticksize=0 0,linewidth=0.5pt,labels=none]{->}(0,0)(0,0)(100,100){10cm}{10cm}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                \psframe*[linecolor=Cornsilk1](!0 ylow)(!10 yhigh)</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                \psframe[linecolor=black](!0 ylow)(!10 yhigh)</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                </font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                \pstVerb{/ylow yhigh def /yhigh yhigh somenumbers 1 get add def}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                \psframe*[linecolor=Cornsilk1](!0 ylow)(!10 yhigh)</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                \psframe[linecolor=black](!0 ylow)(!10 yhigh)</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                </font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                \pstVerb{/ylow yhigh def /yhigh yhigh somenumbers 1 get add def}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                \psframe*[linecolor=Cornsilk1](!0 ylow)(!10 yhigh)</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">                \psframe[linecolor=black](!0 ylow)(!10 yhigh)</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">        \end{psgraph}</font></div>
<div align="left" style="text-align:left;"><font face="Arial" size="+0" color="#0000DD" style="font-family:Arial;font-size:10pt;color:#0000DD;">\end{document}</font></div>
</body>
</html>