Debian Codegraph @

texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.s_snippet.sty

raw
1 % !TeX root = tcolorbox.tex
2 % include file (style) of tcolorbox.tex (manual of the LaTeX package tcolorbox)
3
4 \begin{tcbverbatimwrite}{\jobname_preamble_A.tex}
5 \newtcolorbox[auto counter,number within=section]{pabox}[2][]{%
6 colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,
7 title=Examp.~\thetcbcounter: #2,#1}
8 \end{tcbverbatimwrite}
9 \input{\jobname_preamble_A.tex}
10
11
12 \begin{tcbverbatimwrite}{\jobname_preamble_B.tex}
13 % counter from previous example
14 \newtcbox[use counter from=pabox]{\pbbox}[2][]{%
15 colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,
16 title=(\thetcbcounter) #2,#1}
17 \end{tcbverbatimwrite}
18 \input{\jobname_preamble_B.tex}
19
20
21 \begin{tcbverbatimwrite}{\jobname_preamble_C.tex}
22 \newtcblisting[auto counter]{mycbox}[1]{%
23 colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,
24 title=Listing \thetcbcounter: #1}
25 \end{tcbverbatimwrite}
26 \input{\jobname_preamble_C.tex}
27
28
29 \begin{tcbverbatimwrite}{\jobname_preamble_D.tex}
30 \tcbset{
31 texexp/.style={colframe=red!50!yellow!50!black, colback=red!50!yellow!5!white,
32 coltitle=red!50!yellow!3!white,
33 fonttitle=\small\sffamily\bfseries, fontupper=\small, fontlower=\small},
34 example/.style 2 args={texexp,
35 title={Example \thetcbcounter: #1},label={#2}},
36 }
37
38
39 \newtcblisting{texexp}[1]{texexp,#1}
40 \newtcblisting[auto counter,number within=section]{texexptitled}[3][]{%
41 example={#2}{#3},#1}
42 \newtcolorbox[use counter from=texexptitled]{texexptitledspec}[3][]{%
43 example={#2}{#3},#1}
44 \end{tcbverbatimwrite}
45 \input{\jobname_preamble_D.tex}
46
47
48 \begin{tcbverbatimwrite}{\jobname_preamble_E.tex}
49 \newtcolorbox[auto counter,number within=section,list inside=exam]{texercise}[2][]{%
50 texercisestyle,
51 listing file={solutions/texercise\thetcbcounter.tex},
52 label={exe:#2},
53 record={\string\processsol{solutions/texercise\thetcbcounter.tex}{#2}},
54 title={Exercise \thetcbcounter\hfill\mdseries Solution on page \pageref{sol:#2}},
55 list text={Exercise with solution on page \pageref{sol:#2}},#1}
56 \end{tcbverbatimwrite}
57 \input{\jobname_preamble_E.tex}
58
59
60 \begin{tcbverbatimwrite}{\jobname_preamble_F.tex}
61 \NewTcbTheorem[number within=section]{mytheo}{My Theorem}%
62 {colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}
63 \end{tcbverbatimwrite}
64 \input{\jobname_preamble_F.tex}
65
66
67 \begin{tcbverbatimwrite}{\jobname_preamble_G.tex}
68 % \usepackage{zref-clever}
69 \tcbset{
70 defstyle/.style={fonttitle=\bfseries\upshape, fontupper=\slshape,
71 arc=0mm, colback=blue!5!white,colframe=blue!75!black},
72 theostyle/.style={fonttitle=\bfseries\upshape, fontupper=\slshape,
73 colback=red!10!white,colframe=red!75!black},
74 }
75 \NewTcbTheorem[number within=subsection]{Definition}{Definition}%
76 {defstyle,label type=definition}{def}
77 \NewTcbTheorem[use counter from=Definition]{Theorem}{Theorem}%
78 {theostyle,label type=theorem}{theo}
79 \NewTcbTheorem[use counter from=Definition]{Corollary}{Corollary}%
80 {theostyle,label type=corollary}{cor}
81 \end{tcbverbatimwrite}
82 \input{\jobname_preamble_G.tex}
83
84
85 \begin{tcbverbatimwrite}{\jobname_preamble_H.tex}
86 \newtcolorbox[auto counter,number within=section,
87 number freestyle={(Q/\noexpand\thesection/\noexpand\Alph{\tcbcounter})},
88 ]{phbox}[2][]{%
89 colback=yellow!15!white,colframe=blue!75!black,fonttitle=\bfseries,
90 title=Question~\thetcbcounter: #2,#1}
91 \end{tcbverbatimwrite}
92 \input{\jobname_preamble_H.tex}
93
94
95 \begin{tcbverbatimwrite}{\jobname_preamble_J.tex}
96 \NewTcbTheorem[use counter from=mytheo]{theorem}{Theorem}{%
97 fonttitle=\bfseries\upshape,fontupper=\itshape,
98 colframe=green!50!black,colback=green!10!white,
99 colbacktitle=green!20!white,coltitle=blue!75!black}{theo}
100 \end{tcbverbatimwrite}
101 \input{\jobname_preamble_J.tex}
102
103
104 \begin{tcbverbatimwrite}{\jobname_preamble_K.tex}
105 \usepackage{amsthm}
106
107 \theoremstyle{plain}% from `amsthm'
108 \newtheorem{lem}{Lemma}% from `amsthm'
109
110 \tcolorboxenvironment{lem}{
111 enhanced jigsaw,colframe=cyan,interior hidden,
112 breakable,before skip=10pt,after skip=10pt }
113
114 \tcolorboxenvironment{proof}{% `proof' from `amsthm'
115 blanker,breakable,left=5mm,
116 before skip=10pt,after skip=10pt,
117 borderline west={1mm}{0pt}{red}}
118 \end{tcbverbatimwrite}
119 \input{\jobname_preamble_K.tex}
120
121
122 \begin{tcbverbatimwrite}{\jobname_preamble_L.tex}
123 % \tcbuselibrary{skins}
124
125 \NewTColorBox[auto counter,number within=section]{exercise}{+!O{}}{%
126 enhanced,colframe=green!20!black,colback=yellow!10!white,coltitle=green!40!black,
127 fonttitle=\bfseries,
128 underlay={\begin{tcbclipinterior}
129 \shade[inner color=green!80!yellow,outer color=yellow!10!white]
130 (interior.north west) circle (2cm);
131 \draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
132 (interior.south west) grid (interior.north east);
133 \end{tcbclipinterior}},
134 title={Exercise~\thetcbcounter:},
135 label={exercise@\thetcbcounter},
136 attach title to upper=\quad,
137 after upper={\par\hfill\textcolor{green!40!black}%
138 {\itshape Solution on page~\pageref{solution@\thetcbcounter}}},
139 lowerbox=ignored,
140 savelowerto=solutions/exercise-\thetcbcounter.tex,
141 record={\string\solution{\thetcbcounter}{solutions/exercise-\thetcbcounter.tex}},
142 #1
143 }
144
145 \NewTotalTColorBox{\solution}{mm}{%
146 enhanced,colframe=red!20!black,colback=yellow!10!white,coltitle=red!40!black,
147 fonttitle=\bfseries,
148 underlay={\begin{tcbclipinterior}
149 \shade[inner color=red!50!yellow,outer color=yellow!10!white]
150 (interior.north west) circle (2cm);
151 \draw[help lines,step=5mm,yellow!80!black,shift={(interior.north west)}]
152 (interior.south west) grid (interior.north east);
153 \end{tcbclipinterior}},
154 title={Solution of Exercise~\ref{exercise@#1} on page~\pageref{exercise@#1}:},
155 phantomlabel={solution@#1},
156 attach title to upper=\par,
157 }{\input{#2}}
158
159 \tcbset{no solution/.style={no recording,after upper=}}
160 \end{tcbverbatimwrite}
161 \input{\jobname_preamble_L.tex}
162
163
164 \begin{tcbverbatimwrite}{\jobname_preamble_M.tex}
165 \newtcblisting{myownlisting}[2][]{
166 enhanced,colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,
167 colbacktitle=red!50!yellow,before skip=6pt,after skip=6pt,
168 title={#2},#1}
169
170 \newtcbexternalizetcolorbox{exmyownlisting}{myownlisting}%
171 {minipage,environment with percent=false}%
172 {before skip=6pt,after skip=6pt}% same values as for mylisting
173 \end{tcbverbatimwrite}
174 \input{\jobname_preamble_M.tex}