From d53262abe0e4c60f512696a0cb1619e90c16a0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:36:58 +0200 Subject: [PATCH] LaTeX: avoid "Overfull \hbox" reports when solved by verbatimforcewraps Fix #12722 --- CHANGES.rst | 4 ++++ sphinx/texinputs/sphinxlatexliterals.sty | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 1d04bc27010..ade5ca74599 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -19,6 +19,10 @@ Bugs fixed * #12514: intersphinx: fix the meaning of a negative value for :confval:`intersphinx_cache_limit`. Patch by Shengyu Zhang. +* #12722: LaTeX: avoid TeX reporting ``Overfull \hbox`` from too long + strings in a codeline when the problem has actually been solved thanks + to :ref:`latexsphinxsetupforcewraps`. + Patch by Jean-François B. Testing ------- diff --git a/sphinx/texinputs/sphinxlatexliterals.sty b/sphinx/texinputs/sphinxlatexliterals.sty index c2c0806455d..11991d9c3e8 100644 --- a/sphinx/texinputs/sphinxlatexliterals.sty +++ b/sphinx/texinputs/sphinxlatexliterals.sty @@ -512,6 +512,9 @@ \setbox\spx@tempboxa \vtop{\raggedright\hyphenpenalty\z@\exhyphenpenalty\z@ \doublehyphendemerits\z@\finalhyphendemerits\z@ +% Avoid TeX reporting Overfull \hbox'es during this measuring phase. Setting +% \hbadness to \@M to avoid Underfull reports is unneeded due to \raggedright. + \hfuzz\maxdimen \spx@everypar{}\noindent\strut\FV@Line\strut\spx@par \spx@verb@getwidths}% \ifdim\spx@verb@maxwidth>