Here's something mystifying: I've been trying to use a for loop to create several copies of essentially the same picture stacked vertically on top of one another. But when I use \pgfmathresult in the yshift value, it puts all copies of the picture in the same spot - essentially it acts as if \pgfmathresult evaluates to 0 regardless of what the actual result of the computation is. It's probably best illustrated by this MWE:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \i in {1,...,4} {
\pgfmathparse{2*\i}
\begin{scope}[yshift=\pgfmathresult cm]
\fill (0,0) circle(3pt);
\end{scope}
}
\end{tikzpicture}
\end{document}
The weird thing is that if I change yshift to xshift, the copies of the picture are spread out horizontally as I would expect. Is there some reason for this behavior, or is it a bug?

[yshift=2*\i cm]. – Caramdir Mar 08 '11 at 04:24xshiftbut notyshiftsuggested some deeper explanation. – David Z Mar 08 '11 at 04:5175*(\i - 1) pt, which doesn't work when I put it directly in yshift. – David Z Mar 08 '11 at 04:53\pgfmathresultdirectly. I think it's a good way to avoid this and in this case you have three solutions : you can avoid the use of a scope and the use ofpgfmathresult, you can use shift and not yshift like Frédéric or you can use\pgfmathsetmacro– Alain Matthes Mar 08 '11 at 05:0175*(\i-1)ptyou can avoid the scope and use\myshiftlike in my answer\draw[yshift=\myshift pt,fill] (0,0) circle(3pt);– Alain Matthes Mar 08 '11 at 05:12yshift=is not a solution that works for me. – David Z Mar 08 '11 at 05:29yshift={(75*(\i - 1))*1pt}– Caramdir Mar 08 '11 at 05:57