I'm able to use the subfig package in my documents, but not within an exercise environment:
\documentclass{scrreprt}
\usepackage{exercise}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\newcommand{\onefigure}[2]{%
\includegraphics[#1]{../../figures/ece1229/#2}%
}
\newcommand{\fourfigures}[5]{%
\begin{figure}%
\centering%
\subfloat[][]{\onefigure{scale=#1}{#2}}%
\qquad%
\subfloat[][]{\onefigure{scale=#1}{#3}}%
\qquad%
\subfloat[][]{\onefigure{scale=#1}{#4}}%
\qquad%
\subfloat[][]{\onefigure{scale=#1}{#5}}%
\end{figure}%
}
\begin{document}
\begin{Exercise}
%\onefigure{scale=0.2}{blah1}
\fourfigures{0.2}{blah1}{blah2}{blah3}{blah4}
\end{Exercise}
\end{document}
When the subfloat is embedded in an exercise, I get a "Not in outer par mode" error, similar to that of the question ! LaTeX Error: Not in outer par mode. For that question, the error was because a float is not allowed in a minipage.
I'm assuming that there is a similar restriction for floats in exercise environments. Given this restriction, is there a way to make arrange multiple images in groups as with subfig but in some way that is still compatible with exercise?



exerciseenvironment? – cfr Apr 30 '15 at 03:00demo. – cfr Apr 30 '15 at 03:17subfigis irrelevant, as is the use of KOMA Script.\documentclass{article} \usepackage{exercise} \usepackage[demo]{graphicx} \begin{document} \begin{Exercise} \begin{figure} \onefigure{scale=0.2}{tiger} \end{figure} \end{Exercise} \end{document}reproduces the error. – cfr Apr 30 '15 at 03:28captionto create captions outside floats. So you could just put the images in minipages and use\captionof...to caption them. – cfr Apr 30 '15 at 03:30figureand use four\includegraphicscommands – David Carlisle Apr 30 '15 at 07:30