Algorithm Search⌘K

Definitionintro

Widows and orphans

Also called widow and orphan lines.

Lines of a paragraph left alone by a page break: the last line at the top of a page and the first line at the bottom. Names vary; TeX calls the first line a club line.

Widows and orphans are lines of a paragraph that a page break leaves alone: the last line of a paragraph at the top of a new page, or the first line of a paragraph at the bottom of a page. Both look bad, because the eye loses the paragraph at the break. Page breaking methods avoid them with a penalty on the breaks that make them, or with a hard rule on the number of lines that must stay together. The names are not used the same way in all style guides, so a program should state which line it means.

Definition

Take a paragraph of ℓ≥2\ell \ge 2 lines, numbered 1,…,ℓ1, \ldots, \ell, and a page break between line ii and line i+1i + 1, with 1≤i<ℓ1 \le i < \ell.

  • The break leaves a widow when i=ℓ−1i = \ell - 1: the last line of the paragraph is alone at the top of the next page. This is the common meaning in typography, in TeX (the \widowpenalty) and in CSS.
  • The break leaves an orphan when i=1i = 1: the first line of the paragraph is alone at the bottom of the page. TeX calls this line a club line and its penalty \clubpenalty; CSS calls it an orphan.

Some guides swap the two words, and some use "widow" for a very short last line of a paragraph (one word alone on its line, also called a runt), with no page break at all. The definitions above are the ones used on this site.

The rule with kk lines. CSS generalizes the idea: the property orphans is the least number of lines of a block that must stay on a page before a break, and widows is the least number that must go to the next page. Both have the initial value 2. A break after line ii is allowed only if i≥i \ge orphans and ℓ−i≥\ell - i \ge widows. With both values 2, this forbids exactly the breaks after line 1 and after line ℓ−1\ell - 1.

The penalty model. TeX puts a penalty between each pair of lines of a paragraph, in the box, glue and penalty model. The penalty after line ii is \interlinepenalty, plus \clubpenalty if i=1i = 1, plus \widowpenalty if i=ℓ−1i = \ell - 1 (or \displaywidowpenalty if the paragraph goes on after a display), plus \brokenpenalty if line ii ends with a hyphen. A one-line paragraph gets none of these. Plain TeX sets \clubpenalty=150, \widowpenalty=150, \displaywidowpenalty=50, \brokenpenalty=100 and \interlinepenalty=0; these are design choices, not results. A value of 10000 forbids the break, which gives the hard rule.

Examples and non-examples

  • A paragraph of five lines broken after line 4: line 5 starts the next page alone. This is a widow. In plain TeX the break costs 150 more than a break in the middle of the paragraph.
  • The same paragraph broken after line 1: line 1 ends the page alone. This is an orphan, or a club line in TeX.
  • Broken after line 2 or line 3: neither. At least two lines stay on each side.
  • A two-line paragraph broken after line 1: i=1i = 1 and i=ℓ−1i = \ell - 1, so the break makes both, and TeX adds both penalties, 150+150=300150 + 150 = 300.
  • A paragraph whose last line holds one short word, with no page break: not a widow in the sense of this page, though some guides call it one.
  • A heading at the bottom of a page with its text on the next page: not a widow or an orphan, but a similar fault. TeX and CSS handle it with a penalty or a rule that keeps the heading with the next line.

References

  1. Donald E. Knuth, The TeXbook, Addison-Wesley, 1984, the parameters \clubpenalty, \widowpenalty, \displaywidowpenalty and \brokenpenalty, and their values in the plain format of appendix B
  2. Donald E. Knuth, TeX, The Program, Addison-Wesley, 1986, part 39, Breaking paragraphs into lines, continued (the penalty put between two lines of a paragraph)
  3. CSS Fragmentation Module Level 3, W3C, section 3.3, Breaks Between Lines: orphans, widows

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/XDPBX8/text.yaml