Skip to content

Commit

Permalink
LaTeX: let underfull calculation in wrapped code lines ignore last line
Browse files Browse the repository at this point in the history
Closes: #8925
  • Loading branch information
jfbu committed Feb 24, 2021
1 parent e0a1233 commit 294870b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sphinx/texinputs/sphinxlatexliterals.sty
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,21 @@
\fi\fi
}%
% auxiliary paragraph dissector to get max and min widths
% but minwidth must not take into account the last line
\newbox\spx@scratchbox
\def\spx@verb@getwidths {%
\unskip\unpenalty
\setbox\spx@scratchbox\lastbox
\ifvoid\spx@scratchbox
\else
\setbox\spx@scratchbox\hbox{\unhbox\spx@scratchbox}%
\ifdim\spx@verb@maxwidth<\wd\spx@scratchbox
\xdef\spx@verb@maxwidth{\number\wd\spx@scratchbox sp}%
\fi
\expandafter\spx@verb@getwidths@loop
\fi
}%
\def\spx@verb@getwidths@loop {%
\unskip\unpenalty
\setbox\spx@scratchbox\lastbox
\ifvoid\spx@scratchbox
Expand All @@ -356,7 +369,7 @@
\ifdim\spx@verb@minwidth>\wd\spx@scratchbox
\xdef\spx@verb@minwidth{\number\wd\spx@scratchbox sp}%
\fi
\expandafter\spx@verb@getwidths
\expandafter\spx@verb@getwidths@loop
\fi
}%
% auxiliary macros to implement "cut long line even in middle of word"
Expand Down

0 comments on commit 294870b

Please sign in to comment.