[Tex/LaTex] Nested enumerate list, Page breaks

#enumeratelistsnestingpage-breaking

I am currently writing a multiple choice exam: There is a enumerated list for the question number and then a nested list for the choices within each multiple choice question:
1. Question 1
a)
b)
c)
d)
2. Question 2
a)
b)
c)
d) …
With a long list of questions, it is common that the choices to a particular question become separated between pages. The most straightforward way to fix this problem is to just write \newpage where ever the break occurs. I am wondering if there is a better way? Is it possible to change (or create a new) envirement that always groups the choices so that they never get separated between pages?

Best Answer

One option would be to wrap your list inside a minipage (minipages don't admit page breaks):

\documentclass{exam}

\begin{document}

\noindent\begin{minipage}{\linewidth}
\begin{questions}
\question
One of these things is not like the others; one of these things is not
the same. Which one is different?
\begin{choices}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates
\end{choices}
\end{questions}
\end{minipage}

\end{document}

And, of course, you could define a new environment to alleviate the job:

\documentclass{exam}

\newenvironment{nbchoices}[1]
  {\par\noindent\begin{minipage}{\linewidth}\begin{questions}\question#1\begin{choices}}
  {\end{choices}\end{questions}\end{minipage}\par}

\begin{document}

\begin{nbchoices}{One of these things is not like the others; one of these things is not
the same. Which one is different?}
\choice John
\choice Paul
\choice George
\choice Ringo
\choice Socrates
\end{nbchoices}

\end{document}

Using article and standard enumerate environments, the same idea applies:

\documentclass{article}

\newenvironment{nbchoices}[1]
  {\item#1\par\begin{minipage}{\linewidth}\begin{enumerate}}
  {\end{enumerate}\end{minipage}\par}

\begin{document}

\begin{enumerate}
\begin{nbchoices}{One of these things is not like the others; one of these things is not
the same. Which one is different?}
\item John
\item Paul
\item George
\item Ringo
\item Socrates
\end{nbchoices}
\begin{nbchoices}{One of these things is not like the others; one of these things is not
the same. Which one is different?}
\item John
\item Paul
\item George
\item Ringo
\item Socrates
\end{nbchoices}
\end{enumerate}

\end{document}

No page breaks won't occur in between choices.