%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 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
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% !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.7 \textendash{} 2024/04/29}

\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 \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}[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}
