About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-10-15: New blog post: Tales for Our Times Book Launch.


8. Presentations (The beamer Class)

[Producing presentations (including slides)] There are a number of classes listed on the presentation topic page for presentations. For brevity, this book will only cover the beamer class [103]. At the time of writing, the beamer manual is over 200 pages long. This book is already larger than the previous two volumes combined, so this chapter will only look at how to create a basic document using beamer to help you get started.

A document that uses the beamer class typically consists of a series of frame environments. Each frame produces a slide, or possibly several slides if there are overlays. Here's a simple document that just creates a title slide:

\documentclass{beamer}

\title{Culinary Experimental Research}
\author{Mabel Canary}
\date{22nd March 2014}

\begin{document}
  \begin{frame}
    \maketitle
  \end{frame}
\end{document}

The beamer class provides an optional argument to \title, \author and \date that isn't available with standard classes, such as article. The optional argument can be used to supply an abbreviated version which may be used in headlines or footlines. There are additional title page commands:

\subtitle[short title]{title}

This specifies a subtitle.

\titlegraphic{graphic}

This specifies graphics for the title page. Typically, ⟨graphic⟩ is code to load an image file.

\institute[short name]{name}

This specifies the author's affiliation. If there are multiple authors from different institutes, the institutes should be separated by \and (in a similar manner to \author). Additionally, when there are multiple institutes, each institute should be prefixed by

\inst{text}

This command should also be placed after the corresponding name (or names) in the argument of \author with matching ⟨text⟩.

Example:

\documentclass{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\title{Culinary Experimental Research}
\subtitle{Mind-Controlling Cookies and Exploding Chocolates}
\author[Canary and Zebra]{Mabel Canary\inst{1} \and Zöe Zebra\inst{2}}
\date[Mar'14]{22nd March 2014}
\institute{\inst{1}Secret Lab of Experimental Stuff\\
  University of Somewhere\and
  \inst{2}Department of Stripy Confectioners\\
  College of Somewhere Else
}
\titlegraphic{\includegraphics[width=1in]{dummy-logo}}

\begin{document}
  \begin{frame}
    \maketitle
  \end{frame}
\end{document}

This uses the sample dummy-logo.png file available from the examples page. The resulting slide is shown in Figure 8.1. The footline (bottom right of the slide) provides navigation links.

Figure 8.1: Title Frame
 

Image of a slide. The title and subtitle are in blue, with the title in a larger font. The title information is horizontally centred on the page.

Culinary Experimental Research

Mind-Controlling Cookies and Exploding Chocolates

Mabel Canary1 Zöe Zebra2

1Secret Lab of Experimental Stuff
University of Somewhere
2Department of Stripy Confectioners
College of Somewhere Else

22nd March 2014

Image of sample logo

Small navigation links on the bottom right hand side of the page.

End of Image.

Within the frame environment you can use:

\frametitle{title}

to specify the title of the frame and

\framesubtitle{subtitle}

to specify the subtitle.

Example:

\begin{frame}
  \frametitle{Mind-Controlling Cookies}
  \framesubtitle{Ingredients}

  \begin{itemize}
  \item Self-raising flour;
  \item Butter;
  \item Chocolate chips;
  \item Sugar obtained from secret genetically modified beet.
  \end{itemize}
\end{frame}

The resulting frame is shown in Figure 8.2.

Figure 8.2: An Example Frame
 
Image of a slide. The title and subtitle are on the top left of the page in a blue font. The title is in a larger font than the subtitle. The itemized list uses a blue right pointing triangle as the item marker. A sans-serif font is used.

Mind-Controlling Cookies

Ingredients

  • Self-raising flour;
  • Butter;
  • Chocolate chips;
  • Sugar obtained from secret genetically modified beet.
Small navigation links are on the bottom right hand side of the page.

End of Image.

The contents of the frame environment are fragile. If you want verbatim text in a frame (for example, using \verb or the verbatim or lstlisting environments) you must use the fragile option to the frame environment. For example:

\begin{frame}[fragile]
\frametitle{Hello World!}
\begin{verbatim}
#!/usr/bin/perl
print "Hello World!\n";
1;
\end{verbatim}
\end{frame}

The resulting frame is shown in Figure 8.3.

Figure 8.3: Verbatim in a Frame
 

Image of a slide. The title is in a large blue font.

Hello World!

#!/usr/bin/perl
print "Hello World!\n";
1;

Small navigation links are on the bottom right hand side of the slide.

End of Image.

The standard sectioning commands may be used outside the frame environment. These will be added to the PDF bookmarks and you can add a table of contents frame by putting \tableofcontents inside a frame environment.

Example:

\begin{frame}
  \tableofcontents
\end{frame}

\section{Experimental Research}
\subsection{Cookies}

\begin{frame}
  \frametitle{Mind-Controlling Cookies}
  \framesubtitle{Ingredients}

  \begin{itemize}
  \item Self-raising flour;
  \item Butter;
  \item Chocolate chips;
  \item Sugar obtained from secret genetically modified beet.
  \end{itemize}
\end{frame}

Areas of a frame can be divided into titled blocks using the block environment.

\begin{block}{title}

Example:

\begin{frame}
  \frametitle{Mind-Controlling Cookies}
  \framesubtitle{Recipe}

  \begin{block}{Ingredients}
    \begin{itemize}
    \item Self-raising flour;
    \item Butter;
    \item Chocolate chips;
    \item Sugar obtained from secret genetically modified beet.
    \end{itemize}
  \end{block}
\end{frame}

The resulting frame is shown in Figure 8.4.

Figure 8.4: Block
 
Image of a slide. The title and subtitle are on the top left of the page in a blue font. The title is in a larger font than the subtitle. The itemized list uses a blue right pointing triangle as the item marker. A sans-serif font is used. Block title is in a blue font.

Mind-Controlling Cookies

Recipe

Ingredients

  • Self-raising flour;
  • Butter;
  • Chocolate chips;
  • Sugar obtained from secret genetically modified beet.
Small navigation links are on the bottom right hand side of the page.

End of Image.

There are some predefined block environments, such as theorem and proof.

\begin{theorem}[title]

If ⟨title⟩ is present, this is appended to the “Theorem” block title.

\begin{proof}[proof name]

If ⟨proof name⟩ is present, it's used instead of “Proof” as the block title.


This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-07-4).

© 2015 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs