summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tcolorbox/tcbdocumentation.code.tex
blob: a9475d0f860e2963cc0d9847716c3c57c4eb3ed6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
%% The LaTeX package tcolorbox - version 4.21 (2019/09/19)
%% tcbdocumentation.code.tex: Code for LaTeX documentations
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2006-2019 by Prof. Dr. Dr. Thomas F. Sturm <thomas dot sturm at unibw dot de>
%% -------------------------------------------------------------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%%
%% This work consists of all files listed in README
%%
\tcb@set@library@version{4.21}

\tcbuselibrary{listings,skins,xparse,external}

\RequirePackage{pifont}[2005/04/12]
\RequirePackage{marvosym}[2011/07/20]
\ifdefined\printindex\else\RequirePackage{makeidx}[2000/03/29]\fi
\RequirePackage{refcount}[2011/10/16]
\RequirePackage{hyperref}[2012/02/06]
\ifdefined\marginnote\else\RequirePackage{marginnote}[2012/03/29]\fi

\definecolor{Option}{rgb}{0.118,0.546,0.222}
\definecolor{Definition}{rgb}{0.784,0.06,0.176}
\definecolor{ExampleFrame}{rgb}{0.628,0.705,0.942}
\definecolor{ExampleBack}{rgb}{0.963,0.971,0.994}
\definecolor{Hyperlink}{rgb}{0.281,0.275,0.485}
\definecolor{Fade}{rgb}{0.5,0.5,0.5}

\def\colDef#1{\textcolor{\kvtcb@col@command}{#1}}
\def\colOpt#1{\textcolor{\kvtcb@col@opt}{#1}}
\def\colFade#1{\textcolor{\kvtcb@col@fade}{#1}}

\lstdefinestyle{tcbdocumentation}{language={[LaTeX]TeX},
    aboveskip={0\p@ \@plus 6\p@},
    belowskip={0\p@ \@plus 6\p@},
    columns=fullflexible,
    keepspaces=true,
    breaklines=true,
    prebreak={\Righttorque},
    postbreak={\space\Lefttorque},
    breakatwhitespace=true,
    basicstyle=\ttfamily\footnotesize,
    extendedchars=true,
    moredelim={[is][\itshape\rmfamily]{^^a7}{^^a7}},
    nolol,inputencoding=\kvtcb@listingencoding}

% The following macros are taken from ltxdoc
\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
\def\meta@font@select{\rmfamily\itshape}

\AtEndPreamble{%
  \@ifpackageloaded{doc}{%
  }{% code taken from doc.sty
    \ifx\l@nohyphenation\undefined
      \newlanguage\l@nohyphenation
    \fi
    \DeclareRobustCommand\meta[1]{%
         \ensuremath\langle
         \ifmmode \expandafter \nfss@text \fi
         {%
          \meta@font@select
          \edef\meta@hyphen@restore
            {\hyphenchar\the\font\the\hyphenchar\font}%
          \hyphenchar\font\m@ne
          \language\l@nohyphenation
          #1\/%
          \meta@hyphen@restore
         }\ensuremath\rangle
    }%
  }%
}%

\def\marg#1{%
  {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
\def\oarg#1{%
  \colOpt{{\ttfamily[}\meta{#1}{\ttfamily]}}}

\newrobustcmd\tcb@cs[1]{{\catcode`\_=12\relax\catcode`\@11\relax\ttfamily\char`\\\scantokens{#1}\unskip}}
\newrobustcmd\tcb@scantokens[1]{{\catcode`\_=12\relax\catcode`\@11\relax\ttfamily\scantokens{#1}\unskip}}

\newif\iftcb@doc@toindex
\newif\iftcb@doc@colorize
\newif\iftcb@doc@annotate

% language specific texts
\tcbset{
  doclang/.cd,
  color/.store in=\kvtcb@text@color,
  colors/.store in=\kvtcb@text@colors,
  counter/.store in=\kvtcb@text@counter,
  counters/.store in=\kvtcb@text@counters,
  environment content/.store in=\kvtcb@text@envcontent,
  environment/.store in=\kvtcb@text@env,
  environments/.store in=\kvtcb@text@envs,
  index/.store in=\kvtcb@text@index,
  key/.store in=\kvtcb@text@key,
  keys/.store in=\kvtcb@text@keys,
  length/.store in=\kvtcb@text@length,
  lengths/.store in=\kvtcb@text@lengths,
  new/.store in=\kvtcb@text@new,
  path/.store in=\kvtcb@text@path,
  paths/.store in=\kvtcb@text@paths,
  pageshort/.store in=\kvtcb@text@pageshort,
  updated/.store in=\kvtcb@text@updated,
  value/.store in=\kvtcb@text@value,
  values/.store in=\kvtcb@text@values,
}

% documentation options
\tcbset{
  documentation listing options/.store in=\kvtcb@doclistingoptions,%
  documentation listing style/.style={documentation listing options={style=#1}},%
  documentation minted language/.store in=\kvtcb@docminted@language,
  documentation minted style/.store in=\kvtcb@docmintstyle,
  documentation minted options/.store in=\kvtcb@docmintoptions,
  color command/.store in=\kvtcb@col@command,
  color environment/.store in=\kvtcb@col@environment,
  color key/.store in=\kvtcb@col@key,
  color value/.store in=\kvtcb@col@value,
  color counter/.store in=\kvtcb@col@counter,
  color length/.store in=\kvtcb@col@length,
  color color/.store in=\kvtcb@col@color,
  color fade/.store in=\kvtcb@col@fade,
  color path/.store in=\kvtcb@col@path,
  color definition/.style={color command={#1},color environment={#1},color key={#1},
    color value={#1},color color={#1},color counter={#1},color length={#1}, color path={#1}},
  color option/.store in=\kvtcb@col@opt,
  color hyperlink/.store in=\kvtcb@colhyper,
  color frame/.store in=\kvtcb@colhyper,
  index actual/.store in=\idx@actual,
  index quote/.store in=\idx@quote,
  index level/.store in=\idx@level,
  index format/.store in=\idx@format,
  index colorize/.is if=tcb@doc@colorize,%
  index annotate/.is if=tcb@doc@annotate,%
  index command/.code={\def\kvtcb@index@command##1{#1{##1}}},%
  index command name/.code={\def\kvtcb@index@command##1{\index[#1]{##1}}},%
  doc left/.dimstore in=\kvtcb@doc@left,
  doc right/.dimstore in=\kvtcb@doc@right,
  doc left indent/.dimstore in=\kvtcb@doc@indentleft,
  doc right indent/.dimstore in=\kvtcb@doc@indentright,
  doc head command/.style={doc@head@command/.style={#1}},
  doc head environment/.style={doc@head@environment/.style={#1}},
  doc head key/.style={doc@head@key/.style={#1}},
  doc head path/.style={doc@head@path/.style={#1}},
  doc head/.style={doc head command={#1},doc head environment={#1},doc head key={#1},
    doc head path={#1}},
  doc label/.store in=\kvtcb@doc@label,
  before doc body command/.store in=\kvtcb@doc@body@command@before,
  after doc body command/.store in=\kvtcb@doc@body@command@after,
  before doc body environment/.store in=\kvtcb@doc@body@environment@before,
  after doc body environment/.store in=\kvtcb@doc@body@environment@after,
  before doc body key/.store in=\kvtcb@doc@body@key@before,
  after doc body key/.store in=\kvtcb@doc@body@key@after,
  before doc body path/.store in=\kvtcb@doc@body@path@before,
  after doc body path/.store in=\kvtcb@doc@body@path@after,
  before doc body/.style={before doc body command={#1},before doc body environment={#1},
    before doc body key={#1},before doc body path={#1}},
  after doc body/.style={after doc body command={#1},after doc body environment={#1}
    ,after doc body key={#1},after doc body path={#1}},
  doc description/.store in=\kvtcb@doc@description,%
  doc into index/.is if=tcb@doc@toindex,%
  doc updated/.style={before upper={\tcbdocmarginnote{\tcbdocupdated{#1}}}},
  doc new/.style={before upper={\tcbdocmarginnote{\tcbdocnew{#1}}}},
  doc new and updated/.style 2 args={before upper={\tcbdocmarginnote{\tcbdocnew{#1}\\\tcbdocupdated{#2}}}},
  doc marginnote/.style={doc@marginnote/.style={#1}},
  keywords bold/.is choice,%
  keywords bold/.default=true,%
  keywords bold/true/.code={\let\tcb@doc@bfseries\bfseries},
  keywords bold/false/.code={\let\tcb@doc@bfseries\mdseries},
}


% styles
\tcbset{
  docexample/.style={colframe=ExampleFrame,colback=ExampleBack,
    before skip=\medskipamount,after skip=\medskipamount,
    fontlower=\footnotesize},
  documentation minted language=latex,
  documentation minted style=,
  documentation minted options={tabsize=2,fontsize=\small},
  index default settings/.style={index actual={@},index quote={"},index level={!}},
  index german settings/.style={index actual={=},index quote={!},index level={>}},
  english language/.code={\tcbset{doclang/.cd,
    color=color,colors=Colors,
    counter=counter,counters=Counters,
    environment content=environment content,
    environment=environment,environments=Environments,
    path=path operation,paths=Path operations,
    index=Index,
    key=key,keys=Keys,
    length=length,lengths=Lengths,
    new=New,
    pageshort={P.},
    updated=Updated,
    value=value,values=Values}},
}

\AtBeginDocument{%
  \csname tcb@doc@index@\idx@format\endcsname%
  \hypersetup{
  citecolor=\kvtcb@colhyper,
  linkcolor=\kvtcb@colhyper,
  urlcolor=\kvtcb@colhyper,
  filecolor=\kvtcb@colhyper,
  menucolor=\kvtcb@colhyper
}}

\def\dispExample{\tcb@layer@pushup\tcbset{docexample}\begingroup\tcbwritetemp}

\def\enddispExample{%
  \endtcbwritetemp\endgroup%
  \begin{tcolorbox}%
  \tcb@doc@usetemplisting%
  \tcblower%
  \tcbusetemp%
  \end{tcolorbox}%
}

\newenvironment{dispExample*}[1]{%
  \tcb@layer@pushup\tcbset{docexample,#1}\begingroup\tcbwritetemp%
  }{\enddispExample}

\def\dispListing{\tcb@layer@pushup\tcbset{docexample}\begingroup\tcbwritetemp}

\def\enddispListing{%
  \endtcbwritetemp\endgroup%
  \begin{tcolorbox}%
  \tcb@doc@usetemplisting%
  \end{tcolorbox}%
}

\newenvironment{dispListing*}[1]{%
  \tcb@layer@pushup\tcbset{docexample,#1}\begingroup\tcbwritetemp%
  }{\enddispListing}

% index auxiliary macros
\def\tcb@Index@Print@CA#1#2#3{%
  \iftcb@doc@colorize\textcolor{#2}{\tcb@scantokens{#1}}\else\tcb@scantokens{#1}\fi%
  \iftcb@doc@annotate\ #3\fi%
}

\def\tcb@Index@Print@C#1#2{%
  \iftcb@doc@colorize\textcolor{#2}{\tcb@scantokens{#1}}\else\tcb@scantokens{#1}\fi%
}

\def\tcb@Index@Print@ComCA#1#2#3{%
  \iftcb@doc@colorize\textcolor{#2}{\tcb@cs{#1}}\else\tcb@cs{#1}\fi%
  \iftcb@doc@annotate\ #3\fi%
}

\def\tcb@Index@Print@ComC#1#2{%
  \iftcb@doc@colorize\textcolor{#2}{\tcb@cs{#1}}\else\tcb@cs{#1}\fi%
}

\newrobustcmd{\tcbIndexPrintComC}[1]{\tcb@Index@Print@ComC{#1}{\kvtcb@col@command}}
\def\tcb@Print@Com#1{\textcolor{\kvtcb@col@command}{\tcb@doc@bfseries\tcb@cs{#1}}}

\newrobustcmd{\tcbIndexPrintEnvCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@environment}{\kvtcb@text@env}}
\newrobustcmd{\tcbIndexPrintEnvC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@environment}}
\def\tcb@Print@Env#1{\textcolor{\kvtcb@col@environment}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintKeyCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@key}{\kvtcb@text@key}}
\newrobustcmd{\tcbIndexPrintKeyC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@key}}
\def\tcb@Print@Key#1{\textcolor{\kvtcb@col@key}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintPathCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@path}{\kvtcb@text@path}}
\newrobustcmd{\tcbIndexPrintPathC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@path}}
\def\tcb@Print@Path#1{\textcolor{\kvtcb@col@path}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintValCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@value}{\kvtcb@text@value}}
\newrobustcmd{\tcbIndexPrintValC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@value}}
\def\tcb@Print@Val#1{\textcolor{\kvtcb@col@value}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintColCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@color}{\kvtcb@text@color}}
\newrobustcmd{\tcbIndexPrintColC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@color}}
\def\tcb@Print@Col#1{\textcolor{\kvtcb@col@color}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintCountCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@counter}{\kvtcb@text@counter}}
\newrobustcmd{\tcbIndexPrintCountC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@counter}}
\def\tcb@Print@Count#1{\textcolor{\kvtcb@col@counter}{\tcb@doc@bfseries\tcb@scantokens{#1}}}

\newrobustcmd{\tcbIndexPrintLenCA}[1]{\tcb@Index@Print@ComCA{#1}{\kvtcb@col@length}{\kvtcb@text@length}}
\newrobustcmd{\tcbIndexPrintLenC}[1]{\tcb@Index@Print@ComC{#1}{\kvtcb@col@length}}
\def\tcb@Print@Len#1{\textcolor{\kvtcb@col@length}{\tcb@doc@bfseries\tcb@cs{#1}}}

\def\tcb@index@Com#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintComC{#1}}\fi}
\def\tcb@index@Env#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintEnvCA{#1}}\kvtcb@index@command{\kvtcb@text@envs\idx@level#1\idx@actual\tcbIndexPrintEnvC{#1}}\fi}
\def\tcb@index@Key#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintKeyCA{#1}}\kvtcb@index@command{\kvtcb@text@keys\idx@level#1\idx@actual\tcbIndexPrintKeyC{#1}}\fi}%
\def\tcb@index@KeyPath#1#2{\iftcb@doc@toindex\kvtcb@index@command{#2\idx@actual\tcbIndexPrintKeyCA{#2}}\kvtcb@index@command{\kvtcb@text@keys\idx@level#1\idx@actual\tcbIndexPrintKeyC{/#1/}\idx@level#2\idx@actual\tcbIndexPrintKeyC{#2}}\fi}%
\def\tcb@index@Path#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintPathCA{#1}}\kvtcb@index@command{\kvtcb@text@paths\idx@level#1\idx@actual\tcbIndexPrintPathC{#1}}\fi}
\def\tcb@index@Val#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintValCA{#1}}\kvtcb@index@command{\kvtcb@text@values\idx@level#1\idx@actual\tcbIndexPrintValC{#1}}\fi}
\def\tcb@index@Col#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintColCA{#1}}\kvtcb@index@command{\kvtcb@text@colors\idx@level#1\idx@actual\tcbIndexPrintColC{#1}}\fi}
\def\tcb@index@Count#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintCountCA{#1}}\kvtcb@index@command{\kvtcb@text@counters\idx@level#1\idx@actual\tcbIndexPrintCountC{#1}}\fi}
\def\tcb@index@Len#1{\iftcb@doc@toindex\kvtcb@index@command{#1\idx@actual\tcbIndexPrintLenCA{#1}}\kvtcb@index@command{\kvtcb@text@lengths\idx@level#1\idx@actual\tcbIndexPrintLenC{#1}}\fi}

\def\brackets#1{{\ttfamily\char`\{}#1{\ttfamily\char`\}}}

\newenvironment{tcb@manual@entry}{\begin{list}{}{%
  \setlength{\leftmargin}{\kvtcb@doc@left}%
  \setlength{\itemindent}{0pt}%
  \setlength{\itemsep}{0pt}%
  \setlength{\parsep}{0pt}%
  \setlength{\rightmargin}{\kvtcb@doc@right}%
  }\item}{\end{list}}

\def\tcb@manual@top#1{\itemsep=0pt\parskip=0pt\item\strut{#1}\par\topsep=0pt}

\def\tcb@doc@do@description{%
  \ifx\kvtcb@doc@description\@empty\else\tcblower\raggedleft(\kvtcb@doc@description)\fi%
}

\newtcolorbox{tcb@doc@head}[1]{blank,colback=white,colframe=white,
  code={\tcbdimto\tcb@temp@grow@left{-\kvtcb@doc@indentleft}%
        \tcbdimto\tcb@temp@grow@right{-\kvtcb@doc@indentright}},
  grow to left by=\tcb@temp@grow@left,%
  grow to right by=\tcb@temp@grow@right,
  sidebyside,sidebyside align=top,
  sidebyside gap=-\tcb@w@upper@real,
  phantom=\phantomsection,%
  enlarge bottom by=-0.2\baselineskip,#1}

% main documentation environments
\newenvironment{docCommand}[3][]{\tcbset{doc label={#2},#1}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@command}%
  \tcb@Print@Com{#2}\tcb@index@Com{#2}\protected@edef\@currentlabel{\noexpand\tcb@cs{#2}}\label{com:\kvtcb@doc@label}{\ttfamily #3}%
  \tcb@doc@do@description%
  \end{tcb@doc@head}\nobreak\tcbset{before upper=}\kvtcb@doc@body@command@before\ignorespaces}%
  {\ifvmode\else\unskip\fi\kvtcb@doc@body@command@after\end{tcb@manual@entry}}

\newenvironment{docCommand*}{\bgroup\tcb@doc@toindexfalse\begin{docCommand}}{\end{docCommand}\egroup}

\newenvironment{docEnvironment}[3][]{\tcbset{doc label={#2},#1}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@environment}%
  \strut\cs{begin}\brackets{\tcb@Print@Env{#2}}\tcb@index@Env{#2}\protected@edef\@currentlabel{#2}\label{env:\kvtcb@doc@label}{\ttfamily #3}\par%
  \strut~~\meta{\kvtcb@text@envcontent}\par%
  \strut\cs{end}\brackets{\tcb@Print@Env{#2}}%
  \tcb@doc@do@description%
  \end{tcb@doc@head}\nobreak\tcbset{before upper=}\kvtcb@doc@body@environment@before\ignorespaces}%
  {\ifvmode\else\unskip\fi\kvtcb@doc@body@environment@after\end{tcb@manual@entry}}

\newenvironment{docEnvironment*}{\bgroup\tcb@doc@toindexfalse\begin{docEnvironment}}{\end{docEnvironment}\egroup}

\NewDocumentEnvironment{docKey}{ O{} +O{} m m +m }{\tcbset{doc label={#3},#2,doc description={#5}}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@key}%
  \ifblank{#1}{%
    \tcb@Print@Key{#3}\tcb@index@Key{#3}\protected@edef\@currentlabel{#3}\label{key:\kvtcb@doc@label}{\ttfamily #4}%
  }{%
    \tcb@Print@Key{/#1/#3}%
    \tcb@index@KeyPath{#1}{#3}\protected@edef\@currentlabel{/#1/#3}\label{key:/#1/\kvtcb@doc@label}{\ttfamily #4}%
  }%
  \tcb@doc@do@description%
  \end{tcb@doc@head}\nobreak\tcbset{before upper=}\kvtcb@doc@body@key@before\ignorespaces}%
  {\ifvmode\else\unskip\fi\kvtcb@doc@body@key@after\end{tcb@manual@entry}}

\newenvironment{docKey*}{\bgroup\tcb@doc@toindexfalse\begin{docKey}}{\end{docKey}\egroup}

\def\tcbmakedocSubKey#1#2{%
  \NewDocumentEnvironment{#1}{ O{} +O{} m m +m }{%
    \ifblank{##1}{\def\tcb@key@path{#2}}{\def\tcb@key@path{#2/##1}}%
    \begin{docKey}[\tcb@key@path][##2]{##3}{##4}{##5}}%
      {\end{docKey}}%
  \newenvironment{#1*}{\bgroup\tcb@doc@toindexfalse\begin{#1}}{\end{#1}\egroup}%
}

\newenvironment{docPathOperation}[3][]{\tcbset{doc label={#2},#1}%
  \begin{tcb@manual@entry}%
  \begin{tcb@doc@head}{doc@head@path}%
  \colFade{\tcb@cs{path ...}}\
  \tcb@Print@Path{#2}\tcb@index@Path{#2}\protected@edef\@currentlabel{#2}\label{path:\kvtcb@doc@label}{\ttfamily #3}%
  \ \colFade{\tcb@scantokens{...;}}
  \tcb@doc@do@description%
  \end{tcb@doc@head}\nobreak\tcbset{before upper=}\kvtcb@doc@body@path@before\ignorespaces}%
  {\ifvmode\else\unskip\fi\kvtcb@doc@body@path@after\end{tcb@manual@entry}}

\newenvironment{docPathOperation*}{\bgroup\tcb@doc@toindexfalse\begin{docPathOperation}}{\end{docPathOperation}\egroup}

\DeclareDocumentCommand\docAuxCommand{sm}{%
  \tcb@Print@Com{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Com{#2}}%
}

\DeclareDocumentCommand\docAuxEnvironment{sm}{%
  \tcb@Print@Env{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Env{#2}}%
}

\DeclareDocumentCommand\docAuxKey{sO{}m}{%
  \ifblank{#2}{%
    \tcb@Print@Key{#3}%
    \IfBooleanTF{#1}{}{\tcb@index@Key{#3}}%
  }{%
    \tcb@Print@Key{/#2/#3}%
    \IfBooleanTF{#1}{}{\tcb@index@KeyPath{#2}{#3}}%
}}

\DeclareDocumentCommand\docColor{sm}{%
  \tcb@Print@Col{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Col{#2}}%
}

\DeclareDocumentCommand\docCounter{sm}{%
  \tcb@Print@Count{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Count{#2}}%
}

\DeclareDocumentCommand\docLength{sm}{%
  \tcb@Print@Len{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Len{#2}}%
}

\DeclareDocumentCommand\docValue{sm}{%
  \tcb@Print@Val{#2}%
  \IfBooleanTF{#1}{}{\tcb@index@Val{#2}}%
}

\setrefcountdefault{-1}
\DeclareDocumentCommand\tcb@ref@doc{msm}{%
  \hyperref[#1:#3]{\texttt{\ref*{#1:#3}}%
  \IfBooleanTF{#2}{}{%
    \ifnum\getpagerefnumber{#1:#3}=\thepage%
    \else%
      \textsuperscript{\ding{213}\,\kvtcb@text@pageshort\,\pageref*{#1:#3}}%
    \fi}}%
}

\def\refCom{\tcb@ref@doc{com}}
\def\refEnv{\tcb@ref@doc{env}}
\def\refKey{\tcb@ref@doc{key}}
\def\refPathOperation{\tcb@ref@doc{path}}

\def\refAux#1{\textcolor{\kvtcb@colhyper}{\tcb@scantokens{#1}}}
\def\refAuxcs#1{\textcolor{\kvtcb@colhyper}{\tcb@cs{#1}}}

\newenvironment{absquote}
               {\list{}{\leftmargin2cm\rightmargin\leftmargin}%
                \item\relax\footnotesize}
               {\endlist}

\newcommand{\tcbdocmarginnote}[2][]{%
  \marginnote{%
  \begin{tcolorbox}[enhanced jigsaw,size=fbox,boxrule=1pt,leftrule=0pt,rightrule=0pt,
    arc=0pt,outer arc=1pt,boxsep=1pt,top=1pt,bottom=1pt,
    nobeforeafter,width=\marginparwidth,
    colframe=red!50!white,colback=red!25!yellow!5!white,fontupper=\scriptsize,
    if odd page or oneside={flushright upper}{flushleft upper},
    doc@marginnote,#1]#2\end{tcolorbox}}}

\newcommand*{\tcbdocnew}[1]{\kvtcb@text@new: #1}
\newcommand*{\tcbdocupdated}[1]{\kvtcb@text@updated: #1}

%--- index macros taken from pgfmanual-en-macros
\def\tcb@doc@index@pgf@{%
  \ifdefined\c@IndexColumns%
    \c@IndexColumns=2%
  \fi%
  \def\theindex{\@restonecoltrue
    \columnseprule \z@  \columnsep 29\p@
    \twocolumn[\index@prologue]%
    \parindent -30pt%
    \columnsep 15pt%
    \parskip 0pt plus 1pt%
    \leftskip 30pt%
    \rightskip 0pt plus 2cm%
    \small%
    \def\@idxitem{\par}%
    \let\item\@idxitem\ignorespaces}
  \def\endtheindex{\onecolumn}%
  \def\noindexing{\let\index=\@gobble}%
}

\def\tcb@doc@index@pgfsection{%
  \def\index@prologue{\section*{\kvtcb@text@index}\addcontentsline{toc}{section}{\kvtcb@text@index}%
    \par\noindent%
  }%
  \tcb@doc@index@pgf@%
}

\def\tcb@doc@index@pgfchapter{%
  \def\index@prologue{\ifdefined\phantomsection\phantomsection\fi\@makeschapterhead{\kvtcb@text@index}\addcontentsline{toc}{chapter}{\kvtcb@text@index}}%
  \tcb@doc@index@pgf@%
}

\let\tcb@doc@index@pgf=\tcb@doc@index@pgfsection%

\def\tcb@doc@index@doc{%
  \let\tcb@index@Com=\SpecialMainIndex%%
  \let\tcb@index@Env=\SpecialMainEnvIndex%
  \tcbset{index german settings}%
  \EnableCrossrefs%
  \PageIndex%
}

\def\tcb@doc@index@off{}%

\tcbset{%
  reset@documentation/.style={%
    },
  documentation listing style=tcbdocumentation,
  doc left=2em,
  doc right=0pt,
  doc left indent=-2em,
  doc right indent=0pt,
  doc head=,
  before doc body=,
  after doc body=,
  doc description=,
  doc into index=true,
  doc marginnote=,
  initialize@reset=reset@documentation,
  color option=Option,
  color definition=Definition,
  color hyperlink=Hyperlink,
  color fade=Fade,
  index command=\index,%
  index format=pgf,
  index default settings,
  index colorize=false,
  index annotate=true,
  english language,
  keywords bold,
}

% deprecated
\tcbset{
  before example/.store in=\kvtcb@beforeexample,
  after example/.store in=\kvtcb@afterexample,
    before example=\par\smallskip,
    after example=,
}