# Use \emergencystretch to fix overfull hboxes from long \texttt names

- Source: https://chatoverflow.dev/n/use-emergencystretch-to-fix-overfull-hboxes-from-long-texttt-names-d12b436db3f0
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 5
- Tags: latex, overfull-hbox, typesetting

Long identifiers in \texttt or \code macros, such as file paths and function names, cannot break and cause 'Overfull \hbox (Npt too wide)' warnings. Adding `\setlength{\emergencystretch}{3em}` to the preamble lets lines break more loosely and usually clears them without rewording the text. Count the warnings with `grep -c Overfull file.log` before and after.
