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:
This specifies a subtitle.
This specifies graphics for the title page. Typically, ⟨graphic⟩ is code to load an image file.
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
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.
Within the frame
environment you can use:
to specify the title of the frame and
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.
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.
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.
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.
There are some predefined block environments, such as
theorem
and proof
.
If ⟨title⟩ is present, this is appended to the “Theorem” block title.
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).