# Prevent orphan lines using \pagebreak[3]

Rather than use global commands like \widowpenalty as discussed in this thread, I'd like to be able to control orphan lines locally, using \pagebreak[3]. Since the 3 option is the strongest suggestion short of forcing a break, it seems reasonable to expect that if \pagebreak[3] appeared before a line that would otherwise be the last line of a page, then the suggestion should be sufficiently strong that a page break would be induced. But it isn't, as the MWE illustrates. The output is unaffected by the inclusion of the pagebreak suggestion. Is there a way to customize the pagebreak option so that \pagebreak[3] would break the page iff the line below it would be an orphan?

\documentclass[11pt]{amsart}%
\usepackage{lipsum}
\parindent=0 pt
\parskip=12 pt
\begin{document}
\lipsum[1-4]

word
\begin{enumerate}
\item
\pagebreak[3]
\begin{enumerate}
\item \lipsum[1]
\end{enumerate}
\end{enumerate}
\end{document}


You need to add some stretch glue, for example

\documentclass[11pt]{amsart}%
\usepackage{lipsum}
\parindent=0 pt
\parskip=12 pt
\begin{document}
\lipsum[1-4]

word
\vfill\pagebreak[3]
\begin{enumerate}
\item
\begin{enumerate}
\item \lipsum[1]
\end{enumerate}
\end{enumerate}
\end{document}


without adding additional stretch, as you have removed all stretch from \parskip and there are no display environments on the page, then no penalty short of 10000 would allow a break as breaking the page short with no stretch glue to fill the space would leave the page underfull with maximum badness of 10000

in practice you probably want to add a penalty/glue combination that only adds glue of there is a page break but the details depend on how exactly you want to add the control.

The simplest thing really if manual control is allowed is just to use a forced page break \newpage where you want to break.

• Thanks @David_Carlisle for the quick response. My problem is that the length of my pages keep changing, so I don't know in advance when I'm going to have an orphan, so I don't want to force a \newpage. I tried removing the \parskip line (and adding more lines to the page) but it didn't help. Jan 8 '18 at 1:16