# 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.
1
l.143 }


somebody knows this problem?

-

## closed as not a real question by lockstep, Joseph Wright♦Sep 18 '11 at 15:29

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

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