[texhax] dynamically generating tikz node names

Martin Heller mr_heller at yahoo.dk
Fri Aug 17 10:01:04 CEST 2012


Martin Heller wrote, on 17-08-2012 09:00:
>
> I think it should be doable with the `count` and `remember`options to
> the \foreach statement.

Maybe just using `count` is better:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\def\alltraces{aaa, bbb, ccc, ddd}
\def\plotall{%
   \begin{tikzpicture}
   \node (t0) at (0, 0) {};
   \foreach \trace [count=\i from 1,count=\j from 0] in \alltraces {%
	\node[anchor=north] (t\i) at (t\j.south) {\i \trace};
   }%
   \end{tikzpicture}
}

\plotall

\end{document}




More information about the texhax mailing list