# Performing arithmetic on multido variable in PSTricks

I want to take an image and display it in PSTricks several times side by side, rotating it by the same amount each time. I want to use the multido command - something like

\multido{\i=0+1}{10}{
\rput{\i * 10}(\i,0){Image}
}


but I can't figure out how to multiply the variable \i by a constant in the braces that specify the rotation angle. Since I only need simple integer multiplication, I assume I don't need any heavy-duty packages like fp, as LaTeX has this ability built in. I think it should be easy to do using PostScript - something like

(!\ia 10 mul)


but I can't figure out the syntax.

It must be \iA\space mul otherwise the space between \iA mul is "eaten" by TeX's parser and you'll get a wrong expression like 3mul without the space.

\documentclass{article}
\usepackage{pstricks,multido}
\usepackage{graphicx}
\begin{document}

\multido{\iA=0+1}{10}{%
\rput{!10 \iA\space mul}(\iA,0){\includegraphics[width=1cm]{tiger}}%
}

\end{document}


• To avoid multiple image inclusion with dvips+ps2pdf, you could give xsavebox a try. – AlexG Mar 8 '16 at 7:47
• or usepackage{graphicx-psmin} – user2478 Mar 8 '16 at 8:10
• @Herbert: specifying the rotation angle with {!10 \iA\space mul} doesn't work on my system. It's not the first time I notice using postscript code in parameters does not work. Do I miss something? – Bernard Mar 8 '16 at 12:39
• No it should work. For old systems you have to enable \SpecialCoor – user2478 Mar 8 '16 at 19:39
• @tparker: TeX sees a  and scans the next tokens. If it is a letter then it scans all following characters until it sees a non letter. The space is handled in a special way, it is "eaten" by TeX. It is not easy to explain it in more deatils in a comment. Read the TeXbook or TeX by Topic. – user2478 Mar 8 '16 at 21:23

You also can use commands from pst-fp:

\documentclass[border=3pt]{standalone}
\usepackage{pst-node, multido}
\usepackage{auto-pst-pdf}

\begin{document}

\begin{pspicture}
\psset{unit =0.6}
\multido{\i=0+3}{10}{\pstFPmul{\angle}{\i}{10}%
\rput{\angle}(\i,0){\psellipse[linecolor=red](0,0)(0.5,1)}
}
\end{pspicture}

\end{document}