TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a bit confused about a failure I'm seeing with an inline \cos call. In the code below there I perform contortions with \let, \pgfmathparse, and \pgfmathresult However, the commented line should, in my understanding, do the exact same thing. Instead it fails with an error. I seem to be missing something and I still don't have a good handle on doing math with pgf.





\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (-1,0,0);
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};

\foreach \a in {0, 15, 30, 45, 60, 75, 90}{
     % When this line is uncommented it fails.
%   \tdplotdrawarc[grid]{(0,0,{sin(\a)})}{{cos(\a)}}{0}{180}{}{};

\foreach \rot in {-90, -60, -30, 0, 30, 60, 90} {

share|improve this question
It works with the current CVS version of TikZ, so I suspect: Using math in TikZ – Qrrbrbirlbel Mar 24 '13 at 2:12
up vote 5 down vote accepted

As pointed out by Qrrbrbirlbel, it's due to a bug, which has already been discussed on the site; here, for instance. That bug should be fixed in the next official TikZ release.

If you have an up-to-date, non-CVS version of TikZ, you will make the error disappear by inserting two spaces in the problematic line, like so:

\tdplotdrawarc[grid]{(0,0,{sin(\a)} )}{{cos(\a)} }{0}{180}{}{};

enter image description here

share|improve this answer
Ah, hadn't seen that discussion. Thanks! – Andrew Myers Mar 24 '13 at 14:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.