[Tex/LaTex] How to customize Beamer template

beamerthemes

I need to create a custom Beamer presentation theme for my company. I need to do the following:

  • Include company logo in the header of each slide
  • Include large company logo in the center of the titlepage background
  • Modify the font colors

How do I do each of these tasks? I'd appreciate some details.

Best Answer

My solution will let you know how to perform the modifications you need by customize a template as example.

I think the first thing to do is to select one of the existent themes as starting point.

Let's suppose to have chosen the Copenhagen theme. This MWE:

\documentclass{beamer}

\usetheme{Copenhagen}
\title{The title}
\author{My name}
\date{\today}

\begin{document}

\begin{frame}
\titlepage
\end{frame}

\begin{frame}{The title of the frame}
hello
\end{frame}
\end{document}

allows you to get:

enter image description here

enter image description here

As second step, let's now include a logo in each frame. You can apply the method reported in Positioning logo in the front page as well as slides (in general to position the logo in an arbitrary position you could follow the explanation of How can I position an image in an arbitrary position in beamer? ). I applied the first one and I used just a test image, thus the result is not very good, but the important thing is the idea behind. Now your MWE becomes:

\documentclass{beamer}

\usepackage{textpos} % package for the positioning

\usetheme{Copenhagen}
\title{The title}
\author{My name}
\date{\today}

% position the logo
\addtobeamertemplate{frametitle}{}{%
\begin{textblock*}{100mm}(\textwidth,-1cm)
\includegraphics[height=1cm,width=1cm,keepaspectratio]{logopolito}
\end{textblock*}}


\begin{document}
\begin{frame}
\titlepage
\end{frame}

\begin{frame}{The title of the frame}
hello
\end{frame}
\end{document}

and your second frame:

enter image description here

Let's now add to the title frame a big logo in background. Before doing next passages, I recommend you (not only for this one in particular, but also to change font color), to read carefully the whole code of the starting theme adopted: this will allow you to know how it is composed and what to modify.

To add a large logo in background I used the standard template background: since this will be applied to all frames, I made it transparent for all frames that are not the title page. Perhaps people more expert than me will say that this is not a good method, but I used it two or three times and I think it works pretty well.

The required code is:

\usepackage{tikz,calc}

\pgfdeclareimage[interpolate=true,width=\paperwidth,height=\paperheight]{logo}{logopolito}

\setbeamertemplate{background}{
  \begin{tikzpicture}
  \useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight); 
    \pgftext[at=\pgfpoint{0}{0},left,base]{\pgfuseimage{logo}};
  \ifnum\thepage>1\relax%
  \useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight);
      \fill[white, opacity=1](0,\the\paperheight)--(\the\paperwidth,\the\paperheight)--(\the\paperwidth,0)--(0,0)--(0,\the\paperheight);
  \fi
  \end{tikzpicture}
}

In few words, I declared the image with the size of the full frame ,then I put it inside the template background making a test on the current frame number: if it is not 1 (the title page), I make it invisible setting the opacity to 1.

After this step, the title page becomes:

enter image description here

which actually is very bad because I don't see anymore the author and the date. This is the reason why till now I did not care about colors: at this moment, seeing the partial result it is possible to take better choices; if instead I first decided colors and then put the image, maybe I would had to modify them again.

In this part is really important that you know how is built your starting theme. This one uses as innertheme rounded (that suggest you why the title is put in a rounded box) and as colortheme whale and orchid (you are interested in whale since orchid defines block colors). No definition are given for the fonttheme thus it uses default. Moreover, I noticed that the definition of the title page is not contained in rounded, so the default has been used (a note if you need to modify it).

I adopted several colors as examples: if I really would had to realize a theme it is not a good choice. Just remember that you can use each time a background color (bg) and a foreground color (fg) for the text.

The final example is:

\documentclass{beamer}

\usepackage{textpos} % package for the positioning
\usepackage{tikz,calc}

\usetheme{Copenhagen}
\title{The title}
\author{My name}
\date{\today}

% position the logo
\addtobeamertemplate{frametitle}{}{%
\begin{textblock*}{100mm}(\textwidth,-1cm)
\includegraphics[height=1cm,width=1cm,keepaspectratio]{logopolito}
\end{textblock*}}

\pgfdeclareimage[interpolate=true,width=\paperwidth,height=\paperheight]{logo}{logopolito}

\setbeamertemplate{background}{
  \begin{tikzpicture}
  \useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight); 
    \pgftext[at=\pgfpoint{0}{0},left,base]{\pgfuseimage{logo}};
  \ifnum\thepage>1\relax%
  \useasboundingbox (0,0) rectangle (\the\paperwidth,\the\paperheight);
      \fill[white, opacity=1](0,\the\paperheight)--(\the\paperwidth,\the\paperheight)--(\the\paperwidth,0)--(0,0)--(0,\the\paperheight);
  \fi
  \end{tikzpicture}
}

% Color modification
\setbeamercolor{structure}{fg=red!70!black}% to modify  immediately all palettes
\setbeamercolor{title}{fg=yellow}
\setbeamercolor{title in head/foot}{fg=yellow}
\setbeamercolor{author}{bg=blue!10,fg=blue}
\setbeamercolor{author in head/foot}{bg=yellow!10,fg=red!70!black}
\setbeamercolor{date}{bg=yellow!10,fg=red!70!black}

\beamertemplatenavigationsymbolsempty % to get rid of nav symbols

\begin{document}
\begin{frame}[plain] % to remove the footline in the title page
\titlepage
\end{frame}

\begin{frame}{The title of the frame}
hello
\end{frame}
\end{document}

which gives you:

enter image description here

enter image description here

Any time consider that the beamer documentation is there to help you.