# Page breaks within enumerated list

I'm writing a document with lots of numbered items, and I would like each of those items to be contained on a single page (rather than split across two pages). Is there a way to do this? samepage doesn't seem to work.

For example, if the following two items were too big to fit on the same page, I would like item 2 to move to the next page:

\begin{enumerate}

\item Blah blah blah ...
...

\item More babbling ...
...

\end{enumerate}

-
Welcome to TeX.SE. Enclosing it in a minipage is one option. That is if you want the entire enumerated list on one page. If you want a particular item completely on one page, you could use the resume feature from the enumitem package. –  Peter Grill Oct 12 '12 at 21:21

To ensure that an entire \item's text is on the same page (asuming of coruse that it will fit on the page), you can adapt the solution I used to Replace \item with \MyItem to box each list member with an mdframed, to instead place each \item within a minipage.

Here is a normal enumerate environment where item (c) is split across a page:

and using the MyEnumerate environment we get item (c) on a new page since it does not fit on the previous page.

## Notes:

• An \addvspace{\baselineskip} has been added in between the minipage to resolve the issue with vertical spacing issue that was in an earlier version.

• The geometry package was used only to adjust the paper height to show that the MyEnumerate actually moves the list member to a new page if it does not fit.

## Code:

\documentclass{article}
\usepackage{etoolbox}% for toggles
\usepackage{enumitem}

\usepackage[paperheight=5.8cm]{geometry}

\newcommand{\TextA}{%
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed accumsan hendrerit velit, vitae ultrices sapien porta nec.
}%
\newcommand{\TextB}{%
Duis blandit tempus placerat.
Nulla vitae erat ante. Nulla facilisi.
Aliquam tristique interdum suscipit.
Duis posuere orci vel velit suscipit in porttitor purus eleifend.
}%

%  http://tex.stackexchange.com/questions/43002/how-to-preserve-the-same-parskip-in-minipage
\newlength{\currentparskip}

% http://tex.stackexchange.com/questions/56435/replace-item-with-myitem-to-box-each-list-member-with-an-mdframed
\newcommand{\MyItem}{\item}

\newtoggle{FirstItem}%
\toggletrue{FirstItem}

\toggletrue{FirstItem}%
\newenvironment{MyEnumerate}[1][]{%
\renewcommand{\MyItem}{%
\iftoggle{FirstItem}{%
\global\togglefalse{FirstItem}
\setlength{\currentparskip}{\parskip}% save the value
%--------- start new minipage
\begin{minipage}{\textwidth}%
\setlength{\parskip}{\currentparskip}% restore the value
\begin{enumerate}[#1,series=MySeries]%
}{%
\end{enumerate}%
\end{minipage}%
%--------- end previous minipage and start new one
\begin{minipage}{\textwidth}%
\setlength{\parskip}{\currentparskip}% restore the value
\begin{enumerate}[#1,resume*=MySeries]%
}%
\item\mbox{}%
}%
}{%
\end{enumerate}%
\end{minipage}% --------- end last minipage
\global\toggletrue{FirstItem}%
}%

\begin{document}\noindent
\textbf{enumerate:}
\begin{enumerate}[label={(\alph*)}]
\item \TextA
\item \TextB
\item \TextA\TextB
\end{enumerate}
%
\clearpage
\textbf{MyEnumerate:}
\begin{MyEnumerate}[label={(\alph*)}]
\MyItem \TextA
\MyItem \TextB
\MyItem \TextA\TextB
\MyItem \TextB
\end{MyEnumerate}
\end{document}

-

In the following example document, the first line of the second item would be typeset on page one.

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\lipsum[1-4]

\begin{enumerate}

\item \lipsum*[2]

\begingroup\interlinepenalty=10000
\item \lipsum*[3]

\endgroup

\end{enumerate}

\end{document}


Don't forget the empty line (or \par) before \endgroup.

-
Thanks. Your example works but for some reason it doesn't seem to work within my more complicated document. I'll try to come up with an example I can post. –  rmp251 Oct 12 '12 at 21:54
@user432311 Have you nested lists? –  egreg Oct 12 '12 at 22:17