TeX emergencystretch retry leaves unacceptable paragraph breakpoints unresolved
0 reputation · 29 Oct 2026, 14:46 UTC
0 reputation · 29 Oct 2026, 14:46 UTC
TeX's Knuth–Plass paragraph builder retries breakpoint selection once with \emergencystretch after \pretolerance and \tolerance passes fail. The goal is to confirm whether that single emergencystretch attempt is the engine's final fallback when no acceptable breakpoints exist, or whether an additional automatic retry is available in any TeX engine.
Documented behavior indicates that TeX issues an overfull or underfull box instead of retrying with more stretch, and offers no built-in per-paragraph switch to disable emergencystretch or iterate beyond one retry. This policy appears stable across Knuth TeX, pdfTeX, XeTeX, and LuaTeX core line breaking, although microtype and font expansion in extended engines can alter badness outcomes. Version assumptions cover these four engines without claiming engine-specific extensions beyond the documented pass sequence.
Does TeX treat emergencystretch as the final line-breaking attempt before emitting an overfull or underfull box?
Is there an engine-level mechanism in pdfTeX, XeTeX, or LuaTeX to request another breakpoint retry after emergencystretch fails without manual rewording?
When breakpoints remain unacceptable, is local parameter grouping or rewording the only documented remedy?
35775 reputation · 29 Oct 2026, 19:45 UTC
TeX applies \\emergencystretch exactly once as its final automatic retry; after that it may still emit an overfull or underfull box, and no engine‑level command can trigger another retry without manual changes.
If you need to know whether a custom package or engine extension adds extra retries, please provide the name of that package or the specific TeX engine version you are using.
Use comments to ask for clarification. Post a solution as an answer.
35,775 reputation · 29 Oct 2026, 21:43 UTC
\emergencystretch does not create a second tolerance threshold or a retry loop. In the core Knuth–Plass implementation, the final pass adds the declared dimension to each line’s available stretchability once; if no breakpoint sequence meets \tolerance after that, TeX finalizes the current sequence and reports badness per line rather than restarting the search.
Local groups can tighten or loosen \pretolerance, \tolerance, or \emergencystretch for a single paragraph, but that changes the input to the same fixed pass sequence—it does not ask the engine to retry again after emergencystretch. LuaTeX’s \linebreak_callback can replace breaking entirely, but that is custom Lua logic, not an automatic second pass.
Practical check: compile with \tracingparagraphs=1 and confirm the log shows one emergencystretch pass followed by per-line overfull or underfull \hbox warnings, not repeated stretch iterations. Applies to Knuth TeX, pdfTeX, XeTeX, and LuaTeX core line breaking.