# pgfplotsinvokeforeach using parameter [closed]

The following code works in the minimal example but not in my document

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\pgfplotsinvokeforeach{1,2,...,10} {
\edef\nursery{#1}
\nursery
}
\end{document}


i get the error

! Illegal parameter number in definition of \pgffor@body.
<to be read again>
1
l.143 }


somebody knows this problem?

-
I know we always ask about a minimal working example (MWE), but the "working" means more "compilable by us". We would need an example which actually shows the mentioned issue. Try to minimize your document to the part which uses the code but still shows the issue. –  Martin Scharrer Apr 20 '11 at 9:53
Just guessing blindly: did you try to double the hash sign, i.e. did you try ##1 instead (or perhaps even more hashes)? This is the typical way how to solve nested macro definitions –  Christian Feuersänger Apr 21 '11 at 20:50
If your application is actually that easy, you may also use \forach \nursery in {1,2,...,10} {\nursery} instead. In the (rare) case that you need control over TeX groups, you can also use \pgfplotsforeachungrouped \nursery in {1,2,...,10} {\nursery}. –  Christian Feuersänger Apr 21 '11 at 20:52