For a long time, I thougt I understood how LaTeX expands commands. But apparently, I don't.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\edef\r{1 and 2}
\draw (0,0) ellipse (2 and 4); % this works
\draw (0,0) ellipse (\r); % this causes the error
\end{tikzpicture}
\end{document}
When attempting to compile the above code, I get the following error:
! Package PGF Math Error: Unknown operator `a' or `an' (in '1 and 2').
Can someone explain to me why the above error happens, and what can be done to circumvent this problem?
andoperator while parsing the content of\rthen expands. It does not first expand and then checks the content. – percusse Nov 19 '16 at 15:11arcsyntax notellipse– percusse Nov 19 '16 at 15:15[x radius=2,y radius=4]which is convenient in this case too since you can set the keys instead of a macro def – percusse Nov 19 '16 at 15:19\edef\roverwrites an existing macro within the current scope.\deffollowed by a single letter (or common word) macro name is never wise. – cfr Nov 20 '16 at 01:31