LaTeX: comments following up on regression fix commit in sphinxShadowBox

This commit is contained in:
Jean-François B 2023-03-13 15:10:33 +01:00
parent 8b7758160e
commit ff32c15ce0
3 changed files with 27 additions and 14 deletions

View File

@ -504,10 +504,15 @@ will be set to white}%
\begingroup\edef\spx@tempa{##1}\expandafter\endgroup
\ifx\spx@tempa\spxstring@none
#2%
% MEMO: at 5.1.0 and up to 6.2.0, an \edef+\dimexpr was used here.
% Expansion is now delayed to time of use as for the other dimensions
% handled above. This is synced with the added \dimexpr...\relax
% encapsulation in sphinxpackageboxes.sty's \spx@boxes@fcolorbox@setup.
% MEMO: at 5.1.0 and up to 6.2.0, an \edef with \number\dimexpr was
% used here. Since 6.2.0, expansion is delayed to time of use as for
% the other dimensions handled above. This is synced with an added
% encapsulation in \dimexpr...\relax by the "setup" from
% sphinxpackageboxes.sty. An induced regression had to be fixed in
% the sphinxShadowBox environment as it was using in an \ifdim the
% \spx@topic@shadow@yoffset macro, now holding by default 4pt+\z@
% rather than an already digested 262144sp. The +\z@ is in case ##2
% is empty.
\else #1%
\def#6{##1}\def#7{##2+\z@}%
\if\relax\detokenize{##3}\relax#4\else#3\fi
@ -528,14 +533,17 @@ will be set to white}%
\spx@tempa{spx@attention@}{div.attention_}
\spx@tempa{spx@danger@} {div.danger_}
\spx@tempa{spx@error@} {div.error_}
\spx@tempa{spx@box@} {box_}% new at 6.2.0
\spx@tempa{spx@box@} {box_}
% Support for legacy shadowsize (topic/contents)
% This definition was broken due to a typo at 5.1.0 and got fixed at 6.1.2
% MEMO: at 6.2.0 this no longer does \number\dimexpr in an \edef. Reason is to
% keep in sync with div.topic_box-shadow handling of xoffset and yoffset.
% Attention in particular to \ifdim context, we add a \dimexpr to the one here.
\define@key{sphinx}{shadowsize}{%
\edef\spx@topic@shadow@xoffset{\number\dimexpr#1\relax sp}%
\def\spx@topic@shadow@xoffset{#1}%
\let\spx@topic@shadow@yoffset\spx@topic@shadow@xoffset
\ifdim\spx@topic@shadow@xoffset=\z@
\ifdim\dimexpr\spx@topic@shadow@xoffset=\z@
\spx@topic@withshadowfalse
\else
\spx@topic@withshadowtrue
@ -567,7 +575,7 @@ will be set to white}%
\spx@tempa{spx@attention@}
\spx@tempa{spx@danger@}
\spx@tempa{spx@error@}
\spx@tempa{spx@box@}% new at 6.2.0
\spx@tempa{spx@box@}
%
\def\spx@tempa#1{% #1 = macro prefix
\expandafter\spx@tempb

View File

@ -118,6 +118,7 @@
% The 5.1.0 default calculation of padding parameters maintains PDF output
% identical to legacy behaviour, as long as padding is not set by user.
\setlength{\FrameSep}{0.5\dimexpr\spx@boxes@padding@top+\spx@boxes@padding@bottom\relax}%
% "setup" macro has prepared the \spx@boxes@... dimen registers
\advance\spx@image@maxheight
-\dimexpr\spx@boxes@border@top+\spx@boxes@border@bottom
+\spx@boxes@padding@top+\spx@boxes@padding@bottom

View File

@ -682,7 +682,8 @@
% the top padding (better visually)
\ifspx@opt@verbatimwithframe\else
% but we must now check if there is a background color
\ifspx@pre@withbackgroundcolor\else-\spx@pre@padding@top\fi
% MEMO: "fcolorbox@setup" will have been done by time of use
\ifspx@boxes@withbackgroundcolor\else-\spx@boxes@padding@top\fi
\fi
% caption package adds \abovecaptionskip vspace, remove it
\spx@ifcaptionpackage{-\abovecaptionskip}{}\relax}%
@ -692,7 +693,8 @@
{\nointerlineskip\kern\dimexpr\dp\strutbox
\ifspx@opt@verbatimwithframe\else
% but we must now check if there is a background color
\ifspx@pre@withbackgroundcolor\else-\spx@pre@padding@bottom\fi
% MEMO: "fcolorbox@setup" will have been done by time of use
\ifspx@boxes@withbackgroundcolor\else-\spx@boxes@padding@bottom\fi
\fi
\spx@ifcaptionpackage{-\abovecaptionskip}{}\relax
\sphinxVerbatim@Title}%
@ -805,10 +807,12 @@
\dp\sphinxVerbatim@ContentsBox+
\ht\sphinxVerbatim@TitleBox+
\dp\sphinxVerbatim@TitleBox+
\spx@pre@padding@top+
\spx@pre@padding@bottom+
\ifspx@opt@verbatimwithframe \spx@pre@border@top+
\spx@pre@border@bottom+\fi
% 6.2.0 uses here the dimen registers from sphinxpackageboxes.sty,
% they got setup by \spx@verb@boxes@fcolorbox@setup
\spx@boxes@padding@top+
\spx@boxes@padding@bottom+
\ifspx@opt@verbatimwithframe \spx@boxes@border@top+
\spx@boxes@border@bottom+\fi
% try to account for external frame parameters
% MEMO: this is because the sphinxheavybox (for warning admonitions)
% environment sets \FrameSep and \FrameRule