1

My question is almost exactly the same as here: I would like to place a node along an ellipse, but using variables. I built a MWE based on the best rated answer:

\documentclass[tikz, border = 5mm]{standalone}

\usetikzlibrary{positioning} \usetikzlibrary{calc}

\begin{document} \begin{tikzpicture}

\node (origin) at (0, 2) {Origin};

\pgfmathsetmacro\xradius{3}
\pgfmathsetmacro\yradius{1}
\draw[thick] (origin) ellipse (\xradius cm and \yradius cm);

\node[draw] (test) at ($ (origin) + (90:3 and 1) $) {Hello};
\node[draw] (test2) at ($ (origin) + (90:\xradius and \yradius) $) {Hello}; % <--- This line is not working

\end{tikzpicture} \end{document}

However, I would like to use values stored in a variable instead of setting the value itself, something like: ($ (origin) + (90:\xradius and \yradius) $).

I am using Lualatex, so I am open to solutions with Lua, although I guess the solution will not require it

mistral
  • 35

1 Answers1

1

As answered in the comments by Qrrbrbirlbel, using curly braces around \xradius solve the problem: (90:{\xradius} and \yradius)

mistral
  • 35