Skip to content

Commit 294870b

Browse files
committed
LaTeX: let underfull calculation in wrapped code lines ignore last line
Closes: #8925
1 parent e0a1233 commit 294870b

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

sphinx/texinputs/sphinxlatexliterals.sty

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,21 @@
343343
\fi\fi
344344
}%
345345
% auxiliary paragraph dissector to get max and min widths
346+
% but minwidth must not take into account the last line
346347
\newbox\spx@scratchbox
347348
\def\spx@verb@getwidths {%
349+
\unskip\unpenalty
350+
\setbox\spx@scratchbox\lastbox
351+
\ifvoid\spx@scratchbox
352+
\else
353+
\setbox\spx@scratchbox\hbox{\unhbox\spx@scratchbox}%
354+
\ifdim\spx@verb@maxwidth<\wd\spx@scratchbox
355+
\xdef\spx@verb@maxwidth{\number\wd\spx@scratchbox sp}%
356+
\fi
357+
\expandafter\spx@verb@getwidths@loop
358+
\fi
359+
}%
360+
\def\spx@verb@getwidths@loop {%
348361
\unskip\unpenalty
349362
\setbox\spx@scratchbox\lastbox
350363
\ifvoid\spx@scratchbox
@@ -356,7 +369,7 @@
356369
\ifdim\spx@verb@minwidth>\wd\spx@scratchbox
357370
\xdef\spx@verb@minwidth{\number\wd\spx@scratchbox sp}%
358371
\fi
359-
\expandafter\spx@verb@getwidths
372+
\expandafter\spx@verb@getwidths@loop
360373
\fi
361374
}%
362375
% auxiliary macros to implement "cut long line even in middle of word"

0 commit comments

Comments
 (0)