-
Notifications
You must be signed in to change notification settings - Fork 1
/
beamertheme-tcolorbox-doc.tex
180 lines (159 loc) · 7.25 KB
/
beamertheme-tcolorbox-doc.tex
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Documentation for the tcolorbox inner theme
% A beamer inner theme which reproduces standard beamer blocks using tcolorboxes
% Maintained by samcarter
%
% Project repository and bug tracker:
% https://github.com/samcarter/beamertheme-tcolorbox
%
% Released under the LaTeX Project Public License v1.3c or later
% See https://www.latex-project.org/lppl.txt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% !TeX program = txs:///arara
% arara: latexmk: {
% arara: --> engine: pdflatex,
% arara: --> options: [
% arara: --> '-shell-escape',
% arara: --> '-synctex=1',
% arara: --> '-interaction=nonstopmode',
% arara: --> ]
% arara: --> }
\documentclass{scrartcl}
% meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{The tcolorbox beamer inner theme}
\subtitle{A beamer inner theme to replicate standard beamer blocks with tcolorboxes}
\author{%
\texorpdfstring{
\texttt{samcarter}\\
\url{https://github.com/samcarter/beamertheme-tcolorbox}\\
\url{https://www.ctan.org/pkg/beamertheme-tcolorbox}
}{samcarter}}
\date{Version v0.8 \textendash{} 2024/09/23}
\usepackage[
themecolor=samteal
]{\jobname-settings}
\newcommand{\prefix}{./include}
\tcbset{
compilable listing/.style={listing file={\prefix/\jobname-listing-\thetcblistingcount.tex}},
run pdflatex/.style={run@system@command={cd\space \prefix;\space pdflatex}{\jobname-listing-\thetcblistingcount.tex}},%
}
\begin{document}
\maketitle
\section{Introduction}
\label{intro}
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.
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.
The package is included in \texlive and \miktex and available from \CTAN (\url{https://www.ctan.org/pkg/beamertheme-tcolorbox}).
The development version of this package is located at \url{https://github.com/samcarter/beamertheme-tcolorbox}. If you have any problems, ideas or other feedback, please make constructive use of the issue tracker.
Copyright \raisebox{0.2em}{\tiny\fontfamily{cmr}\selectfont\textcopyright} \texttt{samcarter}. Permission is granted to copy, distribute and\slash or modify this software under the terms of the LaTeX project public licence, version 1.3c or later \url{https://www.latex-project.org/lppl.txt}.
\section{Usage}
The basic usage is fairly simple. One just needs to load the theme via
\begin{tcolorbox}[lower separated=false,title={Usage}]
\begin{samcode}
\useinnertheme{tcolorbox}
\end{samcode}
\end{tcolorbox}
and after that, one can use the normal beamer \saminline|block| environment as usual.
Behind the scenes, this will replace the default mechanism of puzzling together the block from two separate \saminline|beamercolorboxes|, with one tcolorbox.
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:
\begin{tcblisting}{
title={Example},
listing and comment,
pdf comment,
freeze pdf,
compilable listing,
run pdflatex,
comment style={scale=2}
}
\documentclass{beamer}
\usetheme{Madrid}
\useinnertheme{tcolorbox}
\begin{document}
\begin{frame}
\begin{block}{Title}
Body
\end{block}
\begin{alertblock}{Title}
Body
\end{alertblock}
\begin{exampleblock}{Title}
Body
\end{exampleblock}
\end{frame}
\end{document}
\end{tcblisting}
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.
\section{Options}
In addition to automatically adopting settings from other themes, one can also explicitly influence the look and feel via these options:
\begin{description}
\item[blocks] controls if tcolorboxes should be used for beamer blocks (default: \saminline|true|)
\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)
\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)
\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)
\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)
\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)
\item[titlepage] controls if tcolorboxes should be used for the title page, section page etc. (default: \saminline|true|)
\end{description}
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|).
If one, for example, likes the Antibes theme, but prefers the blocks to have shadows, they can now easily be added: \nopagebreak
\begin{tcblisting}{
title={Example},
listing and comment,
pdf comment,
freeze pdf,
compilable listing,
run pdflatex,
comment style={scale=2}
}
\documentclass{beamer}
\usetheme{Antibes}
\useinnertheme[
shadow
]{tcolorbox}
\begin{document}
\begin{frame}
\begin{block}{Title}
Body
\end{block}
\begin{alertblock}{Title}
Body
\end{alertblock}
\begin{exampleblock}{Title}
Body
\end{exampleblock}
\end{frame}
\end{document}
\end{tcblisting}
Beyond these two options, the users also has the myriads of options of the tcolobox package to their disposal, e.g.\ via \saminline|\tcbset{...}| or \saminline|\tcbsetforeverylayer{...}|:
\begin{tcblisting}{
title={Example},
listing and comment,
pdf comment,
freeze pdf,
compilable listing,
run pdflatex,
comment style={scale=2}
}
\documentclass{beamer}
\usetheme{Ilmenau}
\useinnertheme{tcolorbox}
\tcbsetforeverylayer{
borderline={1pt}{0pt}{black,dashed}
}
\begin{document}
\begin{frame}
\begin{block}{Title}
Body
\end{block}
\begin{alertblock}{Title}
Body
\end{alertblock}
\begin{exampleblock}{Title}
Body
\end{exampleblock}
\end{frame}
\end{document}
\end{tcblisting}
\end{document}