For example I would like to do something like this
r=2
\begin{tikzpicture}
\draw (0,{2*r}) ellipse ({sqrt(r)} and {8/r});
\draw (0,{r}) ellipse ({sqrt(r/2)} and {4/r});
\end{tikzpicture}
Where everywhere r is seen in the above tikz commands, it is replaced by its defined value. I cannot seem to find a way to conveniently do this, I am sure I am just not looking in the right place


\def, it does roughly speaking "text substitution" so if you have e.g.\def\a{1+2} \def\b{\a*2}prepare for surprises. Also the value is recomputed every time, use pgfmathsetmacro is better – user202729 May 15 '22 at 03:23