diff --git a/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex b/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex index ae2c47cdc..233b4bf81 100644 --- a/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex +++ b/doc/generic/pgf/text-en/pgfmanual-en-tutorial.tex @@ -1100,11 +1100,17 @@ \subsection{Repeating Things: For-Loops} \end{codeexample} If you provide \emph{two} numbers before the |...|, the |\foreach| statement -will use their difference for the stepping: +will use their difference for the stepping, but be wary of floating-point +rounding errors: % \begin{codeexample}[] -\tikz \foreach \x in {-1,-0.5,...,1} - \draw (\x cm,-1pt) -- (\x cm,1pt); +\begin{tikzpicture} + \foreach \x in {-1,-0.5,...,1} + \draw (\x cm,-1pt) -- (\x cm,1pt); + \foreach \x in {-1,-0.9,...,0} + % tick at 0 is not drawn due to rounding errors + \draw (\x cm,-7pt) -- (\x cm,-5pt); +\end{tikzpicture} \end{codeexample} We can also nest loops to create interesting effects: