Debian Codegraph @

texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.technical.tex

raw
1 % !TeX root = tcolorbox.tex
2 % include file of tcolorbox.tex (manual of the LaTeX package tcolorbox)
3 \clearpage
4 \section{Technical Overview and Customization}\label{sec:technical}%
5 \tcbset{external/prefix=external/technical_}%
6 This section provides a technical overview of the skin concept of |tcolorbox|.
7 For most applications of |tcolorbox|, one will not need to know the bells and
8 whistles described herein.
9 You may proceed to \zvref{sec:skins} where the customization options
10 for most users are documented.
11
12 The following explanations also cover options and settings from the \mylib{skins} library,
13 see \zvref{sec:skins}.
14
15 \subsection{Skins and Drawing Engines}\label{sec:skincorekeys}
16 From a technical point of view, a \emph{skin} is a style definition for the
17 appearance of a |tcolorbox|. The core package provides some additional
18 option keys for skins but only two skins called \refSkin{standard}
19 and \refSkin{standard jigsaw}.
20 The \mylib{skins} library adds several more skins. To change to a skin, only one
21 option from the core package has to be set.
22
23 \begin{docTcbKey}{skin}{=\meta{name}}{style, no default, initially \texttt{standard}}
24 Sets the current skin to \meta{name}. This is a style definition which sets all the following
25 keys, i.\,e., for many use cases there is nothing more to do.
26 \begin{dispExample}
27 \tcbset{colback=Salmon!50!white,colframe=FireBrick!75!black,
28 width=(\linewidth-8mm)/2,before=,after=\hfill,equal height group=ske}
29
30 \begin{tcolorbox}[adjusted title=My title]
31 This is my content.
32 \end{tcolorbox}
33 \begin{tcolorbox}[beamer,adjusted title=My title]
34 This is my content.
35 \end{tcolorbox}
36 \end{dispExample}
37 \end{docTcbKey}
38
39 \begin{docTcbKey}{skin first}{=\meta{name}}{style, no default, initially \texttt{standard}}
40 If the box is set to be \refKey{/tcb/breakable} and \emph{is} broken actually,
41 then the skin for the \emph{first} part of the break sequence
42 is set to \meta{name}, see Subsection \ref{subsec:breaksequence} on page \pageref{subsec:breaksequence}.
43 Typically, this key is set by a \refKey{/tcb/skin}.
44 \end{docTcbKey}
45
46
47 \begin{docTcbKey}{skin middle}{=\meta{name}}{style, no default, initially \texttt{standard}}
48 If the box is set to be \refKey{/tcb/breakable} and \emph{is} broken actually,
49 then the skin for the \emph{middle} parts (if any) of the break sequence
50 is set to \meta{name}, see Subsection \ref{subsec:breaksequence} on page \pageref{subsec:breaksequence}.
51 Typically, this key is set by a \refKey{/tcb/skin}.
52 \end{docTcbKey}
53
54
55 \begin{docTcbKey}{skin last}{=\meta{name}}{style, no default, initially \texttt{standard}}
56 If the box is set to be \refKey{/tcb/breakable} and \emph{is} broken actually,
57 then the skin for the \emph{last} part of the break sequence
58 is set to \meta{name}, see Subsection \ref{subsec:breaksequence} on page \pageref{subsec:breaksequence}.
59 Typically, this key is set by a \refKey{/tcb/skin}.
60 \end{docTcbKey}
61
62
63 \clearpage
64
65 The skin of a |tcolorbox| is drawn by up to four \emph{engines}.
66 Afterwards, the text content is drawn which is not part of a skin.
67 The four steps are:
68 \begin{enumerate}
69 \item The \emph{frame} of the box, drawn by \refKey{/tcb/frame engine}.
70 \item The \emph{interior} of the box. The interior of a box with title is
71 drawn differently from a box without title.
72 \refKey{/tcb/interior titled engine} or \refKey{/tcb/interior engine}
73 is used to draw the interior.
74 \item The \emph{segmentation} (line) of the box, if there is a lower part;
75 drawn by \refKey{/tcb/segmentation engine}.
76 \item The \emph{title area} of the box, if there is a title and
77 \refKey{/tcb/title filled} is set to |true|; drawn
78 by \refKey{/tcb/title engine}.
79 \end{enumerate}
80
81 \begin{docTcbKey}{frame engine}{=\meta{name}}{no default, initially \texttt{standard}}
82 Sets the \emph{frame} drawing engine for a box to \meta{name}.
83 Typically, this key is set by a \refKey{/tcb/skin}.
84 Feasible values for \meta{name} are:
85 \begin{itemize}
86 \item\docValue{standard}: the original code from the core package,
87 \item\docValue{path}: a \tikzname\ path which is controlled by \refKey{/tcb/frame style},
88 \item\docValue{pathjigsaw}: a \tikzname\ path which is controlled by \refKey{/tcb/frame style},
89 \item\docValue{pathfirst}: a \tikzname\ path which is controlled by \refKey{/tcb/frame style},
90 \item\docValue{pathfirstjigsaw}: a \tikzname\ path which is controlled by \refKey{/tcb/frame style},
91 \item\docValue{pathmiddle}: a \tikzname\ path which is controlled by \refKey{/tcb/frame style},
92 \item\docValue{pathmiddlejigsaw}: a \tikzname\ path which is controlled by \refKey{/tcb/frame style},
93 \item\docValue{pathlast}: a \tikzname\ path which is controlled by \refKey{/tcb/frame style},
94 \item\docValue{pathlastjigsaw}: a \tikzname\ path which is controlled by \refKey{/tcb/frame style},
95 \item\docValue{freelance}: deprecated.
96 \item\docValue{spartan}: a quite spartan code.
97 \item\docValue{empty}: draw nothing.
98 \end{itemize}
99 \end{docTcbKey}
100
101 \begin{docTcbKey}{interior titled engine}{=\meta{name}}{no default, initially \texttt{standard}}
102 Sets the \emph{interior} drawing engine for a titled box to \meta{name}.
103 Typically, this key is set by a \refKey{/tcb/skin}.
104 Feasible values for \meta{name} are:
105 \begin{itemize}
106 \item\docValue{standard}: the original code from the core package,
107 \item\docValue{path}: a \tikzname\ path which is controlled by \refKey{/tcb/interior style},
108 \item\docValue{pathfirst}: a \tikzname\ path which is controlled by \refKey{/tcb/interior style},
109 \item\docValue{pathmiddle}: a \tikzname\ path which is controlled by \refKey{/tcb/interior style},
110 \item\docValue{pathlast}: a \tikzname\ path which is controlled by \refKey{/tcb/interior style},
111 \item\docValue{freelance}: deprecated.
112 \item\docValue{spartan}: a quite spartan code.
113 \item\docValue{empty}: draw nothing.
114 \end{itemize}
115 \end{docTcbKey}
116
117 \clearpage
118 \begin{docTcbKey}{interior engine}{=\meta{name}}{no default, initially \texttt{standard}}
119 Sets the \emph{interior} drawing engine for an untitled box to \meta{name}.
120 Typically, this key is set by a \refKey{/tcb/skin}.
121 Feasible values for \meta{name} are:
122 \begin{itemize}
123 \item\docValue{standard}: the original code from the core package,
124 \item\docValue{path}: a \tikzname\ path which is controlled by \refKey{/tcb/interior style},
125 \item\docValue{pathfirst}: a \tikzname\ path which is controlled by \refKey{/tcb/interior style},
126 \item\docValue{pathmiddle}: a \tikzname\ path which is controlled by \refKey{/tcb/interior style},
127 \item\docValue{pathlast}: a \tikzname\ path which is controlled by \refKey{/tcb/interior style},
128 \item\docValue{freelance}: deprecated.
129 \item\docValue{spartan}: a quite spartan code.
130 \item\docValue{empty}: draw nothing.
131 \end{itemize}
132 \end{docTcbKey}
133
134 \begin{docTcbKey}{segmentation engine}{=\meta{name}}{no default, initially \texttt{standard}}
135 Sets the \emph{segmentation} (line) drawing engine for a box to \meta{name}.
136 Typically, this key is set by a \refKey{/tcb/skin}.
137 Feasible values for \meta{name} are:
138 \begin{itemize}
139 \item\docValue{standard}: the original code from the core package,
140 \item\docValue{path}: a \tikzname\ path which is controlled by \refKey{/tcb/segmentation style},
141 \item\docValue{freelance}: deprecated.
142 \item\docValue{spartan}: a quite spartan code.
143 \item\docValue{empty}: draw nothing.
144 \end{itemize}
145 \end{docTcbKey}
146
147 \begin{docTcbKey}{title engine}{=\meta{name}}{no default, initially \texttt{standard}}
148 Sets the \emph{title area} drawing engine for a titled box to \meta{name}.
149 Typically, this key is set by a \refKey{/tcb/skin}.
150 Feasible values for \meta{name} are:
151 \begin{itemize}
152 \item\docValue{standard}: the original code from the core package,
153 \item\docValue{path}: a \tikzname\ path which is controlled by \refKey{/tcb/title style},
154 \item\docValue{pathfirst}: a \tikzname\ path which is controlled by \refKey{/tcb/title style},
155 \item\docValue{pathmiddle}: a \tikzname\ path which is controlled by \refKey{/tcb/title style},
156 \item\docValue{pathlast}: a \tikzname\ path which is controlled by \refKey{/tcb/title style},
157 \item\docValue{freelance}: deprecated.
158 \item\docValue{spartan}: a quite spartan code.
159 \item\docValue{empty}: draw nothing.
160 \end{itemize}
161 \end{docTcbKey}
162
163 \begin{marker}
164 After an engine is set to an initializing value, the resulting graphical
165 code can be changed using code option keys, see \zvref{subsec:addcodeoptions}.
166 \end{marker}
167
168 \clearpage
169 \begin{docTcbKey}{geometry nodes}{\colOpt{=true\textbar false}}{default |true|, initially |false|}
170 If the \mylib{skins} library is loaded and if this option is set to |true|,
171 up to four \tikzname\ nodes are defined for a |tcolorbox|
172 which are named |frame|, |interior|, |segmentation|, and |title|. These nodes
173 describe the boundaries of the equally named parts of a |tcolorbox|.
174 They are used by most engines based on \tikzname.
175 Typically, this key is set automatically by a \refKey{/tcb/skin}.
176 \begin{dispExample}
177 \tcbset{colback=Salmon!50!white,colframe=FireBrick!75!black,
178 width=(\linewidth-8mm)/2,before=,after=\hfill,equal height group=geon}
179
180 \begin{tcolorbox}[adjusted title=The title]
181 The upper part.\tcblower The lower part.
182 \end{tcolorbox}
183 \begin{tcolorbox}[enhanced,adjusted title=The title,
184 frame code={\path[draw=red,fill=red!25]
185 (frame.south west) rectangle (frame.north east);},
186 interior titled code={\path[draw=blue,fill=blue!25]
187 (interior.south west) rectangle (interior.north east);},
188 segmentation code={\path[draw=green,fill=green!25]
189 (segmentation.south west) rectangle (segmentation.north east);},
190 title code={\path[draw=black,fill=brown!75!black]
191 (title.south west) rectangle (title.north east);}]
192 The upper part.\tcblower The lower part.
193 \end{tcolorbox}
194 \end{dispExample}
195 \end{docTcbKey}
196
197
198
199
200
201
202 \clearpage
203 \subsection{Code Option Keys}\label{subsec:addcodeoptions}
204 The following code options are applicable for all skins.
205 %which
206 %use engines of type |freelance|.
207 %Especially, the skin \refSkin{freelance} supports \emph{all} of them,
208 %\refSkin{standard} and \refSkin{enhanced} \emph{none} of them.
209 The used \meta{graphical code} can be any \refPkg{pgf} code. For all skins
210 with exception of \refSkin{standard}
211 and \refSkin{standard jigsaw}, the \meta{graphical code} can also
212 be any \refPkg{tikz} code.
213
214
215 \begin{docTcbKey}{frame code}{\colOpt{=\meta{graphical code}}}{code, default from |standard|}
216 The given \meta{graphical code} is used for drawing the \emph{frame} of the box.
217 %This option is available only if the \refKey{/tcb/frame engine} is set to |freelance|.
218 \begin{dispExample}
219 \tcbset{colback=red!5!white,colframe=red!75!black}
220
221 \begin{tcolorbox}[enhanced,frame code={
222 \foreach \n in {north east,north west,south east,south west}
223 {\path [fill=red!75!black] (interior.\n) circle (3mm); } }]
224 This is a \textbf{tcolorbox}.
225 \tcblower
226 This is the lower part.
227 \end{tcolorbox}
228 \end{dispExample}
229 \end{docTcbKey}
230
231
232 \begin{docTcbKey}{frame empty}{}{style, no value}
233 This is a shortcut for setting \refKey{/tcb/frame code} to empty.
234 This option removes the drawing of the frame.
235 Alternatively, use \refKey{/tcb/frame hidden}.
236 \end{docTcbKey}
237
238
239 \begin{docTcbKey}{interior titled code}{\colOpt{=\meta{graphical code}}}{code, default from |standard|}
240 The given \meta{graphical code} is used
241 for drawing the \emph{interior} of the box, if the box comes with a title.
242 %This option is available only if the \refKey{/tcb/interior titled engine} is set to |freelance|.
243 \begin{dispExample}
244 \tcbset{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries}
245
246 \begin{tcolorbox}[enhanced,title=My title,interior titled code={
247 \path[draw=red!5!white,line width=5mm,line cap=round]
248 ([xshift=3mm,yshift=-3mm]interior.north west)
249 --([xshift=-3mm,yshift=3mm]interior.south east)
250 ([xshift=3mm,yshift=3mm]interior.south west)
251 --([xshift=-3mm,yshift=-3mm]interior.north east);}]
252 This is a \textbf{tcolorbox}.
253 \tcblower
254 This is the lower part.
255 \end{tcolorbox}
256 \end{dispExample}
257 \end{docTcbKey}
258
259
260 \begin{docTcbKey}{interior titled empty}{}{style, no value}
261 This is a shortcut for setting \refKey{/tcb/interior titled code} to empty.
262 This option removes the drawing of the untitled interior.
263 Alternatively, use \refKey{/tcb/interior hidden}.
264 \end{docTcbKey}
265
266
267
268 \clearpage
269 \begin{docTcbKey}{interior code}{\colOpt{=\meta{graphical code}}}{code, default from |standard|}
270 The given \meta{graphical code} is used
271 for drawing the \emph{interior} of the box, if the box is without a title.%\\
272 %This option is available only if the \refKey{/tcb/interior engine} is set to |freelance|.
273 \begin{dispExample}
274 \tcbset{colback=red!5!white,colframe=red!75!black}
275
276 \begin{tcolorbox}[enhanced,interior code={
277 \path[draw=red!5!white,line width=5mm,line cap=round]
278 ([xshift=3mm,yshift=-3mm]interior.north west)
279 --([xshift=-3mm,yshift=3mm]interior.south east)
280 ([xshift=3mm,yshift=3mm]interior.south west)
281 --([xshift=-3mm,yshift=-3mm]interior.north east);}]
282 This is a \textbf{tcolorbox}.
283 \tcblower
284 This is the lower part.
285 \end{tcolorbox}
286 \end{dispExample}
287 \end{docTcbKey}
288
289 \begin{docTcbKey}{interior empty}{}{style, no value}
290 This is a shortcut for setting \refKey{/tcb/interior code} to empty.
291 This option removes the drawing of the interior.
292 Alternatively, use \refKey{/tcb/interior hidden}.
293 \end{docTcbKey}
294
295
296 \begin{docTcbKey}{segmentation code}{\colOpt{=\meta{graphical code}}}{code, default from |standard|}
297 The given \meta{graphical code} is used for drawing the
298 \emph{segmentation} area of the box.%\\
299 %This option is available only if the \refKey{/tcb/segmentation engine} is set to |freelance|.
300 \begin{dispExample}
301 \tcbset{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries}
302
303 \begin{tcolorbox}[enhanced,title=My title,segmentation code={
304 \path[top color=red!5!white,bottom color=red!5!white,middle color=blue]
305 (segmentation.south west) rectangle (segmentation.north east);}]
306 This is a \textbf{tcolorbox}.
307 \tcblower
308 This is the lower part.
309 \end{tcolorbox}
310 \end{dispExample}
311 \end{docTcbKey}
312
313
314 \begin{docTcbKey}{segmentation empty}{}{style, no value}
315 This is a shortcut for setting \refKey{/tcb/segmentation code} to empty.
316 This option removes the drawing of the segmentation line.
317 Alternatively, use \refKey{/tcb/segmentation hidden}.
318 \end{docTcbKey}
319
320
321
322 \clearpage
323 \begin{docTcbKey}{title code}{\colOpt{=\meta{graphical code}}}{code, default from |standard|}
324 The given \meta{graphical code} is used for drawing the
325 \emph{title} area of the box.
326 %\\
327 %This option is available only if the \refKey{/tcb/title engine} is set to |freelance|.
328 \begin{dispExample}
329 \tcbset{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,
330 coltitle=black}
331
332 \begin{tcolorbox}[enhanced,title=My title,title code={
333 \path[draw=yellow,solid,decorate,line width=2mm,
334 decoration={coil,aspect=0,segment length=10.1mm}]
335 ([xshift=1mm]title.west) -- ([xshift=-1mm]title.east);}]
336 This is a \textbf{tcolorbox}.
337 \tcblower
338 This is the lower part.
339 \end{tcolorbox}
340 \end{dispExample}
341 \end{docTcbKey}
342
343
344 \begin{docTcbKey}{title empty}{}{style, no value}
345 This is a shortcut for setting \refKey{/tcb/title code} to empty.
346 This option removes the drawing of the title area.
347 Alternatively, use \refKey{/tcb/title hidden}.
348 \end{docTcbKey}
349
350 \clearpage
351 \subsection{Subskins}\label{subsec:subskins}
352 A subskin is a new \refKey{/tcb/skin} based on an existing skin which
353 is extended or changed.
354
355 \begin{marker}
356 Never use geometry settings or bounding box options inside a subskin definition!
357 If one skin is replaced by another skin, the overall bounding box should stay
358 constant. Especially, if a skin is used for a breakable box, unpredictable
359 and unpleasant results could arise otherwise. If you want to change the
360 geometry also, use an additional style. See the skin \refSkin{beamer} and
361 the style \refKey{/tcb/beamer} as pattern.
362 \end{marker}
363
364 \begin{docCommand}{tcbsubskin}{\marg{name}\marg{base skin}\marg{options}}
365 Creates a new skin \meta{name} which inherits all properties of an
366 existing \meta{base skin} plus the given \meta{options}.
367 The new skin \meta{name} can be used as value for the keys
368 \refKey{/tcb/skin},
369 \refKey{/tcb/skin first},
370 \refKey{/tcb/skin middle}, and
371 \refKey{/tcb/skin last}.
372 As \meta{base skin}, one can take \refSkin{standard}, \refSkin{empty},
373 \refSkin{enhanced}, or any skin from the \mylib{skins} library,
374 see \zvref{sec:skins}.
375
376 \begin{dispExample}
377 % \tcbuselibrary{skins}
378 \tcbsubskin{mycross}{empty}{frame code={%
379 \draw[red,line width=5pt] (frame.south west)--(frame.north east);
380 \draw[red,line width=5pt] (frame.north west)--(frame.south east);},
381 skin first=mycross,skin middle=mycross,skin last=mycross }
382
383 \begin{tcolorbox}[skin=mycross]
384 This is my content.
385 \end{tcolorbox}
386 \end{dispExample}
387
388 \end{docCommand}
389
390
391 \begin{docTcbKey}{skin first is subskin of}{=\marg{base skin}\marg{options}}{no default, initially unset}
392 Creates a new unnamed skin which inherits all properties of an
393 existing \meta{base skin} plus the given \meta{options}.
394 This skin is set as \refKey{/tcb/skin first}.\\
395 See a detailed example on page~\pageref{freeboxexample}.
396 \end{docTcbKey}
397
398
399 \begin{docTcbKey}{skin middle is subskin of}{=\marg{base skin}\marg{options}}{no default, initially unset}
400 Creates a new unnamed skin which inherits all properties of an
401 existing \meta{base skin} plus the given \meta{options}.
402 This skin is set as \refKey{/tcb/skin middle}.\\
403 See a detailed example on page~\pageref{freeboxexample}.
404 \end{docTcbKey}
405
406
407 \begin{docTcbKey}{skin last is subskin of}{=\marg{base skin}\marg{options}}{no default, initially unset}
408 Creates a new unnamed skin which inherits all properties of an
409 existing \meta{base skin} plus the given \meta{options}.
410 This skin is set as \refKey{/tcb/skin last}.\\
411 See a detailed example on page~\pageref{freeboxexample}.
412 \end{docTcbKey}
413
414
415 \clearpage
416 \subsection{Drawing Scheme}\label{subsec:tcolorboxdrawing}
417
418 \bgroup
419
420 Depending on the complexity of a |tcolorbox| definition, the resulting box
421 is drawn in a more or less complex series of steps.
422
423 To document and demonstrate these drawing steps, we consider the
424 following box definition:
425
426 \begin{dispListing}
427 \newtcolorbox{testbox}[1][]{enhanced,title=Test Box,
428 boxrule=1mm,titlerule=0.5mm,colframe=blue!50!black,
429 interior style={top color=blue!20!green!50!white,bottom color=blue!20!yellow!50!white},
430 colbacktitle=blue!50!green!90!white,segmentation style={solid},
431 fonttitle=\bfseries,drop fuzzy shadow,borderline={0.3mm}{0.35mm}{yellow!50!white},
432 underlay={\path[fill image opacity=0.15,fill image scale=0.9,
433 fill stretch picture={\draw[blue,line width=2mm] circle (1);}]
434 (interior.south west) rectangle (interior.north east);},
435 watermark text={Watermark},watermark color={green!20!white},
436 finish={\begin{tcbclipframe}
437 \path[bottom color=black,top color=black!50!white,opacity=0.1]
438 (frame.south west) -- (frame.south east) -- (frame.north east) -- cycle;
439 \path[top color=white,bottom color=black!50!white,opacity=0.1]
440 (frame.south west) -- (frame.north east) -- (frame.north west) -- cycle;
441 \end{tcbclipframe}},#1}
442 \end{dispListing}
443 \tcbusetemp
444
445 For this definition, we get the maximal number of drawing steps:
446
447 \newtcolorbox{itembox}{oversize,enhanced,frame empty,segmentation empty,colback=white,middle=2mm,boxsep=0pt,
448 fuzzy halo=0.5mm with blue!15!white,
449 before lower=\raggedright\begin{itemize},after lower=\end{itemize}}
450
451 \tcbset{finishcomment/.style={
452 finish={\node[fill=white,draw=black!50!white,rounded corners] at (frame.center) {#1};}
453 }}
454
455
456 \begin{itembox}
457 \begin{testbox}[frame empty,interior titled empty,title empty,segmentation empty,
458 no shadow,no borderline,no underlay,no overlay,no finish,opacityupper=0,opacitylower=0,opacitytitle=0,
459 drop fuzzy shadow=red!75!white,
460 finishcomment={1.~shadow}]
461 \lipsum[2]
462 \tcblower
463 Lower part
464 \end{testbox}
465 \tcblower
466 \item Section~\ref{subsec:shadows} on page \pageref{subsec:shadows}.
467 \end{itembox}
468
469 \begin{itembox}
470 \begin{testbox}[interior titled empty,title empty,segmentation empty,
471 no borderline,no underlay,no overlay,no finish,opacityupper=0,opacitylower=0,opacitytitle=0,
472 colframe=red!75!white,
473 finishcomment={2.~frame}]
474 \lipsum[2]
475 \tcblower
476 Lower part
477 \end{testbox}
478 \tcblower
479 \item\refKey{/tcb/colframe}, \refKey{/tcb/opacityframe}
480 \item\refKey{/tcb/frame code}
481 \item\refKey{/tcb/frame style}
482 \end{itembox}
483
484
485 \begin{itembox}
486 \begin{testbox}[title empty,segmentation empty,
487 no borderline,no underlay,no overlay,no finish,opacityupper=0,opacitylower=0,opacitytitle=0,
488 colback=red!75!white,
489 finishcomment={3.~interior}]
490 \lipsum[2]
491 \tcblower
492 Lower part
493 \end{testbox}
494 \tcblower
495 \item\refKey{/tcb/colback}, \refKey{/tcb/opacityback}
496 \item\refKey{/tcb/interior code}, \refKey{/tcb/interior titled code}
497 \item\refKey{/tcb/interior style}
498 \end{itembox}
499
500
501 \begin{itembox}
502 \begin{testbox}[segmentation empty,
503 no borderline,no underlay,no overlay,no finish,opacityupper=0,opacitylower=0,opacitytitle=0,
504 colbacktitle=red!75!white,
505 finishcomment={4.~title area}]
506 \lipsum[2]
507 \tcblower
508 Lower part
509 \end{testbox}
510 \tcblower
511 \item\refKey{/tcb/colbacktitle}, \refKey{/tcb/opacitybacktitle}
512 \item\refKey{/tcb/title code}
513 \item\refKey{/tcb/title style}
514 \end{itembox}
515
516
517 \begin{itembox}
518 \begin{testbox}[
519 no borderline,no underlay,no overlay,no finish,opacityupper=0,opacitylower=0,opacitytitle=0,
520 segmentation style={solid,red!75!white},
521 finishcomment={5.~segmentation}]
522 \lipsum[2]
523 \tcblower
524 Lower part
525 \end{testbox}
526 \tcblower
527 \item\refKey{/tcb/lower separated}
528 \item\refKey{/tcb/segmentation code}
529 \item\refKey{/tcb/segmentation style}
530 \end{itembox}
531
532
533 \begin{itembox}
534 \begin{testbox}[
535 no borderline,no underlay,no overlay,no finish,opacityupper=0,opacitylower=0,opacitytitle=0,
536 borderline={0.3mm}{0.35mm}{red!75!white},
537 finishcomment={6.~border line}]
538 \lipsum[2]
539 \tcblower
540 Lower part
541 \end{testbox}
542 \tcblower
543 \item\zvref{subsec:borderline}
544 \end{itembox}
545
546
547 \begin{itembox}
548 \begin{testbox}[
549 no underlay,no overlay,no finish,opacityupper=0,opacitylower=0,opacitytitle=0,
550 underlay={\path[opacity=0.15,fill image scale=0.9,
551 fill stretch picture={\draw[red,line width=2mm] circle (1);}]
552 (interior.south west) rectangle (interior.north east);},
553 finishcomment={7.~underlay}]
554 \lipsum[2]
555 \tcblower
556 Lower part
557 \end{testbox}
558 \tcblower
559 \item\zvref{subsec:skinboxedtitle}
560 \item\zvref{subsec:skinunderlay}
561 \end{itembox}
562
563
564 \begin{itembox}
565 \begin{testbox}[
566 no finish,opacityupper=0,opacitylower=0,opacitytitle=0,
567 watermark color={red!75!white},
568 finishcomment={8.~overlay}]
569 \lipsum[2]
570 \tcblower
571 Lower part
572 \end{testbox}
573 \tcblower
574 \item\zvref{subsec:overlays}
575 \item\zvref{subsec:watermarks}
576 \end{itembox}
577
578
579 \begin{itembox}
580 \begin{testbox}[
581 no finish,
582 colupper=red!75!white,coltitle=red!75!white,collower=red!75!white,
583 finishcomment={9.~text content}]
584 \lipsum[2]
585 \tcblower
586 Lower part
587 \end{testbox}
588 \tcblower
589 \item\refKey{/tcb/colupper}, \refKey{/tcb/collower}, \refKey{/tcb/coltitle}
590 \item\refKey{/tcb/fontupper}, \refKey{/tcb/fontlower}, \refKey{/tcb/fonttitle}
591 \item\refKey{/tcb/opacityupper}, \refKey{/tcb/opacitylower}, \refKey{/tcb/opacitytitle}
592 \end{itembox}
593
594
595 \begin{itembox}
596 \begin{testbox}[
597 finishcomment={10.~finish}]
598 \lipsum[2]
599 \tcblower
600 Lower part
601 \end{testbox}
602 \tcblower
603 \item\zvref{subsec:skinfinish}
604 \end{itembox}
605
606 All together, the box is drawn:
607 \begin{dispExample}
608 % \usepackage{lipsum}
609 \begin{testbox}
610 \lipsum[2]
611 \tcblower
612 Lower part
613 \end{testbox}
614 \end{dispExample}
615
616 \egroup
617
618
619 \clearpage
620 \subsection{Color Names}\label{subsec:tech_colornames}
621 Color settings for a |tcolorbox| are saved into named colors which may be
622 used inside a box, e.\,g.\ for an overlay.
623 \tcbdocmarginnote{\tcbdocnew{2019-01-18}}
624 These color names are
625 \begin{itemize}
626 \item\docColor{tcbcolframe} set by \refKey{/tcb/colframe} (frame color)
627 \item\docColor{tcbcolback} set by \refKey{/tcb/colback} (background color)
628 \item\docColor{tcbcolbacktitle} set by \refKey{/tcb/colbacktitle} (background color of the title)
629 \item\docColor{tcbcolbacklower} set by \refKey{/tcb/colbacklower} (skin dependent background color
630 of the lower part; needs \mylib{skins} to be loaded)
631 \item\docColor{tcbcolupper} set by \refKey{/tcb/colupper} (text color upper part)
632 \item\docColor{tcbcollower} set by \refKey{/tcb/collower} (text color lower part)
633 \item\docColor{tcbcoltitle} set by \refKey{/tcb/coltitle} (text color title)
634 \end{itemize}
635
636 \medskip
637
638 \begin{dispExample}
639 % \tcbuselibrary{skins}
640 \begin{tcolorbox}[title=Color names,
641 colframe=blue!50!black,colback=blue!5,
642 colbacktitle=blue!50,colupper=red!35!black]
643 \foreach \name in {tcbcolframe,tcbcolback,tcbcolbacktitle,tcbcolbacklower,
644 tcbcolupper,tcbcollower,tcbcoltitle}
645 {\tikz\path[draw,fill=\name]
646 (0,0) rectangle node[right=4mm,font=\ttfamily]{\name} (0.8,0.8);\par}
647 \end{tcolorbox}
648 \end{dispExample}
649
650
651
652 \clearpage
653 \subsection{Useful Properties}\label{subsec:tech_properties}
654
655 The following macros describe certain \textit{properties} which may be
656 used for the drawing scheme, see \zvref{subsec:tcolorboxdrawing}.
657 Sometimes, they are even available inside the box content. All of them are
658 considered to be \textit{read-only} and should never be redefined by the user.
659
660 \begin{docCommand}[doc new=2016-02-16]{tcbheightspace}{}
661 If the height of a |tcolorbox| is not the natural height, the space
662 difference between the forced and the natural size is hold by
663 \refCom{tcbheightspace}.
664 This macro is not usable inside the box content, but for skins or
665 inside \refKey{/tcb/underlay}, \refKey{/tcb/overlay}, etc.
666
667 If such a space information is needed inside the box content, see
668 \refKey{/tcb/space to} instead.
669 \begin{dispExample}
670 % \tcbuselibrary{skins}
671 \newtcolorbox{testbox}[2][]{enhanced,size=fbox,
672 colframe=blue!75!black,colback=white,height=#2,
673 underlay={\node[above,inner sep=3pt] at (interior.south){%
674 \includegraphics[width=\tcbtextwidth,height=\tcbheightspace-3pt]{goldshade.png}};
675 },
676 #1}
677 \begin{testbox}{3cm}
678 This is my box. The space is filled with a picture.
679 \end{testbox}
680 \begin{testbox}{2cm}
681 This is my box. The space is filled with a picture.
682 \end{testbox}
683 \end{dispExample}
684 \end{docCommand}
685
686 \enlargethispage*{1cm}
687
688 \begin{docCommand}[doc new=2016-02-16]{tcbtextwidth}{}
689 This property describes the box content width.
690 \begin{itemize}
691 \item If there also is a lower part, it describes the width of the upper part.
692 \item For \refKey{/tcb/sidebyside} boxes, it describes the combined text
693 width plus segmentation.
694 \item This property can be used inside the box content text with exception
695 of \refKey{/tcb/fit} boxes.
696 \item \refCom{tcbtextwidth} can be used for all box types for skins or
697 inside \refKey{/tcb/underlay}, \refKey{/tcb/overlay}, etc.
698 \end{itemize}
699 \begin{dispExample}
700 \begin{tcolorbox}[colframe=blue!75!black]
701 Inside a box: \tcbtextwidth\ (=\the\linewidth).
702 \end{tcolorbox}
703 \end{dispExample}
704 \end{docCommand}
705
706 \pagebreak
707 \begin{docCommand}[doc new=2016-02-16]{tcbtextheight}{}
708 This property describes the designated box content height. If the
709 box is larger than the natural height, the actual content will be smaller
710 than \refCom{tcbtextheight}.
711 \begin{itemize}
712 \item For boxes with a fixed \refKey{/tcb/height}, this property can
713 be used inside the box content text. For other boxes, it denotes |0pt|
714 inside the box content.
715 \item \refCom{tcbtextheight} can be used for all box types for skins or
716 inside \refKey{/tcb/underlay}, \refKey{/tcb/overlay}, etc.
717 \end{itemize}
718
719 \begin{dispExample}
720 % \tcbuselibrary{skins}
721 \begin{tcolorbox}[enhanced,colframe=blue!75!black,
722 underlay={\node[left,red] at (frame.east) {Here: \tcbtextheight};}]
723 Inside a box with natural height: \tcbtextheight.
724 \end{tcolorbox}
725 \begin{tcolorbox}[enhanced,colframe=blue!75!black,height=1cm,
726 underlay={\node[left,red] at (frame.east) {Here: \tcbtextheight};}]
727 Inside a box with fixed height: \tcbtextheight.
728 \end{tcolorbox}
729 \end{dispExample}
730 \end{docCommand}
731
732
733 \begin{docCommand}[doc new=2017-04-25]{tcbsegmentstate}{}
734 This macro contains |0|, |1|, or |2|. It is set for every unbroken box and every broken partial box
735 with the following meaning:
736 \begin{itemize}
737 \item\docValue{0}: The current (partial) box contains only an upper part.
738 \item\docValue{1}: The current (partial) box contains an upper and a lower part.
739 The segmentation node can be used for positioning.
740 \item\docValue{2}: The current (partial) box contains only a lower part.
741 This can only be true for parts of breakable boxes.
742 \end{itemize}
743 Skins like \refSkin{bicolor} use this property to paint the (partial) boxes.
744 \begin{dispExample}
745 % \tcbuselibrary{skins,raster}
746 \begin{tcbraster}[raster equal height,enhanced,
747 watermark text=\tcbsegmentstate]
748 \begin{tcolorbox}Upper part\end{tcolorbox}
749 \begin{tcolorbox}Upper part\tcblower Lower part\end{tcolorbox}
750 \end{tcbraster}
751 \end{dispExample}
752 \end{docCommand}