Microtype in LaTeX: Automatic Microtypography for Better Justified Text
Add \usepackage{microtype} after your font setup to automatically reduce overfull hbox warnings and improve justified text via character protrusion and font expansion. Works with pdfLaTeX and LuaLaTeX (full support) and XeLaTeX (protrusion only).
26 Aug 2026, 11:42 UTC

The problem and the takeaway
Justified text in LaTeX often produces uneven spacing, excessive hyphenation, and overfull \hbox warnings because the engine must stretch or shrink inter-word space to fit each line. The microtype package solves most of this automatically by applying two microtypographic techniques: character protrusion (letting glyphs such as hyphens, periods, and commas hang slightly into the right margin) and font expansion (scaling glyphs horizontally by a tiny percentage to absorb spacing pressure). Add \usepackage{microtype} after your font setup, recompile, and the majority of overfull-box warnings disappear without any manual line-break fixes.
What microtype actually does
Character protrusion moves specific glyphs—typically punctuation and hyphens—into the margin by a fraction of their width. This makes the right edge of a justified block look visually straight even when the last character of a line is a period or comma. Font expansion stretches or shrinks every glyph in a line by up to a configurable limit (default ±2 %) so that TeX can meet its line-breaking targets with less inter-word space distortion. Both features are implemented at the engine level: pdfTeX and LuaTeX natively support protrusion and expansion; XeTeX supports protrusion only because it lacks the font-expansion primitive.
Minimal worked configuration
Place the package after all font-loading commands so it can detect the active fonts and load its per-font protrusion/expansion tables.
\documentclass{article}
\usepackage{lmodern} % or fontspec + your OpenType fonts
\usepackage[T1]{fontenc} % required for pdfLaTeX with Type 1 fonts
\usepackage{microtype} % defaults: protrusion=true, expansion=true
\begin{document}
Your paragraph-heavy text here.
\end{document}
No further options are needed for most documents. The package ships with configuration files for Latin Modern, Computer Modern, TeX Gyre, and many common Type 1 packages; unknown fonts fall back to generic settings that still work reasonably well.
Engine-specific behavior
| Engine | Protrusion | Expansion | Notes |
|---|---|---|---|
| pdfLaTeX | Full | Full | Requires Type 1 (not bitmap) fonts; \usepackage[T1]{fontenc} recommended. |
| LuaLaTeX | Full | Full | Works with fontspec and OpenType fonts; LuaTeX’s native protrusion/expansion is used. |
| XeLaTeX | Full | Unavailable | Expansion relies on a pdfTeX/LuaTeX primitive XeTeX does not provide. |
If you compile with XeLaTeX, you still gain protrusion, which alone reduces overfull boxes noticeably. For expansion you must use pdfLaTeX or LuaLaTeX.
Tuning expansion when artifacts appear
With certain fonts—especially condensed or high-contrast designs—the default ±2 % scaling can produce visible glyph distortion. Limit the range with the stretch and shrink options (values are in permille, so 10 = 1 %):
\usepackage[stretch=10,shrink=10]{microtype} % ±1 % instead of ±2 %
Start at 10/10; increase only if overfull-box warnings return. The microtype manual lists additional keys (factor, step) for fine-grained control, but the two above cover 95 % of real-world tuning needs.
Limits and common mistakes
- Do not combine with manual protrusion hacks or
pdfcprot. They double-apply protrusion, pushing punctuation too far into the margin. - Bitmap (Type 3) fonts and DVI output disable expansion; use Type 1 or OpenType fonts and PDF output (the default for pdfLaTeX/LuaLaTeX/XeLaTeX).
- Microtype does not fix bad hyphenation. If your document uses the wrong language for
babel/polyglossiaor sets extremely narrow columns, overfull boxes will persist. Fix the language or column width first. - Enable microtype before finalizing manual fixes. Because expansion changes line breaks, any
\linebreak,\pagebreak, or reworded workaround you added earlier may become incorrect after microtype is turned on. Apply microtype early, then address remaining overfull boxes. - Version drift. Default settings and per-font tables have evolved. Run
texdoc microtypein your distribution to read the manual that matches your installed version.
Practical verification
- Compile your document without
microtypeand note the number ofOverfull \hboxwarnings in the log. - Add
\usepackage{microtype}, recompile, and compare the warning count. A healthy drop (often 70–90 %) confirms the package is active. - Visually inspect the right margin of a justified paragraph: periods, commas, and hyphens should protrude slightly into the margin. In PDF viewers, zoom to 200 % to see the effect clearly.
- Run
texdoc microtypelocally; the manual’s “Features” section lists exactly which protrusion/expansion capabilities your engine+version combination provides.
When to look further
If overfull boxes remain after microtype, check \showhyphens{yourword} to see whether hyphenation patterns are missing for your language, or increase \emergencystretch slightly (e.g., \setlength{\emergencystretch}{3em}) as a last resort. Microtype handles the micro-level spacing; macro-level structure (column width, language, hyphenation exceptions) remains your responsibility.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.