Make 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
\begin{frame}[plain] % use plain for titlepage!
 % same arguments as a plain \section:
 \SlideSection[Introduction\dots]{Introduction to the duck \texttt{beamer} theme for \LaTeX}
     \frametitle{New frame title}
     \framesubtitle{New frame subtitle}
 Frame content \begin{itemize}     \item list     \item lost     \item last \end{itemize} \begin{block}{Sommo Poeta} Per me si va ne la città dolente, / per me si va ne l’etterno dolore, / per me si va tra la perduta gente. Giustizia mosse il mio alto fattore: / fecemi la divina podestate, / la somma sapienza e ‘l primo amore. Dinanzi a me non fuor cose create / se non etterne, e io etterno duro. / Lasciate ogne speranza, voi ch’intrate. \end{block}
     \frametitle{New long long long, but really \ annoyingly long, frame title}
     Content\footnote{And footnote}
 \SlideSection{Less crowded slides}
     \frametitle{This is a plain page}
     You can also have a completely blank page
     \frametitle{Just a test}
     It's back to normal\dots

Enjoy it!

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


Playing with Jupyter and Darktable db… which focal lens do I like more?

I am trying to embed a full Jupyter notebook here… it should be more or less auto-explicative. Please comment if you need help!

Ok, so now: what new nice prime lens should I buy?

explore_data /*! * * Twitter Bootstrap * */ /*! * Bootstrap v3.3.7 ( * Copyright 2011-2016 Twitter, Inc. […]

Notes on upgrade from Ubuntu 14.04 to 16.04

I know that the standard policy in Ubuntu is to offer the upgrade from an old LTS to a new one when the new LTS reaches .1, i.e., 16.04.1, but well…

I upgraded my 14.04 in several machines, and I can signal these almost show-stopper problems (workaround exists for all of them, though):

on […]

xkcd color list for LaTeX users…

Update: there is a version on github now, and I submitted it to CTAN…

After reading the (very) fun post about colors name at xkcd, I decided to create a small package to add the color list to my LaTeX documents…

After circumventing a small bug in xcolor, and ten lines of python, I […]

A new nice trick for the Linux keyboard: greek letters

New layout for my Spanish keyboard

I do not know you, but me (as an engineer) use Greek letters like α, β, γ and so on quite often. I did a small change to my linux keyboard layout: the new part in the keyboard symbols files now is

partial alphanumeric_keys xkb_symbols “standard_tlde” { include “es(basic)” key <TLDE> { [ grave, asciitilde, […]


hearth-shaped eclipse

I suppose that everyone and their cat has eclipse shots this days… but I think this is a bit different:

I was shooting the March 20, 2015 eclipse (in Madrid) through a tree, and as a test I tried to focus on the tree silhouette instead — and that was the result. The normal, […]

Managing PPAs in Ubuntu: a couple of useful scripts.

PPAs are really a great thing in Ubuntu: they allow you to have quite recent programs without upgrading all your system; most Ubuntu users use them extensively.

They have just one problematic side — the havoc that can happen on an upgrade. You see, when you upgrade your system, PPAs are disabled, but the program […]

Quick fix xfig bug

Ok, so I am a computer dinosaur. I still use xfig for much of my drawings, although I recon it is a program from the old century…

Unfortunately, after the recent upgrade to Ubuntu 14.04, a nasty bug surfaced in xfig: a crash whenever you try to draw point-dashed lines.

Fortunately, the launchpad user madHamish […]

The perfect lens kit…

…does not exist, of course. But I think I have found mine; at least for my balance (as an amateur) among portability, flexibility and quality.

I am an amateur photographer; I do not sell photos (apart from some wet dream), and my needs are to produce photos for my family in the form of a […]

How to modify a keyboard layout in Linux

New layout for my Spanish keyboard

Or: how to define a programmer-friendl(er) Spanish keyboard. …and you can add Greek, too!

A bit of history

There was a time when the computers all had the same keyboard — basically, the US one. You really do not need any more; the set of characters that could be represented where, after all, just the […]