Compromise between too large whitespaces and \raggedbottom?

Due to some restrictions by my editor I had to remove all orphan and widow lines from my scrbook (via \clubpenalty10000 and \widowpenalty10000). On top of that, they do not want to see "too large" whitespaces between paragraphs or between figure captions and text.

One solution is to use \raggedbottom for the document. But then almost every page ends at a different height and this looks really bad on a twosided document.

Is there a compromise? Something like: "This is the maximum gap allowed and only for larger gaps put the whitespace on the bottom of the page". Or: "... share the whitespace between the standard "gap-location" and the bottom?"

EDIT: or is there something like \raggedbottom but that would align adjacent sides? -- that should be a rather good compromise

• Please inform us about the TeX code you're using to "remove all orphan and widow lines". – Mico Jul 4 '16 at 21:32
• To share the whitespace between the body of the text and the bottom you could try something like \makeatletter \newcommand*\mildraggedbottom{\def\@textbottom{\vskip\z@\@plus 12\p@ \relax}\let\@texttop\relax} \makeatother. But I’m not sure this is a good idea. – GuM Jul 4 '16 at 23:38
• Judicious usage of \enlargethispage is the only feasible solution. – egreg Jul 4 '16 at 23:38
• I have on occasion resized figures/tables/inserts to add or remove a line(s) on a page with success in past. Might be worth a try if you can do so. – acarlow Jul 5 '16 at 1:42
• Does your text contain many floats? If so adjustng related parameters may be most helpful, see tex.stackexchange.com/q/26521/15925 and tex.stackexchange.com/q/39017/15925 – Andrew Swann Oct 30 '16 at 12:43

Using \clubpenalty10000 and \widowpenalty10000 is usually not the best way to avoid widow and club lines, especially with \flushbottom as they almost always make the constraints on page makeup impossible to achieve.

A typical example is a paragraph in which a last line has a couple of words which go over the page, by setting the penalties to 10000 you force TeX to send two lines over to the next page, thus leaving the current page short. Depending on whether there is any stretch glue on the page this leaves the page underfull, or at least unnecessarily loose.

Most paragraphs of more than a few lines could be broken to have a different number of lines so a better (although manual) solution is to add \looseness=-1 before the paragraph, so making TeX squeeze the paragraph into one less line so it all fits on the page, or set it to 1 so the paragraph has an extra line and send two lines over to the next page. (Note that you can do this with any paragraph on the page, it does not have to be the last paragraph, if no suitable line breaking can be found for that one).

Alternatively you can use \enlargethispage{\baselineskip} (usually for both pages on a double page spread) to squeeze an extra line onto the page.

These are manual corrections so not suitable for an automated printing of some database catalogue, where the penalty settings might be appropriate, but for a hand written book, the time taken to do a final page-breaking adjustment should be small compared to the time taken to actually write the text.

Classical TeX does not have a feedback from the page breaking to the linebreaking so this is most easily done via manual correction, although in luatex one could consider using the line and page breaking callbacks to automate this.

• You're focusing on fixes by adjusting the line breaking, which would be the ideal solution. But there are ways to set the vertical glue so that some amount of stretch goes around examples and other displays, and the rest goes on the bottom. So how would one set things up so that space around displays is used first, and the bottom is a last resort (zero if possible)? Perhaps with the help of fil vs. fill... – alexis Oct 30 '16 at 12:27
• @alexis, basically you can't: that's not how tex glue works. If the stretch around figures is the same order as the stretch at the bottom (say both fil or both fill) then they will stretch together. Of they have different orders (say fil and fill) then one will never stretch at all. – David Carlisle Oct 30 '16 at 12:40
• Disappointed to hear that... In past experiments I could never figure out how to do this kind of thing, but assumed it was because of my limited understanding of the endless combinations shown off in the TeXbook. Anyway I think this is what the OP is after, so a complete answer should address it. (Interaction between paragraph breaking and page setting, which you cover, is a separate issue.) – alexis Oct 30 '16 at 14:03
• @alexis no actually I disagree: the real issue is getting good page breaks for which I offer some solutions, the particulars of possible glue balancing methods were some suggestions of the OP, but not easily usable in this case as I tried to explain. – David Carlisle Oct 30 '16 at 14:13
• Fair enough, and it's your answer. Thanks for explaining. – alexis Oct 30 '16 at 14:17