I try to draw some nodes in tikz, and as they are very simple I wanted to "shorten" this using a \foreach command:
\foreach \xnum in {1,2,3,4,5}
{
\node at (X\xnum center) {$x_\xnum$};
}
You can insert this into any MWE with a tikzpicture environement which has
some nodes X1, X2, ... defined.
(In my case, this are rectangles, using this: https://tex.stackexchange.com/a/47797/22276 )
The problem with this is, that the space after \xnum is not preserved, which
is why I get the following error on running pdflatex:
! Package pgf Error: No shape named X1center is known.
Any idea how to solve this?

\xnum\spacework? – Qrrbrbirlbel Jan 27 '13 at 02:44\and~and\xnum{}, none of them did it. But yours is perfect. Do want to write it as answer so I can accept it? – Daniel Jour Jan 27 '13 at 02:46