Is it possible to use matrix with foreach at all??
Thanks in advance,
Cheers!
EDIT: In case my example doesn't conform to the MWE requirements - that is the only thing I have in a '.tikz' file; and then I use tikz2pdf to generate a pdf out of it...
and then, I'd simply add a node from the "array" {AA,BB}... However, as with the above syntax, pdflatex crashes - I was wandering whether there is some syntax that would allow \foreach to work with \node - or whether it is in principle impossible??
.. and as the comment says - the code compiles, nodes are rendered - however, the line ending (\\) is not interpreted, and so the nodes overlap.. Apparently, using the curly braces {} to encapsulate the \foreach argument was the problem...
So, it is possible syntactically to use \foreach in a tikz \matrix with nodes (apart from the line break problem)...
I thought also that it may have had to do with using the 'variable' \nn, as I found in the pgf manual:
Each assignment in a let operation starts with \p, usually followed by a <digit>: \x digit , \y digit , \p digit ...
Instead of writing \p1 = ..., we write \n2 = .... Here, “n” stands for “number” (while “p” stands for “point”).
... but apparently, that is not the problem here ...
Cheers!
EDIT Feb 28 2011: I think I found something close to an answer:
The \mymacro isn't expanded by the \foreach loop, but only afterwards. You need to remove the braces { } around the macro to make it work:
...
Note that while normally both arguments {\mymacro} and \mymacro are identical, \foreach seems to test for { and expands the argument if it isn't present.
...
As far as I remember this is an explicit feature of the \foreach macro.
...
Btw. the pgf manual says: Still in the easiest case, <list> is either a comma-separated list of values surrounded by curly braces or it is the name of a macro that contain such a list of values.