Skip to content
Tutorials Center
My learning

Topics

Lesson 31 of 38 ยท Beamer, Tooling and Workflows

Beamer Basics: Slides with LaTeX

Make presentation slides with the Beamer class: frames, title page, blocks, lists, columns, images, code and handouts, with a stand-in that previews frame layout.

Beamer is the LaTeX class for presentations. You write slides as frames in a normal .tex file and compile to a PDF that you show full screen. Mathematics, code and vector graphics look excellent, the structure (outline, navigation, numbering) is automatic, and your slides live in version control as text.

A minimal presentation

LATEX
\documentclass{beamer}
\usetheme{Madrid}
\usecolortheme{default}

\title{Introduction to Graphs}
\subtitle{Lecture 3}
\author{Your Name}
\institute{University of Example}
\date{\today}

\begin{document}

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

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

\section{Basics}

\begin{frame}{What is a graph?}
  A graph $G = (V, E)$ consists of
  \begin{itemize}
    \item a set $V$ of \alert{vertices},
    \item a set $E$ of edges between them.
  \end{itemize}
\end{frame}

\end{document}

Key points:

  • Each slide is a frame. The title in braces after \begin{frame} can also be written \frametitle{...} inside. Use \framesubtitle{...} for a second line.
  • \titlepage builds the title slide from \title, \author, \institute and \date.
  • \section and \subsection do not print anything on the slide itself but build the outline and navigation bars.
  • Compile with pdfLaTeX, XeLaTeX or LuaLaTeX; set the aspect ratio with \documentclass[aspectratio=169]{beamer} (16:9) or the default 4:3.

Blocks

Beamer provides coloured boxes for definitions, theorems and notes:

LATEX
\begin{frame}{Pythagoras}
  \begin{theorem}
    In a right triangle, $a^2 + b^2 = c^2$.
  \end{theorem}
  \begin{block}{Remember}
    This is the standard block.
  \end{block}
  \begin{alertblock}{Careful}
    Only for right triangles.
  \end{alertblock}
  \begin{exampleblock}{Example}
    $3^2 + 4^2 = 5^2$.
  \end{exampleblock}
\end{frame}

Available environments include theorem, lemma, corollary, definition, example and proof.

Columns and images

LATEX
\begin{frame}{Two columns}
  \begin{columns}[T]                      % T aligns the tops
    \begin{column}{0.55\textwidth}
      \begin{itemize}
        \item Fast to write
        \item Looks professional
      \end{itemize}
    \end{column}
    \begin{column}{0.4\textwidth}
      \includegraphics[width=\textwidth]{diagram.pdf}
    \end{column}
  \end{columns}
\end{frame}

Images load with graphicx (Beamer loads it for you). Prefer PDF or PNG, and keep the width relative: width=0.8\textwidth or height=0.6\textheight. TikZ pictures drop straight into frames (TikZ basics).

The stand-in below estimates whether the text you put on a frame fits, a practical question since Beamer frames do not grow. It counts lines against a limit and warns about overflow, much like the "Overfull \vbox" warnings you will meet.

JS Does it fit on the slide?

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Code and verbatim text

Verbatim material in a frame requires the fragile option, because Beamer reads frame contents as an argument:

LATEX
\begin{frame}[fragile]{A code sample}
\begin{lstlisting}[language=Python, basicstyle=\small\ttfamily]
def add(a, b):
    return a + b
\end{lstlisting}
\end{frame}

Load listings (or minted, which needs -shell-escape and Python Pygments). With [fragile] the closing \end{frame} must be alone on its line.

  • \setbeamertemplate{navigation symbols}{} removes the little control icons.
  • \setbeamertemplate{footline}[frame number] shows page numbers; use \insertframenumber/\inserttotalframenumber for "3/25".
  • \hypersetup{pdfpagemode=FullScreen} opens the PDF in full-screen mode.
  • Backup slides go after \appendix and \begin{frame}[noframenumbering].

Handouts and notes

LATEX
\documentclass[handout]{beamer}     % overlays collapse into one page per frame
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper, landscape, border shrink=5mm]

Speaker notes: \note{Remember to mention the example.} after a frame, and compile with \setbeameroption{show notes} to see them, or show notes on second screen for presenter tools.

Design principles

  • One idea per slide; use a short title that states the point.
  • Large type: 20 pt or larger. Do not use \tiny to fit more text.
  • Use figures and diagrams over bullet walls.
  • Keep consistent theme settings; do not change them mid-talk.
  • Test in the room's resolution; check dark-room contrast.

Overlays, themes and animations are covered next in overlays and themes.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which Beamer environment makes one slide?

    Each slide is a frame environment.
  2. 2. Why does a frame with a code listing need the fragile option?

    Verbatim environments need special reading of the frame body, which [fragile] provides.
  3. 3. How do you create a 16:9 presentation?

    The aspectratio class option accepts 169, 1610, 149, 54, 32 and others.
  4. 4. Which environment puts content side by side?

    Beamer's columns environment contains column environments with widths relative to the text width.

Summary

  • Beamer slides are frame environments; \titlepage, \tableofcontents and blocks provide structure.
  • Use columns for layouts and [fragile] for code; set aspectratio=169 for wide screens.
  • Handouts, notes and backup slides are handled by class options and \appendix.
  • Fewer words and larger type make better slides.

Next: Beamer Overlays, Themes and Animation