# Problem with KOMA-Script and \par in environment

Issue #21 resolved
Rolf Niepraschk created an issue

The following example works like expected:

\documentclass[%
,border=5pt
,class=article
%,class=scrbook
,multi={Example}
,ignorerest=true
]{standalone}

\iffalse
\newenvironment{Example}{}{%
\par\vskip-\parskip
}
\else
\newenvironment{Example}{}{%
}
\fi

\begin{document}

\begin{Example}
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
\end{Example}

\begin{Example}
\itshape
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
\end{Example}

\end{document}


If I uncomment the scrbook class. I get the error:

! LaTeX Error: Missing \begin{document}.


Another problem: If I change \iffalse to iftrue, I get the error:

! Missing } inserted.


...Rolf

1. repo owner
• changed status to open

I have to analyse why scrbook makes problems. However, using a complex class with standalone is not really recommended. Beside ensuring to get the same fonts settings etc. there is no reason the select a different class.

The second error ! Missing } inserted. is because the content is processed in restricted horizontal mode (i.e. inside a \hbox) and you can't use \par there. Use the varwidth or the preview option to enable paragraph mode for the content.

Actually this is related to the way, how KOMA-Script classes handle class options. In particular, the braces within the class options are responsible for this error. You can simple use \PassOptionsToClass before \documentclass and everythings works as expected

\PassOptionsToClass{%
class=scrbook,
border=5pt,
multi={Example},
ignorerest=true,
}{standalone}
\documentclass{standalone}
\newenvironment{Example}{}{}
\begin{document}
\begin{Example}
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
\end{Example}
\begin{Example}
\itshape
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
\end{Example}
\end{document}


However, in your example the braces within multi={Example} aren't even necessary.

2. repo owner
• edited description
• marked as minor
3. repo owner

Thank you, Falk Hanisch, for the solution.