| 1 |
% !TeX root = tcolorbox.tex |
| 2 |
% include file of tcolorbox.tex (manual of the LaTeX package tcolorbox) |
| 3 |
\clearpage |
| 4 |
\section{Library \mylib{theorems}}\label{sec:theorems}% |
| 5 |
\tcbset{external/prefix=external/theorems_}% |
| 6 |
The library is loaded by a package option or inside the preamble by: |
| 7 |
\begin{dispListing} |
| 8 |
\tcbuselibrary{theorems} |
| 9 |
\end{dispListing} |
| 10 |
This also loads the package \refPkg{amsmath}. |
| 11 |
|
| 12 |
Denis Bitouz\'e, Yukai Chou, and many others provided very valuable input for this library. |
| 13 |
|
| 14 |
|
| 15 |
\subsection{Macros of the Library} |
| 16 |
|
| 17 |
\begin{docCommands}[ |
| 18 |
doc parameter = \oarg{init options}\marg{name}\marg{display name}\marg{options}\marg{prefix}, |
| 19 |
doc updated=2022-07-18 |
| 20 |
] |
| 21 |
{ |
| 22 |
{ doc name = NewTcbTheorem }, |
| 23 |
{ doc name = newtcbtheorem } |
| 24 |
} |
| 25 |
Creates new environments \meta{name} and \meta{name}|*| based on |tcolorbox| to frame a |
| 26 |
(mathematical) theorem. The \meta{display name} is used in the title line |
| 27 |
with a number, e.\,g.\ \mbox{\flqq Theorem 5.1\frqq}. |
| 28 |
The \meta{options} are given to the underlying |tcolorbox| to control |
| 29 |
the appearance. |
| 30 |
%The \meta{counter} is used for automatic numbering. |
| 31 |
The \meta{init options} allow setting up automatic numbering, |
| 32 |
see \zvref{sec:initkeys}.\par\medskip |
| 33 |
|
| 34 |
If \meta{name} is chosen as |footheorem|, the new environments are described by |
| 35 |
\begin{docEnvironments}[ |
| 36 |
doc no index, |
| 37 |
doc name = footheorem, |
| 38 |
doc parameter = \oarg{keys}\oarg{short}\marg{title}\marg{marker} |
| 39 |
]{} |
| 40 |
Here, \meta{title} is the title text for the theorem and |
| 41 |
is also set as \refKey{/tcb/nameref} identifier. |
| 42 |
Optionally, the \meta{short} title used instead as \refKey{/tcb/nameref} identifier |
| 43 |
and in lists of theorems. |
| 44 |
\meta{keys} supplement the \meta{options} and may be |
| 45 |
used only in rare cases. The theorem is |
| 46 |
automatically labeled with \meta{prefix}\meta{separator}\meta{marker} |
| 47 |
where \meta{separator} is predefined as \enquote{|:|}, see \refKey{/tcb/label separator}. |
| 48 |
\end{docEnvironments} |
| 49 |
\begin{docEnvironments}[ |
| 50 |
doc no index, |
| 51 |
doc name = footheorem*, |
| 52 |
doc parameter = \oarg{keys}\marg{title} |
| 53 |
]{} |
| 54 |
This represents an unnumbered variant. Again, \meta{title} is the title text for the theorem |
| 55 |
and \meta{keys} supplement the \meta{options}. |
| 56 |
This variant is not labeled and not listed in lists of theorems. |
| 57 |
\end{docEnvironments} |
| 58 |
|
| 59 |
\begin{marker} |
| 60 |
\refCom{NewTcbTheorem} and \refCom{newtcbtheorem} are identical and both |
| 61 |
rely on \refCom{NewTColorBox} based on |\NewDocumentCommand|. |
| 62 |
\end{marker} |
| 63 |
\clearpage |
| 64 |
|
| 65 |
|
| 66 |
\inputpreamblelisting{F} |
| 67 |
\begin{dispExample} |
| 68 |
% usage of `\nameref' needs `nameref' or `hyperref' to be loaded |
| 69 |
\begin{mytheo}{This is my title}{theoexample} |
| 70 |
This is the text of the theorem. The counter is automatically assigned and, |
| 71 |
in this example, prefixed with the section number. This theorem is numbered with |
| 72 |
\ref{th:theoexample}, it is given on page~\pageref{th:theoexample}, |
| 73 |
and it is titled \flqq\nameref{th:theoexample}\frqq. |
| 74 |
\end{mytheo} |
| 75 |
\end{dispExample} |
| 76 |
|
| 77 |
|
| 78 |
\begin{dispExample} |
| 79 |
% usage of `\nameref' needs `nameref' or `hyperref' to be loaded |
| 80 |
\begin{mytheo}[][Concise title]{This my very long theorem title with |
| 81 |
too much words}{theoexample2} |
| 82 |
Here we have a long and a short title. This theorem is numbered with |
| 83 |
\ref{th:theoexample2}, it is given on page~\pageref{th:theoexample2}, |
| 84 |
and it is titled \flqq\nameref{th:theoexample2}\frqq. |
| 85 |
\end{mytheo} |
| 86 |
\end{dispExample} |
| 87 |
|
| 88 |
\begin{dispExample} |
| 89 |
\begin{mytheo}[label=myownlabel]{This is my title}{} |
| 90 |
The label parameter can be left empty without \LaTeX\ error. |
| 91 |
Or you may use an own label to reference Theorem \ref{myownlabel}. |
| 92 |
\end{mytheo} |
| 93 |
\end{dispExample} |
| 94 |
|
| 95 |
\begin{dispExample} |
| 96 |
\begin{mytheo}{}{} |
| 97 |
The title can also be left empty without problem. Note that the \enquote{:} |
| 98 |
vanished magically. |
| 99 |
\end{mytheo} |
| 100 |
\end{dispExample} |
| 101 |
|
| 102 |
\begin{dispExample} |
| 103 |
\begin{mytheo*}{Unnumbered Theorem} |
| 104 |
This theorem is not numbered. |
| 105 |
\end{mytheo*} |
| 106 |
\end{dispExample} |
| 107 |
|
| 108 |
\begin{dispExample} |
| 109 |
\begin{mytheo*}{} |
| 110 |
This theorem has no number and no title. |
| 111 |
\end{mytheo*} |
| 112 |
\end{dispExample} |
| 113 |
|
| 114 |
\begin{marker} |
| 115 |
To switch off the \texttt{nameref} feature permanently, add |
| 116 |
\mbox{\texttt{nameref/.style=\{\}}} inside the \meta{options} list. |
| 117 |
\end{marker} |
| 118 |
|
| 119 |
\end{docCommands} |
| 120 |
|
| 121 |
\medskip |
| 122 |
|
| 123 |
\begin{docCommands}[ |
| 124 |
doc parameter = \oarg{init options}\marg{name}\marg{display name}\marg{options}\marg{prefix}, |
| 125 |
doc updated=2022-07-18 |
| 126 |
] |
| 127 |
{ |
| 128 |
{ doc name = RenewTcbTheorem }, |
| 129 |
{ doc name = renewtcbtheorem } |
| 130 |
} |
| 131 |
Operates like \refCom{NewTcbTheorem}, but based on |\RenewDocumentEnvironment| instead of |\NewDocumentEnvironment|. |
| 132 |
Existing environments are redefined. |
| 133 |
\end{docCommands} |
| 134 |
|
| 135 |
|
| 136 |
\begin{docCommands}[ |
| 137 |
doc parameter = \oarg{init options}\marg{name}\marg{display name}\marg{options}\marg{prefix}, |
| 138 |
doc new = 2022-07-18, |
| 139 |
doc name = ProvideTcbTheorem, |
| 140 |
]{} |
| 141 |
Operates like \refCom{NewTcbTheorem}, but based on |\ProvideDocumentEnvironment| instead of |\NewDocumentEnvironment|. |
| 142 |
New environments are only created if they are not already defined. |
| 143 |
\end{docCommands} |
| 144 |
|
| 145 |
|
| 146 |
\begin{docCommands}[ |
| 147 |
doc parameter = \oarg{init options}\marg{name}\marg{display name}\marg{options}\marg{prefix}, |
| 148 |
doc new = 2022-07-18, |
| 149 |
doc name = DeclareTcbTheorem, |
| 150 |
]{} |
| 151 |
Operates like \refCom{NewTcbTheorem}, but based on |\DeclareDocumentEnvironment| instead of |\NewDocumentEnvironment|. |
| 152 |
New environments are always created and possibly redefine existing ones. |
| 153 |
\end{docCommands} |
| 154 |
|
| 155 |
|
| 156 |
\clearpage |
| 157 |
\begin{docCommand}{tcboxmath}{\oarg{options}\marg{mathematical box content}} |
| 158 |
Creates a \refEnv{tcolorbox} which is fitted to the width of the given |
| 159 |
\meta{mathematical box content}. This box is intended to be applied as |
| 160 |
part of a larger formula and may be used as replacement for the |\boxed| |
| 161 |
macro of \refPkg{amsmath}. |
| 162 |
|
| 163 |
\begin{dispExample} |
| 164 |
\begin{equation} |
| 165 |
\tcbset{fonttitle=\scriptsize} |
| 166 |
\tcboxmath[colback=LightBlue!25!white,colframe=blue]{ a^2 = 16 } |
| 167 |
\quad \Rightarrow \quad |
| 168 |
\tcboxmath[colback=Salmon!25!white,colframe=red,title=Implication]% |
| 169 |
{ a = 4 ~\vee~ a=-4. } |
| 170 |
\end{equation} |
| 171 |
\end{dispExample} |
| 172 |
\end{docCommand} |
| 173 |
|
| 174 |
\begin{docCommand}{tcbhighmath}{\oarg{options}\marg{mathematical box content}} |
| 175 |
This is a special case of the \refCom{tcboxmath} macro which uses |
| 176 |
the style \refKey{/tcb/highlight math}. |
| 177 |
It is intended to provide context sensitive highlighting of formula parts. |
| 178 |
The color settings via \refKey{/tcb/highlight math style} may be different |
| 179 |
inside theorems or other colored areas and outside. |
| 180 |
|
| 181 |
\begin{dispExample} |
| 182 |
\tcbset{myformula/.style={colback=yellow!10!white,colframe=red!50!black, |
| 183 |
every box/.style={highlight math style={colback=LightBlue!50!white,colframe=Navy}} |
| 184 |
}} |
| 185 |
|
| 186 |
\begin{align} |
| 187 |
\tcbhighmath{\sum\limits_{n=1}^{\infty} \frac{1}{n}} &= \infty.\\ |
| 188 |
\int x^2 ~\text{d}x &= \frac13 x^3 + c. |
| 189 |
\end{align} |
| 190 |
|
| 191 |
\begin{tcolorbox}[ams align,myformula] |
| 192 |
\tcbhighmath{\sum\limits_{n=1}^{\infty} \frac{1}{n}} &= \infty.\\ |
| 193 |
\int x^2 ~\text{d}x &= \frac13 x^3 + c. |
| 194 |
\end{tcolorbox} |
| 195 |
\end{dispExample} |
| 196 |
|
| 197 |
\clearpage |
| 198 |
\refCom{tcbhighmath} can be used in symbiosis with the \refPkg{empheq} package |
| 199 |
which allows to specify own boxing commands to mark multiline formulas. |
| 200 |
|
| 201 |
\begin{dispExample} |
| 202 |
% \usepackage{empheq} |
| 203 |
\begin{empheq}[box=\tcbhighmath]{align} |
| 204 |
a&=\sin(z)\\ |
| 205 |
E&=mc^2 + \int_a^b x\, dx |
| 206 |
\end{empheq} |
| 207 |
|
| 208 |
\tcbset{highlight math style={enhanced, |
| 209 |
colframe=red!60!black,colback=yellow!50!white,arc=4pt,boxrule=1pt, |
| 210 |
drop fuzzy shadow}} |
| 211 |
|
| 212 |
\begin{empheq}[box=\tcbhighmath]{align} |
| 213 |
a&=\sin(z)\\ |
| 214 |
E&=mc^2 + \int_a^b x\, dx |
| 215 |
\end{empheq} |
| 216 |
\end{dispExample} |
| 217 |
|
| 218 |
Besides \refCom{tcbhighmath}, one can easily define an independent new box |
| 219 |
based on \refCom{tcbox} which acts like \refCom{tcbhighmath}: |
| 220 |
|
| 221 |
\begin{dispExample} |
| 222 |
% \usepackage{empheq} |
| 223 |
\newtcbox{\otherbox}[1][]{nobeforeafter,math upper,tcbox raise base, |
| 224 |
enhanced,frame hidden,boxrule=0pt,interior style={top color=green!10!white, |
| 225 |
bottom color=green!10!white,middle color=green!50!yellow}, |
| 226 |
fuzzy halo=1pt with green,#1} |
| 227 |
|
| 228 |
\begin{empheq}[box=\otherbox]{align} |
| 229 |
a&=\sin(z)\\ |
| 230 |
E&=mc^2 + \int_a^b x\, dx |
| 231 |
\end{empheq} |
| 232 |
|
| 233 |
\begin{equation} |
| 234 |
\tcbhighmath{E} = \otherbox{mc^2} |
| 235 |
\end{equation} |
| 236 |
\end{dispExample} |
| 237 |
\end{docCommand} |
| 238 |
|
| 239 |
|
| 240 |
\clearpage |
| 241 |
\subsection{Option Keys of the Library} |
| 242 |
|
| 243 |
|
| 244 |
\begin{docTcbKey}{separator sign}{=\meta{sign}}{no default, initially |:|} |
| 245 |
The given \meta{sign} is used inside the title text of a theorem |
| 246 |
as separator between display name combined with number and |
| 247 |
the specific title text. It is omitted, if there is no specific title text. |
| 248 |
|
| 249 |
\begin{dispExample} |
| 250 |
% \usepackage{amssymb} |
| 251 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 252 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 253 |
separator sign={\ $\blacktriangleright$}}{theo} |
| 254 |
\begin{sometheorem}{My example}{} |
| 255 |
My theorem text. |
| 256 |
\end{sometheorem} |
| 257 |
\end{dispExample} |
| 258 |
\end{docTcbKey} |
| 259 |
|
| 260 |
\begin{docTcbKey}{separator sign colon}{}{style, no value, initially set} |
| 261 |
Sets \refKey{/tcb/separator sign} to the default colon |:| sign. |
| 262 |
\end{docTcbKey} |
| 263 |
|
| 264 |
\begin{docTcbKey}{separator sign dash}{}{style, no value} |
| 265 |
Sets \refKey{/tcb/separator sign} to an en-dash sign. |
| 266 |
\begin{dispExample} |
| 267 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 268 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 269 |
separator sign dash}{theo} |
| 270 |
\begin{sometheorem}{My example}{} |
| 271 |
My theorem text. |
| 272 |
\end{sometheorem} |
| 273 |
\end{dispExample} |
| 274 |
\end{docTcbKey} |
| 275 |
|
| 276 |
\begin{docTcbKey}{separator sign none}{}{style, no value} |
| 277 |
Sets \refKey{/tcb/separator sign} to empty. |
| 278 |
\begin{dispExample} |
| 279 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 280 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 281 |
separator sign none}{theo} |
| 282 |
\begin{sometheorem}{My example}{} |
| 283 |
My theorem text. |
| 284 |
\end{sometheorem} |
| 285 |
\end{dispExample} |
| 286 |
\end{docTcbKey} |
| 287 |
|
| 288 |
\clearpage |
| 289 |
\begin{docTcbKey}{description delimiters}{=\marg{left}\marg{right}}{no default, initially empty} |
| 290 |
The given \meta{left} and \meta{right} delimiter signs are used to frame |
| 291 |
the descriptive title text of a theorem. |
| 292 |
|
| 293 |
\begin{dispExample} |
| 294 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 295 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 296 |
description delimiters={\flqq}{\frqq}}{theo} |
| 297 |
\begin{sometheorem}{My example}{} |
| 298 |
My theorem text. |
| 299 |
\end{sometheorem} |
| 300 |
\end{dispExample} |
| 301 |
\end{docTcbKey} |
| 302 |
|
| 303 |
|
| 304 |
\begin{docTcbKey}{description delimiters parenthesis}{}{style, no value} |
| 305 |
Sets \refKey{/tcb/description delimiters} to |(| and |)|. |
| 306 |
\begin{dispExample} |
| 307 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 308 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 309 |
description delimiters parenthesis}{theo} |
| 310 |
\begin{sometheorem}{My example}{} |
| 311 |
My theorem text. |
| 312 |
\end{sometheorem} |
| 313 |
\end{dispExample} |
| 314 |
\end{docTcbKey} |
| 315 |
|
| 316 |
|
| 317 |
\begin{docTcbKey}{description delimiters none}{}{style, no value, initially set} |
| 318 |
Sets \refKey{/tcb/description delimiters} to the default empty texts. |
| 319 |
\end{docTcbKey} |
| 320 |
|
| 321 |
|
| 322 |
\begin{docTcbKey}{description color}{\colOpt{=\meta{color}}}{default empty, initially empty} |
| 323 |
Sets the \meta{color} of the descriptive title text deviating from \refKey{/tcb/coltitle}. |
| 324 |
The color is reset to \refKey{/tcb/coltitle}, if |description color| is used without value. |
| 325 |
|
| 326 |
\begin{dispExample} |
| 327 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 328 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 329 |
description color=red!25!yellow}{theo} |
| 330 |
\begin{sometheorem}{My example}{} |
| 331 |
My theorem text. |
| 332 |
\end{sometheorem} |
| 333 |
\end{dispExample} |
| 334 |
\end{docTcbKey} |
| 335 |
|
| 336 |
\clearpage |
| 337 |
\begin{docTcbKey}{description font}{\colOpt{=\meta{text}}}{default empty, initially empty} |
| 338 |
Sets \meta{text} (e.\,g.\ font settings) before the descriptive title text deviating from \refKey{/tcb/fonttitle}. |
| 339 |
The \meta{text} is removed, if |description font| is used without value. |
| 340 |
|
| 341 |
\begin{dispExample} |
| 342 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 343 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 344 |
description delimiters={\glqq}{\grqq}, |
| 345 |
description font=\mdseries\itshape}{theo} |
| 346 |
\begin{sometheorem}{My example}{} |
| 347 |
My theorem text. |
| 348 |
\end{sometheorem} |
| 349 |
\end{dispExample} |
| 350 |
\end{docTcbKey} |
| 351 |
|
| 352 |
|
| 353 |
\begin{docTcbKey}{description formatter}{\colOpt{=\meta{macro}}}{default empty, initially empty} |
| 354 |
Sets \meta{macro} as formatter for the descriptive title text. The \meta{macro} |
| 355 |
has to take one mandatory argument (the description text).\\ |
| 356 |
Note that \refKey{/tcb/description delimiters}, \refKey{/tcb/description color}, |
| 357 |
and \refKey{/tcb/description font} are ignored, if this option is used.\\ |
| 358 |
If |description formatter| is used without value, the formatter is reset |
| 359 |
to its standard behavior. |
| 360 |
|
| 361 |
\begin{dispExample} |
| 362 |
\newtcbox{\formbox}{enhanced,frame empty,size=minimal,boxsep=2pt,arc=1pt, |
| 363 |
on line,interior style image=goldshade.png} |
| 364 |
|
| 365 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 366 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 367 |
description formatter=\formbox}{theo} |
| 368 |
\begin{sometheorem}{My example}{} |
| 369 |
My theorem text. |
| 370 |
\end{sometheorem} |
| 371 |
\end{dispExample} |
| 372 |
\end{docTcbKey} |
| 373 |
|
| 374 |
|
| 375 |
\begin{docTcbKey}{terminator sign}{=\meta{sign}}{no default, initially empty} |
| 376 |
The given \meta{sign} is used as terminator at the end of the title text of a theorem. |
| 377 |
|
| 378 |
\begin{dispExample} |
| 379 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 380 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 381 |
terminator sign={.}}{theo} |
| 382 |
\begin{sometheorem}{My example}{} |
| 383 |
My theorem text. |
| 384 |
\end{sometheorem} |
| 385 |
\end{dispExample} |
| 386 |
\end{docTcbKey} |
| 387 |
|
| 388 |
\clearpage |
| 389 |
\begin{docTcbKey}{terminator sign colon}{}{style, no value, initially set} |
| 390 |
Sets \refKey{/tcb/terminator sign} to the colon |:| sign. |
| 391 |
\begin{dispExample} |
| 392 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 393 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 394 |
separator sign dash,terminator sign colon}{theo} |
| 395 |
\begin{sometheorem}{My example}{} |
| 396 |
My theorem text. |
| 397 |
\end{sometheorem} |
| 398 |
\end{dispExample} |
| 399 |
\end{docTcbKey} |
| 400 |
|
| 401 |
\begin{docTcbKey}{terminator sign dash}{}{style, no value} |
| 402 |
Sets \refKey{/tcb/terminator sign} to an en-dash sign. |
| 403 |
\begin{dispExample} |
| 404 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 405 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 406 |
terminator sign dash}{theo} |
| 407 |
\begin{sometheorem}{My example}{} |
| 408 |
My theorem text. |
| 409 |
\end{sometheorem} |
| 410 |
\end{dispExample} |
| 411 |
\end{docTcbKey} |
| 412 |
|
| 413 |
\begin{docTcbKey}{terminator sign none}{}{style, no value} |
| 414 |
Sets \refKey{/tcb/terminator sign} to the default empty text. |
| 415 |
\end{docTcbKey} |
| 416 |
|
| 417 |
|
| 418 |
\begin{docTcbKey}[][doc new=2016-04-19]{label separator}{=\meta{separator}}{no default, initially |:|} |
| 419 |
The given \meta{separator} is used for labels created with environments which |
| 420 |
are defined themselves by \refCom{newtcbtheorem}. This \meta{separator} is |
| 421 |
put between \meta{prefix} (defined by \refCom{newtcbtheorem}) |
| 422 |
and \meta{marker} (defined by an actual theorem environment). |
| 423 |
\begin{dispExample} |
| 424 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 425 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 426 |
label separator=*}{theo} |
| 427 |
\begin{sometheorem}{My example}{myex} |
| 428 |
My theorem text. |
| 429 |
\end{sometheorem} |
| 430 |
See Example~\ref{theo*myex}. |
| 431 |
\end{dispExample} |
| 432 |
\end{docTcbKey} |
| 433 |
|
| 434 |
|
| 435 |
\clearpage |
| 436 |
|
| 437 |
\begin{docTcbKey}[][doc new=2018-01-12]{theorem full label supplement}{=\marg{style}}{no default, initially empty} |
| 438 |
The given \meta{style} is used in connection with labels created with environments which |
| 439 |
are defined themselves by \refCom{newtcbtheorem}. |
| 440 |
This \meta{style} uses one argument which is automatically set to the |
| 441 |
full label marker of the environment, i.\,e., a text consisting of |
| 442 |
\meta{prefix} (defined by \refCom{newtcbtheorem}), |
| 443 |
\refKey{/tcb/label separator}, |
| 444 |
and \meta{marker} (defined by an actual theorem environment). |
| 445 |
|
| 446 |
\begin{dispExample} |
| 447 |
% The following adds a hyper target to all environments |
| 448 |
% created with \newtcbtheorem |
| 449 |
\tcbset{theorem full label supplement={hypertarget={#1}}} |
| 450 |
|
| 451 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 452 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries}{theo} |
| 453 |
\begin{sometheorem}{My example}{myex2} |
| 454 |
My theorem text. |
| 455 |
\end{sometheorem} |
| 456 |
This automated \hyperlink{theo:myex2}{hyper target can be linked to with a |
| 457 |
hyper link}. |
| 458 |
\end{dispExample} |
| 459 |
|
| 460 |
A second usage of \refKey{/tcb/theorem full label supplement} overwrites |
| 461 |
the first setting. |
| 462 |
\end{docTcbKey} |
| 463 |
|
| 464 |
|
| 465 |
\begin{docTcbKey}[][doc new=2018-01-12]{theorem label supplement}{=\marg{style}}{no default, initially empty} |
| 466 |
The given \meta{style} is used in connection with labels created with environments which |
| 467 |
are defined themselves by \refCom{newtcbtheorem}. |
| 468 |
This \meta{style} uses one argument which is automatically set to the |
| 469 |
label \meta{marker} defined by an actual theorem environment.\par |
| 470 |
A second usage of \refKey{/tcb/theorem label supplement} overwrites |
| 471 |
the first setting, but |
| 472 |
\refKey{/tcb/theorem full label supplement} |
| 473 |
and \refKey{/tcb/theorem label supplement} can be used independently. |
| 474 |
|
| 475 |
\begin{dispExample} |
| 476 |
% `marginnote' has to be loaded |
| 477 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 478 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 479 |
theorem label supplement={hypertarget={XYZ-##1}}, |
| 480 |
theorem full label supplement={code={\marginnote{##1}}} |
| 481 |
}{theo} |
| 482 |
\begin{sometheorem}{My example}{myex3} |
| 483 |
My theorem text. |
| 484 |
\end{sometheorem} |
| 485 |
This automated \hyperlink{XYZ-myex3}{hyper target can be linked to with a |
| 486 |
hyper link}. |
| 487 |
\end{dispExample} |
| 488 |
\end{docTcbKey} |
| 489 |
|
| 490 |
|
| 491 |
\clearpage |
| 492 |
|
| 493 |
\begin{docTcbKey}[][doc new=2020-10-21]{theorem hanging indent}{\colOpt{=\docValue*{auto}\textbar \meta{length}}}{default \docValue*{auto}, initially \docValue*{auto}} |
| 494 |
Sets the hanging indent of the theorem title to \docValue{auto} or the |
| 495 |
given \meta{length}. |
| 496 |
For \docValue{auto}, the hanging indent matches the display name, number and |
| 497 |
separator sign of the theorem. |
| 498 |
If \meta{length} is negative, the theorem title is indented positively |
| 499 |
without hanging indent. |
| 500 |
|
| 501 |
\begin{dispExample} |
| 502 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 503 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries}{theo} |
| 504 |
|
| 505 |
\begin{sometheorem}{This is a very long and complicated title for a quite |
| 506 |
short and nearly empty theorem}{myexA1} |
| 507 |
My theorem text. |
| 508 |
\end{sometheorem} |
| 509 |
|
| 510 |
\begin{sometheorem}[theorem hanging indent=5mm]{This is a very long and |
| 511 |
complicated title for a quite short and nearly empty theorem}{myexA2} |
| 512 |
My theorem text. |
| 513 |
\end{sometheorem} |
| 514 |
|
| 515 |
\begin{sometheorem}[theorem hanging indent=0pt]{This is a very long and |
| 516 |
complicated title for a quite short and nearly empty theorem}{myexA3} |
| 517 |
My theorem text. |
| 518 |
\end{sometheorem} |
| 519 |
|
| 520 |
\begin{sometheorem}[theorem hanging indent=-5mm]{This is a very long and |
| 521 |
complicated title for a quite short and nearly empty theorem}{myexA4} |
| 522 |
My theorem text. |
| 523 |
\end{sometheorem} |
| 524 |
\end{dispExample} |
| 525 |
\end{docTcbKey} |
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
\clearpage |
| 530 |
\begin{docTcbKey}{theorem name and number}{}{style, no value, initially set} |
| 531 |
Prints theorem name followed by theorem number inside the title. |
| 532 |
\begin{dispExample} |
| 533 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 534 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 535 |
theorem name and number}{theo} |
| 536 |
\begin{sometheorem}{My example}{} |
| 537 |
My theorem text. |
| 538 |
\end{sometheorem} |
| 539 |
\end{dispExample} |
| 540 |
\end{docTcbKey} |
| 541 |
|
| 542 |
|
| 543 |
\begin{docTcbKey}{theorem number and name}{}{style, no value} |
| 544 |
Prints theorem number followed by theorem name inside the title. |
| 545 |
\begin{dispExample} |
| 546 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 547 |
{colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 548 |
theorem number and name}{theo} |
| 549 |
\begin{sometheorem}{My example}{} |
| 550 |
My theorem text. |
| 551 |
\end{sometheorem} |
| 552 |
\end{dispExample} |
| 553 |
\end{docTcbKey} |
| 554 |
|
| 555 |
\begin{docTcbKey}{theorem name}{}{style, no value} |
| 556 |
Prints theorem name without number inside the title. |
| 557 |
\begin{dispExample} |
| 558 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 559 |
{enhanced,colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 560 |
theorem name,watermark text={\thetcbcounter}}{theo} |
| 561 |
\begin{sometheorem}{My example}{} |
| 562 |
My theorem text. |
| 563 |
\end{sometheorem} |
| 564 |
\end{dispExample} |
| 565 |
\end{docTcbKey} |
| 566 |
|
| 567 |
\enlargethispage*{20mm} |
| 568 |
|
| 569 |
\begin{docTcbKey}[][doc new=2021-12-03]{theorem number}{}{style, no value} |
| 570 |
Prints theorem number without name inside the title. |
| 571 |
\begin{dispExample} |
| 572 |
\newtcbtheorem[use counter from=mytheo]{sometheorem}{Theorem}% |
| 573 |
{enhanced,colback=white,colframe=red!50!black,fonttitle=\bfseries, |
| 574 |
theorem number}{theo} |
| 575 |
\begin{sometheorem}{My example}{} |
| 576 |
My theorem text. |
| 577 |
\end{sometheorem} |
| 578 |
\end{dispExample} |
| 579 |
\end{docTcbKey} |
| 580 |
|
| 581 |
|
| 582 |
\clearpage |
| 583 |
\begin{docTcbKey}{theorem}{=\marg{display name}\marg{counter}\marg{title}\marg{marker}}{no default} |
| 584 |
This key can be used |
| 585 |
directly in a |tcolorbox| for a more flexible approach to create a |
| 586 |
theorem type box. |
| 587 |
The \meta{display name} is used together with the increased \meta{counter} value |
| 588 |
and the \meta{title} for the title line of the box. Additionally, a |
| 589 |
|\label| with the given \meta{marker} is created. |
| 590 |
\begin{dispExample} |
| 591 |
% \newcounter{texercise}% preamble |
| 592 |
\begin{tcolorbox}[colback=green!10,colframe=green!50!black,arc=4mm, |
| 593 |
theorem={Test}{texercise}{Direct usage}{myMarker}] |
| 594 |
Here, we see the test \ref{myMarker}. |
| 595 |
\end{tcolorbox} |
| 596 |
\end{dispExample} |
| 597 |
For a common appearance inside the document, the key |theorem| should not be |
| 598 |
used directly as in the example above, but as part of a new environment |
| 599 |
created by hand or using \refCom{newtcbtheorem}. |
| 600 |
\end{docTcbKey} |
| 601 |
|
| 602 |
\clearpage |
| 603 |
|
| 604 |
\begin{docTcbKey}{highlight math}{}{style, no value} |
| 605 |
A style which is used for \refCom{tcbhighmath} and which is |
| 606 |
predefined as |notitle,nophantom,colframe=red,colback=yellow!25!white|.\par |
| 607 |
It can be changed with the usual |pgf| key techniques or |
| 608 |
with \refKey{/tcb/highlight math style}. |
| 609 |
\begin{dispExample} |
| 610 |
\begin{align*} |
| 611 |
\tcbhighmath{1} + 1 &= 2,\\ |
| 612 |
\tcbset{highlight math/.append style={left=0mm,right=0mm,top=0mm,bottom=0mm}} |
| 613 |
\tcbhighmath{1} + 1 &= 2. |
| 614 |
\end{align*} |
| 615 |
\end{dispExample} |
| 616 |
|
| 617 |
\end{docTcbKey} |
| 618 |
|
| 619 |
|
| 620 |
\begin{docTcbKey}{highlight math style}{=\meta{style definition}}{style, no default} |
| 621 |
Changes the definition for \refKey{/tcb/highlight math} to |
| 622 |
|notitle,nophantom| plus the given \meta{style definition}. |
| 623 |
See \refCom{tcbhighmath} for another example. |
| 624 |
\begin{dispExample} |
| 625 |
% \tcbuselibrary{skins} |
| 626 |
\tcbset{highlight math style={enhanced,%<-- needed for the `remember' options |
| 627 |
colframe=red,colback=red!10!white,boxsep=0pt}} |
| 628 |
\begin{align*} |
| 629 |
\tcbhighmath[remember as=fx]{f(x)} |
| 630 |
&= \int\limits_{1}^{x} \frac{1}{t^2}~dt |
| 631 |
= \left[ -\frac{1}{t} \right]_{1}^{x}\\ |
| 632 |
&= -\frac{1}{x} + \frac{1}{1}\\ |
| 633 |
&= |
| 634 |
\tcbhighmath[remember,overlay={% |
| 635 |
\draw[blue,very thick,->] (fx.south) to[bend right] ([yshift=2mm]frame.west);}] |
| 636 |
{1-\frac{1}{x}.} |
| 637 |
\end{align*} |
| 638 |
\end{dispExample} |
| 639 |
\end{docTcbKey} |
| 640 |
|
| 641 |
\clearpage |
| 642 |
\begin{docTcbKey}{math upper}{}{style, no value} |
| 643 |
Sets the upper part to mathematical mode with font |\displaystyle|. |
| 644 |
\end{docTcbKey} |
| 645 |
|
| 646 |
\begin{docTcbKey}{math lower}{}{style, no value} |
| 647 |
Sets the lower part to mathematical mode with font |\displaystyle|. |
| 648 |
\end{docTcbKey} |
| 649 |
|
| 650 |
\begin{docTcbKey}{math}{}{style, no value} |
| 651 |
Sets the upper part \emph{and} lower part to mathematical mode with font |\displaystyle|. |
| 652 |
\begin{dispExample} |
| 653 |
\begin{tcolorbox}[math,colback=yellow!10!white,colframe=red!50!black] |
| 654 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty. |
| 655 |
\end{tcolorbox} |
| 656 |
\end{dispExample} |
| 657 |
\end{docTcbKey} |
| 658 |
|
| 659 |
|
| 660 |
\begin{marker} |
| 661 |
The following styles are only tested to work with the original |
| 662 |
\refPkg{amsmath} environments. |
| 663 |
If e.\,g.\ the |equation| environment is redefined as |gather|, then |
| 664 |
\refKey{/tcb/ams equation} should / could not be used. Obviously, you are encouraged |
| 665 |
to use \refKey{/tcb/ams gather} in this case. |
| 666 |
\end{marker} |
| 667 |
|
| 668 |
\begin{docTcbKey}[][doc updated=2014-10-30]{ams equation upper}{}{style, no value} |
| 669 |
Adds an |amsmath| |equation| environment to the start and end |
| 670 |
of the upper part. |
| 671 |
\end{docTcbKey} |
| 672 |
|
| 673 |
\begin{docTcbKey}[][doc updated=2014-10-30]{ams equation lower}{}{style, no value} |
| 674 |
Adds an |amsmath| |equation| environment to the start and end |
| 675 |
of the lower part. |
| 676 |
\end{docTcbKey} |
| 677 |
|
| 678 |
\begin{docTcbKey}[][doc updated=2014-10-30]{ams equation}{}{style, no value} |
| 679 |
Adds an |amsmath| |equation| environment to the start and end |
| 680 |
of the upper \emph{and} lower part. |
| 681 |
\begin{dispExample} |
| 682 |
\begin{tcolorbox}[ams equation,colback=yellow!10!white,colframe=red!50!black] |
| 683 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty. |
| 684 |
\end{tcolorbox} |
| 685 |
\end{dispExample} |
| 686 |
\end{docTcbKey} |
| 687 |
|
| 688 |
\begin{docTcbKey}[][doc updated=2014-10-30]{ams equation* upper}{}{style, no value} |
| 689 |
Adds an |amsmath| |equation*| environment to the start and end |
| 690 |
of the upper part. |
| 691 |
\end{docTcbKey} |
| 692 |
|
| 693 |
\begin{docTcbKey}[][doc updated=2014-10-30]{ams equation* lower}{}{style, no value} |
| 694 |
Adds an |amsmath| |equation*| environment to the start and end |
| 695 |
of the lower part. |
| 696 |
\end{docTcbKey} |
| 697 |
|
| 698 |
\enlargethispage*{2cm} |
| 699 |
\begin{docTcbKey}[][doc updated=2014-10-30]{ams equation*}{}{style, no value} |
| 700 |
Adds an |amsmath| |equation*| environment to the start and end |
| 701 |
of the upper \emph{and} lower part. |
| 702 |
\begin{dispExample} |
| 703 |
\begin{tcolorbox}[ams equation*,colback=yellow!10!white,colframe=red!50!black] |
| 704 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty. |
| 705 |
\end{tcolorbox} |
| 706 |
\end{dispExample} |
| 707 |
\end{docTcbKey} |
| 708 |
|
| 709 |
\clearpage |
| 710 |
\begin{docTcbKeys}[ |
| 711 |
doc parameter = , |
| 712 |
doc description = {style, no value}, |
| 713 |
] |
| 714 |
{ |
| 715 |
{ |
| 716 |
doc name = ams align upper, |
| 717 |
}, |
| 718 |
{ |
| 719 |
doc name = ams align, |
| 720 |
doc updated = 2024-06-27, |
| 721 |
} |
| 722 |
} |
| 723 |
Adds an |amsmath| |align| environment to the start and end |
| 724 |
of the upper part. |
| 725 |
\begin{dispExample} |
| 726 |
\begin{tcolorbox}[ams align,colback=yellow!10!white,colframe=red!50!black] |
| 727 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} &= \infty.\\ |
| 728 |
\int x^2 ~\text{d}x &= \frac13 x^3 + c. |
| 729 |
\end{tcolorbox} |
| 730 |
\end{dispExample} |
| 731 |
\begin{marker} |
| 732 |
Boxes with \refKey{/tcb/ams align upper} or \refKey{/tcb/ams align} |
| 733 |
cannot have a lower part! |
| 734 |
For a lower part, use \refKey{/tcb/ams nodisplayskip upper} instead. |
| 735 |
\end{marker} |
| 736 |
\end{docTcbKeys} |
| 737 |
|
| 738 |
\begin{docTcbKey}{ams align lower}{}{style, no value} |
| 739 |
Adds an |amsmath| |align| environment to the start and end |
| 740 |
of the lower part. |
| 741 |
\end{docTcbKey} |
| 742 |
|
| 743 |
|
| 744 |
\begin{docTcbKeys}[ |
| 745 |
doc parameter = , |
| 746 |
doc description = {style, no value}, |
| 747 |
] |
| 748 |
{ |
| 749 |
{ |
| 750 |
doc name = ams align* upper, |
| 751 |
}, |
| 752 |
{ |
| 753 |
doc name = ams align*, |
| 754 |
doc updated = 2024-06-27, |
| 755 |
} |
| 756 |
} |
| 757 |
Adds an |amsmath| |align*| environment to the start and end |
| 758 |
of the upper part. |
| 759 |
\begin{dispExample} |
| 760 |
\begin{tcolorbox}[ams align*,colback=yellow!10!white,colframe=red!50!black] |
| 761 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} &= \infty.\\ |
| 762 |
\int x^2 ~\text{d}x &= \frac13 x^3 + c. |
| 763 |
\end{tcolorbox} |
| 764 |
\end{dispExample} |
| 765 |
\begin{marker} |
| 766 |
Boxes with \refKey{/tcb/ams align* upper} or \refKey{/tcb/ams align*} |
| 767 |
cannot have a lower part! |
| 768 |
For a lower part, use \refKey{/tcb/ams nodisplayskip upper} instead. |
| 769 |
\end{marker} |
| 770 |
\end{docTcbKeys} |
| 771 |
|
| 772 |
\begin{docTcbKey}{ams align* lower}{}{style, no value} |
| 773 |
Adds an |amsmath| |align*| environment to the start and end |
| 774 |
of the lower part. |
| 775 |
\end{docTcbKey} |
| 776 |
|
| 777 |
|
| 778 |
\clearpage |
| 779 |
\begin{docTcbKeys}[ |
| 780 |
doc parameter = , |
| 781 |
doc description = {style, no value}, |
| 782 |
] |
| 783 |
{ |
| 784 |
{ |
| 785 |
doc name = ams gather upper, |
| 786 |
}, |
| 787 |
{ |
| 788 |
doc name = ams gather, |
| 789 |
doc updated = 2024-06-27, |
| 790 |
} |
| 791 |
} |
| 792 |
Adds an |amsmath| |gather| environment to the start and end |
| 793 |
of the upper part. |
| 794 |
\begin{dispExample} |
| 795 |
\begin{tcolorbox}[ams gather,colback=yellow!10!white,colframe=red!50!black] |
| 796 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.\\ |
| 797 |
\int x^2 ~\text{d}x = \frac13 x^3 + c. |
| 798 |
\end{tcolorbox} |
| 799 |
\end{dispExample} |
| 800 |
\begin{marker} |
| 801 |
Boxes with \refKey{/tcb/ams gather upper} or \refKey{/tcb/ams gather} |
| 802 |
cannot have a lower part! |
| 803 |
For a lower part, use \refKey{/tcb/ams nodisplayskip upper} instead. |
| 804 |
\end{marker} |
| 805 |
\end{docTcbKeys} |
| 806 |
|
| 807 |
\begin{docTcbKey}{ams gather lower}{}{style, no value} |
| 808 |
Adds an |amsmath| |gather| environment to the start and end |
| 809 |
of the lower part. |
| 810 |
\end{docTcbKey} |
| 811 |
|
| 812 |
\begin{docTcbKeys}[ |
| 813 |
doc parameter = , |
| 814 |
doc description = {style, no value}, |
| 815 |
] |
| 816 |
{ |
| 817 |
{ |
| 818 |
doc name = ams gather* upper, |
| 819 |
}, |
| 820 |
{ |
| 821 |
doc name = ams gather*, |
| 822 |
doc updated = 2024-06-27, |
| 823 |
} |
| 824 |
} |
| 825 |
Adds an |amsmath| |gather*| environment to the start and end |
| 826 |
of the upper part. |
| 827 |
\begin{dispExample} |
| 828 |
\begin{tcolorbox}[ams gather*,colback=yellow!10!white,colframe=red!50!black] |
| 829 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.\\ |
| 830 |
\int x^2 ~\text{d}x = \frac13 x^3 + c. |
| 831 |
\end{tcolorbox} |
| 832 |
\end{dispExample} |
| 833 |
\begin{marker} |
| 834 |
Boxes with \refKey{/tcb/ams gather* upper} or \refKey{/tcb/ams gather*} |
| 835 |
cannot have a lower part! |
| 836 |
For a lower part, use \refKey{/tcb/ams nodisplayskip upper} instead. |
| 837 |
\end{marker} |
| 838 |
\end{docTcbKeys} |
| 839 |
|
| 840 |
\begin{docTcbKey}{ams gather* lower}{}{style, no value} |
| 841 |
Adds an |amsmath| |gather*| environment to the start and end |
| 842 |
of the lower part. |
| 843 |
\end{docTcbKey} |
| 844 |
|
| 845 |
\clearpage |
| 846 |
\begin{docTcbKey}{ams nodisplayskip upper}{}{style, no value} |
| 847 |
Neutralizes the |\abovedisplayskip| of a following |align| or |gather| |
| 848 |
environment for the upper part. Note that the text content has to |
| 849 |
start with such a formula. |
| 850 |
\end{docTcbKey} |
| 851 |
|
| 852 |
|
| 853 |
\begin{docTcbKey}{ams nodisplayskip lower}{}{style, no value} |
| 854 |
Neutralizes the |\abovedisplayskip| of a following |align| or |gather| |
| 855 |
environment for the lower part. Note that the text content has to |
| 856 |
start with such a formula. |
| 857 |
\end{docTcbKey} |
| 858 |
|
| 859 |
|
| 860 |
\begin{docTcbKey}{ams nodisplayskip}{}{style, no value} |
| 861 |
Neutralizes the |\abovedisplayskip| of a following |align| or |gather| |
| 862 |
environment for the upper part \emph{and} lower part. |
| 863 |
Note that the text content has to start with such a formula. |
| 864 |
\begin{dispExample} |
| 865 |
\begin{tcolorbox}[ams nodisplayskip,colback=yellow!10!white,colframe=red!50!black] |
| 866 |
\begin{gather} |
| 867 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.\\ |
| 868 |
\int x^2 ~\text{d}x = \frac13 x^3 + c. |
| 869 |
\end{gather} |
| 870 |
And now for something completely different. |
| 871 |
\end{tcolorbox} |
| 872 |
\end{dispExample} |
| 873 |
\end{docTcbKey} |
| 874 |
|
| 875 |
\bigskip |
| 876 |
New colored mathematical environments are easily created using |
| 877 |
\refCom{newtcolorbox}: |
| 878 |
|
| 879 |
\begin{dispExample} |
| 880 |
\newtcolorbox{mymath}{ams gather*,colback=yellow!10!white,colframe=red!50!black} |
| 881 |
|
| 882 |
\begin{mymath} |
| 883 |
\sum\limits_{n=1}^{\infty} \frac{1}{n} = \infty.\\ |
| 884 |
\int x^2 ~\text{d}x = \frac13 x^3 + c. |
| 885 |
\end{mymath} |
| 886 |
\end{dispExample} |
| 887 |
|
| 888 |
\bigskip |
| 889 |
\begin{marker} |
| 890 |
All described options like \refKey{/tcb/ams gather upper}, \refKey{/tcb/ams gather lower}, |
| 891 |
\refKey{/tcb/ams gather} are (partially) setting (overwriting) the |
| 892 |
keys \refKey{/tcb/before upper}, \refKey{/tcb/after upper}, |
| 893 |
\refKey{/tcb/before lower}, \refKey{/tcb/after lower}.\par |
| 894 |
Therefore, e.\,g.\ |\tcbset{ams gather,before upper={\text{Pythagoras:}}}| |
| 895 |
produces an invalid result. For this case, you are invited to use\\ |
| 896 |
|\tcbset{ams gather,before upper app={\text{Pythagoras:}}}|,\\ |
| 897 |
see \refKey{/tcb/before upper app}. |
| 898 |
\end{marker} |
| 899 |
|
| 900 |
|
| 901 |
\clearpage |
| 902 |
\begin{docTcbKey}{theorem style}{=\meta{name}}{no default, initially |standard|} |
| 903 |
Applies a predefined style \meta{name} to the theorem environment. Some of |
| 904 |
the feasible \meta{name} values resemble style names from the packages \refPkg{theorem} |
| 905 |
and \refPkg{ntheorem} to give convenient access to known patterns. |
| 906 |
\begin{marker} |
| 907 |
The styles alter \refKey{/tcb/separator sign}, \refKey{/tcb/description delimiters}, |
| 908 |
\refKey{/tcb/terminator sign}, and more. Therefore, one should apply such |
| 909 |
keys \emph{after} a theorem style. |
| 910 |
\end{marker} |
| 911 |
|
| 912 |
For the following examples, we use: |
| 913 |
\inputpreamblelisting{J} |
| 914 |
|
| 915 |
The predefined styles are: |
| 916 |
\begin{itemize} |
| 917 |
% |
| 918 |
\item\docValue{standard}: This is the initial value. |
| 919 |
\begin{dispExample} |
| 920 |
\begin{theorem}[theorem style=standard]{standard}{} |
| 921 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 922 |
\end{theorem} |
| 923 |
\end{dispExample} |
| 924 |
% |
| 925 |
\item\docValue{change standard} |
| 926 |
\begin{dispExample} |
| 927 |
\begin{theorem}[theorem style=change standard]{change standard}{} |
| 928 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 929 |
\end{theorem} |
| 930 |
\end{dispExample} |
| 931 |
% |
| 932 |
\item\docValue{plain} |
| 933 |
\begin{dispExample} |
| 934 |
\begin{theorem}[theorem style=plain]{plain}{} |
| 935 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 936 |
\end{theorem} |
| 937 |
\end{dispExample} |
| 938 |
% |
| 939 |
\clearpage |
| 940 |
\item\docValue{break} |
| 941 |
\begin{dispExample} |
| 942 |
\begin{theorem}[theorem style=break]{break}{} |
| 943 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 944 |
\end{theorem} |
| 945 |
\end{dispExample} |
| 946 |
% |
| 947 |
\item\docValue{plain apart} |
| 948 |
\begin{dispExample} |
| 949 |
\begin{theorem}[theorem style=plain apart]{plain apart}{} |
| 950 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 951 |
\end{theorem} |
| 952 |
\end{dispExample} |
| 953 |
% |
| 954 |
\item\docValue{change} |
| 955 |
\begin{dispExample} |
| 956 |
\begin{theorem}[theorem style=change]{change}{} |
| 957 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 958 |
\end{theorem} |
| 959 |
\end{dispExample} |
| 960 |
% |
| 961 |
\item\docValue{change break} |
| 962 |
\begin{dispExample} |
| 963 |
\begin{theorem}[theorem style=change break]{change break}{} |
| 964 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 965 |
\end{theorem} |
| 966 |
\end{dispExample} |
| 967 |
% |
| 968 |
\item\docValue{change apart} |
| 969 |
\begin{dispExample} |
| 970 |
\begin{theorem}[theorem style=change apart]{change apart}{} |
| 971 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 972 |
\end{theorem} |
| 973 |
\end{dispExample} |
| 974 |
% |
| 975 |
\clearpage |
| 976 |
\item\docValue{margin} |
| 977 |
\begin{dispExample} |
| 978 |
\begin{theorem}[theorem style=margin,left=10mm]{margin}{} |
| 979 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 980 |
\end{theorem} |
| 981 |
\begin{theorem}[theorem style=margin,left=10mm,oversize]{margin}{} |
| 982 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 983 |
\end{theorem} |
| 984 |
\end{dispExample} |
| 985 |
% |
| 986 |
\item\docValue{margin break} |
| 987 |
\begin{dispExample} |
| 988 |
\begin{theorem}[theorem style=margin break,left=10mm]{margin break}{} |
| 989 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 990 |
\end{theorem} |
| 991 |
\begin{theorem}[theorem style=margin break,left=10mm,oversize]{margin break}{} |
| 992 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 993 |
\end{theorem} |
| 994 |
\end{dispExample} |
| 995 |
% |
| 996 |
\item\docValue{margin apart} |
| 997 |
\begin{dispExample} |
| 998 |
\begin{theorem}[theorem style=margin apart,left=10mm]{margin apart}{} |
| 999 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 1000 |
\end{theorem} |
| 1001 |
\begin{theorem}[theorem style=margin apart,left=10mm,oversize]{margin apart}{} |
| 1002 |
This is my theorem. \begin{equation*} a^2 + b^2 = c^2. \end{equation*} |
| 1003 |
\end{theorem} |
| 1004 |
\end{dispExample} |
| 1005 |
% |
| 1006 |
\end{itemize} |
| 1007 |
\end{docTcbKey} |
| 1008 |
|
| 1009 |
|
| 1010 |
% |
| 1011 |
\clearpage |
| 1012 |
\subsection{Examples for Definitions and Theorems} |
| 1013 |
In the following, the application of \refCom{newtcbtheorem} |
| 1014 |
to highlight mathematical definitions, theorems, or the like is demonstrated. |
| 1015 |
|
| 1016 |
At first, additional |tcb| keys are created for the appearance of |
| 1017 |
the colored boxes. It is assumed that theorems and corollaries should be |
| 1018 |
identically colored. |
| 1019 |
All following environments are numbered with a common counter, but this |
| 1020 |
can be changed easily. Here, the counter output is supplemented by |
| 1021 |
the subsection number. |
| 1022 |
Further, the \refPkg{zref-clever} package \cite{barros:zref-clever} is used for clever |
| 1023 |
references. |
| 1024 |
|
| 1025 |
\inputpreamblelisting{G} |
| 1026 |
|
| 1027 |
By \refCom{newtcbtheorem}, commonly numbered theorem environments are |
| 1028 |
created now. |defstyle| and |theostyle| are used for the appearance. |
| 1029 |
|
| 1030 |
\begin{marker} |
| 1031 |
If you do not need \refPkg{zref-clever} support, drop \refKey{/tcb/label type} |
| 1032 |
from the definitions above. |
| 1033 |
\end{marker} |
| 1034 |
|
| 1035 |
|
| 1036 |
Now, everything is prepared for the following examples. |
| 1037 |
|
| 1038 |
\begin{dispExample} |
| 1039 |
The following theorem is numbered as \zcref[S]{theo:diffbarstetig} |
| 1040 |
and referenced with the marker \texttt{theo:diffbarstetig}. |
| 1041 |
Alternatively, use the basic form Theorem~\ref{theo:diffbarstetig}. |
| 1042 |
|
| 1043 |
\begin{Theorem}{Differenzierbarkeit bedingt Stetigkeit, wobei diese Benennung |
| 1044 |
zu Testzwecken ungew\"{o}hnlich lang ist}{diffbarstetig}% |
| 1045 |
Eine Funktion $f:I\to\mathbb{R}$ ist in $x_0\in I$ stetig, wenn $f$ in |
| 1046 |
$x_0$ differenzierbar ist. |
| 1047 |
\end{Theorem} |
| 1048 |
\end{dispExample} |
| 1049 |
|
| 1050 |
|
| 1051 |
\begin{dispExample} |
| 1052 |
The following definition is numbered as \zcref[cap]{def:diffbarkeit} and |
| 1053 |
referenced with the marker \texttt{def:diffbarkeit}.\bigskip |
| 1054 |
|
| 1055 |
\begin{Definition}{Differenzierbarkeit}{diffbarkeit} |
| 1056 |
Eine Funktion $f:~I\to\mathbb{R}$ auf einem Intervall $I$ hei\ss{}t in |
| 1057 |
$x_0\in I$ differenzierbar oder linear approximierbar, |
| 1058 |
wenn der Grenzwert |
| 1059 |
\begin{equation*} |
| 1060 |
\lim\limits_{x\to x_0}\frac{f(x)-f(x_0)}{x-x_0}= |
| 1061 |
\lim\limits_{h\to 0}\frac{f(x_0+h)-f(x_0)}{h} |
| 1062 |
\end{equation*} |
| 1063 |
existiert. Bei Existenz hei\ss{}t dieser Grenzwert Ableitung |
| 1064 |
oder Differentialquotient von $f$ in $x_0$ und man |
| 1065 |
schreibt f\"{u}r ihn |
| 1066 |
\begin{equation*} |
| 1067 |
f'(x_0)\quad\text{oder}\quad\frac{df}{dx}(x_0). |
| 1068 |
\end{equation*} |
| 1069 |
\end{Definition} |
| 1070 |
\end{dispExample} |
| 1071 |
|
| 1072 |
|
| 1073 |
\begin{dispExample} |
| 1074 |
The following corollary is numbered as \zcref{cor:nullstellen} and |
| 1075 |
referenced with the marker \texttt{cor:nullstellen}.\bigskip |
| 1076 |
|
| 1077 |
\begin{Corollary}{Nullstellenexistenz}{nullstellen} |
| 1078 |
Ist $f:[a,b]\to\mathbb{R}$ stetig und haben $f(a)$ und $f(b)$ entgegengesetzte |
| 1079 |
Vorzeichen, also $f(a)f(b)<0$, so besitzt $f$ eine Nullstelle $x_0\in]a,b[$, |
| 1080 |
also $f(x_0)=0$. |
| 1081 |
\end{Corollary} |
| 1082 |
\end{dispExample} |
| 1083 |
|
| 1084 |
|
| 1085 |
\begin{dispExample} |
| 1086 |
\begin{Theorem}[boxrule=2mm,toptitle=-1.5mm,bottomtitle=-1.5mm]{% |
| 1087 |
Hinreichende Bedingung f\"{u}r Wendepunkte}{wendehinreichend}% |
| 1088 |
$f$ sei eine auf einem Intervall $]a,b[$ dreimal stetig differenzierbare Funktion. |
| 1089 |
Ist $f''(x_0)=0$ in $x_0\in]a,b[$ und $f'''(x_0)\ne 0$, so ist |
| 1090 |
$(x_0,f(x_0))$ ein Wendepunkt von $f$. |
| 1091 |
\end{Theorem} |
| 1092 |
\end{dispExample} |
| 1093 |
|
| 1094 |
\begin{dispExample} |
| 1095 |
% \usepackage{zref-clever} |
| 1096 |
% \usepackage{zref-vario} |
| 1097 |
% \tcbuselibrary{skins} |
| 1098 |
\newtcbtheorem[use counter from=Definition]{YetAnotherTheorem}{Theorem}% |
| 1099 |
{theorem style=plain apart,label type=theorem,enhanced,frame hidden, |
| 1100 |
boxrule=2mm,titlerule=0mm,toptitle=1mm,bottomtitle=1mm, |
| 1101 |
fonttitle=\bfseries\large,fontupper=\normalsize, |
| 1102 |
coltitle=green!35!black,colbacktitle=green!15!white, |
| 1103 |
colback=green!50!yellow!15!white,borderline={1pt}{0pt}{green!25!blue}, |
| 1104 |
}{theo} |
| 1105 |
|
| 1106 |
\begin{YetAnotherTheorem}{Mittelwertsatz f\"{u}r $n$ Variable}{meanvaluetheorem}% |
| 1107 |
Es sei $n\in\mathbb{N}$, $D\subseteq\mathbb{R}^n$ eine offene Menge und |
| 1108 |
$f\in C^{1}(D,\mathbb{R})$. Dann gibt es auf jeder Strecke |
| 1109 |
$[x_0,x]\subset D$ einen Punkt $\xi\in[x_0,x]$, so dass gilt |
| 1110 |
\begin{equation*} |
| 1111 |
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0) |
| 1112 |
\end{equation*} |
| 1113 |
\end{YetAnotherTheorem} |
| 1114 |
|
| 1115 |
\medskip |
| 1116 |
Here, |zref-clever| support is used to reference \zcref{theo:meanvaluetheorem} |
| 1117 |
on \zcpageref{theo:meanvaluetheorem}. This \zcref*[noref]{theo:meanvaluetheorem} |
| 1118 |
can also be referenced by |\zvref| resulting in \zvref{theo:meanvaluetheorem}. |
| 1119 |
\end{dispExample} |
| 1120 |
|
| 1121 |
\begin{marker} |
| 1122 |
Note that \refKey{/tcb/label type} was used in the example above to feed |
| 1123 |
\refPkg{zref-clever} \cite{barros:zref-clever} with the needed name information. |
| 1124 |
\end{marker} |
| 1125 |
|
| 1126 |
\clearpage |
| 1127 |
|
| 1128 |
\begin{dispExample} |
| 1129 |
Here, using |\zvref| resulting in \zvref{theo:meanvaluetheorem} |
| 1130 |
is more interesting\ldots |
| 1131 |
\end{dispExample} |
| 1132 |
|
| 1133 |
|
| 1134 |
\begin{dispExample} |
| 1135 |
% \tcbuselibrary{skins} |
| 1136 |
\newtcbtheorem[use counter from=Definition]{YetAnotherTheorem}{Theorem}% |
| 1137 |
{theorem style=change apart,enhanced,arc=0mm,outer arc=0mm, |
| 1138 |
boxrule=0mm,toprule=1mm,bottomrule=1mm,left=1mm,right=1mm, |
| 1139 |
titlerule=0mm,toptitle=0mm,bottomtitle=1mm,top=0mm, |
| 1140 |
colframe=red!50!black,colback=red!5!white,coltitle=red!50!black, |
| 1141 |
title style={top color=yellow!50!white,bottom color=red!5!white, |
| 1142 |
middle color=yellow!50!white}, |
| 1143 |
fonttitle=\bfseries\sffamily\normalsize,fontupper=\normalsize\itshape, |
| 1144 |
}{theo} |
| 1145 |
|
| 1146 |
\begin{YetAnotherTheorem}{Mittelwertsatz f\"{u}r $n$ Variable}{mittelwertsatz_n2}% |
| 1147 |
Es sei $n\in\mathbb{N}$, $D\subseteq\mathbb{R}^n$ eine offene Menge und |
| 1148 |
$f\in C^{1}(D,\mathbb{R})$. Dann gibt es auf jeder Strecke |
| 1149 |
$[x_0,x]\subset D$ einen Punkt $\xi\in[x_0,x]$, so dass gilt |
| 1150 |
\begin{equation*} |
| 1151 |
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0) |
| 1152 |
\end{equation*} |
| 1153 |
\end{YetAnotherTheorem} |
| 1154 |
\end{dispExample} |
| 1155 |
|
| 1156 |
|
| 1157 |
\begin{dispExample} |
| 1158 |
% \usepackage{varwidth} \tcbuselibrary{skins} |
| 1159 |
\newtcbtheorem[use counter from=Definition]{YetAnotherTheorem}{Theorem}% |
| 1160 |
{enhanced,frame empty,interior empty,colframe=ForestGreen!50!white, |
| 1161 |
coltitle=ForestGreen!50!black,fonttitle=\bfseries,colbacktitle=ForestGreen!15!white, |
| 1162 |
borderline={0.5mm}{0mm}{ForestGreen!15!white}, |
| 1163 |
borderline={0.5mm}{0mm}{ForestGreen!50!white,dashed}, |
| 1164 |
attach boxed title to top center={yshift=-2mm}, |
| 1165 |
boxed title style={boxrule=0.4pt},varwidth boxed title}{theo} |
| 1166 |
|
| 1167 |
\begin{YetAnotherTheorem}{Mittelwertsatz f\"{u}r $n$ Variable}{mittelwertsatz_n3}% |
| 1168 |
Es sei $n\in\mathbb{N}$, $D\subseteq\mathbb{R}^n$ eine offene Menge und |
| 1169 |
$f\in C^{1}(D,\mathbb{R})$. Dann gibt es auf jeder Strecke |
| 1170 |
$[x_0,x]\subset D$ einen Punkt $\xi\in[x_0,x]$, so dass gilt |
| 1171 |
\begin{equation*} |
| 1172 |
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0) |
| 1173 |
\end{equation*} |
| 1174 |
\end{YetAnotherTheorem} |
| 1175 |
\end{dispExample} |
| 1176 |
|
| 1177 |
|
| 1178 |
\clearpage |
| 1179 |
You need more attention for your theorems? Here, you are \ldots |
| 1180 |
|
| 1181 |
\begin{dispExample} |
| 1182 |
% tcbuselibrary{skins} % preamble |
| 1183 |
\begin{Theorem}[enhanced, |
| 1184 |
fuzzy halo=3mm with yellow, |
| 1185 |
fuzzy halo=2mm with red, |
| 1186 |
fuzzy halo=1mm with yellow, |
| 1187 |
watermark color=red!35!white, |
| 1188 |
watermark text={Overacting\\Fundamental Theorem}]% |
| 1189 |
{Fundamental Theorem of Theorems}{fundamental}% |
| 1190 |
\lipsum[1-2] |
| 1191 |
\end{Theorem} |
| 1192 |
\end{dispExample} |
| 1193 |
|
| 1194 |
Let's try a more conservative approach: |
| 1195 |
|
| 1196 |
\begin{dispExample} |
| 1197 |
% \tcbuselibrary{skins} |
| 1198 |
\newtcbtheorem[use counter from=Definition]{YetAnotherTheorem}{Theorem}% |
| 1199 |
{theorem style=plain,enhanced,colframe=blue!50!black,colback=yellow!20!white, |
| 1200 |
coltitle=red!50!black,fonttitle=\upshape\bfseries,fontupper=\itshape, |
| 1201 |
drop fuzzy shadow=blue!50!black!50!white,boxrule=0.4pt}{theo} |
| 1202 |
|
| 1203 |
\begin{YetAnotherTheorem}{Mittelwertsatz f\"{u}r $n$ Variable}{mittelwertsatz_n4}% |
| 1204 |
Es sei $n\in\mathbb{N}$, $D\subseteq\mathbb{R}^n$ eine offene Menge und |
| 1205 |
$f\in C^{1}(D,\mathbb{R})$. Dann gibt es auf jeder Strecke |
| 1206 |
$[x_0,x]\subset D$ einen Punkt $\xi\in[x_0,x]$, so dass gilt |
| 1207 |
\begin{equation*} |
| 1208 |
f(x)-f(x_0) = \operatorname{grad} f(\xi)^{\top}(x-x_0) |
| 1209 |
\end{equation*} |
| 1210 |
\end{YetAnotherTheorem} |
| 1211 |
\end{dispExample} |
| 1212 |
|
| 1213 |
|
| 1214 |
\clearpage |
| 1215 |
\subsection{Using other theorem environments with \texttt{tcolorbox}}\label{subsec:theorems_other} |
| 1216 |
|
| 1217 |
Instead of creating theorem environments with the methods described before, |
| 1218 |
environments from other packages can be boxed with a |tcolorbox|. |
| 1219 |
|
| 1220 |
Environments may be created e.\,g.\ by methods from the \refPkg{theorem} package or |
| 1221 |
the \refPkg{amsthm} package. \refCom{tcolorboxenvironment} can be used to put a box |
| 1222 |
around these environments. |
| 1223 |
|
| 1224 |
\inputpreamblelisting{K} |
| 1225 |
|
| 1226 |
\begin{dispExample} |
| 1227 |
\begin{lem} |
| 1228 |
\lipsum[2] |
| 1229 |
\end{lem} |
| 1230 |
|
| 1231 |
\lipsum[3] |
| 1232 |
|
| 1233 |
\begin{proof} |
| 1234 |
\lipsum*[4] |
| 1235 |
\end{proof} |
| 1236 |
\end{dispExample} |