# How to Create a Beamer Template — A Newbie’s Tutorial

newcommand{slidesetsubtitle}{}
newcommand{slidesetnumber}{01}
usefonttheme{professionalfonts}


Title Page

Let’s begin by looking at how we’ve modified the title page. Notice, first that we’re including the header file just after the definitions above.

input{../../includes/header-commands}


This will ensure that we have the stuff included in this location. The way I’ve set this up, the title page will get created automatically and the body will start. The code for that can be seen in includes/header-commands.tex:

begin{document}
{setbeamertemplate{footline}{}
begin{frame}
title{slidesettitle}
%subtitle{SUBTITLE}
author{footnotesize
textbf{authorname}\ authoremail \ {scriptsize url{authorweb}} \vspace{12pt}
{scriptsize authoraffiliation}\vspace{6pt}
{tiny textcolor{gray}{insertdate}}
}
date{
{scriptsize today}
}
begin{flushright}includegraphics[width=0.15textwidth]{logoimagepath}end{flushright}
.
.
begin{flushleft}
vspace{-1.5cm}{small textcolor{highlightcolor}{coursetitle}}\vspace{2cm}
{huge slidesettitle ifthenelse{equal{slidesetsubtitle}{}}%
{}% if #1 is empty
{: \ {large slidesetsubtitle}}% if #1 is not empty
} \
vspace{20pt}
insertauthor
end{flushleft}
end{frame}
}
% custom footer after the title


A little explanation of what’s going on here. This should help you customize the theme depending on your needs. The line numbers in code below refer to the actual file. (Refer to the complete file for reference. We’ll be jumping around a bit.)

Line 102 sets the footline (that’s the footer) to empty. This makes the page numbers etc disappear.

Line 103 begins the first frame (slide).

Lines 104-113 set the title and author etc. Pretty basic stuff.

Line 114 inserts the logo. See the pre-reqs section above to see where the logo image comes from.

Lines 117-127 typeset the title of the presentation, author etc. Again, it’s pretty straight-forward if you know a bit of LaTeX. The only complication might be the if statements. It’s basically saying that if we have a non-empty subtitle, put a colon after the title, insert a linebreak and put the subtitle, otherwise, skip the colon and the subtitle.

Line 130 hides the navigation symbols from this point onwards i.e. they won’t appear on slides other than the title.

We have another little fix that we need to do to finish off the title page and that is the definition of the header for it.

So, we have two types of headers: (a) for the title page and (b) for subsequent pages.

The title header gets defined as:

setbeamertemplate{headline}{%
hbox{%
fontsize{5}{5}selectfont

end{beamercolorbox}%
}vspace{-50ex}
}


We basically redefine the headline template to be a a box! It’s a thin, tall box that just sits on the left edge. It’s created using the beamercolorbox environment with 50ex height, 2.25ex width and the color headbarcolor (Line 54). It has no text (Line 56). Finally, we add a -50ex vertical space so that the text that follows will not get displaced because of this box. (Try getting rid of this line to see where the title goes.)

The second headline we need to define is for subsequent pages.

setbeamertemplate{headline}{%
hbox{%
fontsize{5}{5}selectfont

end{beamercolorbox}%
}vspace{-10ex}
}

% greater line spacing for new slides


This very similar to the first headline. The only difference is that the box is much shorter (10ex). Same trick with the negative vertical space. Notice that we have not actually inserted the frame title. Beamer will take care of that automatically for us. We’re just redefining the headline.

We’re also increasing the line spacing for our subsequent slides (Line 145).

Finally, let’s get to the footer.

Footer

The footer is going to be defined using the same technique of placing boxes with some information in them this time.

setbeamertemplate{footline}{
begin{tiny}
setbeamercolor{foot1}{fg=black!70,bg=gray!10}
setbeamercolor{foot2}{fg=gray,bg=gray!15}
setbeamercolor{foot3}{fg=gray,bg=gray!10}
setbeamercolor{foot4}{fg=black!70,bg=gray!20}
setbeamercolor{foot5}{fg=gray,bg=gray!15}
setbeamercolor{foot6}{fg=black,bg=gray!20}

% taken from theme infolines and adapted
leavevmode%
hbox{%
begin{beamercolorbox}[wd=.35paperwidth,ht=2.25ex,dp=1ex,center]{foot1}%
fontsize{5}{5}selectfont
slidesettitle
end{beamercolorbox}%
begin{beamercolorbox}[wd=.1paperwidth,ht=2.25ex,dp=1ex,center]{foot2}
end{beamercolorbox}%
begin{beamercolorbox}[wd=.05paperwidth,ht=2.25ex,dp=1ex,center]{foot3}
end{beamercolorbox}%
begin{beamercolorbox}[wd=.25paperwidth,ht=2.25ex,dp=1ex,center]{foot4}%
fontsize{5}{5}selectfont
insertshortauthor (authorweb)
end{beamercolorbox}%
begin{beamercolorbox}[wd=.05paperwidth,ht=2.25ex,dp=1ex,center]{foot5}
end{beamercolorbox}%
begin{beamercolorbox}[wd=.2paperwidth,ht=2.25ex,dp=1ex,right]{foot6}%
end{beamercolorbox}}%
vskip0pt%
end{tiny}
vskip10pt
}


Lines 62-67 define some colors — basically shades of gray.

Linex 71-88 insert some boxes. Most of them are empty and there for design. We do, however, put the slidesettitle with a small fontsize in the first box (Lines 73-74) and the author’s web address in another box (Lines 81-82). We also put the page numbers in the last box (Line 87). If you can get over all the boxes, this is not that complicated.

Finally, we put a vspace (Line 91) at the end to separate the footer from the lower edge of our slide.

Our slides file now works on this theme and every LaTeX command will work as usual. Maybe I should’ve done some renewcommand’s to get a .sty file but that will have to wait for another day. If someone reading this tutorial can help out with that, fork the project on github, make the changes and send me a pull request.

## 5 thoughts on “How to Create a Beamer Template — A Newbie’s Tutorial”

1. Sanaullah says:

i dont have the requisite know how to comment on this article but, if you need to run Microsoft powerpoint in linux then use the following utility, it works like a charm

http://www.playonlinux.com/en/

give it a try

2. Good job sir, can we see the demo?

• recluze says:

You can see the final PDF on github in the beamer-tutorial tag.

3. JK says:

Do you know how to remove the space of navigation symbols? – not only the navigationsymbols themselves [setbeamertemplate{navigation symbols}{}]?