Debian Codegraph @

texmf-dist/doc/latex/tcolorbox/tcolorbox.doc.intro.tex

raw
1 % !TeX root = tcolorbox.tex
2 % include file of tcolorbox.tex (manual of the LaTeX package tcolorbox)
3 \clearpage
4 \section{Introduction}%
5 \tcbset{external/prefix=external/intro_}%
6 The package originates from the first edition of my book
7 \flqq\citetitle{sturm:latex}\frqq~\cite{sturm:latex}
8 in about 2006.
9 For the \LaTeX\ examples and tutorials given there, I wanted to have
10 accentuated and colored boxes to display source code and
11 compiled text in combination.
12 Since, in my opinion, this type of boxes is also quite useful to highlight definitions
13 and theorems, I applied them for my lecture notes in
14 mathematics \cite{sturm:mathe1,sturm:mathe2,sturm:mathe3}
15 as well.
16 With this package, you are invited to apply these boxes for similar projects.
17
18 The breaking news for version 2.00 was the support for breakable boxes.
19 This feature allows new applications of the package without
20 affecting the core package too much if you do not need boxes to break automatically.
21 With version 2.20, the often requested \enquote{side by side} mode for listings has been added.
22 With version 3.00, boxed titles are introduced together with improved
23 customization options for overlays, underlays, finishes, and own code extensions.
24
25 \begin{tcolorbox}[enhanced,boxrule=0mm,boxsep=0mm,frame hidden,interior hidden,
26 left=0mm,right=0mm,top=0mm,bottom=0mm,watermark opacity=0.25,watermark zoom=1.2,before=\par\smallskip,
27 clip watermark=false,
28 watermark tikz={%
29 \path[fill=yellow,draw=yellow!75!red] (0,0) circle (1cm);
30 \fill[red] (45:5mm) circle (1mm);
31 \fill[red] (135:5mm) circle (1mm);
32 \draw[line width=1mm,red] (215:5mm) arc (215:325:5mm);}]
33 Since the first public release in 2011, I received a lot of feedback from all over the world.
34 I want to thank all who wrote me for supporting this package by sending bug reports
35 and ideas for new or better features.
36 \end{tcolorbox}
37
38
39 \subsection{Installation}
40 Typically, |tcolorbox| will be installed as part of a major \LaTeX\ distribution
41 and there is nothing special to do for a user.
42
43 If you intend to make a local
44 installation \emph{by hand}, see the |README| file of the |tcolorbox| package
45 for some hints. The short story is: you have to install not only
46 |tcolorbox.sty|, but also all |*.code.tex| files in the local |texmf| tree.
47
48
49 \subsection{Loading the Package}
50 The core package |tcolorbox| loads the packages
51 \refPkg{tikz} \cite{tantau:tikz_and_pgf},
52 \refPkg{verbatim} \cite{schoepf:verbatim},
53 \refPkg{etoolbox} \cite{lehmann:etoolbox},
54 and \refPkg{environ} \cite{robertson:2014a}.
55 |tcolorbox| itself is loaded in the usual manner in the preamble:
56 \begin{dispListing}
57 \usepackage{tcolorbox}
58 \end{dispListing}
59 The package takes option keys in the key-value syntax.
60 Alternatively, you may use these keys later in the preamble with
61 \refCom{tcbuselibrary} (see there).
62 For example, the key to typeset listings is:
63 \begin{dispListing}
64 \usepackage[listings]{tcolorbox}
65 \end{dispListing}
66
67
68 \clearpage
69 \subsection{Libraries}\label{sec:bibliothek}
70 The core package |tcolorbox| is extendable by program libraries.
71 This is done by using option keys while loading the package or inside
72 the preamble by applying the following macro with the same set of keys.
73
74 \begin{docCommand}{tcbuselibrary}{\marg{key list}}
75 Loads the libraries given by the \meta{key list}.
76 \begin{dispListing}
77 \tcbuselibrary{listings,theorems}
78 \end{dispListing}
79 \end{docCommand}
80
81 The following keys are used inside |\tcbuselibrary| respectively
82 |\usepackage| without the key tree path |/tcb/library/|.
83
84 \begin{docTcbKey}[library]{skins}{}{\mylib{skins}}
85 Loads the package \refPkg[tikzfill]{tikzfill.image} and provides additional
86 styles (skins) for the appearance of the colored boxes; see \zvref{sec:skins}.
87 \end{docTcbKey}
88
89 \begin{docTcbKey}[library]{vignette}{}{\mylib{vignette}}
90 Provides code for more ornamental; see \zvref{sec:vignette}.
91 \end{docTcbKey}
92
93 \begin{docTcbKey}[library]{raster}{}{\mylib{raster}}
94 Provides additional macros and options for typesetting multiple
95 boxes arranged in a kind of raster; see \zvref{sec:raster}.
96 \end{docTcbKey}
97
98 \begin{docTcbKey}[library]{listings}{}{\mylib{listings}}
99 Loads the package \refPkg{listings} \cite{hoffmann:listings} and provides additional
100 macros for typesetting listings which are described in \zvref{sec:listings}.
101 \end{docTcbKey}
102
103 \begin{docTcbKey}[library]{listingsutf8}{}{\mylib{listingsutf8}}
104 Loads the packages \refPkg{listings} \cite{hoffmann:listings} and
105 \refPkg{listingsutf8} \cite{oberdiek:listingsutf8} for UTF-8 support.
106 This is a variant of the library \mylib{listings}
107 and is described in \zvref{sec:listings}.
108 \end{docTcbKey}
109
110 \begin{docTcbKey}[library]{minted}{}{\mylib{minted}}
111 Loads the package \refPkg{minted} \cite{poore:minted} to
112 typeset listings with the |Pygments| \cite{pygments:web} tool,
113 also see \zvref{sec:listings}.
114 \end{docTcbKey}
115
116 \begin{docTcbKey}[library]{theorems}{}{\mylib{theorems}}
117 Provides additional
118 macros for typesetting theorems which are described in \zvref{sec:theorems}.
119 \end{docTcbKey}
120
121
122 \begin{docTcbKey}[library]{breakable}{}{\mylib{breakable}}
123 Provides support for automatic box breaking from one page to another;
124 see \zvref{sec:breakable}.
125 \end{docTcbKey}
126
127 \begin{docTcbKey}[library]{magazine}{}{\mylib{magazine}}
128 Provides support for storing broken box parts to be used later or
129 in interchanged order, see \zvref{sec:magazine}.
130 \end{docTcbKey}
131
132 \begin{docTcbKey}[library]{poster}{}{\mylib{poster}}
133 Provides support for creating posters, see \zvref{sec:poster}.
134 \end{docTcbKey}
135
136 \begin{docTcbKey}[library]{fitting}{}{\mylib{fitting}}
137 Provides support for font size adaption of the box content to
138 the box dimensions; see \zvref{sec:fitting}.
139 \end{docTcbKey}
140
141 \begin{docTcbKey}[library]{hooks}{}{\mylib{hooks}}
142 Extends several option keys to \enquote{hookable} keys; see \zvref{sec:hooks}.
143 \end{docTcbKey}
144
145 \clearpage
146 \begin{docTcbKey}[library]{xparse}{}{\mylib{xparse}}
147 Loads the package \refPkg{xparse} and is considered a legacy library kept for compatibility;
148 see \zvref{sec:xparse}.
149 \end{docTcbKey}
150
151 \begin{docTcbKey}[library]{external}{}{\mylib{external}}
152 Provides externalization support for stand-alone document snippets,
153 see \zvref{sec:external}.
154 \end{docTcbKey}
155
156 \begin{docTcbKey}[library]{documentation}{}{\mylib{documentation}}
157 Provides additional
158 macros for typesetting \LaTeX\ documentations
159 which are described in \zvref{sec:documentation}.
160 \end{docTcbKey}
161
162 \begin{docTcbKey}[library]{many}{}{style, no value}
163 Loads the libraries \mylib{skins}, \mylib{breakable}, \mylib{raster}, \mylib{hooks},
164 \mylib{theorems}, and \mylib{fitting}.
165 Use this shortcut, if you want to use all features of |tcolorbox|
166 with exception of typesetting listings and using
167 the specialized \mylib{documentation} library.
168 \end{docTcbKey}
169
170 \begin{docTcbKey}[library]{most}{}{style, no value}
171 Loads all libraries except \mylib{minted}, \mylib{documentation}, and \mylib{xparse}.
172 Use this shortcut, if you want to use all features of |tcolorbox|
173 with exception of using the \refPkg{minted} package and using
174 the specialized \mylib{documentation} library.
175 \end{docTcbKey}
176
177 \begin{docTcbKey}[library]{all}{}{style, no value}
178 Loads all libraries. Use this shortcut only, if you intend to use the
179 \mylib{documentation} library.
180 \end{docTcbKey}
181
182
183 \begin{extcolorbox}[runs=2]{intro_packageoverview}
184 [title={Package \texttt{tcolorbox}},center title,fonttitle=\bfseries,arc=0pt,
185 colback=red!10!white,
186 interior style={fill tile image*={width=2cm}{pink_marble.png},fill image opacity=0.5},
187 colframe=red!50!black]
188 \begin{tcolorbox}[beamer,adjusted title=Basic Features,colframe=blue!50!black,colback=blue!10!white]
189 Core package
190 \end{tcolorbox}
191 \begin{tcbitemize}[raster columns=3,raster before skip=2mm,raster after skip=0pt,
192 raster equal height,beamer,colframe=blue!50!black,colback=blue!10!white]
193 \tcbitem[adjusted title=Advanced Features]
194 \mylib{breakable}\\
195 \mylib{external}\\
196 \mylib{fitting}\\
197 \mylib{hooks}\\
198 \mylib{magazine}\\
199 \mylib{poster}\\
200 \mylib{raster}\\
201 \mylib{skins}\\
202 \mylib{theorems}\\
203 \mylib{vignette}
204 \tcbitem[adjusted title=Advanced Listings]
205 \mylib{listings}\\
206 \mylib{listingsutf8}
207 \tcblower
208 \mylib{minted}
209 \tcbitem[adjusted title=Documentation]
210 \mylib{documentation}
211 \end{tcbitemize}
212 \begin{tcolorbox}[beamer,adjusted title=Legacy,colframe=blue!50!black,colback=blue!10!white]
213 \mylib{xparse}
214 \end{tcolorbox}
215 \end{extcolorbox}