It is not nice to have a page break right after the colon and have the list start on a new page:
And here, finally, is the list of mission-critical items:
\begin{itemize}
...
\end{itemize}
How can I prevent that?
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this community\makeatletter
\newcommand\mynobreakpar{\par\nobreak\@afterheading}
\makeatother
.....
text\mynobreakpar
\begin{itemize}
....
\vspace{\baselineskip}
, like this: \newcommand\mynobreakpar{\vspace{\baselineskip}\par\nobreak\@afterheading}
LaTeX puts \beginparpenalty
at the begin of a list. The standard classes set \@beginparpenalty
to -\@lowpenalty
(-51), i.e., they somewhat encourage page breaks before lists. If you want to avoid page breaks before lists at all costs, set \@beginparpenalty
to 10000 in the preamble of your document.
\documentclass{article}
\makeatletter
\@beginparpenalty=10000
\makeatother
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\begin{itemize}
\item \lipsum*[6]
\end{itemize}
\end{document}
enumitem
's beginpenalty
parameter is still missing here, and is specially convenient (adapting lockstep's MWE):
\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\begin{itemize}[beginpenalty=10000]
\item \lipsum*[6]
\end{itemize}
\end{document}
enumitem
package has also midpenalty
and endpenalty
parameters, which can be useful to handle widowed/orphaned list items: texnia.com/archive/enumitem.pdf#subsection.3.5
Another solution, similar to Corbie's one, is use of samepage environment in way below. It's enough to use it on first item in list (or a few first ones), so you can use it without suppressing page-break either in preceding paragraph and in whole list. Also, minipage environment is probably overkill comparing to samepage and you need not specify line width, but it's matter of taste, you can use it too.
And here, finally, is the list of mission-critical items:
\begin{itemize}
\begin{samepage} % first item is tied to end of preceding paragraph
\item first item...
\end{samepage}
... % second and following items
\end{itemize}
The \mynobreakpar
solution does met work properly for user87690 (see comment on the \mynobreakpar
solution), because in his scope, the paragraph separator is zero, but the list top separator is not. So it seems better to use the macro \nolisttopbreak
below instead.
\makeatletter
\newcommand{\nolisttopbreak}{\vspace{\topsep}\nobreak\@afterheading}
\makeatother
.....
text\nolisttopbreak
\begin{itemize}
....
As you can see, then is no \par
, so the paragraph separator is not used.
I prefer moving the introduction to a minipage:
\begin{minipage}{\textwidth}
And here, finally, is the list of mission-critical items:
\begin{itemize}
...
\end{itemize}
\end{minipage}
Note that this prevents page breaks inside the list too.