diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty index 31f0fb97b28..a8647dbe7bb 100644 --- a/sphinx/texinputs/sphinx.sty +++ b/sphinx/texinputs/sphinx.sty @@ -311,8 +311,6 @@ will be set to white}% % Except that \sphinxbox is for boxing inline elements (no linebreak, no % pagebreak). % -% (this addition happens in a descendant commit of this one) -% % MEMO: the 6.2.0 refactoring induced a change that the default \fboxrule used % by verbatimborder and shadowrule is now not expanded to its value immediately in % preamble (no assignment to a \dimen register is done, only storage in a @@ -361,6 +359,8 @@ will be set to white}% \spx@tempa{spx@attention@}{div.attention_}{attentionborder}{1pt} \spx@tempa{spx@danger@} {div.danger_} {dangerborder} {1pt} \spx@tempa{spx@error@} {div.error_} {errorborder} {1pt} +% this one new at 6.2.0: +\spx@tempa{spx@box@} {box_} {boxborder} \fboxrule % Set default box-decoration-break style for codeblocks to slice \spx@pre@border@opentrue % new default at 6.0.0: slice, not clone @@ -401,12 +401,11 @@ will be set to white}% \spx@tempa{spx@attention@}{div.attention_} {\dimexpr.6\baselineskip-\spx@attention@border\relax} \spx@tempa{spx@danger@} {div.danger_} {\dimexpr.6\baselineskip-\spx@danger@border\relax} \spx@tempa{spx@error@} {div.error_} {\dimexpr.6\baselineskip-\spx@error@border\relax} +\spx@tempa{spx@box@} {box_} \fboxsep % new at 6.2.0 % define legacy verbatimsep key as alias of pre_padding key \expandafter\let\expandafter\KV@sphinx@verbatimsep\csname KV@sphinx@pre_padding\endcsname % define legacy shadowsep key as alias of div.topic_padding key \expandafter\let\expandafter\KV@sphinx@shadowsep\csname KV@sphinx@div.topic_padding\endcsname -% (temporary explanation: this next comment and code line belong to a descendant -% commit down the line for \sphinxbox support, left-overs from a rebase) % also define a boxsep key as alias of box_padding key, because we defined boxborder % boxborder was defined only as collateral of batch definitions so some hesitation % we do keep these boxborder and boxsep as they configure the probably two most @@ -438,6 +437,7 @@ will be set to white}% \spx@tempa{spx@attention@}{div.attention_} \z@ \spx@tempa{spx@danger@} {div.danger_} \z@ \spx@tempa{spx@error@} {div.error_} \z@ +\spx@tempa{spx@box@} {box_} {3pt}% new and tentative at 6.2.0 % Shadow keys % @@ -455,6 +455,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 % \def\spx@tempa#1{% #1 = macro prefix \expandafter\spx@tempb @@ -495,6 +496,7 @@ 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 % Support for legacy shadowsize % This definition was broken at 5.1.0 and fixed at 6.1.2 @@ -567,6 +569,7 @@ will be set to white}% \spx@tempa{spx@attention@}{div.attention_} {sphinxattention} \spx@tempa{spx@danger@} {div.danger_} {sphinxdanger} \spx@tempa{spx@error@} {div.error_} {sphinxerror} +\spx@tempa{spx@box@} {box_} {sphinxbox}% new at 6.2.0 % Keep legacy sphinxsetup interface for warning type notices \def\spx@tempa#1#2{% #1 = option prefix, #2 = legacy option prefix \expandafter\let\csname KV@sphinx@#2BorderColor\expandafter\endcsname @@ -680,6 +683,13 @@ will be set to white}% %% FRAMED ENVIRONMENTS % +% \sphinxbox added at 6.2.0, support code in sphinxpackageboxes +% some of these defaults are already set, we repeat here via \sphinxsetup +\sphinxsetup{boxborder=\fboxrule, + boxsep=\fboxsep, + box_border-radius=3pt, +% border left without specific color, i.e. uses a priori black + box_background-TeXcolor=VerbatimColor}% \RequirePackage{sphinxpackageboxes} \def\spx@RequirePackage@PictIIe{% \IfFileExists{pict2e.sty} diff --git a/sphinx/texinputs/sphinxpackageboxes.sty b/sphinx/texinputs/sphinxpackageboxes.sty index c894f4eed0c..c30ea1d6e0a 100644 --- a/sphinx/texinputs/sphinxpackageboxes.sty +++ b/sphinx/texinputs/sphinxpackageboxes.sty @@ -135,6 +135,24 @@ \fi } +%%%%%%%%%%%%%%%% +% \sphinxbox (added at 6.2.0) +% +% For an inline box, possibly rounded. +\newcommand\sphinxbox[1][]{% #1 stands for the options, they are... optional! + \begingroup + \sphinxsetup{#1}% supposedly only "box" related options used here, + % setting other options is possible but will have a priori no effect + \spx@boxes@fcolorbox@setup + {box} + {sphinxboxBorderColor} + {sphinxboxBgColor} + {sphinxboxShadowColor}% + \setbox0\hbox\bgroup\aftergroup\spx@boxes@sphinxbox@a + \let\next=% +} +\def\spx@boxes@sphinxbox@a{\spx@boxes@fcolorbox{\box\z@}\endgroup} + %%%%%%%%%%%%%%%% % MACROS %