Skip to content

Commit

Permalink
LaTeX: add support for div.topic_box-decoration-break=slice
Browse files Browse the repository at this point in the history
It is however undecided if the slice style should suppress the
horizontal shadow forcefully.  It does not so far.

This commit has removed the \spx@ShadowFBox macro which got so
simple that its meaning could be put directly into \FrameCommand
definition.
  • Loading branch information
jfbu committed Mar 13, 2023
1 parent 66c819e commit 27b30bb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sphinx/texinputs/sphinx.sty
Expand Up @@ -506,7 +506,7 @@ will be set to white}%
#2%
% 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
% the other dimensions handled above. This is synched 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
Expand Down
32 changes: 22 additions & 10 deletions sphinx/texinputs/sphinxlatexshadowbox.sty
Expand Up @@ -23,15 +23,14 @@
{topic}{sphinxtopicBorderColor}{sphinxtopicBgColor}{sphinxtopicShadowColor}%
}%

% At 5.1.0 the code formerly here has been refactored and incorporated
% into more powerful \spx@boxes@fcolorbox from sphinxpackageboxes.sty
% (which not only has a @rectangle variant but also @rounded)
\long\def\spx@ShadowFBox#1{%
\leavevmode
\setbox\z@\hbox{#1}%
% \spx@shadowbox@boxes@fcolorbox@setup MUST have been called before
\spx@boxes@fcolorbox{\box\z@}%
}
% At 5.1.0 the code formerly here in a definition of \spx@ShadowFBox has been
% refactored to hand over to a more powerful \spx@boxes@fcolorbox provided by
% file sphinxpackageboxes.sty, it can draw rounded corners and add a background
% color.

% At 6.2.0, \spx@ShadowFBox is so much simplified that it is now not
% separatedly defined but directly incorporated into the \FrameCommand
% definition done by sphinxShadowBox environment below.

% Use framed.sty \MakeFramed/\endMakeFramed to allow page breaks for topic
% boxes. Originally Sphinx used \shadowbox from fancybox.sty but it did not
Expand All @@ -56,7 +55,20 @@
\spx@shadowbox@boxes@fcolorbox@setup
% we will use the dimen registers from sphinxpackageboxes.sty which now hold
% the values from options related to topic/contents
\def\FrameCommand {\spx@ShadowFBox }%
% MEMO: \spx@boxes@fcolorbox creates an \hbox but does not quit vertical
% mode; but in context of framed.sty's \FrameCommand TeX is already
% in restricted horizontal mode, so no need for a \leavevmode here.
\def\FrameCommand {\spx@boxes@fcolorbox}%
% 6.2.0 adds support for div.topic_box-decoration-break=slice.
% (it is yet undecided if slice style should inhibit a bottom shadow)
\ifspx@topic@border@open
\def\FirstFrameCommand
{\spx@boxes@fcolorbox@setup@openbottom\FrameCommand}%
\def\MidFrameCommand
{\spx@boxes@fcolorbox@setup@openboth \FrameCommand}%
\def\LastFrameCommand
{\spx@boxes@fcolorbox@setup@opentop \FrameCommand}%
\fi
\advance\spx@image@maxheight
-\dimexpr\spx@boxes@border@top+\spx@boxes@border@bottom
+\spx@boxes@padding@top+\spx@boxes@padding@bottom
Expand Down

0 comments on commit 27b30bb

Please sign in to comment.