Is it possible to use a macro to name and reference TikZ nodes. For example:
\begin{tikzpicture}
\node (0) at (0,0) {X};
\node (\mymacro{2}{3}) at (1,2) {Y};
\draw (\mymacro{2}{3}) -- (0);
\end{tikzpicture}
Where \mymacro
is (for example):
\newcount\counterA
\def\mymacro#1#2%
{\counterA=#1\relax%
\advance\counterA by#2\relax%
\the\counterA}
The actual calculation that my macro computes uses \loop\ifnum
(which I think) means I cannot use the solution in Modular arithmetic on node names in TikZ? without defining a new \pgfmathMyMacro
function.
Is this a limitation of TikZ or is there some \edef
or \expandafter
black magic I could use?
\newcount
in a definition of this kind: you are reassigning every time the same name to a new counter register. It's difficult to say something more, you should offer more details about what you're trying to do. – egreg Sep 7 '11 at 13:25