4

Edit: The original title of this question was "How can I avoid widows and orphans with the geometry package?" However, as egreg pointed out, the geometry package was not the cause of the problem. So, I have corrected the title.

I am writing my dissertation. My university specifies the page margins and absolutely forbids widows and orphans. To avoid the latter, I have set both clubpenalty and widowpenalty to 10000. I am using the geometry package to set the margins. As the following example shows (or, at least, does when I run pdfLaTeX), this can create widows and orphans. I've tried using geometry with various options, such as including or ignoring this or that. How can I keep to the required margins without creating widows and orphans?

\documentclass{article}
\usepackage[lmargin=1.5in,rmargin=1.0in,tmargin=1.0in,bmargin=1in]{geometry}
\usepackage{lipsum}

\widowpenalty = 10000
\clubpenalty = 10000

\begin{document}

\lipsum

This text is boring and repetitive.

This text is boring and repetitive.

This text is boring and repetitive.  However, it is easy to see that
\[x^n + y^n = z^n\]
has no solutions for $n \geq 3$.  This text is boring and repetitive.  This text is boring and repetitive.

This text is boring and repetitive.

This text is boring and repetitive.

\end{document}
1

4 Answers 4

11

The displayed equation is not counted as part of the paragraph in the context of widows and orphans. You can forbid a page break after the displayed equation by setting

\postdisplaypenalty=10000
1
  • Thanks! I ended up needing a \postdisplaypenalty of 10000, and it doesn't look pretty, but it meets the requirements. Commented Mar 29, 2012 at 22:21
12

The geometry package has nothing to do with widows and orphans. In your example a widow is created because of the display. Some remedy can be applied, but only when the text of your document is in final form.

For example, adding a line to an "almost full" long paragraph may avoid an orphan or a widow

Some long paragraph that ends almost flush right.\looseness=1

or conversely trying to shorten a long paragraph that doesn't quite fill the last line

Some long paragraph that doesn't fill the last line.\looseness=-1

Other known tricks are adding some words to a paragraph, or cutting some.

The correct parameter to set for "avoiding" orphans is

\makeatletter
\@clubpenalty=10000
\makeatother
\clubpenalty=10000 % initial value

because LaTeX uses \@clubpenalty to reinstate \clubpenalty after it has changed it to 10000 in some occasions.

A final comment: your institution forbids club and widow lines, but forces you to use a page format that's simply awful and unreadable. :(

1
  • Thank you for the answer and for the correction. I assumed that geometry was causing the problem because the document did not have any widows or orphans before I added that package. That I can only fix this when my document is otherwise finalized is not, of course, what I hoped to hear, but it's very good to know. Commented Mar 29, 2012 at 21:26
2

Something has to give....

If you don't want TeX to break there you have to let it break somewhere else. There isn't enough stretch on the page to pad out if it breaks anywhere else. the following settings work on your example, but...

\widowpenalty = 10000
\clubpenalty = 10000
\postdisplaypenalty =100

\parskip0pt plus 15pt
0
1

Besides all the (very good!) answers above, probably the microtype package might help as well. Though it does require lots of tweaking now and then. But it would allow you flexibility on the sub-letter level.

E.g., if there is an orphan, for the preceeding lines you might ask TeX/microtype to squeeze the letters together a bit more so that the orphan is solved.

But then, you really (REALLY) shouldn't start any of this tweaking before you have finished the entire document. Indeed, the addition of one line at the beginning of a chapter might require you to retweak all orphans and widows in that particular chapter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .
https://tex.stackexchange.com/questions/50008/how-can-i-avoid-widows-and-orphans-after-displayed-equations
tex.stackexchange.com
CC-MAIN-2024-26
179373
application/http; msgtype=response
sha1:WEL7LEXZCWPCBGWVLCEO26EOZXCYWNYJ
<urn:uuid:276b8637-c110-4ba0-a607-5dc7f770c1ab>
2024-06-15T08:58:17Z
104.18.43.226
text/html
sha1:53J3Q347CLSO5F3CTJ3NJ5RS2BVEM3IM
<urn:uuid:22beb601-c2bf-41d3-a373-6e0128302393>
https://tex.stackexchange.com/questions/50008/how-can-i-avoid-widows-and-orphans-after-displayed-equations
response
<urn:uuid:ae75f773-74e0-43ff-9e0e-d8adfbb5c196>
isPartOf: CC-MAIN-2024-26
publisher: Common Crawl
description: Wide crawl of the web for June 2024
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-105
software: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/