Set the same manuscript twice. An 11pt article, a 180pt measure, one hundred lipsum paragraphs. Without microtype it comes to 1731 lines with 117 overfull boxes. Add the single line \usepackage{microtype} to the preamble and it is 1702 lines with 6 overfull boxes. Micro-typography is nothing more than letting punctuation hang a hair into the margin and stretching glyph widths by well under one percent. This page looks at what LaTeX’s microtype actually does — protrusion, font expansion and tracking — with the measurements alongside.
What microtype actually does
microtype does no typesetting of its own. It is a unified LaTeX interface to the micro-typographic features pdfTeX introduced and that later spread, in part, to LuaTeX and XeTeX. It was written by R. Schlicht. At the centre are two things — character protrusion (also called margin kerning) and font expansion — followed by tracking (letterspacing), the disabling of ligatures, and adjustment of interword spacing and extra kerning. Protrusion and expansion are on by default whenever the package can safely assume they will work on your engine.
Where those two came from is documented precisely. Hàn Thế Thành implemented them in pdfTeX as part of the doctoral thesis he submitted to Masaryk University in Brno in 2000, “Micro-typographic extensions to the TeX typesetting system,” published as TUGboat volume 21, number 4, pages 317–434. The same thesis explains margin kerning as needed for optical alignment, because mechanically justified margins look ragged to the eye, and defines font expansion as substituting a wider variant of a font in a loose line and a narrower one in a tight line so that the interword spaces vary less. What microtype implements, in other words, begins from an observation about how human eyes misread a straight edge.
One note on scope: these are refinements for Western (Latin-script) text. Japanese has a different typesetting model — line-breaking restrictions at the start and end of a line, spacing between Japanese and Western characters — handled by tools such as luatexja, and loading microtype does not change any of it. The more basic automatic processing of Western text, ligatures and kerning, belongs to a sibling page.
How much does microtype help? A measurement
The narrower the measure, the more it helps. On TeX Live 2024, an 11pt article with \usepackage[T1]{fontenc} and a 180pt measure — about one column of a two-column layout — one hundred lipsum paragraphs were set and the lines and Overfull \hbox reports counted. The results are in the table below: adding microtype takes the total from 1731 to 1702 lines, −1.7 %, and the overruns from 117 to 6. Repeat the measurement at 345pt, close to the text width of an a4paper article, and the gap narrows to 921 → 909 lines, −1.3 %. The effect is real but it is not a dramatic shortening.
| Setting | Total lines (180pt measure, 100 paragraphs) | Overfull hbox reports |
|---|---|---|
(package not loaded) | 1731 | 117 |
expansion=false | 1718 (protrusion only) | 102 |
protrusion=false | 1711 (expansion only) | 9 |
\usepackage{microtype} | 1702 (both, the default) | 6 |
What the breakdown shows is that the two features do different jobs. Expansion removes the most lines (1731 → 1711), though protrusion contributes thirteen of its own. But killing overfull boxes is almost entirely expansion’s doing: 117 drops to 9, whereas protrusion alone only gets it down to 102. If a line is sticking out into the margin, expansion is your fix; if the right edge merely looks ragged, protrusion is. That is the rule of thumb when you have to decide which one to switch off. Incidentally, loading microtype sets both \pdfprotrudechars and \pdfadjustspacing to 2 (without it, both are 0), so \the on those two tells you whether anything is actually switched on.
Character protrusion — cancelling an optical illusion
Protrusion (margin kerning) lets characters at the start or end of a line hang a hair past the margin, and the point is to cancel an illusion. Align a period, comma or hyphen — or a letter with a round or slanted contour like o, A, v — flush with the text edge, and the sidebearing of that glyph makes the edge look as though it caves inward. Let such characters protrude a little and the edge reads as optically straight. How far each one protrudes differs per character: a lot for punctuation, less for round letters, nothing at all for straight-sided ones like H — and microtype ships configuration files of these values per font.
To raise or lower the whole scale of protrusion, use the factor option (factor=1100 gives 1.1 times the defaults). Protrusion also does nothing where TeX sees no margin — the items of an itemize, the cell edges of a tabular. For those places microtype provides \leftprotrusion and \rightprotrusion, which make the first or last glyph at that point protrude as if it stood at an ordinary outer margin. In a table whose left column starts with brackets or quotation marks, inserting these alone changes how it reads.
Font expansion — letting glyph widths do the spacing’s work
Font expansion stretches or squeezes each line’s glyphs horizontally by a tiny amount — typically a fraction of a percent up to a few percent — so the line fits the measure. In justification, line width is normally reached by stretching and shrinking the interword glue alone. Hand part of that job to the glyph widths and the interword spaces need to vary less, which evens out line-to-line spacing and gives the paragraph a more uniform colour. It was expansion that took the overfull boxes from 117 down to 9 in the measurement above. Limits are set with stretch and shrink and granularity with step, but the defaults are fine to start with.
There is one hard limit here. Expansion works on pdfTeX and LuaTeX only — not on XeTeX. Loading microtype with no options under XeLaTeX raises no error at all: the package enables only what can safely run, so protrusion and tracking work and expansion is quietly switched off. Ask for it explicitly with \usepackage[expansion=true]{microtype}, though, and the run stops with this:
$ xelatex xe.tex
! Package microtype Error: Font expansion does not work with xetex.
See the microtype package documentation for explanation.
% The reason is one missing primitive. Asking each engine directly:
% pdftex : has \efcode, has \lpcode
% xetex : NO \efcode, has \lpcode
% luatex : has \efcode, has \lpcode
% XeTeX can shift glyphs into the margin, but it cannot scale their widths.The reason comes down to one missing primitive. \lpcode and \rpcode, the left and right protrusion amounts, exist on all three engines, but \efcode — the one expansion needs — does not exist in XeTeX (pdfTeX and LuaTeX both have it). XeTeX can shift a glyph into the margin; it has no way to scale the glyph’s width. If you want the full treatment including expansion and you are on XeTeX, moving to LuaTeX is the coherent answer.
Tracking (\textls) — letterspacing that does not break hyphenation
Tracking, or letterspacing, opens up the space between letters evenly. What makes microtype’s version good is that it does not insert space between characters: it builds and uses a copy of the font whose glyphs are wider. The word therefore stays one word, and hyphenation is not broken. Scattering \kerns through a word by hand, the classic approach, means that word can never break at a line end again. For ad-hoc letterspacing use \textls{...}; to apply it to everything that follows use \lsstyle, which stays on until the end of the group. For headings, where you do not want extra kerning added before and after, the starred \textls*{...} is handy.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{microtype}
% Space out small caps by 40/1000 em wherever they appear
\SetTracking{encoding = *, shape = sc}{40}
\begin{document}
\textsc{Small Caps}, and an ad-hoc \textls[200]{wide run of letters}.
% \lsstyle stays on until the end of the group
{\lsstyle everything here is letterspaced}
% The starred form adds no kerning before or after - good for headings
\section*{\textls*{Chapter Title}}
\end{document}Amounts are in thousandths of an em; per the microtype manual the default is 100/1000 em = 0.1 em. Give a one-off value in the optional argument, as in \textls[200]{...}, or declare it for a whole set of fonts in the preamble with something like \SetTracking{encoding=*, shape=sc}{40} (that example tracks small caps by 40/1000). A caution is in order: the manual itself writes that letterspacing lowercase text “is held in abhorrence,” and warns that unless you know what you are doing you should only letterspace capitals or small capitals. Tracking works on pdfTeX and LuaTeX — microtype’s README spells out the version requirements. If you need letterspacing in plain TeX too, the letterspace package provides just that part.
Cutting ligatures and touching spacing — \DisableLigatures, kerning, spacing
The occasions for disabling ligatures are few but pressing when they come — a sentence showing code where -- must not fuse into an en dash. \DisableLigatures turns them off for a named set of fonts: \DisableLigatures{encoding = T1, family = tt*} covers just the typewriter family in T1. Be aware, though, that disabling all of a font’s ligatures switches off its kerning too, as the manual states outright. List the ligature-initial characters in the optional argument and only the chosen ligatures stop, as in \DisableLigatures[?,!]{encoding = T1}. The command may be used only in the preamble, and only once.
The kerning and spacing options enable extra kerning and interword-spacing adjustment respectively, and both are pdfTeX-only (they do nothing on LuaTeX or XeTeX). Both are off by default, so name them only when you need them. To change settings after loading, use \microtypesetup{...} — to switch protrusion off only while the table of contents is built, for instance, bracket it with \microtypesetup{protrusion=false} and \microtypesetup{protrusion=true}. To give one part of the document a different setup, switch context with \microtypecontext{...} or the microtypecontext environment. Passing draft disables the micro-typography wholesale, and final conversely forces it on even when the document class is in draft mode — a useful pair for before-and-after experiments.
Which features you get depends on the engine
Two things to remember: expansion is not available on XeTeX, and interword spacing and extra kerning are pdfTeX-only. So the most capable engine is pdfTeX (protrusion + expansion + tracking + kerning + spacing), then LuaTeX (protrusion + expansion + tracking), and XeTeX offers protrusion and tracking alone. microtype automatically enables only what runs safely on your engine, so loading it with no options never errors — which is precisely why you need to know for yourself what is not taking effect.
| Feature | pdfTeX / LuaTeX / XeTeX | Notes |
|---|---|---|
protrusion | yes / yes / yes | all three have \lpcode and \rpcode; on by default |
expansion | yes / yes / no | XeTeX has no \efcode; asking for it raises a Package microtype Error |
tracking | yes / yes / yes | \textls and \lsstyle; off by default, enabled with tracking |
kerning | yes / no / no | pdfTeX only; off by default |
spacing | yes / no / no | pdfTeX only; adjustment of interword spacing |
What to actually write in the preamble
The basic case is the single line \usepackage{microtype}. That turns protrusion and expansion on by default (where the engine supports them), and most documents are meaningfully better for it. microtype is stable and nearly free of side effects — there is rarely any harm in adding it. On the pdfTeX engines the idiom is to pair it with \usepackage[T1]{fontenc}, partly because the protrusion and expansion configuration files are organised per encoding. The example below goes a little further: it activates protrusion and expansion explicitly, tracks small caps lightly, and disables ligatures only for the typewriter family used to show code.
\documentclass{article}
\usepackage[T1]{fontenc}
% protrusion and expansion explicitly on;
% "final" forces them on even when the class is in draft mode
\usepackage[activate={true,nocompatibility},final]{microtype}
% letterspace small caps a little (40/1000 em)
\SetTracking{encoding = *, shape = sc}{40}
% no ligatures in the typewriter family, so "--" stays two hyphens
\DisableLigatures{encoding = T1, family = tt*}
\begin{document}
% turn protrusion off just while the table of contents is built
\microtypesetup{protrusion=false}
\tableofcontents
\microtypesetup{protrusion=true}
\end{document}One last calibration of expectations. Adjustments of this kind are subtle, and a single page may not show them at all — the measurement found only a 1.7 percent reduction in total lines, and that at a narrow measure. What matters more in daily writing is that the overfull boxes fell from 117 to 6: every overrun you do not get is a sentence you do not have to rewrite to make it fit. The value of microtype lies less in making things shorter than in reducing the number of times you have to intervene by hand.