Skip to content

Commit 8fe25d0

Browse files
committed
LaTeX: let underfull calculation in wrapped code lines ignore last line
Closes: #8925
1 parent 97de316 commit 8fe25d0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

sphinx/texinputs/sphinx.sty

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,8 +1271,21 @@
12711271
\fi\fi
12721272
}%
12731273
% auxiliary paragraph dissector to get max and min widths
1274+
% but minwidth must not take into account the last line
12741275
\newbox\spx@scratchbox
12751276
\def\spx@verb@getwidths {%
1277+
\unskip\unpenalty
1278+
\setbox\spx@scratchbox\lastbox
1279+
\ifvoid\spx@scratchbox
1280+
\else
1281+
\setbox\spx@scratchbox\hbox{\unhbox\spx@scratchbox}%
1282+
\ifdim\spx@verb@maxwidth<\wd\spx@scratchbox
1283+
\xdef\spx@verb@maxwidth{\number\wd\spx@scratchbox sp}%
1284+
\fi
1285+
\expandafter\spx@verb@getwidths@loop
1286+
\fi
1287+
}%
1288+
\def\spx@verb@getwidths@loop {%
12761289
\unskip\unpenalty
12771290
\setbox\spx@scratchbox\lastbox
12781291
\ifvoid\spx@scratchbox
@@ -1284,7 +1297,7 @@
12841297
\ifdim\spx@verb@minwidth>\wd\spx@scratchbox
12851298
\xdef\spx@verb@minwidth{\number\wd\spx@scratchbox sp}%
12861299
\fi
1287-
\expandafter\spx@verb@getwidths
1300+
\expandafter\spx@verb@getwidths@loop
12881301
\fi
12891302
}%
12901303
% auxiliary macros to implement "cut long line even in middle of word"

0 commit comments

Comments
 (0)