Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 16 down vote accepted
\makeatletter 
\newcommand\mynobreakpar{\par\nobreak\@afterheading} 
\makeatother
.....
text\mynobreakpar
\begin{itemize}
....
share|improve this answer
    
It works but somehow swallows the vertical space before itemize. –  user87690 Jul 13 at 12:05

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}
share|improve this answer
    
Is there some way to change the penalty for a specific list? –  svick Jul 13 '12 at 18:42
    
@svick: "List" meaning "type of list" or "instance of a list environment"? –  krlmlr Sep 12 '12 at 5:44
    
@user946850 I meant a specific instance of a list. –  svick Sep 12 '12 at 8:24
2  
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 '12 at 8:56

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.

share|improve this answer
    
While this might answer the question, it's sometimes better to provide a full example instead of a fragment –  Christian Hupfer Nov 6 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 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.