# Not start a new page with scanty number of words, lines [duplicate]

This script

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\lipsum[1-5]
\lipsum[6][1-2]
\end{document}


produces the output

How can I avoid starting page 2 with such a scanty number of words, lines?

You can use TeX's \looseness parameter. If you say \looseness=<number> for a paragraph, TeX will try to make it <number> lines longer than what would have been done otherwise, without exceeding the current \tolerance. <number> may be negative, so in your case, setting \looseness=-1 for one of the paragraphs does the trick:

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\looseness=-1 % make the next paragraph one line shorter than usual
\lipsum[1-5]

\lipsum[6][1-2]
\end{document}


According to the TeXbook, \looseness is reset to zero at the same time as \hangindent, \hangafter, and \parshape are reset to their normal values, which is

at the end of every paragraph, and (by local definitions) whenever it enters internal vertical mode.

(TeXbook p. 103)

Therefore, the \looseness=-1 in the above example affects only the first of the five paragraphs produced by \lipsum[1-5]. There is no need to do this assignment in a group.

If I remember correctly, the TeXbook also mentions a trick to spread some looseness among several paragraphs. I could probably find it if you're interested.

As suggested in Skillmon's comment, another way would be to play with penalties, in particular with \widowpenalty (to avoid page breaking before the last line of a paragraph) and \linepenalty (to make TeX's line breaking algorithm more reluctant to add lines to a paragraph: this penalty defines the “base cost” of each line).