# Environment not working inside \multido using standalone document class

I have the following code

\documentclass[multi={image},crop,ignorerest]{standalone}%
\usepackage{multido}
\begin{document}
\multido{\iframe=1+1}{2}{
\begin{image}
\iframe
\end{image}
}
\end{document}


which is failing with this error:

ERROR: Extra }, or forgotten \endgroup.

--- TeX said ---
\endsa@boxit ...dvarwidth \color@endgroup \egroup

l.8 }


Can you help me figure out what is happening?

-
Related question about multiple frames / animation which accepted answer also uses standalone. –  Martin Scharrer Mar 6 '12 at 10:46
You are using ignorerest which tells standalone to ignore everything outside the image environments. This also includes the \multido line, which is not what you want. The rest is ignored by storing it inside a box which is never used. This adds a group around everything after \begin{document} and the \begin{image}, i.e. the \multido line which triggers the error. You need to simply remove the ignorerest option. Also add % after \begin{image} to avoid a space there. Then it works fine for me.
@MarinScharrer: I removed ignorerest and it worked! Thanks –  Mário Feb 25 '12 at 16:18
@Mário: Because \multido seems to be used often I now implemented a multido option for the standalone class which will wrap the content automatically in a multi environment and also ensures that ignorerest is supported with it. It will be part of the next release. –  Martin Scharrer Jan 5 at 9:13