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
  • Loading branch information
jfbu committed Feb 24, 2021
1 parent 97de316 commit e41cc76
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Features added
Bugs fixed
----------

* #8925: LaTeX: 3.5.1 ``verbatimmaxunderfull`` setting does not work as
expected

Testing
--------

Expand Down
15 changes: 14 additions & 1 deletion sphinx/texinputs/sphinx.sty
Original file line number Diff line number Diff line change
Expand Up @@ -1271,8 +1271,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 @@ -1284,7 +1297,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 e41cc76

Please sign in to comment.