I tried to recreate a multi meter and have created the following code:
\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,calc,decorations.markings,backgrounds,decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\R}{2}
\draw[thick,fill=black] (0,0) circle (0.1);
\draw[thick] ($(0,0)+(45:\R cm)$) arc (45:135:\R);
\foreach \x/\y [count=\xi] in {45/3,50/2.5,60/2,72/1.5,90/1,115.5/0.5,135/0}
{
\draw[thick] ($(0,0)+(\x:\R cm)$) -- ($(0,0)+(\x:\R+0.2+0.28Mod(\xi-1,2)$);
\node[rotate=\x-90] at ($(0,0)+(\x:\R+0.4+0.3Mod(\xi-1,2)$) {\y};
}
\end{tikzpicture}
\end{document}
As far as I understand, this must be the correct code, with an extra bracket after Mod.
\node[rotate=\x-90] at ($(0,0)+(\x:\R+0.4+0.3*Mod(\xi-1,2))$) {\y};
But this gives the following error: ! Package tikz Error: + or - expected.
\R? You've got to hide the)of theModfunction from the TikZ parser:($(0,0)+(\x:{\R+0.2+0.28*Mod(\xi-1,2)})$). (Of course, the(0,0)+is pointless here but that's another topic. You're also mixing coordinates from the canvas (with units) and from the xyz (without units) coordinate systems which I advise against unless it is necessary.) – Qrrbrbirlbel Sep 28 '23 at 21:19(\x:{\R+0.2+0.28*Mod(\xi-1,2)actually works because of a quirk in PGFMath so I don't know what your issue is besides not having\Rnot defined. Once I define\R, your code works for me. Maybe you have an older installation of your TeX distribution or of PGF/TikZ. – Qrrbrbirlbel Sep 28 '23 at 23:50)and then tries to parse this as a coordinate. If you use*Mod(\xi-1,2))it will find the first)and the radius of the polar coordinate will be\R+0.2+0.28*Mod(\xi-1,2. PGFMath is forgiving and doesn't care about the missing)but then TikZ finds the second)and that doesn't the path syntax and it raises an error. If you use only one), PGFMath gets the same formula, still forgiving but TikZ can go on. (That's the equivalent to the “code golf” example(0, sqrt(7)in the link.) – Qrrbrbirlbel Sep 29 '23 at 09:25{}to protect the occuring)from the TikZ parser which isn't as smart as when PGFMath parses a formula (and matches the()correctly, of course). – Qrrbrbirlbel Sep 29 '23 at 09:30