Flat Earth Catalogue

2021-12-24

Curing the overfull hbox in LaTeX

TeX doesn't know how to hyphenate words with hyphens or slashes in them, resulting in spillover. When you really, really need to toe the line on your margins, there are two tricks worth trying.

\setlength{\emergencystretch}{0.2em} tells LaTeX that if it can't find a good way to set a paragraph, it's allowed to hallucinate this much extra stretchiness per line, divided evenly among its spaces, and try again. This replaces all advice about using \sloppy and most if not all advice about setting \tolerance (which is tolerance for really wide spaces, BTW). 

Find the overfull hbox and use \- to mark acceptable hyphenations of that word.

There's a package that does microtypographic adjustments like on interletter spacing, which might be worth trying, but I haven't yet.



02:27

Powered by Blogger

 

(K) 2002-present. All rights reversed, except as noted.

Hard-won technical knowledge, old rants, and broken links from 10 years ago. I should not have to explain this in the 21st century, but no, I do not actually believe the world is flat.

Past
current