# Can I set an adjustable line spacing to avoid orphans and widows?

I have a relatively simple question. I'm compiling a large document and finding that I have a lot of pages that start with the last two lines of a paragraph. Is there a way to allow the line-spacing to vary to avoid this? It's currently set to \onehalfspacing using the setspace package.

Update following David's answer: Is there a way to allow a general spacing feature to vary for the same purpose?

The two-liners are mostly caused by \widowpenalty=10000 and \clubpenalty=10000 to avoid widows and orphans. I was hoping that the penalties would squeeze text onto one page rather than expanding it to more on the next page.

I've been searching the site for an answer to this but I haven't manage to find one even though I imagine a solution, if one exists, has been described somewhere else. Other than, of course, just rewriting a few sentences...

-
To avoid the two-liners maybe you could try to enlarge \interlinepenalty a bit to encourage breaking after the paragraph. Furthermore, you could use \widowpenalties to make it especially (but decreasingly) undesirable to split off two, three and so on lines. –  Stephan Lehmke Apr 11 '12 at 9:39

You really don't want to do this;-)

\documentclass{article}

\textheight4.5\baselineskip

\usepackage{lipsum}

\begin{document}
\flushbottom
\baselineskip=1\baselineskip plus 12pt minus 2pt\relax

\showthe\baselineskip

\lipsum

\end{document}


If you remove the plus component and only have the minus component then TeX will only squeeze and never shrink. But worrying about widow and club lines is typographic fine tuning and if you have variable line spacing really it's a typographic disaster area already so widow and club lines would not be a concern in that case (only half a :-) ).

Is there no other white space on the pages that you can make stretchable?: inter paragraph space, space after headings or around lists or anywhere? Interline space would only be my very last resort. Actually after last resort, as I would rather the page was a line bigger or shorter (using \enlargethispage) to help bad breaks.

-
I gather that the warning is because the text on some pages is expanded (to nearly double-spacing) to have paragraph breaks on page breaks? Is there a way to encourage TeX to rather squeeze the line-spacing rather than spreading it? (Or should I just bite the bullet and rewrite those few sentences?) –  Warrick Apr 11 '12 at 7:47
reply was too long for a comment so I'll put it in the edited answer –  David Carlisle Apr 11 '12 at 8:25
Is the method above extensible to other spacings? The most frequent and least disruptive breaks in my document are probably those between equations and text. Shall I change my question to ask how to make any appropriate spacing adjustable? That'll give it wider scope. –  Warrick Apr 11 '12 at 8:57
That would be much better. display spaces are already stretch by default eg 10pt article class sets \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@ \abovedisplayshortskip \z@ \@plus3\p@ \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@ \belowdisplayskip \abovedisplayskip but you could make it stretchier paragraph skip is similarly a bit stretchy (just 1pt) but you could increase it in article class \setlength\parskip{0\p@ \@plus \p@} –  David Carlisle Apr 11 '12 at 9:02
Thanks David, but this isn't quite clear to me. I'm using book class so I presume you mean to add the \setlength... line (at the end of your comment) to the actual class file? There isn't an appropriate command for the document itself? –  Warrick Apr 11 '12 at 16:29