# How do I prevent widow/orphan lines?

How do I prevent a line from appearing by itself:

Orphan: at the bottom of the page, or
Widow: at the top of the page?

-

As Brent points out, you cannot always do this. The best you can do is to tell TeX that it's infinitely bad for these to appear:

\widowpenalty10000
\clubpenalty10000


One thing to keep in mind is that when presented with multiple infinitely bad options, TeX just picks one of them so you can still get widows or orphans.

-
I looked up somewhere else and they had \widowpenalty=10000. It didn't work then. Thanks! :) –  Kit Oct 16 '10 at 1:30
@Kit (it's a late comment, but anyway) You don't need the = in the assignment, but it doesn't hurt. \widowpenalty=10000 and \widowpenalty 10000 are the same. –  topskip Oct 4 '11 at 8:38

You can now use the nowidow package to make this task easier:

\usepackage[all]{nowidow}

-
Where do I find nowindow.sty, I don't seem to have it in my standard (Mac) TeX install... Thanks –  Emit Taste Oct 25 '13 at 9:03

The Memoir manual, in section 3.5 "Sloppybottom" discusses this in some detail, which I won't reproduce here.

Be prepared even to re-word in the most intractable cases.

Update:

I think the specific commands like \enlargethispage and \sloppybottom are exclusively for the memoir package, but here's a snippet extracted from the aforementioned that you may care to adjust (you can see the extensive comments in the original):

\clubpenalty=9996
\widowpenalty=9999
\brokenpenalty=4991
\predisplaypenalty=10000
\postdisplaypenalty=1549
\displaywidowpenalty=1602


Personally, I tend to avoid this TinXering with Plain TeX internals; although I don't know how to do it specifically for newlfm, I'd probably opt for adjusting the textheight on a case-by-case basis, as a final tidy-up before publishing.

-
I'm using newlfm. Is this applicable, too? –  Kit Oct 16 '10 at 1:18
while \sloppybottom is indeed memoir-specific (\raggedbottom is the comparable "plain" command), \enlargethispage is defined in base latex, so should be usable with any document class. –  barbara beeton Sep 27 '11 at 13:27

This FAQ answer gives some tips, including enlarging/reducing the (double-)page, setting the paragraph tighter, using \raggedbottom (for which, see also this FAQ answer which discusses putting some stretch in the \topskip).

-