Home > Communication, LaTeX > Beamer theme creation

## Beamer theme creation

As mentioned in a previous post , INRA renewed it’s visual identity. Unfortunately no beamer theme was provided. This gave me the occasion to look a bit deeper on beamer’s theme and how to create a relatively simple INRA theme.

I tried to keep things simple. Thus, I first identify the main characteristics of the powerpoint template.

1. First slide have a green background while others slides have a white background and a logo on the left of the header
2. General colors for title and subtitle are two specific green (with a precise RGB code)
3. All the slides contains author name, presentation title, and date in their footer.

Beamer theme are defined through “.sty” files. Here, we’ll create a file named beamerthemeINRA.sty , the later will be used via the command \usetheme{INRA} in our source code. The beamerthemeINRA.sty itself, contain instructions to include sty files each defining a part of the theme.

\ProvidesPackage{beamerthemeINRA}[]
\useoutertheme{INRA}

We will address the solutions I’ve adopted for each of the 3 main points of the INRA theme.

## Background

The Background can be changed in the outtertheme, we have to redefine the canvas template and include a background image.

In my case, to get the background, I opened the powerpoint templates, removed any text made  screen-shots of it. The screen-shots were then pasted in gimp, and saved as png. Now, in the file outerthemeINRA.sty we define the images to include in the background. As we’ll use a different background on the first slide, we’ll need a conditional instructions.

\setbeamertemplate{background canvas}{%
\includegraphics[width=\paperwidth,height=\paperheight]{bgINRA1}
\else%Other slides
\includegraphics[width=\paperwidth,height=\paperheight]{bgINRA2}
\fi%
}

First test, add \usetheme{INRA} in your source code, check bgINRA1 and bgINRA2, and all the sty file are in the current directory. Compile, check your pdf (things should already be pretty close to what you expect).

The title slide is obviously not where it should it should ! We’ll have to tweak the title template. After a quick look at some other beamer theme, and series of trials and errors, I  end out with this bunch of code :

## Colors

Colors are generally defined in a beamercolortheme.sty file.

\definecolor{INRA@lgreen}{RGB}{188,214,49}
\definecolor{INRA@dgreen}{RGB}{139,172,33}
\setbeamercolor{structure}{fg=INRA@dinst}

Structure will define the color set for most of the elements of your presentation. We define only the foreground color, since a background colour would hide the upper left logo in the background. Now add \usecolortheme{INRA} to the beamerthemeINRA.sty, compile and check the results.

## Footline

Back to the outertheme, we now want to add the author, presentation title and date in the footline. Once again, after a look at other theme, we copy paste code that look close to what we are looking for. Proceed by trial and errors, until obtaining a satisfactory result. For me it gave something like :

%footline
\defbeamertemplate*{footline}{INRA theme}{
\begin{beamercolorbox}[wd=\paperwidth,ht=15 pt,leftskip=1.5cm,dp=1ex]{structure.fg}%
\end{beamercolorbox}
}

## Useful resources

The theme is now available on the animal genetics’ forge

In order to create the theme, I googled a lot, here is a stack of useful link I went trough, it might be of interest to you.

http://www.tug.org/pracjourn/2005-4/mertz/mertz.pdf

http://en.wikibooks.org/wiki/LaTeX/Presentations

http://mcclinews.free.fr/latex/beamermodif.php

http://www.math.umbc.edu/~rouben/beamer/quickstart.html

http://distrib-coffee.ipsl.jussieu.fr/pub/mirrors/ctan/macros/latex/contrib/beamer/doc/beameruserguide.pdf

http://programming-r-pro-bro.blogspot.fr/2011/11/create-your-own-beamer-template.html