Skip to content

Commit

Permalink
Merge pull request sphinx-doc#8926 from jfbu/latex_maxunderfull
Browse files Browse the repository at this point in the history
LaTeX: let underfull calculation in wrapped code lines ignore last line
  • Loading branch information
jfbu authored Feb 24, 2021
2 parents e0a1233 + c9a1a9b commit 13341c7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ Bugs fixed
change) with late TeXLive 2019
* #8253: LaTeX: Figures with no size defined get overscaled (compared to images
with size explicitly set in pixels) (fixed for ``'pdflatex'/'lualatex'`` only)
* #8925: LaTeX: 3.5.0 ``verbatimmaxunderfull`` setting does not work as
expected
* #8911: C++: remove the longest matching prefix in
:confval:`cpp_index_common_prefix` instead of the first that matches.
* C, properly reject function declarations when a keyword is used
Expand Down
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 13341c7

Please sign in to comment.