Debian Codegraph @

texmf-dist/tex/latex/lwarp/lwarp-tcolorbox.sty

raw
1 %%
2 %% This is file `lwarp-tcolorbox.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% lwarp.dtx (with options: `tcolorbox')
8 %% This is a generated file.
9 %% Copyright 2016-2026 Brian Dunn
10 %%
11 %% This work may be distributed and/or modified under the
12 %% conditions of the LaTeX Project Public License, either version 1.3
13 %% of this license or (at your option) any later version.
14 %% The latest version of this license is in
15 %% http://www.latex-project.org/lppl.txt
16 %% and version 1.3 or later is part of all distributions of LaTeX
17 %% version 2005/12/01 or later.
18
19 \LWR@ProvidesPackagePass{tcolorbox}[2025/11/28]
20 \newbool{LWR@havetcblower}
21 \boolfalse{LWR@havetcblower}
22 \newcommand{\LWR@tcolorbox@findcolors}{%
23 \convertcolorspec{named}{tcbcolback}{HTML}\LWR@tcbcolback
24 \convertcolorspec{named}{tcbcolframe}{HTML}\LWR@tcbcolframe
25 \iftcb@titlefilled%
26 \convertcolorspec{named}{tcbcolbacktitle}{HTML}\LWR@tcbcolbacktitle
27 \else
28 \convertcolorspec{named}{tcbcolframe}{HTML}\LWR@tcbcolbacktitle
29 \fi
30 \convertcolorspec{named}{tcbcoltitle}{HTML}\LWR@tcbcoltitle
31 \convertcolorspec{named}{tcbcolupper}{HTML}\LWR@tcbcolupper
32 \convertcolorspec{named}{tcbcollower}{HTML}\LWR@tcbcollower
33 }
34
35 \newcommand*{\LWR@tcolorbox@titlecolorstyles}{%
36 border-top: 1px solid \LWR@origpound\LWR@tcbcolframe ;
37 border-bottom: 1px solid \LWR@origpound\LWR@tcbcolframe ;
38 background: \LWR@origpound\LWR@tcbcolbacktitle ;
39 color: \LWR@origpound\LWR@tcbcoltitle ;
40 }
41 \newcommand*{\LWR@showtitle@}[1]{%
42 \begin{BlockClass}[
43 \LWR@tcolorbox@titlecolorstyles
44 ]{tcolorboxtitle}
45 \kvtcb@before@title#1\kvtcb@after@title
46 \end{BlockClass}
47 }
48 \newcommand*{\LWR@showtitle}[1]{%
49 \iftcb@titlevisible
50 \LWR@showtitle@{#1}
51 \else
52 \LWR@showtitle@{~}
53 \fi
54 }
55
56 \newcommand*{\LWR@tcolorbox@dophantom}{%
57 \kvtcb@phantom
58 \let\kvtcb@phantom\@empty%
59 }
60 \newcommand*{\LWR@tcolorboxstart}[1]{
61 \LWR@tcolorbox@findcolors
62 \begin{BlockClass}[
63 border: 1px solid \LWR@origpound\LWR@tcbcolframe ;
64 background: \LWR@origpound\LWR@tcbcolback ;
65 ]{#1}
66 \LWR@tcolorbox@dophantom%
67 \ifdefvoid{\kvtcb@title}
68 {}
69 {
70 \LWR@showtitle{\kvtcb@title}
71 }
72 \begin{BlockClass}[
73 color: \LWR@origpound\LWR@tcbcolupper ;
74 ]{tcolorboxupper}
75 }
76 \newcommand*{\LWR@tcolorbox@dostartfloat}{%
77 \ifx\kvtcb@float\@empty%
78 \else%
79 \tcb@float@env@begin{tcbfloat}[\kvtcb@float]
80 \noexpand\kvtcb@everyfloat
81 \fi%
82 }
83
84 \newcommand*{\LWR@tcolorbox@doendfloat}{%
85 \ifx\kvtcb@float\@empty%
86 \else%
87 \tcb@float@env@end%
88 \fi%
89 }
90 \renewenvironment{tcolorbox}[1][]
91 {
92 \ifnumcomp{\value{LWR@lateximagedepth}}{>}{0}%
93 {
94 \PackageError{lwarp}
95 {%
96 Lwarp cannot process a tcolorbox inside a lateximage\MessageBreak
97 or SVG math.\MessageBreak
98 Enter 'H' for possible solutions%
99 }
100 {%
101 Use \protect\tcbox, \protect\tcboxmath, or
102 \protect\tcbhighmath\space instead.\MessageBreak%
103 (Inside math, you probably want to use these anyhow.)%
104 }
105 }{\relax}
106 \LWR@printpendingfootnotes
107 \tcb@layer@inc
108 \tcb@apply@box@options{#1}
109 \LWR@tcolorbox@dostartfloat%
110 \boolfalse{LWR@havetcblower}
111 \LWR@tcolorboxstart{tcolorbox}
112 \tcb@insert@before@upper%
113 }
114 {
115 \ifbool{LWR@havetcblower}{%
116 \tcb@insert@after@lower%
117 }{%
118 \tcb@insert@after@upper%
119 }%
120 \end{BlockClass}
121 \LWR@printpendingfootnotes
122 \tcb@layer@dec
123 \end{BlockClass}
124 \LWR@tcolorbox@doendfloat%
125 }
126 \newcommand{\LWR@HTML@tcb@error@nolower}{%
127 \tcb@insert@after@upper%
128 \end{BlockClass}
129 \begin{BlockClass}[%
130 border-top: 1px dashed \LWR@origpound\LWR@tcbcolframe ;
131 color: \LWR@origpound\LWR@tcbcollower ;
132 ]{tcolorboxlower}
133 \tcb@insert@before@lower%
134 }
135 \LWR@formatted{tcb@error@nolower}
136 \AtBeginDocument{
137 \ifdef{\tcbline}{
138 \newcommand*{\LWR@sub@tcbline}{%
139 \begin{BlockClass}{hrule}
140 \end{BlockClass}
141 }
142 \newcommand{\LWR@HTML@tcbline}{\@ifstar\LWR@sub@tcbline\LWR@sub@tcbline}
143 \LWR@formatted{tcbline}
144 }{}
145 }
146
147 \VerifyCommand[lwarp][tcolorbox]{\tcbox}{BECBA274BEECF88812D5324A9B87D4EE}
148
149 \newcommand{\LWR@HTML@tcbox}[2][]{
150 \LWR@printpendingfootnotes
151 \LWR@tcolorbox@dostartfloat%
152 \begingroup
153 \tcb@layer@inc
154 \tcb@apply@box@options{#1}
155 \boolfalse{LWR@havetcblower}
156 \LWR@tcolorboxstart{tcolorbox inlineminipage}
157 \tcb@insert@before@upper%
158 #2
159 \ifbool{LWR@havetcblower}{%
160 \tcb@insert@after@lower%
161 }{%
162 \tcb@insert@after@upper%
163 }%
164 \end{BlockClass}
165 \LWR@printpendingfootnotes
166 \end{BlockClass}
167 \tcb@layer@dec%
168 \endgroup%
169 \LWR@tcolorbox@dostartfloat%
170 \global\booltrue{LWR@minipagethispar}%
171 }
172 \LWR@formatted{tcbox}
173
174 \appto\LWR@restoreMathJaxformatting{%
175 \renewcommand{\tcbox}[2][]{#2}%
176 }
177 \VerifyCommand[lwarp][tcolorbox]{\tcbsubtitle}{EE29A34AF27D7FB1DB24A5F6E67E9E45}
178
179 \xpatchcmd{\tcbsubtitle}
180 {\begingroup}
181 {\begingroup\let\kvtcb@title\relax\begin{BlockClass}{tcolorboxsubtitle}}
182 {}
183 {\LWR@patcherror{tcolorbox}{tcbsubtitle}}
184
185 \xpatchcmd{\tcbsubtitle}
186 {\endgroup}
187 {\end{BlockClass}\endgroup}
188 {}
189 {\LWR@patcherror{tcolorbox}{tcbsubtitleB}}
190 \AtBeginDocument{
191 \ifdef{\tcboxfit}{%
192 \let\LWR@HTML@tcboxfit\tcbox%
193 \LWR@formatted{tcboxfit}
194 }{}
195 }
196 \VerifyCommand[lwarp][tcolorbox]{\tcbtitle}{D0221624B8279F835B74928C4CB209DD}
197
198 \LetLtxMacro\LWR@HTML@tcbtitle\tcbtitle
199 \xpatchcmd{\LWR@HTML@tcbtitle}
200 {\tcb@insert@before@title\tcbtitletext}
201 {\tcb@insert@before@title\LWR@textcurrentfont{\LWR@textcurrentcolor{\tcbtitletext}}}
202 {}
203 {\LWR@patcherror{tcolorbox}{LWR@HTML@tcbtitle}}
204 \LWR@formatted{tcbtitle}
205 \renewcommand*\l@tcolorbox[2]{\hypertocfloat{1}{tcolorbox}{lof}{#1}{#2}}
206 \AtBeginDocument{
207 \pgfkeysifdefined{/tcb/libload/theorems}{
208
209 \def\LWR@HTML@tcb@hack@amsmath{%
210 \PackageError{lwarp}
211 {%
212 tcolorbox ``math'', ``ams equation'', and related\MessageBreak
213 are not supported.\MessageBreak
214 \protect\tcboxmath\space and
215 \protect\tcbhighmath\space are emulated.\MessageBreak
216 Enter 'H' for possible solutions%
217 }
218 {%
219 Remove tcolorbox math-related options, and instead\MessageBreak
220 use the usual math environments inside each tcolorbox.%
221 }
222 }
223 \LWR@formatted{tcb@hack@amsmath}
224
225 % Cause an error if using math:
226 \tcbset{%
227 math upper/.style={before upper*=\tcb@hack@amsmath,after upper*=$},%
228 math lower/.style={before lower*=\tcb@hack@amsmath,after lower*=$},%
229 }
230
231 \appto\LWR@restoreorigformatting{%
232 \tcbset{%
233 math upper/.style={before upper*=$\displaystyle,after upper*=$},%
234 math lower/.style={before lower*=$\displaystyle,after lower*=$},%
235 }%
236 }
237
238 \newcommand{\LWR@HTML@tcboxmath}[2][]{#2}
239 \LWR@formatted{tcboxmath}
240 \newcommand{\LWR@HTML@tcbhighmath}[2][]{#2}
241 \LWR@formatted{tcbhighmath}
242 \appto\LWR@restoreMathJaxformatting{%
243 \renewcommand{\tcboxmath}[2][]{#2}%
244 \renewcommand{\tcbhighmath}[2][]{#2}%
245 }
246 }{}% theorems loaded
247 }% AtBeginDocument
248 \CustomizeMathJax{\newcommand{\tcbset}[1]{}}
249 \CustomizeMathJax{\newcommand{\tcbsetforeverylayer}[1]{}}
250 \CustomizeMathJax{\newcommand{\tcbox}[2][]{\boxed{\text{#2}}}}
251 \CustomizeMathJax{\newcommand{\tcboxfit}[2][]{\boxed{#2}}}
252 \CustomizeMathJax{\newcommand{\tcblower}{}}
253 \CustomizeMathJax{\newcommand{\tcbline}{}}
254 \CustomizeMathJax{\newcommand{\tcbtitle}{}}
255 \CustomizeMathJax{\newcommand{\tcbsubtitle[2][]{\mathrm{#2}}}}
256 \CustomizeMathJax{\newcommand{\tcboxmath}[2][]{\boxed{#2}}}
257 \CustomizeMathJax{\newcommand{\tcbhighmath}[2][]{\boxed{#2}}}
258 \endinput
259 %%
260 %% End of file `lwarp-tcolorbox.sty'.