diff options
Diffstat (limited to 'crypto/krb5/doc/pdf/sphinxlatexshadowbox.sty')
-rw-r--r-- | crypto/krb5/doc/pdf/sphinxlatexshadowbox.sty | 96 |
1 files changed, 56 insertions, 40 deletions
diff --git a/crypto/krb5/doc/pdf/sphinxlatexshadowbox.sty b/crypto/krb5/doc/pdf/sphinxlatexshadowbox.sty index 8d6c78666cf9..a2a1a0e393e4 100644 --- a/crypto/krb5/doc/pdf/sphinxlatexshadowbox.sty +++ b/crypto/krb5/doc/pdf/sphinxlatexshadowbox.sty @@ -1,7 +1,7 @@ %% TOPIC AND CONTENTS BOXES % % change this info string if making any custom modification -\ProvidesFile{sphinxlatexshadowbox.sty}[2021/01/27 sphinxShadowBox] +\ProvidesFile{sphinxlatexshadowbox.sty}[2023/03/19 sphinxShadowBox] % Provides support for this output mark-up from Sphinx latex writer: % @@ -16,48 +16,58 @@ % % Requires: \RequirePackage{framed} +\RequirePackage{sphinxpackageboxes} -% Again based on use of "framed.sty", this allows breakable framed boxes. -\long\def\spx@ShadowFBox#1{% - \leavevmode\begingroup - % first we frame the box #1 - \setbox\@tempboxa - \hbox{\vrule\@width\sphinxshadowrule - \vbox{\hrule\@height\sphinxshadowrule - \kern\sphinxshadowsep - \hbox{\kern\sphinxshadowsep #1\kern\sphinxshadowsep}% - \kern\sphinxshadowsep - \hrule\@height\sphinxshadowrule}% - \vrule\@width\sphinxshadowrule}% - % Now we add the shadow, like \shadowbox from fancybox.sty would do - \dimen@\dimexpr.5\sphinxshadowrule+\sphinxshadowsize\relax - \hbox{\vbox{\offinterlineskip - \hbox{\copy\@tempboxa\kern-.5\sphinxshadowrule - % add shadow on right side - \lower\sphinxshadowsize - \hbox{\vrule\@height\ht\@tempboxa \@width\dimen@}% - }% - \kern-\dimen@ % shift back vertically to bottom of frame - % and add shadow at bottom - \moveright\sphinxshadowsize - \vbox{\hrule\@width\wd\@tempboxa \@height\dimen@}% - }% - % move left by the size of right shadow so shadow adds no width - \kern-\sphinxshadowsize - }% - \endgroup -} +% 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. -% use framed.sty to allow page breaks in frame+shadow -% works well inside Lists and Quote-like environments -% produced by ``topic'' directive (or local contents) -% could nest if LaTeX writer authorized it +% At 6.2.0, \spx@ShadowFBox is so much simplified that it is now not +% separately 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 +% allow pagebreaks (which was problematic for "contents" directive if there +% are many subsections). +% +% Docutils does not allow topic to be nested within topics or other body +% elements. But the LaTeX code here does allow it: +% +% - a topic inside another topic would be rendered in a minipage (thus not +% allowing pagebreaks). Its external frame would adapt perfectly to +% the *current (smaller) width for text*. +% +% - a topic inside (nested) lists or quote environments would have its frame +% take the *full width* of the page, but its text contents on the other hand +% would obey exactly the current indentation plus inner separation. This is +% in contrast with the framing used for literal blocks, also based, but in a +% more sophisticated way on usage of \MakeFramed/\endMakeFramed, and +% adjusting to current text indentation. \newenvironment{sphinxShadowBox} - {\def\FrameCommand {\spx@ShadowFBox }% + {% + \spx@boxes@fcolorbox@setup{topic}% + % we will use the dimen registers from sphinxpackageboxes.sty which now hold + % the values from options related to topic/contents + % 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 - -\dimexpr2\sphinxshadowrule - +2\sphinxshadowsep - +\sphinxshadowsize + -\dimexpr\spx@boxes@border@top+\spx@boxes@border@bottom + +\spx@boxes@padding@top+\spx@boxes@padding@bottom + +\ifdim\spx@boxes@shadow@yoffset<\z@-\fi\spx@boxes@shadow@yoffset +\baselineskip\relax % configure framed.sty not to add extra vertical spacing \ltx@ifundefined{OuterFrameSep}{}{\OuterFrameSep\z@skip}% @@ -73,7 +83,7 @@ % use a minipage if we are already inside a framed environment \ifspx@inframed\begin{minipage}{\linewidth}\fi \MakeFramed {\spx@inframedtrue - % framed.sty puts into "\width" the added width (=2shadowsep+2shadowrule) + % framed.sty puts into "\width" the added width (padding+border widths) % adjust \hsize to what the contents must use \advance\hsize-\width % adjust LaTeX parameters to behave properly in indented/quoted contexts @@ -86,9 +96,15 @@ \@minipagerestore \@setminipage }% + \color@begingroup % workaround upstream framed.sty bug + \ifspx@topic@withtextcolor + \color{sphinxtopicTextColor}% + \fi + \spx@topic@TeXextras }% {% insert the "endminipage" code \par\unskip + \color@endgroup % matches the \color@begingroup \@minipagefalse \endMakeFramed \ifspx@inframed\end{minipage}\fi |