summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/beamer-contrib/themes/beamertheme-tcolorbox/beamertheme-tcolorbox-doc.tex
blob: 234082375dda3af554e2f99176887259e0227e50 (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
% !TeX TS-program = latexmk -time -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %%O %%S" %   | txs:///view-log | txs:///view-pdf 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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 http://www.latex-project.org/lppl.txt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[parskip=half]{scrartcl}

% packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[T1]{fontenc}	
\usepackage[utf8]{inputenc}		
\usepackage[english]{babel}
\usepackage[bitstream-charter]{mathdesign}
\usepackage[most]{tcolorbox}
\usepackage[paper=a4paper,hmargin=2.9cm,vmargin=2.5cm]{geometry}
\usepackage{scrlayer-scrpage} 
\usepackage[colorlinks=true,breaklinks=true,urlcolor=blendedblue,linkcolor=blendedblue,citecolor=blendedblue,filecolor=blendedblue]{hyperref}

% customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{blendedblue}{rgb}{0.2,0.2,0.7}
\addtokomafont{sectioning}{\color{blendedblue}}
\addtokomafont{date}{\normalsize}
\addtokomafont{author}{\normalsize}

\lstdefinestyle{tcolorboxstyle}{%
	language={[latex]TeX},
	tabsize=2,
	breaklines,
	basicstyle=\ttfamily,
	columns=fullflexible,
%	texcsstyle=*\color{blendedblue}\bfseries,
%	moretexcs={usetheme,useinnertheme},
}

\tcbset{%
  toptitle=1mm,
  left=2mm,
  title={Example},
  fonttitle=\large\sffamily,
  colbacktitle=blendedblue!75!black,
	colframe=blendedblue!75!black,
  colback=blendedblue!75!black!10!white,
  boxrule=0cm,
  frame hidden,
  arc=1.3mm,
	arc=2mm,
	sidebyside,
	listing options={style=tcolorboxstyle},
	bottom=0pt, 
	top=0pt,
  lower separated=false,
  comment style={scale=2},
  enhanced,
  drop fuzzy shadow=black!90,
  title code app={
    \shade[top color=blendedblue!75!black,bottom color=blendedblue!75!black!10!white] (title.south west) rectangle ([yshift=-1mm]title.south east); 
  }        
}

\lstset{style=tcolorboxstyle}

% meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{The tcolorbox beamer inner theme}
\subtitle{A beamer inner theme to reproduce standard beamer blocks using tcolorboxes}
\author{%
	\texorpdfstring{
		\texttt{samcarter}\\
		\url{https://github.com/samcarter/beamertheme-tcolorbox}\\
		\url{https://www.ctan.org/pkg/beamertheme-tcolorbox}
	}{samcarter}}
\date{Version v0.4 \textendash{} 2022/09/06}

\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 \TeX{}Live 
%and MiK\TeX\ 
and available from \textsc{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{http://www.latex-project.org/lppl.txt}.

\section{Usage}

The basic usage is fairly simple. One just needs to load the theme via 
\begin{tcolorbox}[title={}]
\begin{lstlisting}
\useinnertheme{tcolorbox}
\end{lstlisting}
\end{tcolorbox}
and after that, one can use the normal beamer \lstinline|block| environment as usual. 

Behind the scenes, this will replace the default mechanism of puzzling together the block from two separate \lstinline|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}{
  listing and comment,
  pdf comment,
  freeze pdf,
  compilable listing,
  run pdflatex,
}
\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}

\section{Options}

In addition to automatically adopting settings from the other themes, one can also influence the look and feel via these options:
\begin{description}
\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 \lstinline|Bergen| (default: \lstinline|false|)
\item[rounded] controls if corners are rounded or sharp (default: \lstinline|false|)
\item[shadow] controls if the block has a shadow (default: \lstinline|false|)
\item[shaded] controls if there is a short colour gradient between the title and the body or if there is a sharp border between the colours (Default: \lstinline|false|; if rounded corners are activated, it is \lstinline|true|)
\end{description}
These options can be set to \lstinline|true| or \lstinline|false| (calling either option without explicit \lstinline|true| or \lstinline|false| will set it to \lstinline|true|).

\begin{tcolorbox}[title={}]
\begin{lstlisting}
\useinnertheme[
  rounded,
  shadow=false,
  shaded,
  inmargin=false
]{tcolorbox}
\end{lstlisting}
\end{tcolorbox}

If one for example likes the Antibes theme, but prefers the blocks to have shadows, they can now easily be added:

\begin{tcblisting}{
  listing and comment,
  pdf comment,
  freeze pdf,
  compilable listing,
  run pdflatex,
}
\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 \lstinline|\tcbset{...}|:

\begin{tcblisting}{
  listing and comment,
  pdf comment,
  freeze pdf,
  compilable listing,
  run pdflatex,
}
\documentclass{beamer}
\usetheme{Ilmenau}
\useinnertheme{tcolorbox}
\tcbsetforeverylayer{
  boxrule=3pt,
  borderline={1pt}{0pt}{pink,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}

\section{Caveats and known issues}

\begin{itemize}
\item at the moment, this theme only applies to blocks. Things like the title page, which directly use beamercolorboxes, won't be replaced by tcolorboxes
\end{itemize}

\end{document}