From 52d8f3a3bcf9656e16a5673372a1fba01dcf79e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20B?= <2589111+jfbu@users.noreply.github.com> Date: Wed, 29 Jun 2022 23:52:31 +0200 Subject: [PATCH] LaTeX: (cont'd) fix of code comments and slight refactoring --- sphinx/texinputs/sphinxlatexliterals.sty | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/sphinx/texinputs/sphinxlatexliterals.sty b/sphinx/texinputs/sphinxlatexliterals.sty index 0557cd10a..894ec51a0 100644 --- a/sphinx/texinputs/sphinxlatexliterals.sty +++ b/sphinx/texinputs/sphinxlatexliterals.sty @@ -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 @@ -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 @@ -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 @@ -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 }%