In The Elements of Typographical Style, the author notes (§2.4.8) that widows—single lines occurring at the top of a page—should be avoided. Yet the text height of two facing pages should be the same, and so a line should be removed from both pages in the spread (§2.4.9).

I assume that TeX has the ability to perform this kind of check. What solutions are possible (or already exist) to solve this general problem?

The same solution could be applied to orphans, though Robert Bringhurst does not seem to be so concerned about these.

  • Options include mostly adjusting penalties (see What are penalties and which ones are defined?. For example, \widowpenalty; however, this might not be perfect. I would suggest a manual adjustment during final production of the document, perhaps also fiddling around with \enlargethispage and/or \looseness (see Which choice of line-breaking parameters gives the minimum number of lines and Squeeze some more lines on the current page).
    – Werner
    Sep 18 '14 at 22:31
  • Note that in this type of book, I want to keep the distance between lines and paragraphs completely even. Manual adjustment is always a possibility, but this seems like the kind of task which can (and should) be automated. Perhaps it will need to come down to my writing a package! Sep 18 '14 at 22:33
  • 1
    I think that TeX outputs page-by-page. So if the right page will be one line shorter to avoid a widow, I'm not sure there is any way for TeX to automatically adjust the left page. It might be different the other way around i.e. if TeX knows it had to shorten the left to avoid a widow, maybe you could then get it to adjust the right. But perhaps I am wrong about this?
    – cfr
    Sep 18 '14 at 22:43
  • 2
    PAge breaking is no-way that easy to automate. Certain relevant problems are proven to be NP-hard. So there is always a final-tweak phase and also strongly recommended. Here is more tex.stackexchange.com/questions/114292/…
    – percusse
    Sep 18 '14 at 22:44
  • 1
    They are not rare. With floats, the problem is really compicated. It's not merely a few checks whether remaning line number is 1 or not. You might need to give away the line breaking optimality etc. Espcially if you have nonbreakable things like display math etc. It is quite complicated before even you arrive to the core NP part. Off the top of my head, I had three pages in my thesis that never had proper page breaking.
    – percusse
    Sep 19 '14 at 0:06

Paul Isambert discusses a theoretical solution in TUGboat: Strategies against widows. This is his fourth and preferred solution to the problem. He provides example macros, which assume three passes, though does not provide a package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.