[texhax] dynamically generating tikz node names

Martin Heller mr_heller at yahoo.dk
Fri Aug 17 09:00:40 CEST 2012


Paul Isambert wrote, on 17-08-2012 08:12:
> I don't know whether there are better ways to plot PGF nodes, but at
> least this solves your problem.

I think it should be doable with the `count` and `remember`options to 
the \foreach statement.

   \documentclass{article}
   \usepackage{tikz}

   \begin{document}

   \def\alltraces{aaa, bbb, ccc, ddd}
   \newcounter{j}%
   \def\plotall{
     \begin{tikzpicture}

     \node (t0) at (0, 0) {};
     \foreach \trace [count=\i] in \alltraces {%
	   \setcounter{j}{\i}\addtocounter{j}{-1}%
        \node[anchor=north] (t\i) at (t\thej.south) {\i \trace};
     }
     \end{tikzpicture}
   }

   \plotall

   \end{document}

Hovever, in my short test, I diden't succeed in getting `remember` to 
work.



More information about the texhax mailing list