1

Why does the following code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{math}
\begin{document}
\begin{tikzpicture}
\tikzmath{
   coordinate \v;
   \v = (cos(pi),sin(pi));
}
\end{tikzpicture}
\end{document}

produce an error? How can I fix this bug?

! Package pgf Error: No shape named `cos(pi' is known.

See the pgf package documentation for explanation. Type H <return> for immediate help. ...

l.9 }

Evan Aad
  • 11,066
  • 2
    Try \v = ({cos(pi)}, {sin(pi)}); – Willoughby Mar 18 '23 at 15:53
  • @Willoughby Thanks. This solved the problem. – Evan Aad Mar 18 '23 at 16:02
  • 2
    Has nothing to do with tikzmath. That's just the coordinate parser of TikZ. By the way, by default the trigonometric functions assume angles in degree, not in radians. So, here you're using an angle of 3.14° instead of 180°. Furthermore, Tikz also supports polar coordinates: (<angle>:<radius>) (radius could also by x and y radii). – Qrrbrbirlbel Mar 18 '23 at 16:23

0 Answers0