[pstricks] multido

Richard K. Oliver rko15 at att.net
Wed Nov 11 19:03:11 CET 2009


Sorry. I forgot a backslash. iAA should be \iAA, and with this change the 
code works fine.

Sincerely,
R. K. Oliver

----- Original Message ----- 
From: "Richard K. Oliver" <rko15 at att.net>
To: <pstricks at tug.org>
Sent: Wednesday, November 11, 2009 10:52 AM
Subject: multido


> Thanks Herbert. Your code worked fine.
>
> I now wish to print out the dots by diagonals.
>
> First attempt:
>
> \documentclass{article}
> \usepackage{pst-all}
> \begin{document}
>
> \begin{pspicture}[showgrid=true](-1,-1)(10,10)
>  \multido{\iA=0+1}{11}{%
>    \multido{\iB=0+1}{iA+1}{%
>      \psdots[linecolor=red,dotsize=10pt](\iB,\iA-\iB)}}
> \end{pspicture}
>
> \end{document}
>
> As expected, this did not work, undoubtedly because the multido macro does 
> not have this kind of flexibility.
>
> Second attempt (using fpAdd and fpSub from Version 1.41 of the multido 
> documentation 
> http://www.ctan.org/tex-archive/macros/generic/multido/multido.pdf ):
>
> \documentclass{article}
> \usepackage{pst-all}
> \begin{document}
>
> \begin{pspicture}[showgrid=true](-1,-1)(10,10)
>  \multido{\iA=0+1}{11}{%
>    \fpAdd{\iA}{1}{\iAA}
>    \multido{\iB=0+1}{iAA}{%
>      \fpSub{\iA}{\iB}{\iC}
>      \psdots[linecolor=red,dotsize=10pt](\iB,\iC)}}
> \end{pspicture}
>
> \end{document}
>
> Again, this did not work. I know substitution in macros is tricky, but is 
> there some way to make the number of repetitions of the inner loop depend 
> on the variable of the outer loop? The error message was:
>
> ! Missing number, treated as zero.
> <to be read again>
>                   i
> l.10 ...ots[linecolor=red,dotsize=10pt](\iB,\iC)}}
>
> Sincerely,
> R. K. Oliver
>
>
>
>
>
>
>
>
>
>> Am 11.11.2009 06:50, schrieb Richard K. Oliver:
>>> \documentclass{article}
>>> \usepackage{pst-all}
>>> \begin{document}
>>> \begin{figure}
>>> \begin{pspicture}(-1,-1)(10,10)
>>> \psgrid[subgriddiv=1,griddots=0,gridlabels=7pt]
>>> \multido{\i=0+1}{11}{\multido{\j=0+1}{11}{\psdots[linecolor=red,dotsize=10pt](\i,\j)}}
>>
>> see multi documentation for variable names
>>
>> \documentclass{article}
>> \usepackage{pst-all}
>> \begin{document}
>>
>> \begin{pspicture}[showgrid=true](-1,-1)(10,10)
>>  \multido{\iA=0+1}{11}{ %
>>    \multido{\iB=0+1}{11}{ %
>>      \psdots[linecolor=red,dotsize=10pt](\iA,\iB)}}
>> \end{pspicture}
>>
>> \end{document}
>>
>>
>> Herbert
>>
>>
> 



More information about the PSTricks mailing list