NueelDocs

DocumentationTypography

Justification and hyphenation

Why justified text needs hyphenation, which languages are supported, and the rules that stop a book looking hyphen-ridden.

Why the two go together

Justified text has both edges flush. The only way to reach the right margin exactly is to stretch the spaces in the line.

If a line holds one long word that will not fit, its remaining spaces have to stretch a long way. Do that on several lines running and the enlarged gaps line up vertically into pale channels down the page — rivers. They are the most common fault in self-published typesetting, and they are caused by justifying without hyphenating.

Hyphenation gives the line somewhere else to break, so the spaces barely move.

The rules that keep it discreet

Automatic hyphenation follows the conventions a typesetter would:

Rule Value
Shortest word that may be broken 6 letters
Letters before the break at least 3
Letters after the break at least 3
Capitalised words never broken
Consecutive hyphenated lines avoided; a run costs progressively more

Three letters either side is what the Chicago Manual and Bringhurst ask for. Looser settings — the browser default is two letters on a five-letter word — produce fa-ther, al-ways, si-lences, and four hyphenated lines in a row.

A capitalised word is never broken because a hyphenated proper name reads as a typo rather than as typesetting.

Languages

Around 90 languages have hyphenation patterns, including French, German, Spanish, Italian, Portuguese, Dutch, Polish, Czech, Hungarian, Greek, Russian, Turkish and the Nordic languages.

The language comes from DetailsPublication. Setting it wrong means hyphens in the wrong places — a French book hyphenated by English rules breaks words where no French dictionary would.

How lines are chosen

Line breaks are chosen for the paragraph as a whole rather than line by line.

A greedy typesetter fits as much as it can on each line and moves on, so one tight line early forces a bad one later with no way back. Choosing across the whole paragraph lets an early line take one word fewer so that three later lines fall better.

You will notice this most where a paragraph ends: the last line is never stretched to reach the margin, and the paragraph above it is not distorted to make it long enough.

Where hyphenation is off

Some block types are never hyphenated and never justified, whatever the body text does:

  • Verse — line breaks belong to the poet
  • Code — a broken identifier is a wrong identifier
  • Table cells and headings — too short for the stretch to work
  • Captions

The Poetry and Children’s themes also set the body text ragged and unhyphenated.

Ragged right

Turning justification off gives a natural right edge. It is the convention for children’s books, poetry, and any book with a narrow measure — a column too narrow to justify well is better left ragged than stretched.

Hyphenation still applies unless you turn it off, and on a narrow measure it is worth keeping: it stops the ragged edge from becoming a jagged one.