summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tcolorbox/tcolorbox.doc.s_main.sty
blob: 80604e3d0499b2e744c1db90617cc065dfeba5a5 (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
% !TeX root = tcolorbox.tex
% include file (style) of tcolorbox.tex (manual of the LaTeX package tcolorbox)
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.7em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{4.2em}{3.2em}}

\RequirePackage[T1]{fontenc}
\RequirePackage[latin1]{inputenc}
\RequirePackage[english]{babel}
\RequirePackage{lmodern,parskip,array,ifthen,calc}
\RequirePackage{amsmath,amssymb}
\RequirePackage[svgnames,table,hyperref]{xcolor}
\RequirePackage{tikz}
\RequirePackage{varioref}
%\RequirePackage[makeindex]{imakeidx}
\RequirePackage[pdftex,bookmarks,raiselinks,pageanchor,hyperindex,colorlinks]{hyperref}
\RequirePackage{bookmark,varwidth,cleveref,incgraph}

\RequirePackage[a4paper,left=2.5cm,right=2.5cm,top=1.5cm,bottom=1.5cm,
    marginparsep=3mm,marginparwidth=18mm,
    headheight=0mm,headsep=0cm,
    footskip=1.5cm,includeheadfoot%,showframe
    ]{geometry}
\RequirePackage{fancyhdr}
\fancyhf{}
\fancyfoot[C]{\thepage}%
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}
\tolerance=2000%
\setlength{\emergencystretch}{20pt}%


\usetikzlibrary{shadings,shadows}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{patterns}
\usetikzlibrary{spy}
\usetikzlibrary{arrows.meta}

\RequirePackage{array,tabularx}
\RequirePackage{amsmath}
\RequirePackage{lipsum}
\RequirePackage{empheq}
\RequirePackage[extendedchars,encoding,filenameencoding=utf-8]{grffile}

\providecommand{\tcbpkgprefix}{}
\RequirePackage{\tcbpkgprefix tcolorbox}

\tcbuselibrary{most,documentation}
\tcbifexternal{}{%
  \tcbuselibrary{minted}%
  \tcbset{listing engine=listings,initialize@reset={listing engine=listings}}%
}

\tcbset{skin=enhanced,
  doc head={colback=yellow!10!white,interior style=fill},
  doc head key={colback=magenta!5!white,interior style=fill},
  doc head path={colback=blue!50!gray!7!white,interior style=fill},
  color key=DarkViolet,
  color value=Teal,
  color color=Teal,
  color counter=Orange!85!black,
  color length=Orange!85!black,
  index colorize,
  index annotate,
}
\urlstyle{sf}

\tcbmakedocSubKey{docTcbKey}{tcb}
\tcbmakedocSubKeys{docTcbKeys}{tcb}
\tcbmakedocSubKey{langTcbKey}{tcb/doclang}
\tcbmakedocSubKey{newTcbKey}{tcb/new}
\tcbmakedocSubKey{boxTcbKey}{tcb/boxtitle}
\tcbmakedocSubKey{extTcbKey}{tcb/external}
\tcbmakedocSubKey{vigTcbKey}{tcb/vig}
\tcbmakedocSubKey{posterTcbKey}{tcb/poster}
\tcbmakedocSubKey{posterlocTcbKey}{tcb/posterloc}
\tcbmakedocSubKey{postersetTcbKey}{tcb/posterset}
\tcbmakedocSubKey{docTikzKey}{tikz}

\def\tikzname{Ti\emph{k}Z}


\newrobustcmd{\tcbIndexPrintSkinCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@key}{Skin}}
\newrobustcmd{\tcbIndexPrintSkinC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@key}}
\def\refSkin{\tcb@ref@doc{skin}}

\newrobustcmd{\tcbIndexPrintFadCA}[1]{\tcb@Index@Print@CA{#1}{\kvtcb@col@value}{fading}}
\newrobustcmd{\tcbIndexPrintFadC}[1]{\tcb@Index@Print@C{#1}{\kvtcb@col@value}}


\ExplSyntaxOn

\NewDocumentEnvironment{docSkin}{ O{} m }
  {
    \__tcobox_doc_entry_begin:nnn
      {
        doc~keypath=tcb,
        doc~name={skin},
        doc~label={skin=#2},
        doc~parameter={=\docValue*[nophantom]{#2}},
        doc~description={skin},
        #1,
        doc~no~index,
        doc~head~key =
        {
          colback=magenta!5!white,interior~style=fill,
          phantom=
            {
              \protected@edef\@currentlabel{#2}
              \label{skin:#2}
              \index{#2\idx@actual\tcbIndexPrintSkinCA{#2}}
              \index{Skins\idx@level#2\idx@actual\tcbIndexPrintSkinC{#2}}
            },
        }
      }
      {}{key}
  }
  {
    \__tcobox_doc_entry_end:n { key }
  }


\NewDocumentCommand \docFading { s +O{} m }
  {
    \group_begin:
    \tcbset{doc~name={#3},#2}
    \textcolor{\kvtcb@col@value}{\__tcobox_print_docname:}
    \IfBooleanF{#1}
      {
        \kvtcb@index@command{\kvtcb@doc@sortindex\idx@actual\tcbIndexPrintFadCA{\kvtcb@doc@index}}
        \kvtcb@index@command{Fadings\idx@level\kvtcb@doc@sortindex\idx@actual\tcbIndexPrintFadC{\kvtcb@doc@index}}
      }
    \group_end:
  }

\ExplSyntaxOff



\newtcolorbox{marker}[1][]{enhanced,
  before skip=2mm,after skip=3mm,
  boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm,
  colback=yellow!50,
  colframe=yellow!20!black,
  sharp corners,rounded corners=southeast,arc is angular,arc=3mm,
  underlay={%
    \path[fill=tcbcolback!80!black] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
    \path[draw=tcbcolframe,shorten <=-0.05mm,shorten >=-0.05mm] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
    \path[fill=yellow!50!black,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries !} ([xshift=4mm]interior.north west);
    },
  drop fuzzy shadow,#1}


\renewcommand*{\tcbdocnew}[1]{\textcolor{green!50!black}{\sffamily\bfseries N} #1}
\renewcommand*{\tcbdocupdated}[1]{\textcolor{blue!75!black}{\sffamily\bfseries U} #1}

\newcounter{texexp}
\newcounter{texercise}
\newcounter{mytheorem}[section]

\newcounter{myexample}

\newcounter{example}
\newlength{\examlen}
\newsavebox\mysavebox

\lstdefinestyle{mydocumentation}{style=tcbdocumentation,
  classoffset=0,
  texcsstyle=*\color{blue},
  % LaTeX and other packages
  moretexcs={arrayrulecolor,draw,includegraphics,ifthenelse,isodd,lipsum,path,pgfkeysalso},
  classoffset=1,
  % tcolorbox macros
  moretexcs={% core
    endtcolorbox,endtcbverbatimwrite,newtcolorbox,newtcbox,newtcboxfit,tcbusetemp,tcbtitle,tcbtitletext,
    tcblower,tcbox,tcboxfit,tcbset,tcbuselibrary,tcolorbox,tcbverbatimwrite,tcbsetforeverylayer,tcbsubtitle,
    tcolorboxenvironment,tcblistof,tcbstartrecording,tcbrecord,tcbstoprecording,tcbinputrecords,
    tcbpatcharcangular,tcbpatcharcround,tcbifoddpage,thetcolorboxnumber,thetcolorboxpage,
    tcbheightfromgroup,tcbheightspace,tcbtextwidth,tcbtextheight,
    % listings
    endtcblisting,newtcblisting,newtcbinputlisting,
    tcblisting,tcbinputlisting,tcbuselistingtext,tcbuselistinglisting,tcbusetemplisting,
    tcbfitdim,tcbfitsteps,
    % raster
    thetcbrasternum,tcbitem,
    % breakable
    tcbbreak,
    % theorems
    tcbmaketheorem,tcboxmath,tcbhighmath,thetcbcounter,newtcbtheorem,
    % documentation
    brackets,
    colDef,colOpt,cs,
    docAuxCommand,docColor,docAuxEnvironment,docAuxKey,
    docCounter,docLength,
    meta,marg,
    oarg,
    refCom,refEnv,refKey,
    tcbmakedocSubKey,tcbdocmarginnote,tcbdocnew,tcbdocupdated,
    % skins
    tcbincludegraphics,tcbincludepdf,pdfpages,imagepage,imagepath,imagename,
    tcbline,tcboxedtitleheight,tcboxedtitlewidth,
    tcbsettowidthofnode,tcbsetmacrotowidthofnode,tcbsettoheightofnode,tcbsetmacrotoheightofnode,
    tcbhypernode,
    % vignette
    tcbvignette,
    % xparse
    DeclareTColorBox,NewTColorBox,RenewTColorBox,ProvideTColorBox,
    DeclareTotalTColorBox,NewTotalTColorBox,RenewTotalTColorBox,ProvideTotalTColorBox,
    DeclareTCBox,NewTCBox,RenewTCBox,ProvideTCBox,
    DeclareTotalTCBox,NewTotalTCBox,RenewTotalTCBox,ProvideTotalTCBox,
    DeclareTCBListing,NewTCBListing,RenewTCBListing,ProvideTCBListing,
    DeclareTCBInputListing,NewTCBInputListing,RenewTCBInputListing,ProvideTCBInputListing,
    DeclareTCBoxFit,NewTCBoxFit,RenewTCBoxFit,ProvideTCBoxFit,
    DeclareTotalTCBoxFit,NewTotalTCBoxFit,RenewTotalTCBoxFit,ProvideTotalTCBoxFit,
    tcbsidebyside,tcboxverb,
    % externalization
    tcbEXTERNALIZE,tcbifexternal,newtcbexternalizeenvironment,
    renewtcbexternalizeenvironment,extcolorbox,extikzpicture,
    newtcbexternalizetcolorbox,renewtcbexternalizetcolorbox,
    tcbiffileprocess,
    % box array
    newboxarray,boxarraygetsize,boxarrayreset,boxarrayclear,
    boxarraygetbox,boxarraygetwidth,boxarraygetheight,boxarraygetdepth,
    boxarraygettotalheight,useboxarray,usetcboxarray,
    consumeboxarray,consumetcboxarray,ifboxarrayempty,
    % poster
    posterbox,tcbposterwidth,tcbposterheight,tcbpostercolspacing,
    tcbposterrowspacing,tcbpostercolumns,tcbposterrows,tcbpostercolwidth,
    tcbposterrowheight,tcbposterset,
    },
  texcsstyle=*\color{Definition}\bfseries,
  classoffset=0% restore default
  }

\definecolor{Green_Dark}{rgb}{0.078431,0.407843,0.176471}
\definecolor{Blue_Dark}{rgb}{0.090196,0.211765,0.364706}
\definecolor{Blue_Bright}{rgb}{0.858824,0.898039,0.945098}

\tcbset{
  documentation listing style=mydocumentation,%
  sbs/.style={sidebyside,before lower app={\tcbset{sidebyside=false}}},%
  innerbox/.style={reset,documentation listing style=mydocumentation,
    doc keypath/.store in=\kvtcb@doc@keypath,
    docexample/.style={docexample original},%
    },
  beforeafter example/.style={
    before skip=4pt plus 2pt minus 1pt,
    after skip=8pt plus 4pt minus 2pt
  },
  base example/.style={bicolor,
    beforeafter example,arc is angular,fonttitle=\bfseries,
    fontlower=\footnotesize,
    colframe=Blue_Dark,
    colback=Blue_Bright,
    colbacklower=white,
    drop fuzzy shadow,
    },
  docexample/.style={base example,%
    every box on layer 2/.style={every box},
    before upper={\tcbset{innerbox}},before lower={\tcbset{innerbox}}
    },
  docexample original/.style={colframe=ExampleFrame,colback=ExampleBack,fontlower=\footnotesize,
    before skip=\medskipamount,after skip=\medskipamount,frame style={}},
}

\newtcbexternalizetcolorbox{exdispExample}{dispExample}{environment with percent=false,minipage}{beforeafter example}

\newtcbexternalizetcolorbox{exdispExample*}{dispExample*}{environment with percent=false,minipage}{beforeafter example}

\newcommand{\inputpreamblelisting}[1]{%
  \tcbinputlisting{title=Definition in the preamble:,
    base example,coltitle=black,fonttitle=\itshape,titlerule=0pt,
    colbacktitle=Navy!15!ExampleBack,
    top=0mm,
    before=\par\smallskip,%
    listing style=mydocumentation,
    listing only,listing file={\jobname_preamble_#1.tex}}%
}

\newtcolorbox{deprecated}{blank,breakable,watermark text=deprecated}

\newtcbox{\mylib}{enhanced,nobeforeafter,tcbox raise base,boxrule=0.4pt,top=0mm,bottom=0mm,
  right=0mm,left=4mm,arc=1pt,boxsep=2pt,before upper={\vphantom{dlg}},
  colframe=green!50!black,coltext=green!25!black,colback=green!10!white,
  overlay={\begin{tcbclipinterior}\fill[green!75!blue!50!white] (frame.south west)
    rectangle node[text=white,font=\sffamily\bfseries\tiny,rotate=90] {LIB} ([xshift=4mm]frame.north west);\end{tcbclipinterior}}}

\robustify{\mylib}

\pdfstringdefDisableCommands{%
  \def\mylib#1{'#1'}%
}

\newrobustcmd*{\tcbexclamation}{!}

\newtcbox{\section@box}{tile,before=\clearpage\noindent,after=,
  fontupper=\normalfont\Large\bfseries,capture=minipage,colback=blue!80,coltext=white,
  boxsep=0mm,top=4mm,bottom=4mm,left=\oddsidemargin+1in,right=\oddsidemargin+1in,
  spread sidewards,fuzzy halo=1mm with blue!50!gray}

\renewcommand\section{\@startsection{section}{1}{\z@}{\z@}{5mm}{\section@box}}

\newtcblisting{fulldocumentlisting}[1]{%
  enhanced jigsaw,lower separated=false,breakable,
  leftlower=0mm,rightlower=0mm,bottom=0mm,middle=1mm,
  listing style=mydocumentation,base example,
  listing and comment,
  pdf comment,freeze pdf,
  comment style={raster columns=2,raster equal skip=1mm},
  compilable listing,
  run pdflatex,#1
}

\ExplSyntaxOn

\cs_new:Npn \__tcobox_aux_mkdir:n #1
  {
    \file_if_exist:nF { "#1"/dir.marker }
      {
        \sys_shell_now:x {mkdir~"#1"}
        \iow_open:Nn \g_tmpa_iow {"#1"/dir.marker}
        \iow_close:N \g_tmpa_iow
      }
  }

\NewDocumentCommand{ \tcbAUXmkdir }{ m }
  {
    \__tcobox_aux_mkdir:n {#1}
  }

\ExplSyntaxOff