|
23 | 23 | \RequirePackage{framed}% used by sphinxheavybox |
24 | 24 | % |
25 | 25 | % Dependencies (they do not need to be defined at time of loading): |
| 26 | +% |
26 | 27 | % - of course the various colour and dimension options handled via sphinx.sty |
| 28 | +% |
27 | 29 | % - \sphinxstrong (for sphinxlightbox and sphinxheavybox) |
| 30 | +% |
28 | 31 | % - dimension register \spx@image@maxheight from sphinxlatexgraphics.sty |
| 32 | +% |
29 | 33 | % - \savenotes/\spewnotes from sphinxpackagefootnote (for sphinxheavybox) |
| 34 | +% |
| 35 | +% - \sphinxnotetitle, ..., \sphinxwarningtitle, etc... which are used by |
| 36 | +% default in the corresponding sphinx<notice> environments to replace at 6.2.0 |
| 37 | +% formerly hard-coded \sphinxstrong{#1}<space> |
| 38 | +% Their definitions are in sphinxlatexstyletext.sty. Also \sphinxseealsotitle |
| 39 | + |
30 | 40 |
|
31 | 41 | % Provides: (also in sphinxlatexliterals.sty) |
32 | 42 | \providecommand*\sphinxvspacefixafterfrenchlists{% |
33 | 43 | \ifvmode\ifdim\lastskip<\z@ \vskip\parskip\fi\else\par\fi |
34 | 44 | } |
35 | 45 |
|
36 | 46 | % Some are quite plain |
37 | | -\newenvironment{sphinxseealso}[1]{\sphinxstrong{#1}\par\nopagebreak}{} |
| 47 | +\newenvironment{sphinxseealso}[1]{\sphinxseealsotitle{#1}}{} |
38 | 48 |
|
39 | 49 | % This \dimen register is a legacy relic from Sphinx 1.5 which is used now |
40 | 50 | % only for sphinxlightbox. It is set in the sphinxadmonition environment. |
41 | 51 | \newdimen\spx@notice@border |
42 | 52 |
|
43 | | -% 6.2.0: add support for the <type>_TeXcolor options for text color. |
44 | | -% 6.2.0: use directly sphinx<type>BorderColor, not spx@notice@bordercolor, |
45 | | -% as the latter will probably be removed altogether at 7.0.0 |
46 | 53 | \newenvironment{sphinxlightbox}{% |
47 | | - % done in sphinxadmonition but its place should be here |
48 | | - % \spx@notice@border \dimexpr\csname spx@\spx@noticetype @border\endcsname\relax |
49 | 54 | \par |
50 | | - \noindent{\color{sphinx\spx@noticetype BorderColor}% |
| 55 | + \noindent{\color{spx@notice@bordercolor}% |
51 | 56 | \rule{\linewidth}{\spx@notice@border}}% |
52 | 57 | \par\nobreak |
53 | 58 | {\parskip\z@skip\noindent}% |
|
57 | 62 | % (we can't cancel that any earlier \vskip introduced a potential pagebreak) |
58 | 63 | \sphinxvspacefixafterfrenchlists |
59 | 64 | \nobreak\vbox{\noindent\kern\@totalleftmargin |
60 | | - {\color{sphinx\spx@noticetype BorderColor}% |
| 65 | + {\color{spx@notice@bordercolor}% |
61 | 66 | \rule[\dimexpr.4\baselineskip-\spx@notice@border\relax] |
62 | 67 | {\linewidth}{\spx@notice@border}}\hss}\allowbreak |
63 | 68 | }% end of sphinxlightbox environment definition |
|
72 | 77 | % \newenvironment{sphinxhint}[1] |
73 | 78 | % {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}} |
74 | 79 | % |
75 | | -% It was possible for user to \renewenvironment this to use sphinxheavybox, |
76 | | -% but this had stopped functioning at 5.1.0 which had greatly enhanced the |
77 | | -% sphinxheavybox environment and the needed support macros existed only for |
78 | | -% warning, caution, attention, danger, and error admonitions. At 6.1.0 a |
79 | | -% patch was added to allow the \renewenvironment method to work again for |
80 | | -% note, hint, important, tip to use sphinxheavybox. |
81 | | -% |
82 | | -% Then at 6.2.0, note, hint, important, tip can now access full customization |
83 | | -% of sphinxheavybox: CSS-named alike options (if used) trigger sphinxheavybox. |
84 | | -% The \renewenvironment method still works but then only common border width, |
85 | | -% non-configurable padding, straight corners and no shadow are all implied, |
86 | | -% as long as the related CSS-named options are not used. |
| 80 | +% The more complex definition below will branch to sphinxheavybox if a certain |
| 81 | +% boolean associated to the notice type is true. This boolean is set to true |
| 82 | +% whenever a CSS-named alike options for the notice type has been used in |
| 83 | +% sphinxsetup. The old coding as above would still work, with the new options |
| 84 | +% being then simply ignored. A user redefinition will probably either use |
| 85 | +% directly sphinxlightbox or sphinxheavybox or something else, with no need to |
| 86 | +% test the boolean. |
| 87 | +% |
| 88 | +% 6.2.0 also adds one layer of mark-up via \sphinxnotetitle etc..., because |
| 89 | +% the former \sphinxstrong{#1}<space> used a too generic \sphinxstrong. But |
| 90 | +% perhaps the #1 should be passed over to sphinx{light,heavy}box as parameter. |
| 91 | +% Unfortunately replacing these environments with one-parameter environments |
| 92 | +% would be potentially a breaking change. Anyway, sphinxpackageboxes.sty does not |
| 93 | +% provide a "titled" box; the caption of code-blocks is handled by extra |
| 94 | +% code in sphinxVerbatim. |
87 | 95 | \newenvironment{sphinxnote}[1] |
88 | 96 | {\edef\spx@env{sphinx\ifspx@opt@heavynote heavy\else light\fi box}% |
89 | | - \expandafter\begin\expandafter{\spx@env}\sphinxstrong{#1} } |
| 97 | + \expandafter\begin\expandafter{\spx@env}\sphinxnotetitle{#1}} |
90 | 98 | {\expandafter\end\expandafter{\spx@env}} |
91 | 99 | \newenvironment{sphinxhint}[1] |
92 | 100 | {\edef\spx@env{sphinx\ifspx@opt@heavyhint heavy\else light\fi box}% |
93 | | - \expandafter\begin\expandafter{\spx@env}\sphinxstrong{#1} } |
| 101 | + \expandafter\begin\expandafter{\spx@env}\sphinxhinttitle{#1}} |
94 | 102 | {\expandafter\end\expandafter{\spx@env}} |
95 | 103 | \newenvironment{sphinximportant}[1] |
96 | 104 | {\edef\spx@env{sphinx\ifspx@opt@heavyimportant heavy\else light\fi box}% |
97 | | - \expandafter\begin\expandafter{\spx@env}\sphinxstrong{#1} } |
| 105 | + \expandafter\begin\expandafter{\spx@env}\sphinximportanttitle{#1}} |
98 | 106 | {\expandafter\end\expandafter{\spx@env}} |
99 | 107 | \newenvironment{sphinxtip}[1] |
100 | 108 | {\edef\spx@env{sphinx\ifspx@opt@heavytip heavy\else light\fi box}% |
101 | | - \expandafter\begin\expandafter{\spx@env}\sphinxstrong{#1} } |
| 109 | + \expandafter\begin\expandafter{\spx@env}\sphinxtiptitle{#1}} |
102 | 110 | {\expandafter\end\expandafter{\spx@env}} |
103 | 111 |
|
104 | 112 | % warning/caution/attention/danger/error get more distinction |
|
193 | 201 | % - Since 6.2.0, also note/hint/important/tip notices can use these options |
194 | 202 | % and then they go automatically via sphinxheavybox. If only the legacy options |
195 | 203 | % are used, they keep using sphinxlightbox. |
| 204 | +% |
| 205 | +% - Since 6.2.0, \sphinxwarningtitle etc... add one level of mark-up (they |
| 206 | +% expand to \sphinxstrong{#1}<space> which was former hard-coded mark-up). |
| 207 | +% Example: |
| 208 | +% \renewcommand{\sphinxwarningtitle}[1]{\textbf{#1}\par\smallskip |
| 209 | +% {\color{sphinxwarningBorderColor}\hrule height1pt}\smallskip} |
196 | 210 | \newenvironment{sphinxwarning}[1] |
197 | | - {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}} |
| 211 | + {\begin{sphinxheavybox}\sphinxwarningtitle{#1}}{\end{sphinxheavybox}} |
198 | 212 | \newenvironment{sphinxcaution}[1] |
199 | | - {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}} |
| 213 | + {\begin{sphinxheavybox}\sphinxcautiontitle{#1}}{\end{sphinxheavybox}} |
200 | 214 | \newenvironment{sphinxattention}[1] |
201 | | - {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}} |
| 215 | + {\begin{sphinxheavybox}\sphinxattentiontitle{#1}}{\end{sphinxheavybox}} |
202 | 216 | \newenvironment{sphinxdanger}[1] |
203 | | - {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}} |
| 217 | + {\begin{sphinxheavybox}\sphinxdangertitle{#1}}{\end{sphinxheavybox}} |
204 | 218 | \newenvironment{sphinxerror}[1] |
205 | | - {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}} |
| 219 | + {\begin{sphinxheavybox}\sphinxerrortitle{#1}}{\end{sphinxheavybox}} |
206 | 220 |
|
207 | 221 | % the main dispatch for all types of notices |
208 | 222 | \newenvironment{sphinxadmonition}[2]{% #1=type, #2=heading |
209 | 223 | % can't use #1 directly in definition of end part |
210 | 224 | \def\spx@noticetype {#1}% |
211 | | - % At 6.2.0, these definitions of spx@notice@bordercolor and |
212 | | - % spx@notice@bgcolor serve nothing at all for sphinxheavybox. And the |
213 | | - % sphinxlightbox uses sphinx<type>BorderColor directly. Not removing |
214 | | - % though, in case some people have redefined sphinxlightbox (or even |
215 | | - % sphinxheavybox) and expect these things to exist. |
216 | | - % |
217 | | - % This is marked for removal at 7.0.0. |
218 | | - \sphinxcolorlet{spx@notice@bordercolor}{sphinx#1BorderColor}% |
219 | | - \sphinxcolorlet{spx@notice@bgcolor}{sphinx#1BgColor}% |
220 | | - \spx@notice@border \dimexpr\csname spx@#1@border\endcsname\relax |
| 225 | + % those next three are a remnant of legacy code; they are not used at |
| 226 | + % all by sphinxheavybox, and their usage could be disposed of by sphinxlightbox |
| 227 | + % but we keep for backward compatibility and also because it may be simpler |
| 228 | + % for user redefinitions to employ for example "spx@notice@bgcolor" and not |
| 229 | + % the more bulky "sphinx\spx@noticetype BgColor". |
| 230 | + \sphinxcolorlet{spx@notice@bordercolor}{sphinx#1BorderColor}% |
| 231 | + \sphinxcolorlet{spx@notice@bgcolor}{sphinx#1BgColor}% |
| 232 | + \spx@notice@border \dimexpr\csname spx@#1@border\endcsname\relax |
221 | 233 | % trigger the sphinx<type> environment, #2=heading is passed as argument |
222 | 234 | \begin{sphinx#1}{#2}% |
223 | 235 | % 6.2.0 support of div.<type>_TeX{color,extras} options |
|
0 commit comments