Skip to content

Commit 12395c7

Browse files
committed
documentation
1 parent 35fa2a0 commit 12395c7

File tree

1 file changed

+242
-0
lines changed

1 file changed

+242
-0
lines changed

beamertheme-tcolorbox-doc.tex

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
% !TeX document-id = {ba2bf522-7c7a-4e0b-b68d-dc54a96e4f4a}
2+
% !TeX TS-program = latexmk -time -pdf -pdflatex="pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %%O %%S" % | txs:///view-log | txs:///view-pdf
3+
4+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5+
%
6+
% Documentation for the tcolorbox inner theme
7+
% A beamer inner theme which reproduces standard beamer blocks using tcolorboxes
8+
% Maintained by samcarter
9+
%
10+
% Project repository and bug tracker:
11+
% https://github.com/samcarter/beamertheme-tcolorbox
12+
%
13+
% Released under the LaTeX Project Public License v1.3c or later
14+
% See http://www.latex-project.org/lppl.txt
15+
%
16+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
17+
\documentclass[parskip=half]{scrartcl}
18+
19+
% packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20+
\usepackage[T1]{fontenc}
21+
\usepackage[utf8]{inputenc}
22+
\usepackage[english]{babel}
23+
\usepackage[bitstream-charter]{mathdesign}
24+
%\usepackage{duckuments}
25+
\usepackage{tikz}
26+
\usetikzlibrary{matrix}
27+
\usepackage[most]{tcolorbox}
28+
\usepackage[paper=a4paper,margin=2.9cm]{geometry}
29+
\usepackage{url}
30+
\usepackage{xspace}
31+
\usepackage{scrlayer-scrpage}
32+
\usepackage[hang,flushmargin,bottom]{footmisc}
33+
\usepackage[colorlinks=true,breaklinks=true,urlcolor=blendedblue,linkcolor=blendedblue,citecolor=blendedblue,filecolor=blendedblue]{hyperref}
34+
35+
% macros %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36+
\newcommand{\CTAN}{\textsc{CTAN}\xspace}
37+
\newcommand{\TikZ}{Ti\emph{k}Z\xspace}
38+
\newcommand{\miktex}{MiK\TeX\xspace}
39+
\newcommand{\texlive}{\TeX{}Live\xspace}
40+
41+
% customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42+
\definecolor{blendedblue}{rgb}{0.2,0.2,0.7}
43+
\definecolor{marmotred}{RGB}{140,20,40}
44+
\addtokomafont{sectioning}{\color{blendedblue}}
45+
\addtokomafont{date}{\normalsize}
46+
\addtokomafont{author}{\normalsize}
47+
\setlength{\footnotemargin}{0.7em}
48+
49+
% from https://tex.stackexchange.com/a/147848
50+
\def\beginlstdelim#1#2#3%
51+
{%
52+
\def\endlstdelim{#2\egroup}%
53+
\ttfamily#1\bgroup\color{#3}\aftergroup\endlstdelim%
54+
}
55+
56+
\lstdefinestyle{beamertheme-tcolorboxstyle}{%
57+
language={[latex]TeX},
58+
tabsize=2,
59+
breaklines,
60+
basicstyle=\footnotesize\ttfamily,
61+
commentstyle={\color{teal}\slshape},
62+
columns=fullflexible,
63+
texcsstyle=*\color{blendedblue}\bfseries,
64+
keywordstyle=\color{red!60!black}\bfseries,
65+
morekeywords={tikzpicture,scope},
66+
moretexcs={path,node,draw,clip,pic,includegraphics,color,piece,tile,beamertheme-tcolorbox},
67+
delim ={[s][\ttfamily\color{green!50!black}]{$}{$}},
68+
moredelim=[is][\footnotesize\ttfamily\color{orange!70!black}]{|}{|},
69+
moredelim={[s][\color{gray}]{<}{>}},
70+
% moredelim = **[is][\beginlstdelim{\{}{\}}{orange!70!black}]{\{}{\}},
71+
% moredelim = **[is][\beginlstdelim{[}{]}{orange!70!black}]{[}{]},
72+
}
73+
74+
\tcbset{%
75+
colframe=blendedblue,
76+
arc=2mm,
77+
fonttitle=\bfseries,
78+
sidebyside,
79+
listing options={style=beamertheme-tcolorboxstyle},
80+
% center lower,
81+
% righthand width=6cm,
82+
bottom=0pt,
83+
top=0pt,
84+
% sidebyside gap=10pt,
85+
lower separated=false,
86+
}
87+
88+
\lstset{style=beamertheme-tcolorboxstyle}
89+
90+
% meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91+
\title{The tcolorbox beamer inner theme}
92+
\subtitle{A beamer inner theme to reproduce standard beamer blocks using tcolorboxes}
93+
\author{%
94+
\texorpdfstring{
95+
\texttt{samcarter}\\
96+
\url{https://github.com/samcarter/beamertheme-tcolorbox}\\
97+
% \url{https://www.ctan.org/pkg/beamertheme-tcolorbox}
98+
}{samcarter}}
99+
\date{Version v0.1 \textendash{} 2022/08/25}
100+
101+
\begin{document}
102+
\maketitle
103+
104+
\section{Introduction}
105+
\label{intro}
106+
107+
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.
108+
109+
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 (round/sharp corners and shadows) as well as the colours of the default beamer blocks.
110+
111+
%The package is included in both \texlive and \miktex and available from \CTAN (\url{https://ctan.org/pkg/beamertheme-tcolorbox}).
112+
The development version of this package is located at \url{github.com/samcarter/beamertheme-tcolorbox}. If you have any problems, ideas or other feedback, please make constructive use of its bug tracker.
113+
114+
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}.
115+
116+
\section{Usage}
117+
118+
The basic usage is fairly simple. One just needs to load the theme via
119+
\begin{tcolorbox}
120+
\begin{lstlisting}
121+
\useinnertheme{tcolorbox}
122+
\end{lstlisting}
123+
\end{tcolorbox}
124+
and after that, one can use the normal bemaer `block` environment as usual. Behind the scenes, this will replace the default mechanism of puzzling together the block from two separate tcolorboxes, with a tcolorbox.
125+
126+
In this simple configuration, the look and feel of the new blocks will be taken from the 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:
127+
128+
\begin{tcblisting}{
129+
listing and comment,
130+
pdf comment,
131+
freeze pdf,
132+
compilable listing,
133+
run pdflatex,
134+
% righthand width=8cm
135+
}
136+
\documentclass{beamer}
137+
\usetheme{Madrid}
138+
\useinnertheme{tcolorbox}
139+
\begin{document}
140+
\begin{frame}
141+
\begin{block}{Title}
142+
Body
143+
\end{block}
144+
\begin{alertblock}{Title}
145+
Body
146+
\end{alertblock}
147+
\begin{exampleblock}{Title}
148+
Body
149+
\end{exampleblock}
150+
\end{frame}
151+
\end{document}
152+
\end{tcblisting}
153+
154+
\section{Options}
155+
156+
In addition to automatically adopting settings from the other themes, one can also influence the look and feel via the two options \lstinline|rounded| and \lstinline|shadow|, which 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|).
157+
158+
\begin{tcolorbox}
159+
\begin{lstlisting}
160+
\useinnertheme[
161+
rounded
162+
shadow=false
163+
]{tcolorbox}
164+
\end{lstlisting}
165+
\end{tcolorbox}
166+
167+
If one for example likes the Antibes theme, but prefers the blocks to have shadows, they can now easily be switched on:
168+
169+
\begin{tcblisting}{
170+
listing and comment,
171+
pdf comment,
172+
freeze pdf,
173+
compilable listing,
174+
run pdflatex,
175+
% righthand width=8cm
176+
}
177+
\documentclass{beamer}
178+
\usetheme{Antibes}
179+
\useinnertheme[
180+
shadow
181+
]{tcolorbox}
182+
\begin{document}
183+
\begin{frame}
184+
\begin{block}{Title}
185+
Body
186+
\end{block}
187+
\begin{alertblock}{Title}
188+
Body
189+
\end{alertblock}
190+
\begin{exampleblock}{Title}
191+
Body
192+
\end{exampleblock}
193+
\end{frame}
194+
\end{document}
195+
\end{tcblisting}
196+
197+
Beyond these two options, the users also has the myriads of options of the tcolobox package to their disposal, e.g.\ via \lstinline|\tcbset{...}|:
198+
199+
\begin{tcblisting}{
200+
listing and comment,
201+
pdf comment,
202+
freeze pdf,
203+
compilable listing,
204+
run pdflatex,
205+
% righthand width=8cm
206+
}
207+
\documentclass{beamer}
208+
\usetheme{Ilmenau}
209+
\useinnertheme{tcolorbox}
210+
211+
\tcbset{
212+
boxrule=3pt,
213+
borderline={1pt}{0pt}{pink,dashed},
214+
}
215+
216+
\begin{document}
217+
\begin{frame}
218+
\begin{block}{Title}
219+
Body
220+
\end{block}
221+
\begin{alertblock}{Title}
222+
Body
223+
\end{alertblock}
224+
\begin{exampleblock}{Title}
225+
Body
226+
\end{exampleblock}
227+
\end{frame}
228+
\end{document}
229+
\end{tcblisting}
230+
231+
\section{Caveats and known issues}
232+
233+
\begin{itemize}
234+
\item the tcolorbox inner theme is not yet optimised for the \lstinline|inmargin| inner theme, which is e.g.\ used by the Bergen theme
235+
\item for themes which don't set the \lstinline|block body| colour, e.g.\ the default theme, the block body will be shown in the same colour as the title and instead of the normal text colour.
236+
\end{itemize}
237+
238+
239+
240+
241+
242+
\end{document}

0 commit comments

Comments
 (0)