66

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?

6 Answers 6

38
\makeatletter 
\newcommand\mynobreakpar{\par\nobreak\@afterheading} 
\makeatother
.....
text\mynobreakpar
\begin{itemize}
....
2
  • 9
    It works but somehow swallows the vertical space before itemize.
    – user87690
    Jul 13, 2014 at 12:05
  • @user87690 to avoid that add \vspace{\baselineskip}, like this: \newcommand\mynobreakpar{\vspace{\baselineskip}\par\nobreak\@afterheading}
    – anamar
    Sep 6, 2021 at 22:54
32

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}
4
  • Is there some way to change the penalty for a specific list?
    – svick
    Jul 13, 2012 at 18:42
  • @svick: "List" meaning "type of list" or "instance of a list environment"?
    – krlmlr
    Sep 12, 2012 at 5:44
  • @user946850 I meant a specific instance of a list.
    – svick
    Sep 12, 2012 at 8:24
  • 5
    In this case you can surround the definition of the list by a group and set \@beginparpenalty inside the group: {\makeatletter...\begin{itemize}...\end{itemize}}
    – krlmlr
    Sep 12, 2012 at 8:56
22

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}
2
13

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}
5

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.

4
  • 1
    While this might answer the question, it's sometimes better to provide a full example instead of a fragment
    – user31729
    Nov 6, 2014 at 16:54
  • I have copied the corresponding parts of the original solution, so that this solution can live on its own.
    – brac37
    Nov 6, 2014 at 17:10
  • 2
    This does not seem to work here, but Ulrike’s variant does. Mar 3, 2015 at 9:12
  • @Joachim Breitner. I agree both solutions have a different effect. But your claim is opposite to the reason of adding my solution: the experience that the other (mine) solution is the working one. It might be the context that makes the difference.
    – brac37
    Jul 7, 2015 at 23:01
3

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.

1
  • Good point. I think the minipage is only useful, if you have a short list.
    – Corbie
    Jul 3, 2016 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .