Skip to content

Commit

Permalink
LaTeX: (cont'd) fix of code comments and slight refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
jfbu committed Jun 29, 2022
1 parent 2566f6e commit 52d8f3a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions sphinx/texinputs/sphinxlatexliterals.sty
Original file line number Diff line number Diff line change
Expand Up @@ -284,13 +284,12 @@
% MEMO: usage of original \colorbox would insert a \set@color here
% and this then places a "color pop" at the end of the \box\z@.
% But this could pair erroneously with an unmatched "color push"
% as #1 is maybe only a part (already hboxed) of a codeline.
% as #1 is maybe only a part (already hboxed) of a codeline
% if (default) verbatimwrapslines=true
% (cf \spx@verb@@PreProcessLine; refs: #8686)
% MEMO: formerly we did something with \fboxsep in relation to the LaTeX
% bug graphics/4524 for \colorbox, but as we don't use \colorbox...
% MEMO: the #1 has a \strut so the colored background will have correct
% dimensions
\setbox\z@\hbox{#1}%
\setbox\z@\hb@xt@\linewidth{\strut#1\hss}%
% MEMO: \colorbox would lead to \color{sphinxVerbatimHighlightColor}
% plus \color@block, which results in doubled (a color.sty feature)
% color command send to device driver and more importantly has
Expand All @@ -307,10 +306,13 @@
% we added a group only for \FV@RightListNumber not be influenced by the
% \current@color, if \fvset has been used to set numbers to the right.
}%
% MEMO: formerly we did \hb@xt@\linewidth{\strut #1\hss}, but there is now
% not much to do as since \spx@verb@@PreProcessLine this #1 is simply
% \box\spx@verb@tempboxb\strut
\newcommand\sphinxVerbatimFormatLine[1]{#1}%
% MEMO: fancyvrb has options obeytabs and tabsize. Anyhow tab characters
% do not make it to the tex file, they have been converted to spaces earlier.
% But, if this was not the case, the support would be implemented here via
% \newcommand\sphinxVerbatimFormatLine[1]{\FV@ObeyTabs{\strut #1}}%
\newcommand\sphinxVerbatimFormatLine[1]{\strut#1}%
% MEMO: if verbatimwrapslines is set to true (default) the #1 above is
% simply \box\spx@verb@tempboxb, from the next two macros.
% The next two macros are a deep hack of fancyvrb.sty core line processing in
% order to wrap too long lines, either at spaces and natural break-points,
% (soft wrap) or optionally at any character (hard wrap). This requires deep
Expand All @@ -332,7 +334,7 @@
\setbox\spx@verb@tempboxb\lastbox
\ifvoid\spx@verb@tempboxb\else
{\spx@verb@@ProcessLines}%
\FV@ProcessLine{\box\spx@verb@tempboxb\strut}%
\FV@ProcessLine{\box\spx@verb@tempboxb}%
\global\let\FV@ProcessLine\FV@ProcessLine
\global\setbox\@tempboxa=\box\@tempboxa
\aftergroup\spx@verb@@InhibitLineNumber
Expand Down Expand Up @@ -382,7 +384,7 @@
\setbox\spx@verb@tempboxa=\vtop{\unvbox\spx@verb@tempboxa
\setbox\spx@verb@tempboxb\lastbox
{\spx@verb@@ProcessLines}%
\FV@ProcessLine{\box\spx@verb@tempboxb\strut}%
\FV@ProcessLine{\box\spx@verb@tempboxb}%
\global\let\FV@ProcessLine\FV@ProcessLine
\global\setbox\@tempboxa=\box\@tempboxa
}%
Expand Down

0 comments on commit 52d8f3a

Please sign in to comment.