Fonts and Text Formatting

Controlling Hyphenation in LaTeX

Control where LaTeX breaks words with exception lists, discretionary hyphens, German babel settings, and keeping hyphenated compounds together.

On this page
  1. How LaTeX decides where to hyphenate
  2. Set the language first
  3. Hyphenation in German documents
  4. Hyphenated words and dashes
  5. Adding exceptions with \hyphenation
  6. Marking one break point with -
  7. Reducing or stopping hyphenation
  8. Frequently asked questions

How LaTeX decides where to hyphenate

LaTeX breaks paragraphs at spaces. When a word does not fit at the end of a line, TeX may split it at a hyphenation point and add a hyphen. It finds those points with hyphenation patterns, which are lists of letter sequences that usually can be split. Each language has its own patterns.

TeX chooses line breaks for the whole paragraph, not one line at a time. Hyphenation is part of that choice, because splitting a word gives TeX more room to keep the word spacing even across the paragraph.

If the language is set wrongly, TeX uses the wrong patterns and hyphens appear in odd places. So the first step is always to set the language.

Set the language first

Hyphenation depends on the language that babel loads. For German:

\documentclass{article}
\usepackage[ngerman]{babel}
\begin{document}
Ein Beispieltext mit Silbentrennung.
\end{document}

With XeLaTeX or LuaLaTeX, use polyglossia instead and set the German language there. The polyglossia manual lists the spelling variants.

Hyphenation in German documents

ngerman versus german

Babel has two German options. ngerman applies the current spelling rules, which follow the 1996 reform. german applies the older, traditional rules. Choose the option that matches the spelling your text uses.

The "- shorthand

The German babel option adds a shorthand: typing "- inserts a discretionary hyphen. That is a point where TeX may break the word, and a hyphen appears only if the line actually breaks there. Use it inside a compound when you want a break to be allowed at a particular place:

Das Donau"-dampfschiff fuhr langsam.

Here TeX may break the word after “Donau”. If it does not, no hyphen appears.

Hyphenated words and dashes

TeX can break a line after a hyphen in a compound such as “well-known”, because a hyphen is a break point. To keep the compound on one line, wrap it in \mbox:

The \mbox{well-known} result holds in every case.

Dashes work the same way. An en dash (--), as in a page range, is also a point where TeX may break. To keep a range together, wrap it in \mbox{10--20}.

A \mbox cannot break at all, so a long one can overflow the margin. Use it only for short phrases.

Adding exceptions with \hyphenation

When TeX picks a wrong break in a word, add the word to the exception list in the preamble. Mark each allowed hyphen point with a hyphen:

\hyphenation{Ma-the-ma-ti-cal ex-am-ple}

Put the list after the babel line, so it applies to the right language. The list only affects the words you name, and it is not needed for words that already break correctly.

Marking one break point with -

For a single word, put \- at the break point you want:

The word hy\-phen\-ation can break at both marked points.

The \- command allows a break at that spot, and a hyphen appears only if the line breaks there. It works in any language.

Reducing or stopping hyphenation

Sometimes you want fewer hyphens, for example in a narrow column or a formal layout. These settings control how eager TeX is to hyphenate:

  • \hyphenpenalty: a higher value makes TeX less willing to hyphenate. A very high value, such as \hyphenpenalty=10000, almost stops automatic hyphenation.
  • \exhyphenpenalty: the same idea, for hyphens you type yourself.
  • \sloppy and \fussy: \sloppy allows looser lines with more space between words, which can avoid hyphens. \fussy restores the normal limits.
  • \emergencystretch: gives TeX extra stretch for difficult paragraphs.

These settings change the whole document, or the part of it where you put them. Test with your own text. Hyphenation also affects how justified text looks, so the choice between left alignment and justified text is related.

Frequently asked questions

Does LaTeX hyphenate automatically?

Yes. Once babel or the default patterns are set for your language, LaTeX hyphenates words automatically.

Why won’t LaTeX hyphenate a particular word?

Usually the word is not covered by the patterns for its language, or a hyphen point is blocked by the line’s spacing. Add the word to the exception list with \hyphenation, or mark its break points with \-.

Can LaTeX hyphenate words in a table?

Only in paragraph columns. A p{width} column can hyphenate its text. The LaTeX table formatting guide covers column widths. Columns set with l, c, or r hold each entry on one line, so their words do not break.

The complete guide to fonts and text formatting

LaTeX Fonts and Font Families Explained
Read the guide

Keep exploring

Guides from other topics

All topics →