Reduce LaTeX overfull lines with microtype
Load microtype to improve LaTeX justification and reduce overfull hbox warnings; verify results in the log.
12 May 2026, 08:07 UTC

Justified text often creates tight or loose lines
When LaTeX justifies a paragraph, it stretches or compresses the space between words to fill the line width. In narrow columns or with long words, this can produce awkward spacing or an overfull \hbox warning, meaning content extends into the margin. Rewriting the paragraph is one fix, but it is not always practical.
The useful takeaway is to load the microtype package in the document preamble. It applies two typographic adjustments—character protrusion and font expansion—so justified lines fit better and TeX issues fewer overfull line warnings.
How microtype adjusts line breaking
Character protrusion lets certain glyphs, such as periods or commas, extend slightly into the margin so the optical edge of the text looks straighter. Font expansion slightly widens or narrows individual glyph widths within a safe tolerance, giving TeX more flexibility when it chooses line breaks. Neither change alters TeX's line-breaking algorithm; they only adjust the available widths of characters.
Worked configuration
Add this to the preamble of filename.tex, replacing filename with your document name:
\documentclass{article}
\usepackage{microtype}
\begin{document}
\section{Results}
This is a long justified paragraph with several words that would otherwise force LaTeX to stretch spaces unevenly across the line width. By loading microtype, the package can make small width adjustments to glyphs so the justified block looks more even and produces fewer overfull line warnings.
\end{document}
Compile from a terminal or command prompt in the same directory as the file. No special permissions are required:
pdflatex filename.tex
If you use LuaLaTeX or XeLaTeX, replace pdflatex with lualatex or xelatex. XeLaTeX support depends on the font backend, so confirm the log shows microtype initialized for the selected font. This guide assumes a current TeX Live or MiKTeX installation; older distributions may lack the primitives microtype requires.
Check the log before and after
Compile the document once without \usepackage{microtype}, then open filename.log and search for Overfull. Note the number and location of warnings. Add the package line, compile again, and compare the log. A successful configuration typically shows fewer overfull \hbox warnings for the same paragraph.
Look for microtype initialization messages confirming that protrusion and expansion are active for the selected font. If the log reports that font expansion is unavailable, the document may be using bitmap fonts or a font package that does not support expansion.
| Check | Without microtype | With microtype |
|---|---|---|
| Log search term | Overfull \hbox | Overfull \hbox and microtype initialization |
| Justified spacing | TeX stretches word spaces only | Glyph widths adjusted within tolerance |
| Draft option | Not applicable | [draft] disables effects |
Limits and common mistakes
- Narrow columns: microtype cannot repair badly constrained text. If a column is too narrow, adjust the text, increase
\emergencystretch, or widen the column instead. - Unsupported fonts: Bitmap fonts and some font packages do not allow expansion. Check the log for warnings rather than assuming the package fixed everything.
- Draft mode: Loading
\usepackage[draft]{microtype}disables the typographic effects during drafting. Remove[draft]or use\usepackage{microtype}for production output. - Journal class files: Some class files override microtype settings. Verify the PDF output before submission.
Practical verification
- Open
filename.logafter compiling without microtype and record the overfull \hbox warnings. - Add
\usepackage{microtype}to the preamble and recompile. - Search the new log for the same warnings and confirm the count is lower or unchanged, not higher.
- Switch to
\usepackage[draft]{microtype}, recompile, and confirm spacing reverts to the unmodified behavior. - Inspect the PDF visually at the previously flagged line breaks to ensure no new overlap or clipping appears.
Reverting the change
Because loading a package does not modify system state, there is no rollback procedure. To return to default behavior, comment out or delete the \usepackage{microtype} line and recompile.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.