# How to break long solutions in exam class?

I am currently using the exam class to write up the solutions to a take-home exam, but I am having issues when my solutions are too big to fit a page. I either have huge gaps in my paper or solutions that spill over the page and never make it to the next one. So what I need is to find a way to break the solution \fbox into multiple boxes.

I don't mind a solution where I have to manually tweak the contents of each solution box, but if that can be done automatically that would be even better. I would also really like it if boxes comprising the same solution could be "open-ended" to show that they belong together.

Just for the sake of completeness, here's some extra info:

• I tried splitting solutions manually by just adding things like \end{solution}\newpage\begin{solution} to no avail.

• I also tried reading exam.cls (I have version 2.4, 2011/05/22) to see if I could hack it myself, and saw a comment (line 70) that page breaks were in fact supposed to be possible within the solution environment, but they don't seem to work for me.

• This question reports the same issue, but since there was no solution and my comment would probably not get any attention, I decided to repost the reformulated question including the following MWE:

\documentclass[a4paper,12pt,answers]{exam}
\usepackage{amsmath,amssymb,amsthm}

\begin{document}

\begin{questions}

\question Let $A \in \mathbb{R}^{n \times n}$, possibly singular. Show there exists $\epsilon \neq 0$ such that  $A+\epsilon I$ is n.

\begin{EnvFullwidth}
\begin{solution} \\
01 REALLY LONG SOLUTION \\
02 REALLY LONG SOLUTION \\
03 REALLY LONG SOLUTION \\
04 REALLY LONG SOLUTION \\
05 REALLY LONG SOLUTION \\
06 REALLY LONG SOLUTION \\
07 REALLY LONG SOLUTION \\
08 REALLY LONG SOLUTION \\
09 REALLY LONG SOLUTION \\
10 REALLY LONG SOLUTION \\
11 REALLY LONG SOLUTION \\
12 REALLY LONG SOLUTION \\
13 REALLY LONG SOLUTION \\
14 REALLY LONG SOLUTION \\
15 REALLY LONG SOLUTION \\
16 REALLY LONG SOLUTION \\
17 REALLY LONG SOLUTION \\
18 REALLY LONG SOLUTION \\
19 REALLY LONG SOLUTION \\
20 REALLY LONG SOLUTION \\
21 REALLY LONG SOLUTION \\
22 REALLY LONG SOLUTION \\
23 REALLY LONG SOLUTION \\
24 REALLY LONG SOLUTION \\
25 REALLY LONG SOLUTION \\
26 REALLY LONG SOLUTION \\
27 REALLY LONG SOLUTION \\
28 REALLY LONG SOLUTION \\
29 REALLY LONG SOLUTION \\
30 REALLY LONG SOLUTION \\
31 REALLY LONG SOLUTION \\
32 REALLY LONG SOLUTION \\
33 REALLY LONG SOLUTION \\
34 REALLY LONG SOLUTION \\
35 REALLY LONG SOLUTION \\
36 REALLY LONG SOLUTION \\
37 REALLY LONG SOLUTION \\
38 REALLY LONG SOLUTION \\
39 REALLY LONG SOLUTION \\
40 REALLY LONG SOLUTION \\
41 REALLY LONG SOLUTION \\
42 REALLY LONG SOLUTION \\
43 REALLY LONG SOLUTION \\
44 REALLY LONG SOLUTION \\
45 REALLY LONG SOLUTION \\
46 REALLY LONG SOLUTION \\
47 REALLY LONG SOLUTION \\
48 REALLY LONG SOLUTION \\
49 REALLY LONG SOLUTION \\
50 REALLY LONG SOLUTION \\
51 REALLY LONG SOLUTION \\
52 REALLY LONG SOLUTION \\
53 REALLY LONG SOLUTION \\
54 REALLY LONG SOLUTION \\
55 REALLY LONG SOLUTION \\
56 REALLY LONG SOLUTION \\
57 REALLY LONG SOLUTION \\
58 REALLY LONG SOLUTION \\
59 REALLY LONG SOLUTION \\
60 REALLY LONG SOLUTION \\
\end{solution}
\end{EnvFullwidth}

\end{questions}

\end{document}


Thanks a lot for the attention!

-
Nice question: well formatted, well explained, listed what you tried so far. We could do with more questions like this :) the one thing you could do to make it better is to make your code compilable by including everything from \documentclass{} to \end{document}, making sure the necessary packages are in the preamble. –  Vivi Jan 4 '13 at 9:20
Am I crazy and the full MWE was all there all along? I was looking from my iPad and I could swear it wasn't there. Sorry... –  Vivi Jan 4 '13 at 9:37
No problem, maybe I was in the middle of editing my question... Thanks for the compliment! –  georgebrindeiro Jan 4 '13 at 9:59

use it without the

\begin{EnvFullwidth}
...
\end{EnvFullwidth}


or define a command \SetTotalwidth which does the same but allows a pagebreak

\documentclass[a4paper,12pt,answers]{exam}
\usepackage{amsmath,amssymb,amsthm,lipsum}

\makeatletter
\@totalleftmargin=0pt}
\makeatother

\begin{document}

\begin{questions}
\question Let $A \in \mathbb{R}^{n \times n}$, possibly singular. Show there exists $\epsilon \neq 0$ such that  $A+\epsilon I$ is n.

\SetTotalwidth
\begin{solution}\noindent
\lipsum
\end{solution}

\end{questions}

\begin{questions}

\question Let $A \in \mathbb{R}^{n \times n}$, possibly singular. Show there exists $\epsilon \neq 0$ such that  $A+\epsilon I$ is n.
\begin{solution}
\lipsum[5]
\end{solution}
\end{questions}

\end{document}

-
This is awesome! Such a simple answer... It would be great if I could still have solutions spanning the full width of the page, though. Is that impossible? –  georgebrindeiro Jan 4 '13 at 10:02
see my edited answer –  Herbert Jan 4 '13 at 10:25
You, sir, have officially made my day. Many thanks! –  georgebrindeiro Jan 4 '13 at 17:09