Tuning Latex’S Tolerance Settings To Reduce Spurious Warnings

When typesetting documents with LaTeX, you may encounter cryptic warnings about "overfull hboxes," "underfull vboxes," or "loose lines" even if your document looks perfectly fine visually. These warnings originate from LaTeX's built-in tolerance settings that govern how strictly it evaluates the typographic quality of your content. However, the default settings are sometimes too rigid for complex documents - triggering spurious warnings that can safely be ignored without harming overall quality. This article explains key tolerance parameters in LaTeX and provides guidance on tuning them to suppress needless warnings.

Understanding LaTeX’s Tolerance Settings

LaTeX provides a number of low-level typesetting parameters that control its sensitivity in flagging suboptimal content. Key tolerance settings include:

  • \tolerance: Maximum amount of white space (called "stretch") LaTeX allows when justifying text before triggering an "overfull hbox" warning about paragraphs exceeding their horizontal space allocation.
  • \emergencystretch: Factor to multiply \tolerance by for last line of a paragraph, allowing more stretch only when needed to balance the final line.
  • \hbadness: Threshold for signaling "underfull hboxes" about paragraph lines that couldn't stretch enough to reach their target length.
  • \jcharwidctl: Allow individual characters to stretch or shrink more than their normal limits when justifying text.
  • \linepenalty: Penalty factor for starting a new paragraph to bias earlier column or page breaks over loose line spacing.

By tuning these and related parameters, you can relax LaTeX's strictness in areas where you're willing to accept more variation in inter-word spacing or looser lines in exchange for fewer nuisance bad box warnings during compilation.

Common Causes of Spurious Warnings

LaTeX warnings often reflect suboptimal formatting decisions rather than actual content problems:

  • Inappropriate Document Classes: Reports versus books have different margins affecting text flow.
  • Poor Font Choice: Fonts with wide letters or poor kerning can cause loose lines.
  • Graphics/Table Size Mismatch: Figures or tables slightly too wide for text area trigger bad box warnings.
  • Long URLs/Code Snippets: Unbreakable strings overflow lines and cause looseness.
  • Complex Math Expressions: Multi-line equations struggle fitting in narrow measure.

In such cases, warnings triggered by LaTeX's tight defaults fail to reflect severe problems, just the unavoidable tradeoffs in typesetting certain content.

Strategies to Tune the Tolerance Settings

You have several options to reduce spurious bad box warnings by adjusting tolerance parameters:

  • Loosen \emergencystretch: Allow up to 50% more stretch just for problematic final lines of paragraphs.
  • Raise \tolerance: Accept additional overflowing whitespace on tough-to-justify paragraphs.
  • Increase \hbadness: Widen threshold for flagging "Underfull hbox" warnings to ignore more borderline cases.
  • Set \jcharwidctl: Let individual characters compress or expand more to justify difficult lines.
  • Increase \linepenalty: Bias against starting new paragraphs due to loose lines.

Balancing these parameters requires understanding the specific trouble spots in your document and the downsides of allowing more variation in typesetting quality.

Handling Unavoidable Spurious Warnings

In problematic document regions where there are no good options to improve spacing within tolerance settings, you can cleanly silence warnings with focused commands:

  • \sloppy: Locally disable all bad box warnings for a paragraph likely to trigger bogus messages.
  • \IgnoreSpaces: Declare whitespace to ignore when determining stretchability and box dimensions.
  • Warning Suppression Macros: Create custom commands to swallow expected warnings from test pages or legacy documents.

Used judiciously on the smallest possible content subsets, such warnings suppression keeps logs clean without masking potentially serious underlying issues.

When to Avoid Suppressing Warnings

Indiscriminately increasing tolerance thresholds has downsides:

  • Subtle Quality Issues: Excess looseness or variation in letter/word spacing degrades reading flow and harmony but may not trigger warnings.
  • Accessibility Concerns: Disabled readers rely on orderly, precisely spaced content that tolerances stretch.
  • Recommend Limits: As rule of thumb, keep \tolerance under 200, \hbadness under 1000 ( LaTeX's default is 10000), \emergencystretch under 1.5.

Analyze and understand the root typography factors causing warnings rather than blanket allowances. Preventing underlying conditions leads to the highest quality output.


LaTeX ships with very strict typesetting quality enforcement that signals warnings even for non-critical issues common in complex content. Tuning tolerance parameters can help reduce spurious warnings, but should be done judiciously based on analyzing root causes. Allowances made should be the minimum needed rather than blanket increases, which can silently erode output quality and accessibility.

Building overall LaTeX skills with handling complex documents, page layout, floats, alignments and troubleshooting methods helps prevent many common triggers for bad boxes rather than simply adding tolerances. Understanding the health of your content first, then strategically relaxing only affected parameters allows you to ship polished, professional documents compliant with publishing best practices.

Leave a Reply

Your email address will not be published. Required fields are marked *