Debian Codegraph @

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

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Documentation for the tcolorbox inner theme
4 % A beamer inner theme which reproduces standard beamer blocks using tcolorboxes
5 % Maintained by samcarter
6 %
7 % Project repository and bug tracker:
8 % https://github.com/samcarter/beamertheme-tcolorbox
9 %
10 % Released under the LaTeX Project Public License v1.3c or later
11 % See https://www.latex-project.org/lppl.txt
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 % !TeX program = txs:///arara
15 % arara: latexmk: {
16 % arara: --> engine: pdflatex,
17 % arara: --> options: [
18 % arara: --> '-shell-escape',
19 % arara: --> '-synctex=1',
20 % arara: --> '-interaction=nonstopmode',
21 % arara: --> ]
22 % arara: --> }
23 \documentclass{scrartcl}
24
25 \usepackage[
26 themecolor=samteal
27 ]{\jobname-settings}
28
29 \usepackage[edges]{forest}
30
31 % meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 \title{The tcolorbox beamer inner theme}
33 \subtitle{A beamer inner theme to replicate standard beamer blocks with tcolorboxes}
34 \author{%
35 \texorpdfstring{
36 \texttt{samcarter}\\
37 \url{https://github.com/samcarter/beamertheme-tcolorbox}\\
38 \url{https://ctan.org/pkg/beamertheme-tcolorbox}
39 }{samcarter}}
40 \date{Version v1.4 \textendash{} 2026/01/16}
41 \packagename{beamertheme-tcolorbox}
42
43 \begin{document}
44 \maketitle
45
46 \section{Introduction}
47 \label{intro}
48
49 Over the last decade of answering beamer problems and more recently also being one of the maintainers of the beamer class, I saw countless of requests about beamer blocks. There were users who were looking for sometimes smaller, sometimes larger tweaks to the blocks in their document, for example "How to use the rectangular blocks with sharp corners, but with the shadows from the rounded beamer blocks". Other users encountered various tiny or something bigger problems with the default beamer blocks, like issues with some pdf viewers in which the seams of the underlying colorboxes would become visible.
50
51 For all these cases, there is now an alternative to the default beamer blocks: The tcolorbox inner beamer theme will replace the usual beamer mechanism to draw blocks with tcolorboxes. The tcolorboxes will automatically adopt the look and feel (round vs.\ sharp corners and shadows) as well as the colours of the normal beamer blocks.
52
53 \blurb
54
55 \section{Usage}
56
57 The basic usage is fairly simple. One just needs to load the theme via
58 \begin{tcolorbox}[lower separated=false,title={Usage}]
59 \begin{samcode}
60 \useinnertheme{tcolorbox}
61 \end{samcode}
62 \end{tcolorbox}
63 and after that, one can use the normal beamer \saminline|block| environment as usual.
64
65 Behind the scenes, this will replace the default mechanism of puzzling together the block from two separate \saminline|beamercolorboxes|, with one tcolorbox.
66
67 In this simple configuration, the look and feel of the new blocks will be taken from other themes loaded in the presentation. For example if the Madrid theme is loaded, the resulting tcolorbox will have the usual colours, rounded corners and a shadow:
68
69 \begin{tcblisting}{
70 title={Example},
71 compilable listing sam
72 }
73 \documentclass{beamer}
74 \usetheme{Madrid}
75 \useinnertheme{tcolorbox}
76 \begin{document}
77 \begin{frame}
78 \begin{block}{Title}
79 Body
80 \end{block}
81 \begin{alertblock}{Title}
82 Body
83 \end{alertblock}
84 \begin{exampleblock}{Title}
85 Body
86 \end{exampleblock}
87 \end{frame}
88 \end{document}
89 \end{tcblisting}
90
91 Additional settings done by user, like e.g. \saminline|\setbeamertemplate{blocks}[rounded]|, won't be taken into account and the \saminline|tcolorbox| inner theme should be loaded after such modifications.
92
93 \section{Options}
94
95 In addition to automatically adopting settings from other themes, one can also explicitly influence the look and feel via these options:
96 \begin{description}
97 \item[blocks] controls if tcolorboxes should be used for beamer blocks (default: \saminline|true|)
98 \item[inmargin] controls if the block titles are placed in the left sidebar instead of the top of the block, e.g. for themes like \saminline|Bergen| (default: \saminline|false|, but set to \saminline|true| if the \saminline|inmargin| inner theme is detected)
99 \item[rounded] controls if corners are rounded or sharp (default: \saminline|false|, but set to \saminline|true| if the \saminline|rounded| inner theme is detected)
100 \item[shaded] controls if there is a short colour gradient between the title and the body (default: \saminline|false|, but set to \saminline|true| if the block corners are rounded)
101 \item[shadow] controls if the block has a shadow (default: \saminline|false|, but set to \saminline|true| if the \saminline|shadow| outer theme is detected)
102 \item[showtitle] controls if a small coloured stripe is shown for blocks with empty title (default: \saminline|true|, but set to \saminline|false| if the block has rounded corners)
103 \item[titlepage] controls if tcolorboxes should be used for the title page, section page etc. (default: \saminline|true|)
104 \item[buttons] controls if beamer buttons should be replaced with tcboxes (default: \saminline|false|)
105 \end{description}
106 These options can be set to \saminline|true| or \saminline|false| (calling either option without explicit \saminline|true| or \saminline|false| will set it to \saminline|true|).
107
108 If one, for example, likes the Antibes theme, but prefers the blocks to have shadows, they can now easily be added:
109 \begin{tcblisting}{
110 title={Example},
111 compilable listing sam
112 }
113 \documentclass{beamer}
114 \usetheme{Antibes}
115 \useinnertheme[
116 shadow
117 ]{tcolorbox}
118 \begin{document}
119 \begin{frame}
120 \begin{block}{Title}
121 Body
122 \end{block}
123 \begin{alertblock}{Title}
124 Body
125 \end{alertblock}
126 \begin{exampleblock}{Title}
127 Body
128 \end{exampleblock}
129 \end{frame}
130 \end{document}
131 \end{tcblisting}
132
133 Beyond these two options, the users also has the myriads of options of the tcolobox package to their disposal, e.g.\ via \saminline|\tcbthemeset{...}| to only change options for beamer blocks or \saminline|\tcbset{...}| and \saminline|\tcbsetforeverylayer{...}| to change options for all tcolorboxes:
134 \begin{tcblisting}{
135 title={Example},
136 compilable listing sam
137 }
138 \documentclass{beamer}
139 \usetheme{Ilmenau}
140 \useinnertheme{tcolorbox}
141 \tcbthemeset{
142 borderline={1pt}{0pt}{black,dashed}
143 }
144 \begin{document}
145 \begin{frame}
146 \begin{block}{Title}
147 Body
148 \end{block}
149 \begin{alertblock}{Title}
150 Body
151 \end{alertblock}
152 \begin{exampleblock}{Title}
153 Body
154 \end{exampleblock}
155 \end{frame}
156 \end{document}
157 \end{tcblisting}
158
159 To make other tcoloboxes look like beamer blocks, one can access the collected options via \saminline|code={\pgfkeysalsofrom\tcbthemeoptions}|:
160 \begin{tcblisting}{
161 title={Example},
162 compilable listing sam
163 }
164 \documentclass{beamer}
165 \usetheme{Berlin}
166 \useinnertheme{tcolorbox}
167 \begin{document}
168 \begin{frame}
169 \begin{block}{Title}
170 Body
171 \end{block}
172 \begin{tcolorbox}[
173 title={Title},
174 code={\pgfkeysalsofrom\tcbthemeoptions}
175 ]
176 Body
177 \end{tcolorbox}
178 \end{frame}
179 \end{document}
180 \end{tcblisting}
181
182 \section{Using with \texttt{\textbackslash pause}}
183
184 Using the \saminline|\pause| macro in pgf-based environments like a \saminline|tikzpicture| or a \saminline|tcolorbox| is known to cause problems like disappearing footlines.
185 There are some ways to avoid such problems:
186
187 \begin{enumerate}
188 \item The best solution to problems with \saminline|\pause| is to not use \saminline|\pause|. Instead one can use overlays like \saminline|\only<...>{...}|, \saminline|\visible<...>{...}|, \saminline|\uncover<...>{...}| etc.
189 \item Alternatively, one could switch to another covered style for the presentation, e.g. by adding \saminline|\setbeamercovered{transparent=0}| to the preamble.
190 \end{enumerate}
191
192 \clearpage
193 \section{ltx-talk}
194
195 There is also an experimental \saminline|ltx-talk| version of the tcolorbox inner theme available.
196 Most of the theme options are the same, only the \saminline|inmargin| and \saminline|buttons| options do not exist:
197 \begin{tcblisting}{
198 title={ltx-talk theme},
199 compilable listing sam
200 }
201 \DocumentMetadata{}
202 \documentclass{ltx-talk}
203 \usepackage[
204 shadow,
205 rounded,
206 shaded,
207 showtitle,
208 titlepage,
209 blocks
210 ]{talkthemetcolorbox}
211 \begin{document}
212 \begin{frame}
213 \begin{block}{Title}
214 Body
215 \end{block}
216 \begin{alertblock}{Title}
217 Body
218 \end{alertblock}
219 \begin{exampleblock}{Title}
220 Body
221 \end{exampleblock}
222 \end{frame}
223 \end{document}
224 \end{tcblisting}
225
226 Internally, the tcolorbox ltx-talk theme works a bit differently than the normal beamer theme and thus making customisations is a bit different, too. The ltx-talk theme uses a set of tcolorbox styles to store the options used for the different blocks and boxes:
227 \begin{center}
228 \begin{forest}
229 baseline,
230 for tree={%
231 folder,
232 grow'=0,
233 font=\ttfamily,
234 draw
235 }
236 [titlepage
237 [titlepage-title]
238 [titlepage-author]
239 [titlepage-institute]
240 [titlepage-date]
241 ]
242 \end{forest}
243 \qquad
244 \begin{forest}
245 baseline,
246 for tree={%
247 folder,
248 grow'=0,
249 font=\ttfamily,
250 draw
251 }
252 [block
253 [alertblock]
254 [exampleblock]
255 ]
256 \end{forest}
257 \end{center}
258
259 These styles can be used to adjust the appearance of the different elements:
260 \begin{tcblisting}{
261 title={ltx-talk theme},
262 compilable listing sam
263 }
264 \DocumentMetadata{}
265 \documentclass{ltx-talk}
266
267 \usepackage{talkthemetcolorbox}
268
269 \title{Some Very Interesting Title}
270 \subtitle{Subtitle}
271 \author{Author Name}
272 \institute{Cool Conference}
273
274 \tcbset{
275 titlepage/.append style={
276 colback=lightgray,
277 width=10cm
278 },
279 titlepage-title/.append style={
280 drop lifted shadow
281 },
282 block/.append style={
283 borderline={1pt}{0pt}{black,dashed}
284 },
285 alertblock/.append style={
286 colbacktitle=orange
287 },
288 }
289
290 \begin{document}
291
292 \maketitle
293
294 \begin{frame}
295 \begin{block}{Title}
296 Body
297 \end{block}
298 \begin{alertblock}{Title}
299 Body
300 \end{alertblock}
301 \begin{exampleblock}[colbacktitle=teal]{Title}
302 Body
303 \end{exampleblock}
304 \end{frame}
305
306 \end{document}
307 \end{tcblisting}
308
309 \end{document}