ComputersMake your own beamer style: ducks!

It is that moment in time when someone (maybe yourself!) decide it’s time to change the style of the presentations… and they send you a (more or less) nice PowerPointTM  template.

Obviously, you want it in LaTeX — to use all your nice math or TikZ drawing: let’s see how can design your beamer theme from square one.


The needed reference is the Beamer manual, of course; then start (like me) from this nice post; and of course, you need the fun TikZducks package by samcarter.  Also invaluable is this nice cheat sheet.

I will post here two files: the first one is the style itself, heavily commented to help you adapt it (if you change all the ducks with your images, and twiddle the colors, you can have very different styles); the second one is how to use the style for an example presentation.

% Code by Romano Giannetti, (c) 2019
% This code is distributable with one of the following licences:
% CC-BY 4.0
% The code is heavily based on:
% ...and several other ideas on
% Thanks to @marmot, @samcarter, @Raaja and @JouleV for very useful hints...
% \usepackage[absolute,overlay,showboxes]{textpos}
%% the next line will superimpose a grid that you can use to
%% commands to set several elements in the presentation
% colors
% \providecolor{ducksamarillo}{RGB}{215,188,10}
 %% color scheme
\setbeamercolor{alerted text}{fg=ducksrojo}
 \setbeamercolor{palette primary}{fg=ducksazul,bg=ducksamarillo!70}
\setbeamercolor{palette secondary}{fg=ducksazul,bg=ducksamarillo!80}
\setbeamercolor{palette tertiary}{fg=ducksazul,bg=ducksamarillo!90}
\setbeamercolor{palette quaternary}{fg=ducksgris}%, bg=ducksamarillo}
 \setbeamercolor{titlelike}{parent=palette quaternary}
 \setbeamercolor{block title}{fg=ducksazul,bg=ducksamarillo}
\setbeamercolor{block title alerted}{use=alerted text,fg=ducksazul,bg=alerted text.fg!75!bg}
\setbeamercolor{block title example}{use=example text,fg=ducksazul,bg=example text.fg!75!bg}
 \setbeamercolor{block body}{parent=normal text,use=block title,bg=block!25!bg}
\setbeamercolor{block body alerted}{parent=normal text,use=block title alerted,
bg=block title!25!bg}
\setbeamercolor{block body example}{parent=normal text,use=block title example,
bg=block title!25!bg}
 \setbeamercolor*{separation line}{}
\setbeamercolor*{fine separation line}{}
 \setbeamercolor{date in head/foot}{fg=ducksgris}
\setbeamercolor{title in head/foor}{fg=black}
 %% fonts
\setbeamerfont{description item}{series=\bfseries}
\setbeamerfont{tile in head/foot}{series=\bfseries}
 %% lists and outlines
 \setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
 %% duck boxes
\savebox{\bigduck}{\tikz[scale=4]\begin{scope}[transparency group] \duck\end{scope};}
\tikz[scale=0.3] \duck[body=ducksazul] \duck;
\tikz[scale=0.3] \duck[body=ducksamarillo] \duck;
\tikz[scale=0.3] \duck[body=ducksrojo] \duck;
%% overlays
% \setbeamercovered{transparent}
 % The original template requires a left-shift frame. I don't like it, but well...
\setbeamersize{text margin left=\the\left@shift}%
% The normal logo is on top right side. Embedded in the frametitle so that you can
% switch it off with a simple \frametitle{}
\tikz[scale=0.6] \duck[body=ducksazul];
\insertframetitle \par
{\small \insertframesubtitle\par}
% The standard background has a very transparent image in it. The problem here is
% that how visible it is depend on the gamma of the display, so make it configurable.
\setbeamertemplate{background canvas}{%
\useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight);
\fill[white] (0,0) rectangle (\the\paperwidth,\the\paperheight);
\ifbeamer@plainframe % no bg for plain frames
\node[anchor=south east, opacity=\ducks@bgduckopacity] at (\the\paperwidth, 0pt)
% This is a bit of magic numbers hit and miss. It works at least in 4:3, 16:9, 16:10, 3:2
% Title slide must have [plain] to suppress footline
\setbeamertemplate{title page}{%
\begin{tikzpicture}[box/.style={% draw=red, % for debug
text width=\the\tmp@w, align=left, anchor=north west,
\useasboundingbox (0,0) rectangle (0.9*\the\paperwidth-\the\left@shift, \the\paperheight-5pt);
\fill [color=ducksamarillo] (\the\paperwidth/3-\the\left@shift, \the\paperheight/3) rectangle (\the\paperwidth,\the\paperheight);
\fill [color=ducksgris] (\the\paperwidth/3-\the\left@shift, -5pt) rectangle (\the\paperwidth,\the\paperheight/3);
% \node [draw, circle, inner sep=0.5cm] at (\the\paperwidth/3-\the\left@shift, \paperheight/2) {}; % for debug
% 1.2cm is more or less half the width of the duck
\begin{scope}[xshift=\the\tmp@l-1.2cm, yshift=0.6*\the\paperheight]
\duck[body=ducksazul, head=ducksamarillo, water=cyan];
\node at (\the\tmp@l, 0.4cm) {\usebox{\horducks}};
\node [anchor=south east, opacity=0.1] at (0.9*\the\paperwidth, -5pt) {\usebox{\bigduck}};
\node [box, font=\large] at(\the\tmp@l,0.9*\the\paperheight) {\ducks@toptitlepage};
\node [box, font=\Large] at(\the\tmp@l,0.7*\the\paperheight) {\textbf{\inserttitle}\\ \insertsubtitle};
\node [box, font=\large, color=white] at(\the\tmp@l,0.28*\the\paperheight) {\insertauthor};
% We have two lines in the footline. Not convinced, but alas ---
anchor=south west,
text width=\the\tmp@w,
\useasboundingbox (0,0) rectangle (\the\paperwidth, 1cm);
% \fill[color=cyan!30] (0,0) rectangle (\the\paperwidth, 1cm); % for debug
\pgfmathsetlength{\tmp@w}{(\the\paperwidth-\the\left@shift-4cm)/2} % 2 cm for the number, 1+1 for separation
\node [box, color=ducksgris, font=\bfseries](lb) at(\the\left@shift, 0) {\ducks@leftbelow};
\node [box, color=black, font=\bfseries](lt) at (lb.north west) {\ducks@leftabove};
\node [box, color=ducksgris, font=\bfseries](rb) at(\the\left@shift+1cm+\the\tmp@w, 0) {\ducks@rightbelow};
\node [box, color=black, font=\bfseries] at (rb.north west) {\ducks@rightabove};
\node [anchor=south east, color=ducksgris, font=\large] at (\the\paperwidth, 0) {\strut\insertframenumber/\inserttotalframenumber};
\draw (lt.north west) ++(0,2pt) -- ++(\the\tmp@w/2,0);
% Misc things
\setbeamertemplate{sidebar right}{}% or get rid of navigation entries there somehow
\renewcommand*{\footnoterule}{\vspace{0.5ex}\hrule width 2in\relax}
\setbeamertemplate{navigation symbols}{}
% Create a section with a "special" slide.
\useasboundingbox (0,0) rectangle (\the\paperwidth, 1cm);
\fill[color=ducksazul] (0,0) rectangle (0.7*\the\paperwidth, 1cm);
\node [anchor=south east] at (\the\paperwidth, 0cm) {\usebox{\horducks}};
\path [use as bounding box] (0,0) rectangle (0.9*\the\paperwidth-\the\left@shift, 0.8*\the\paperheight);
\node [anchor=north west, minimum size=2cm, fill=ducksgris!30, font=\Huge\bfseries]
(nb) at (0, 0.6*\the\paperheight) {\color{white}\thesection};
\node [anchor=north west, text width=0.7*\the\paperwidth, font=\Large, align=center]
(tb) at (0, 0.3*\the\paperheight) {#2};
\begin{scope}[thin, color=ducksazul]
\draw (nb.north west) ++(7pt,2pt) -- ++(-14pt, 0);
\draw (nb.north west) ++(-2pt,-3pt) -- ++(0, 8pt);
\draw (nb.south west) ++(7pt,-2pt) -- ++(-14pt, 0);
\draw (nb.south west) ++(-2pt,-5pt) -- ++(0, 16pt);
\draw (nb.north east) ++(7pt,2pt) -- ++(-14pt, 0);
\draw (nb.north east) ++(2pt,-10pt) -- ++(0, 16pt);
\draw (tb.south west) ++(7pt,-2pt) -- ++(-14pt, 0);
\draw (tb.south west) ++(-2pt,-5pt) -- ++(0, 16pt);
\draw (tb.north east) ++(7pt,2pt) -- ++(-14pt, 0);
\draw (tb.north east) ++(2pt,-10pt) -- ++(0, 16pt);
% end

The following code shows you how to use the style to obtain this:


% vim: set spell spelllang=en :
     % ,handout %% "handout" for one page per slide
     ,aspectratio=169 %%
     % ,aspectratio=1610 %%
     % ,aspectratio=32 %%
 \usepackage{lmodern} % basic font
 %% presentation data starts here
 %% Title page
 \title{Testing duck style}
 \toptitlepage{duck, test slide}
 \author[RGtti]{Romano Giannetti}
 %% Definitions for the footer
 \leftabove{Left Above}
 \leftbelow{Left Below}
 \rightabove{Right Above}
 \rightbelow{Right Below}
 %% For example; you can find more \insert… at
 % you can change bg's image transparency here
 \bgduckopacity{0.10}% (background semitransparent lion) default=0.2

Enjoy it!

You can download the files clicking here (can’t find how to add the nice link…)


Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>





This site uses Akismet to reduce spam. Learn how your comment data is processed.