# Paragraph ended before \pgffor@@vars was complete. (\foreach)

Until now I always used \invokepgfplotsforeach{1,...5} successfully. Since I have some nested dynamic code all using #1, #2, #3, etc., I wanted to name the foreach's variable #1 by using \foreach.

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\foreach \variable \in {1,3,5} {
}
\end{axis}
\end{tikzpicture}
\end{document}


Unfortunately, even this MWE leads to the following error message:

! Paragraph ended before \pgffor@@vars was complete.


The same when I am using \pgfplotsforeachungrouped instead of \foreach. What is it missing?

• It's just in, not \in. – campa Aug 16 '17 at 14:42
• Really...? Really! Took me hours. Thanks a lot! - Post it as answer and I can mark the question as answered. – Chickenmarkus Aug 17 '17 at 16:04
• Additionally, I have a follow up question when using group plots: tex.stackexchange.com/questions/386988 – Chickenmarkus Aug 18 '17 at 7:11

It's just in, not \in.