| 1 |
% !TeX root = tcolorbox.tex |
| 2 |
% include file of tcolorbox.tex (manual of the LaTeX package tcolorbox) |
| 3 |
\clearpage |
| 4 |
\section{Initialization Option Keys}\label{sec:initkeys}% |
| 5 |
\tcbset{external/prefix=external/initoptions_}% |
| 6 |
The \emph{initialization} options are only applicable for the generation |
| 7 |
of new environments and commands based on |tcolorbox| and friends. |
| 8 |
Particularly, they can be used for |
| 9 |
\begin{itemize} |
| 10 |
\item\refCom{newtcolorbox}, \refCom{NewTColorBox}, \refCom{NewTotalTColorBox}, |
| 11 |
\item\refCom{newtcbox}, \refCom{NewTCBox}, \refCom{NewTotalTCBox}, |
| 12 |
\item\refCom{newtcblisting}, \refCom{NewTCBListing}, |
| 13 |
\item\refCom{newtcbinputlisting}, \refCom{NewTCBInputListing}, |
| 14 |
\item\refCom{newtcbtheorem}, \refCom{NewTcbTheorem}, |
| 15 |
\item\refCom{newtcboxfit}, \refCom{NewTCBoxFit}, \refCom{NewTotalTCBoxFit}, |
| 16 |
\end{itemize} |
| 17 |
and friends like \refCom{renewtcolorbox}, etc. |
| 18 |
|
| 19 |
\bigskip |
| 20 |
\begin{marker} |
| 21 |
Typically, these options may generate counters and alike. |
| 22 |
It is \textbf{strongly} recommended that you use initialization options inside |
| 23 |
the preamble only. Otherwise, you may get trouble when using \LaTeX's |\include| features. |
| 24 |
Also, it is recommended to generate new environments and commands with these |
| 25 |
options \emph{after} \refPkg{hyperref} is loaded to avoid warnings about |
| 26 |
\emph{duplicate identifiers}. |
| 27 |
\end{marker} |
| 28 |
|
| 29 |
|
| 30 |
\subsection{Numbered Boxes}\label{sec:numberedboxes} |
| 31 |
Counters assigned using the initialization options are administrated |
| 32 |
automatically. Especially, they are increased for each new box. |
| 33 |
|
| 34 |
\begin{docCommand}{thetcbcounter}{} |
| 35 |
Counter value of the current numbered box. It may be used inside the box, |
| 36 |
e.\,g.\ inside the title of |
| 37 |
the box. See \refKey{/tcb/new/auto counter} and following for examples. |
| 38 |
\end{docCommand} |
| 39 |
|
| 40 |
\begin{docCommand}{tcbcounter}{} |
| 41 |
Real counter name of the current numbered box for possible use inside the box. |
| 42 |
\end{docCommand} |
| 43 |
|
| 44 |
\begin{docCommand}[doc new=2025-07-21]{thetcbcounterof}{\marg{tcolorbox}} |
| 45 |
Counter value of a numbered \meta{tcolorbox} created with |
| 46 |
initialization options as documented below, e.\,g.\ \refKey{/tcb/new/auto counter}. |
| 47 |
\meta{tcolorbox} can be the name of a created box environment (by \refCom{newtcolorbox} and friends) |
| 48 |
or a created box macro (by \refCom{newtcbox} and friends; here, the name is |
| 49 |
without the leading backslash of the macro). |
| 50 |
\end{docCommand} |
| 51 |
|
| 52 |
\begin{docCommand}[doc new=2025-07-21]{tcbcounterof}{\marg{tcolorbox}} |
| 53 |
Real counter name of a numbered \meta{tcolorbox}. |
| 54 |
\end{docCommand} |
| 55 |
|
| 56 |
|
| 57 |
\clearpage |
| 58 |
\begin{newTcbKey}{auto counter}{}{no value, initially unset} |
| 59 |
Creates a new counter automatically. |
| 60 |
With \refKey{/tcb/new/number format} and |
| 61 |
\refKey{/tcb/new/number within}, the appearance and behavior of the counter |
| 62 |
can be changed. The counter value is referenced by \refCom{thetcbcounter}. |
| 63 |
|
| 64 |
\inputpreamblelisting{A} |
| 65 |
|
| 66 |
\begin{dispExample} |
| 67 |
\begin{pabox}[label={myautocounter}]{Title with number} |
| 68 |
This box is automatically numbered with \ref{myautocounter} on page |
| 69 |
\pageref{myautocounter}. Inside the box, the \thetcbcounter\ can |
| 70 |
also be referenced by |\thetcbcounter|. |
| 71 |
The real counter name is \texttt{\tcbcounter}. |
| 72 |
\end{pabox} |
| 73 |
\end{dispExample} |
| 74 |
\end{newTcbKey} |
| 75 |
|
| 76 |
|
| 77 |
\begin{newTcbKey}{use counter from}{=\meta{tcolorbox}}{no default, initially unset} |
| 78 |
Here, a counter from another \meta{tcolorbox} is reused. |
| 79 |
Note that the settings for \refKey{/tcb/new/number format} and |
| 80 |
\refKey{/tcb/new/number within} are inherited and cannot be changed. |
| 81 |
The counter value is referenced by \refCom{thetcbcounter}. |
| 82 |
|
| 83 |
\begin{dispExample} |
| 84 |
\newtcolorbox[use counter from=pabox]{mybox}[2][]{% |
| 85 |
colback=blue!5!white,colframe=blue!75!black,fonttitle=\bfseries, |
| 86 |
title=Some Box \thetcbcounter: #2,#1} |
| 87 |
|
| 88 |
\begin{mybox}[label={myusecounterfrom}]{Title with continued number} |
| 89 |
This box is automatically numbered with \ref{myusecounterfrom} on page |
| 90 |
\pageref{myusecounterfrom}. Inside the box, the \thetcbcounter\ can |
| 91 |
also be referenced by |\thetcbcounter|. |
| 92 |
The real counter name is \texttt{\tcbcounter}. |
| 93 |
\end{mybox} |
| 94 |
\end{dispExample} |
| 95 |
\end{newTcbKey} |
| 96 |
|
| 97 |
|
| 98 |
\clearpage |
| 99 |
\begin{newTcbKey}{use counter}{=\meta{counter}}{no default, initially unset} |
| 100 |
Here, an ordinary existing \LaTeX\ \meta{counter} is used for numbering. |
| 101 |
With \refKey{/tcb/new/number format} and |
| 102 |
\refKey{/tcb/new/number within}, the appearance and behavior of the counter |
| 103 |
can be changed. The counter value is referenced by \refCom{thetcbcounter}. |
| 104 |
|
| 105 |
\begin{dispExample} |
| 106 |
% \newcounter{myexample}% preamble |
| 107 |
\newtcolorbox[use counter=myexample,number format=\Alph]{mybox}[2][]{% |
| 108 |
colback=green!5!white,colframe=green!55!black,fonttitle=\bfseries, |
| 109 |
title=Some Box \thetcbcounter: #2,#1} |
| 110 |
|
| 111 |
\begin{mybox}[label={myusecounter}]{Title with \LaTeX\ number} |
| 112 |
This box is automatically numbered with \ref{myusecounter} on page |
| 113 |
\pageref{myusecounter}. Inside the box, the \thetcbcounter\ can |
| 114 |
also be referenced by |\thetcbcounter|. |
| 115 |
The real counter name is \texttt{\tcbcounter}. |
| 116 |
\end{mybox} |
| 117 |
\end{dispExample} |
| 118 |
\end{newTcbKey} |
| 119 |
|
| 120 |
|
| 121 |
\begin{newTcbKey}[][doc new=2014-09-19]{use counter*}{=\meta{counter}}{no default, initially unset} |
| 122 |
An existing \LaTeX\ \meta{counter} is used for numbering. In contrast to |
| 123 |
\refKey{/tcb/new/use counter}, the options \refKey{/tcb/new/number format} and |
| 124 |
\refKey{/tcb/new/number within} are ignored. Use this for counters which |
| 125 |
are already configured outside the |tcolorbox| package, e.\,g.\ the standard |
| 126 |
|figure| counter. |
| 127 |
\end{newTcbKey} |
| 128 |
|
| 129 |
|
| 130 |
\begin{newTcbKey}{no counter}{}{no value, initially set} |
| 131 |
The created boxes are not numbered. This is the default. The option may |
| 132 |
be used to overrule a previous option. |
| 133 |
\end{newTcbKey} |
| 134 |
|
| 135 |
|
| 136 |
\begin{newTcbKey}[][doc new=2019-10-18]{reset counter on overlays}{\colOpt{=true\textbar false}}{default |true|, initially |false|} |
| 137 |
For \refPkg{beamer} slides, this invokes the |\resetcounteronoverlays| command |
| 138 |
for the box counter. The counter is automatically reset on subsequent |
| 139 |
overlay slides of a frame. |
| 140 |
Thereby, the counter will be the same on all slides of every frame. |
| 141 |
\end{newTcbKey} |
| 142 |
|
| 143 |
|
| 144 |
\clearpage |
| 145 |
\begin{newTcbKey}{number within}{=\meta{counter}}{no default, initially unset} |
| 146 |
The automatic counter is set to zero, if \meta{counter} is increased. |
| 147 |
Additionally, during output, the value of \meta{counter} is prepended to the value of |
| 148 |
the automatic counter.\par |
| 149 |
To prepend the automatic counter with the chapter number and to reset it |
| 150 |
with every new chapter, use: |
| 151 |
\begin{dispListing} |
| 152 |
number within=chapter |
| 153 |
\end{dispListing} |
| 154 |
See \refKey{/tcb/new/use counter} for a complete example. |
| 155 |
\end{newTcbKey} |
| 156 |
|
| 157 |
|
| 158 |
\begin{newTcbKey}[][doc new=2025-07-21]{number within from}{=\meta{tcolorbox}}{no default, initially unset} |
| 159 |
This is a shortcut for \refKey{/tcb/new/number within}|=|\refCom{tcbcounterof}\meta{tcolorbox}, |
| 160 |
i.\,e., the automatic counter is set to zero, if the counter of the referenced \meta{tcolorbox} is increased. |
| 161 |
\end{newTcbKey} |
| 162 |
|
| 163 |
|
| 164 |
\begin{newTcbKey}{number format}{=\meta{format macro}}{no default, initially \texttt{\textbackslash arabic}} |
| 165 |
Declares the format of the automatic counter. The \meta{format macro} can be |
| 166 |
any valid \LaTeX\ number formatting macro like |\arabic|, |\roman|, etc.\par |
| 167 |
To display the counter value in large roman numbers, use: |
| 168 |
\begin{dispListing} |
| 169 |
number format=\Roman |
| 170 |
\end{dispListing} |
| 171 |
See \refKey{/tcb/new/auto counter} for a complete example. |
| 172 |
\end{newTcbKey} |
| 173 |
|
| 174 |
|
| 175 |
\begin{newTcbKey}{number freestyle}{=\meta{code}}{no default, initially unset} |
| 176 |
Allows advanced control over the complete number format. This option overrules |
| 177 |
the format given by \refKey{/tcb/new/number within} and \refKey{/tcb/new/number format}. |
| 178 |
Nevertheless, you can combine it with \refKey{/tcb/new/number within} to |
| 179 |
get the desired reset property.\par |
| 180 |
The \meta{code} is some formatting code which should contain \refCom{tcbcounter} to |
| 181 |
reference the automated counter. Since this \meta{code} is expanded, you have |
| 182 |
to secure each macro with |\noexpand| with \emph{exception} of \refCom{tcbcounter}. |
| 183 |
|
| 184 |
\inputpreamblelisting{H} |
| 185 |
|
| 186 |
\begin{dispExample} |
| 187 |
\begin{phbox}[label={myfreestyle}]{Title with freestyle number} |
| 188 |
This box is automatically numbered with \ref{myfreestyle} on page |
| 189 |
\pageref{myfreestyle}. Inside the box, the \thetcbcounter\ can |
| 190 |
also be referenced by |\thetcbcounter|. |
| 191 |
The real counter name is \texttt{\tcbcounter}. |
| 192 |
\end{phbox} |
| 193 |
\end{dispExample} |
| 194 |
\end{newTcbKey} |
| 195 |
|
| 196 |
\clearpage |
| 197 |
\begin{marker} |
| 198 |
The following options \refKey{/tcb/new/crefname} and \refKey{/tcb/new/Crefname} |
| 199 |
need to be set inside the preamble. |
| 200 |
Note that \refPkg{cleveref} had its last update in 2018 (as of 2025-06-04) and |
| 201 |
had or has conflicts with recent \LaTeX\ kernels. \refPkg{zref-clever} is |
| 202 |
a possible alternative. |
| 203 |
\end{marker} |
| 204 |
|
| 205 |
\begin{newTcbKey}[][doc updated=2014-12-01]{crefname}{=\marg{singular}\marg{plural}}{no default, initially unset} |
| 206 |
This option key can be used only in conjunction with the \refPkg{cleveref} package |
| 207 |
\cite{cubitt:2018a} which has to be loaded separately. |
| 208 |
It creates a cross-reference type for the new |tcolorbox|'es, where the |
| 209 |
lowercase \meta{singular} and \meta{plural} forms of the cross-reference are given. |
| 210 |
This type is the environment or macro name and \refKey{/tcb/label type} is set automatically. |
| 211 |
See \refKey{/tcb/label type} and \cite{cubitt:2018a} for more information. |
| 212 |
\end{newTcbKey} |
| 213 |
|
| 214 |
|
| 215 |
\begin{newTcbKey}[][doc updated=2014-12-01]{Crefname}{=\marg{singular}\marg{plural}}{no default, initially unset} |
| 216 |
This option key can be used only in conjunction with the \refPkg{cleveref} package |
| 217 |
\cite{cubitt:2018a} which has to be loaded separately. |
| 218 |
It creates a cross-reference type for the new |tcolorbox|'es, where the |
| 219 |
uppercase \meta{singular} and \meta{plural} forms of the cross-reference are given. |
| 220 |
This type is the environment or macro name and \refKey{/tcb/label type} is set automatically. |
| 221 |
See \refKey{/tcb/label type} and \cite{cubitt:2018a} for more information. |
| 222 |
\end{newTcbKey} |
| 223 |
|
| 224 |
\begin{fulldocumentlisting}{ |
| 225 |
comment style={raster columns=1,raster left skip=20mm,raster right skip=20mm}, |
| 226 |
run pdflatex} |
| 227 |
\documentclass[12pt]{article} |
| 228 |
\usepackage[papersize={160mm,80mm},noheadfoot,margin=10mm]{geometry} |
| 229 |
\usepackage{varioref,cleveref} |
| 230 |
\usepackage{tcolorbox} |
| 231 |
|
| 232 |
\newtcolorbox[auto counter,number within=section, |
| 233 |
crefname={bluebox}{blueboxes}]% |
| 234 |
{mybluebox}[2][]{colback=blue!5!white,colframe=blue!75!black,fonttitle=\bfseries, |
| 235 |
title=Bluebox \thetcbcounter: #2,#1} |
| 236 |
|
| 237 |
\begin{document} |
| 238 |
\section{Blue} |
| 239 |
|
| 240 |
\begin{mybluebox}[label={myreference}]{My title} |
| 241 |
This is an example. |
| 242 |
\end{mybluebox} |
| 243 |
|
| 244 |
\noindent\Cref{myreference}, \cref{myreference}.\\ |
| 245 |
\Cpageref{myreference}, \cpageref{myreference}.\\ |
| 246 |
\nameCref{myreference}, \namecref{myreference}.\\ |
| 247 |
\labelcref{myreference}, \labelcpageref{myreference}.\\ |
| 248 |
With \texttt{varioref}:\\ |
| 249 |
\Vref{myreference}, \vref{myreference}. |
| 250 |
\end{document} |
| 251 |
\end{fulldocumentlisting} |
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
\clearpage |
| 256 |
|
| 257 |
\begin{newTcbKey}[][doc new and updated={2014-09-19}{2023-07-03}]{blend into}{=\meta{name}}{style, no default, initially unset} |
| 258 |
Used to comfortably blend into an existing schema of naming and numbering for |
| 259 |
some selected cases. For example, a |tcolorbox| can be used to display |
| 260 |
and entitle an image pretending to be a standard |figure| environment. |
| 261 |
Here, \refKey{/tcb/title} is used instead of the standard |\caption| |
| 262 |
and \refKey{/tcb/list text} can be used instead of the optional parameter |
| 263 |
of the standard |\caption|. |
| 264 |
Also, \refKey{/tcb/new/list type} is automatically adapted (changed with version 6.0.5). |
| 265 |
|
| 266 |
Feasible values for \meta{name} are: |
| 267 |
\begin{itemize} |
| 268 |
\item\docValue{figures}: blend into the standard |figure| environment. |
| 269 |
\item\docValue{tables}: blend into the standard |table| environment. |
| 270 |
\item\docValue{listings}: blend into the standard |lstlisting| environment |
| 271 |
of the package \refPkg{listings} \cite{hoffmann:listings}. |
| 272 |
\begin{marker} |
| 273 |
Note that |blend into=listings| can only be used in the document content |
| 274 |
or, preferably, inside a |\AtBeginDocument| clause! Using it without |
| 275 |
|\AtBeginDocument| inside the preamble does not work since the |listings| |
| 276 |
packages initializes its counter also inside |\AtBeginDocument|. |
| 277 |
\end{marker} |
| 278 |
\end{itemize} |
| 279 |
\end{newTcbKey} |
| 280 |
|
| 281 |
\enlargethispage*{5cm} |
| 282 |
\begin{dispListing} |
| 283 |
\begin{figure}[htb] |
| 284 |
\centering\includegraphics[height=4cm]{lichtspiel.jpg} |
| 285 |
\caption{A standard figure} |
| 286 |
\end{figure} |
| 287 |
|
| 288 |
\newtcolorbox[blend into=figures]{myfigure}[2][]{float=htb,capture=hbox, |
| 289 |
title={#2},every float=\centering,#1} |
| 290 |
|
| 291 |
\begin{myfigure}{A tcolorbox figure} |
| 292 |
\includegraphics[height=4cm]{lichtspiel.jpg} |
| 293 |
\end{myfigure} |
| 294 |
\end{dispListing} |
| 295 |
{\tcbusetemp} |
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
\clearpage |
| 300 |
\begin{docTcbKey}[][doc new=2015-03-13]{blend before title}{=\meta{value}}{no default, initially \docValue{colon}} |
| 301 |
This option formats the title output of \refKey{/tcb/new/blend into}. |
| 302 |
Note that this is a common |tcolorbox| option which should be set |
| 303 |
globally or in the normal option part of \refCom{newtcolorbox}. |
| 304 |
|
| 305 |
Feasible values for \meta{value} are: |
| 306 |
\begin{itemize} |
| 307 |
\item\docValue{colon}: use name/number plus colon. |
| 308 |
\item\docValue{dash}: use name/number plus dash. |
| 309 |
\item\docValue{colon hang}: use name/number plus colon with hanging indent. |
| 310 |
\item\docValue{dash hang}: use name/number plus dash with hanging indent. |
| 311 |
\end{itemize} |
| 312 |
|
| 313 |
\begin{dispListing} |
| 314 |
\newtcolorbox[blend into=figures]{myfigure}[2][]{float=htb,capture=hbox, |
| 315 |
blend before title=dash hang,title={#2},every float=\centering,#1} |
| 316 |
|
| 317 |
\begin{myfigure}{A tcolorbox figure with quite a long title} |
| 318 |
\includegraphics[height=5cm]{lichtspiel.jpg} |
| 319 |
\end{myfigure} |
| 320 |
\end{dispListing} |
| 321 |
{\tcbusetemp} |
| 322 |
\end{docTcbKey} |
| 323 |
|
| 324 |
\clearpage |
| 325 |
\begin{docTcbKey}[][doc new=2015-03-13]{blend before title code}{=\meta{code}}{no default} |
| 326 |
This option formats the title output of \refKey{/tcb/new/blend into}. |
| 327 |
The \meta{code} takes one parameter, the name/number. |
| 328 |
Use this, if \refKey{/tcb/blend before title} is not flexible enough. |
| 329 |
|
| 330 |
\begin{dispListing} |
| 331 |
\newtcolorbox[blend into=figures]{myfigure}[2][]{float=htb,capture=hbox, |
| 332 |
blend before title code={\fbox{##1}\ },title={#2},every float=\centering,#1} |
| 333 |
|
| 334 |
\begin{myfigure}{A tcolorbox figure} |
| 335 |
\includegraphics[height=6cm]{lichtspiel.jpg} |
| 336 |
\end{myfigure} |
| 337 |
\end{dispListing} |
| 338 |
{\tcbusetemp} |
| 339 |
\end{docTcbKey} |
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
\clearpage |
| 344 |
\subsection{Lists of \texttt{tcolorbox}es}\label{sec:listsof} |
| 345 |
For figures and tables, \LaTeX\ provides the |\listoffigures| and |
| 346 |
|\listoftables| commands to create lists of these numbered entities. |
| 347 |
Also, a |tcolorbox| can be part of such a kind of list. |
| 348 |
\begin{enumerate} |
| 349 |
\item Assign a list \meta{name} by the \emph{initialization} option |
| 350 |
\refKey{/tcb/new/list inside}. |
| 351 |
\item Optionally, a new \meta{type} for list entries may be assigned |
| 352 |
by the \emph{initialization} option \refKey{/tcb/new/list type}. |
| 353 |
\item List entries a generated automatically within each new |tcolorbox| |
| 354 |
using the above initialization. |
| 355 |
\begin{itemize} |
| 356 |
\item If \refKey{/tcb/list entry} is set, the entry is generated with it. |
| 357 |
\item Otherwise, if \refKey{/tcb/title} is set, the entry is generated with it. |
| 358 |
\item Otherwise, the entry is generated with the current number and the environment name. |
| 359 |
\end{itemize} |
| 360 |
\item The generated list is displayed by \refCom{tcblistof}. |
| 361 |
\end{enumerate} |
| 362 |
|
| 363 |
\begin{newTcbKey}{list inside}{=\meta{name}}{no default, initially unset} |
| 364 |
Assigns a list or contents file to the generated |tcolorbox|es. |
| 365 |
Entries to this list are saved to a file which gets the \meta{name} as |
| 366 |
file name extension. The list is referenced by this name in |
| 367 |
\refCom{tcblistof}. |
| 368 |
For example: |
| 369 |
\begin{dispListing} |
| 370 |
list inside=exam |
| 371 |
\end{dispListing} |
| 372 |
See Section \ref{listing:exercises} from page \pageref{listing:exercises} |
| 373 |
for a complete example. |
| 374 |
\end{newTcbKey} |
| 375 |
|
| 376 |
|
| 377 |
\begin{newTcbKey}{list type}{=\meta{type}}{no default, initially |tcolorbox|} |
| 378 |
Optionally, some \meta{type} can be assigned to the list entries. |
| 379 |
For a new \meta{type}, a macro |\l@|\meta{type} has to exist which controls |
| 380 |
the format of the list entry. The default type is defined by |
| 381 |
\begin{dispListing} |
| 382 |
\newcommand*\l@tcolorbox{\@dottedtocline{1}{1.5em}{2.3em}} |
| 383 |
\end{dispListing} |
| 384 |
This is identical to the |\l@section| setting of \LaTeX. |\l@tcolorbox| can |
| 385 |
be redefined or a new \meta{type} can be assigned. |
| 386 |
\end{newTcbKey} |
| 387 |
|
| 388 |
|
| 389 |
\clearpage |
| 390 |
\begin{docCommand}[doc updated=2021-05-20]{tcblistof}{\oarg{macro}\marg{name}\oarg{short}\marg{title text}} |
| 391 |
Displays the generated list of |tcolorbox|es with the given \meta{name}. |
| 392 |
The heading is generated by \meta{macro}\oarg{short}\marg{title text} where \texttt{\textbackslash section} |
| 393 |
is the default setting for \meta{macro}. |
| 394 |
Here, as usual, \meta{title text} is the title of the section or chapter |
| 395 |
while \meta{short} is a shorter title for headings and table of contents. |
| 396 |
\begin{itemize} |
| 397 |
\item If \meta{macro} ends with a |*|, \refCom{tcblistof} mimics the behavior of |
| 398 |
|\listoffigures| from the standard \LaTeX\ classes and adds the title |
| 399 |
to the left and right mark for headings. |
| 400 |
\item If \meta{macro} starts with |\chapter|, a possible two column document setting |
| 401 |
is restored to one column (as standard \LaTeX\ classes do for |\listoffigures|). |
| 402 |
\end{itemize} |
| 403 |
|
| 404 |
\medskip |
| 405 |
To display the list inside a subsection, use for example: |
| 406 |
\begin{dispListing} |
| 407 |
\tcblistof[\subsection]{exam}{List of Exercises} |
| 408 |
\end{dispListing} |
| 409 |
The result of the example is found as Subsection \ref{listofexercises} on |
| 410 |
page \pageref{listofexercises}. |
| 411 |
|
| 412 |
\medskip |
| 413 |
To apply the list similar to |\listoffigures| for a report or book, use for example: |
| 414 |
\begin{dispListing} |
| 415 |
\tcblistof[\chapter*]{exam}{List of Exercises} |
| 416 |
\end{dispListing} |
| 417 |
|
| 418 |
\medskip |
| 419 |
To set a short title for headings with the default |\section| setting, use for example: |
| 420 |
\begin{dispListing} |
| 421 |
\tcblistof{exam}[List of Exercises]{Elaborate List of Fine Exercises |
| 422 |
for all Students of my Course} |
| 423 |
\end{dispListing} |
| 424 |
|
| 425 |
\begin{marker} |
| 426 |
The core of the list is generated by |\@starttoc|\marg{name} which |
| 427 |
can be wrapped into an own macro. |
| 428 |
\end{marker} |
| 429 |
\end{docCommand} |
| 430 |
|
| 431 |
\clearpage |
| 432 |
|
| 433 |
\begin{marker} |
| 434 |
The following options are not initialization options, but common options, |
| 435 |
which are typically reasonable in connection with lists of |tcolorbox|es. |
| 436 |
\end{marker} |
| 437 |
|
| 438 |
\begin{docTcbKey}{list entry}{=\meta{text}}{no default, initially unset} |
| 439 |
If the \flqq list of tcolorbox(es)\frqq\ feature described in |
| 440 |
%Subsection \ref{sec:listsof} from page \pageref{sec:listsof} |
| 441 |
the current subsection |
| 442 |
is used, this key |
| 443 |
describes the \meta{text} for an entry into the generated list, e.\,g. |
| 444 |
\begin{dispListing} |
| 445 |
list entry={\protect\numberline{\thetcbcounter}My beautiful Example} |
| 446 |
\end{dispListing} |
| 447 |
See Section \ref{listing:exercises} from page \pageref{listing:exercises} |
| 448 |
for a complete example.\par |
| 449 |
If \refCom{thetcbcounter} is omitted, \refKey{/tcb/list entry} could be used for |
| 450 |
unnumbered boxes too. |
| 451 |
\begin{marker} |
| 452 |
This is a customization option. For numbered boxes, \refKey{/tcb/list entry} |
| 453 |
typically has not to be given, because this entry will be generated automatically. |
| 454 |
\end{marker} |
| 455 |
\end{docTcbKey} |
| 456 |
|
| 457 |
\begin{docTcbKey}[][doc new=2014-09-19]{list text}{=\meta{text}}{style, no default} |
| 458 |
This is a shortcut for setting \refKey{/tcb/list entry} to\\ |
| 459 |
|\protect\numberline{\thetcbcounter}|\meta{text}. |
| 460 |
So, the following settings are identical: |
| 461 |
\begin{dispListing} |
| 462 |
list text={My beautiful Example}, |
| 463 |
list entry={\protect\numberline{\thetcbcounter}My beautiful Example} |
| 464 |
\end{dispListing} |
| 465 |
See Section \ref{listing:exercises} from page \pageref{listing:exercises} |
| 466 |
for a complete example. |
| 467 |
\end{docTcbKey} |
| 468 |
|
| 469 |
\begin{docTcbKey}{add to list}{=\marg{list}\marg{type}}{no default, initially unset} |
| 470 |
If the \flqq list of tcolorbox(es)\frqq\ feature described in |
| 471 |
%Subsection \ref{sec:listsof} from page \pageref{sec:listsof} |
| 472 |
the current subsection |
| 473 |
is used, list entries are |
| 474 |
generated automatically. With this key, you can enforce an entry to the |
| 475 |
given \meta{list} with the given \meta{type}. |
| 476 |
This issues:\par |
| 477 |
|\addcontentsline|\marg{list}\marg{type}\marg{entry text}\par |
| 478 |
\meta{entry text} may be given by \refKey{/tcb/list entry}. |
| 479 |
\begin{marker} |
| 480 |
This is a customization option. For numbered boxes, this feature is configured |
| 481 |
automatically, where |
| 482 |
\meta{list} is set by \refKey{/tcb/new/list inside} and |
| 483 |
\meta{type} is set by \refKey{/tcb/new/list type} |
| 484 |
\end{marker} |
| 485 |
\end{docTcbKey} |
| 486 |
|