user52366 - 1 year ago 163
LaTeX Question

# prevent page break within \item in latex document

I have a long document consisting of an enumeration. Each item consists of several lines, and possibly also includes other elements such as graphics and lists. The document type requires that each of these items appears on a single page, with no page break within item. Unused white space at the bottom of the page is acceptable.

Here is an example

\documentclass[a5paper,12pt]{article}
\usepackage{blindtext}

\begin{document}
\begin{enumerate}
\item \blindtext
\item \blindtext % don't break this apart
\item very long text here
\end{enumerate}
\end{document}


I know of solutions with the
samepage
environment, and also with
minipage
. The problem is that I can't wrap the individual
\item
s into these environments, which I would need.

needspace
works, but then I need to determine the vertical extent of each item manually (at least that is what I think).

What I did in the end is use the enumitem package and break up the enumeration into parts which are in minipages:

\documentclass[a5paper,12pt]{article}
\usepackage{blindtext}
\usepackage{enumitem}           % modified itemize

\begin{document}
\begin{minipage}{\linewidth}
\item \blindtext
\end{enumerate}
\end{minipage}

\begin{minipage}{\linewidth}