Possible Duplicate:
Problems with TikZ calculations
I am trying to generate a surface in tikzpicture environment. The surface is composed of spheres so I have created this:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,fadings,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\def\nuPi{3.1459265}
\foreach \i in {11,10,...,0}{
\foreach \j in {5,4,...,0}{
\shade[ball color=red] (#1,sin(#2)) circle(0.45);
}
}
\end{tikzpicture}
\end{document}
Which is supposed to give some nice undulation to the surface. However, when I run this I get the dreaded
!Package tikz Error: Giving up on this path. Did you forget a semicolon?.
How can generate the undulation then?
{sin(#2)}. BTW #1 and #2 does not exist... ;) – nickpapior Jan 09 '12 at 14:15sin(..)as zeroth says and replacing#1by\iand#2by\j. However, the variation is so small that the result is just a line of spheres! The braces are needed to protect the)ofsin(..)from being interpreted as the closing parenthesis of the coordinate (there's no error checking on()as there is with{}). – Andrew Stacey Jan 09 '12 at 14:24pijust use therparameter to let TikZ know about it. Check the manual page 526. – percusse Jan 09 '12 at 14:44