Basic presentations with LaTeX Beamer

3854

Author: Bruce Byfield

Since slide shows are graphical themselves, most people associate them with GUI programs. Yet you can build slide shows just as effectively with some of the simplest and oldest of GNU/Linux tools. A case in point is LaTeX Beamer, which adds extensions to the classic LaTeX typesetting program to produce PDF presentations. Although LaTeX Beamer is capable of considerable complexity, you need to know surprisingly little in order to produce a slide show.

By longstanding tradition, LaTeX is installed by default in major distributions. Beamer is not, although usually it is available as a package. However, until you come to compile your presentation, the documentation for the programs is more important to you than the programs themselves, although you might want to check their availability before you invest your time.

To begin working, create a folder for the presentation and place in it any graphics or other objects that you might want to use in the presentation. Producing the slide show will create a number of files, too, and keeping everything in one folder is the easiest way of keeping track of it all.

Open a text editor and enter the basic markup for a document, or use Kile, the graphical editor for LaTeX, which includes a Beamer document template. The basic structure is:

documentclass{Beamer} 
title{text}
author{text}
date{date}

begin{document}
end{document}

Even if you are new to LaTeX, this basic structure should be self-explanatory. The first line declares the type of document, just as in an HTML file, and gives the file access to Beamer’s resources. The next three lines give basic information about the presentation, which Beamer can pick up automatically while compiling. Depending on how customized your presentation is, you may be adding more structure in these sections. The actual content of the presentation is entered between the begin and end tags of the document.

However, before you start entering content, you need to add slides. Your first slide is probably a title page, whose structure is:

begin{frame}
  titlepage
end{frame}

Next, you may want an outline or table of contents for the entire presentation. Enter:

section*{Outline}
begin{frame}
  tableofcontents
end{frame}

The section is declared so that you can automatically generate the table of contents. The asterisk indicates that this page should not be included in the table of contents when it is generated. Other pages you want included will have their own sections. In effect, the section’s name serves as the title of the slide.

The rest of the slides in the program have a similar structure. For instance, the third slide might be defined as:

section{Introduction}
begin{frame}
  frametitle{titletext}
end{frame}

Entering content on slides

As you might expect, you enter content between the begin and end tags for each frame. If you choose, you can simply start typing. However, if you want to follow the slide show tradition of putting points in bullet form, you can use this structure:

begin{itemize}
 item 
end{itemize}

Just add

item

tags as necessary.

If you want a graphic in PNG format, then enter:

begin{center}
includegraphics{filepath}
end{center}

LaTeX also supports other graphical formats, such as EPS or JPEG. If you place all of the slide show’s graphics in the same folder, as suggested, then the file path needs to include only the file name. You can also change the alignment of the graphic by replacing “center” with “left” or “right” as appropriate.

In addition to text and graphics, you also can include other structural elements in LaTeX, including formulas, numbered lists, tables, hyperlinks, font sizes, and multiple column layouts for individual frames. With LaTeX, you have an entire document layout program available for your presentations. However, defining some of these structures, such as tables, can be challenging no matter what your level of expertise, since you are working non-graphically. Therefore it’s a good idea to constantly convert your presentation to PDF as you work, to see whether you have made any mistakes. More on how to export the presentation in a moment.

Basic customizations

Once you are comfortable with the basics of structuring a slide show and adding slides, you can customize the look and feel of your presentation.

One especially useful customization is to use pause to break up content on a slide, revealing the material below only as you advance. This tool is useful for revealing bullet points one at a time, or for concealing the answer to a question until you are ready to display it.

In addition, Beamer includes optional themes for backgrounds that you can define by adding usetheme{themename} below the document class declaration at the beginning of the file. You can also define color themes (usecolortheme{themename}), font themes (usefonttheme{themename}), inner themes for everything on a frame or slide (useinnertheme{themename}), and outer themes for slide borders and headers and footers (useoutertheme{themename}). All these themes are stored in a Debian system in subfolders of /usr/share/textmf/tex/latex/Beamer/themes, and in a similar location in other distros.

Not only can these themes be mixed and matched, but they can be individually customized as well. For example, you could set the font for the title of slides to use Times Roman with setBeamerfont{title}{shape=itshape,family=rmfamily}. In short, so long as you have the patience to learn, Beamer lacks little found in a conventional presentation program like OpenOffice.org’s Impress — except, perhaps, convenience.

Compiling and using the presentation

When you are finished designing your slide show and adding its content, save the file with a .tex extension, then run the command pdflatex filename to prepare your show. If you are using Kile, you can perform the same operation by selecting Build -> Compile ->PDFLaTeX. Either way, the pdflatex command produces a log of the operation, which you can use to troubleshoot, as well as the PDF output file, both of which are located in the same directory as your .tex file.

To run the presentation, open the file in the PDF viewer of your choice, with the window maximized and the zoom set as high as possible. An especially good PDF viewer is Evince, which has both a full-screen and a presentation mode. With other PDF viewers, your audience may notice the presence of navigation bars and menus, but otherwise, your Beamer-produced presentation should pass muster as well as any slide show without sound. It might even gain points for the originality of its slide design.

Conclusion

How much you want to learn about Beamer depends on your needs. The program includes a thorough manual that not only steps you through a sample presentation, but also gives concrete advice about workflow when planning and designing a presentation. You can even learn how to add notes and handouts to your presentations from it.

You can think of working with Beamer as a throwback to the earliest days of free operating systems. You might not want to use Beamer all the time, but there’s something satisfying about working in this way — if only the feeling that, by the time you’ve produced your first presentation, you’ve learned more about your operating system.

Even without going deeply into the arcana of LaTeX and the programs related to it, you can still learn enough to produce a respectable slide show — proving yet again, as GNU/Linux often does, that command-line tools can still match the results of desktop tools, if only you can accustom yourself to the change in perspective.

Category:

  • Office Software