Beamer in LaTeX: Presentations, Frames and Themes
Quick answer
- Class:
\documentclass{beamer}. Each slide is aframe:\begin{frame}{Title} ... \end{frame}. - Theme:
\usetheme{Madrid}, colors with\usecolortheme{beaver}. - Step by step:
\pause,\item<2->,\only<2>{...},\onslide<3->{...}. - Code on a slide:
\begin{frame}[fragile]. Too much content:[allowframebreaks]or[shrink].
\documentclass{beamer}
\usetheme{Madrid}
\title{My First Talk}
\author{Ada Lovelace}
\date{\today}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}{Main points}
\begin{itemize}
\item First point
\pause
\item Second point, shown on the next click
\end{itemize}
\end{frame}
\end{document}Beamer is the LaTeX class for slides. You write a presentation the same way you write a paper, with the same math, citations and figures, and the result is a PDF that opens full screen on any computer. This guide starts from a complete deck and covers frames, the built-in themes and color themes, overlays with \pause, \only and \onslide, columns, blocks and figures, the title page and section navigation, handouts and speaker notes, and the errors that come up most. Every snippet compiles as shown.
Frames in Beamer (\begin{frame})
A Beamer document is a sequence of frames. Each \begin{frame} ... \end{frame} is one slide, and the frame title can be given in braces right after \begin{frame} or with \frametitle inside it. A subtitle goes in a second pair of braces or \framesubtitle:
\documentclass{beamer}
\begin{document}
\begin{frame}{Frame title}{Optional subtitle}
Text on the slide.
\end{frame}
\begin{frame}
\frametitle{The same, with commands}
\framesubtitle{Useful when the title is long}
Text on the slide.
\end{frame}
\end{document}Anything outside a frame (other than preamble-style commands such as \section) is ignored. Frames take options in square brackets, and these are the ones worth knowing:
| Option | Effect |
|---|---|
[fragile] | Allows verbatim, \verb, lstlisting and minted on the frame |
[allowframebreaks] | Content that does not fit continues on extra slides, titled “Title I, II, …” |
[shrink=10] | Shrinks the content by at least 10% (more if needed) to fit; small text, use sparingly |
[plain] | Hides headline, footline and sidebars, e.g. for a full-slide image |
[t], [c], [b] | Aligns content at the top, center (default) or bottom |
[noframenumbering] | Does not count the frame, e.g. for backup slides |
[label=name] | Names the frame so it can be repeated with \againframe{name} |
Two related terms often get mixed up: a frame is what you write, a slide is a PDF page. A frame with overlays produces several slides, one per step, but they share a frame number.
Themes and Color Themes
The look of a deck is set in the preamble. \usetheme picks the overall layout (headline, footline, sidebar and block style), \usecolortheme changes only the colors, and \usefonttheme changes the fonts:
\documentclass{beamer}
\usetheme{Madrid}
\usecolortheme{beaver}
\usefonttheme{professionalfonts}
\title{Themes}
\author{Ada Lovelace}
\institute{Analytical Engine Lab}
\begin{document}
\begin{frame}{Madrid with the beaver color theme}
\begin{block}{A block}
Blocks, the footline and the title bar follow the theme colors.
\end{block}
\end{frame}
\end{document}Beamer's presentation themes are named after cities. Most of them fall into a few families that differ mainly in where the navigation goes:
| Theme | Layout | Good for |
|---|---|---|
default | Plain white, no navigation bars | Minimal decks, full control |
Madrid | Colored title bar, three-part footline with author, title and page | The most common choice for talks |
CambridgeUS | Like Madrid in red, with a headline for sections | Conference talks |
Boadilla | Madrid layout with lighter, rounded blocks | Clean lecture slides |
Berlin | Headline with section and frame navigation dots | Long talks with many sections |
Warsaw | Shaded headline with sections, footline with author and title | Classic academic look |
Copenhagen | Warsaw without shading, flat colors | Academic talks with a lighter feel |
Frankfurt | Navigation dots in the headline, no footline | Seminars |
AnnArbor | Dense headline and footline in blue and yellow | Recognisable branding-style decks |
Singapore | Light headline with navigation dots, white body | Low-ink slides that print well |
PaloAlto, Berkeley, Hannover | Table of contents in a sidebar | Lectures where the outline should stay visible |
metropolis | Flat, modern, minimal (separate package, bundled with TeX Live) | Modern talks; looks best with Fira fonts under XeLaTeX/LuaLaTeX |
The built-in color themes are albatross, beaver, beetle, crane, dolphin, dove, fly, lily, orchid, rose, seagull, seahorse, spruce, whale and wolverine. dove and seagull are greyscale and good for printing. To match a university or company color, set the main structure color directly:
\documentclass{beamer}
\usetheme{Madrid}
\definecolor{brand}{RGB}{0, 92, 151}
\usecolortheme[named=brand]{structure}
\setbeamercolor{alerted text}{fg=orange}
\setbeamertemplate{navigation symbols}{} % hide the small icons bottom right
\begin{document}
\begin{frame}{Brand colors}
Normal text and \alert{alerted text}.
\end{frame}
\end{document}The aspect ratio is a class option: \documentclass[aspectratio=169]{beamer} gives 16:9 slides (the default is 4:3); 1610, 149 and 43 are also available. For font sizes on slides see LaTeX font size.
Overlays and Pauses
Overlays reveal a frame step by step. The simplest is \pause: everything after it appears on the next slide. Overlay specifications in angle brackets give exact control; <2-> means “from slide 2 on”, <3> only slide 3, <1-2> slides 1 and 2, and <+-> “from the next step on”:
\documentclass{beamer}
\begin{document}
\begin{frame}{\textbackslash pause}
First sentence.
\pause
Second sentence, on the next slide.
\end{frame}
\begin{frame}{Item by item}
\begin{itemize}[<+->] % every item gets its own step
\item One
\item Two
\item Three
\end{itemize}
\end{frame}
\begin{frame}{\textbackslash only versus \textbackslash onslide}
\only<1>{Shown on slide 1, takes no space afterwards.}
\only<2>{Replaces the line above on slide 2.}
\onslide<2->{Hidden on slide 1 but its space is reserved.}
\alert<3>{Highlighted on slide 3 only.}
\end{frame}
\end{document}The difference between the commands is what happens to hidden content:
| Command | Hidden content | Typical use |
|---|---|---|
\pause | Invisible, space reserved | Reveal the rest of the frame |
\onslide<n>{...}, \uncover<n>{...} | Invisible, space reserved | Reveal parts without the layout jumping |
\visible<n>{...} | Invisible, space reserved (no transparency effect) | Same as \uncover |
\only<n>{...} | Removed, takes no space | Swap one picture or line for another |
\alt<n>{a}{b} | Shows a on slide n, b otherwise | Change a word or formula in place |
\item<n->, \alert<n>{...} | Item hidden or highlight off | Step through a list |
With \setbeamercovered{transparent} in the preamble, upcoming content is shown greyed out instead of invisible, which helps the audience see where the frame is going.
Columns, Blocks and Figures
The columns environment splits a frame side by side; each column takes a width. Blocks are the boxed paragraphs with a title bar that the theme styles: block, alertblock and exampleblock, plus theorem, definition, example and proof, which Beamer defines for you.
\documentclass{beamer}
\usetheme{Madrid}
\begin{document}
\begin{frame}{Two columns}
\begin{columns}[T] % align column tops
\begin{column}{0.48\textwidth}
\begin{itemize}
\item Text on the left
\item A second point
\end{itemize}
\begin{alertblock}{Watch out}
Columns need explicit widths.
\end{alertblock}
\end{column}
\begin{column}{0.48\textwidth}
\centering
\includegraphics[width=\linewidth]{example-image-a}
\end{column}
\end{columns}
\end{frame}
\begin{frame}{Blocks}
\begin{block}{Block}
A standard block.
\end{block}
\begin{exampleblock}{Example}
An example block.
\end{exampleblock}
\begin{theorem}[Pythagoras]
$a^2 + b^2 = c^2$
\end{theorem}
\end{frame}
\begin{frame}{A figure with a caption}
\begin{figure}
\centering
\includegraphics[height=0.6\textheight]{example-image-b}
\caption{Figures do not float in Beamer; they stay where you put them.}
\end{figure}
\end{frame}
\end{document}Beamer loads graphicx and xcolor itself, so \includegraphics works without a \usepackage line. The example-image-a placeholders come from the mwe package; replace them with your own file names. Figure captions are unnumbered by default; add \setbeamertemplate{caption}[numbered] to number them. Diagrams drawn with TikZ and plots from pgfplots go straight into a frame, and tables work as in any document.
Title Page and Sections
Set the title information in the preamble and typeset it with \titlepage inside a frame. Short forms in square brackets go into the footline, where the full title would not fit. Sections are ordinary \section commands between frames; they drive the navigation bars and the outline:
\documentclass{beamer}
\usetheme{Warsaw}
\title[Short title]{A Long and Descriptive Title}
\subtitle{With a subtitle}
\author[A. Lovelace]{Ada Lovelace}
\institute[AEL]{Analytical Engine Lab}
\date{Seminar, \today}
% Show the outline with the current section highlighted at each new section
\AtBeginSection[]{
\begin{frame}{Outline}
\tableofcontents[currentsection]
\end{frame}
}
\begin{document}
\begin{frame}[plain]
\titlepage
\end{frame}
\begin{frame}{Outline}
\tableofcontents
\end{frame}
\section{Introduction}
\begin{frame}{Motivation}
Why this matters.
\end{frame}
\section{Results}
\subsection{Main result}
\begin{frame}{Main result}
What we found.
\end{frame}
\end{document}Adding a logo is one line in the preamble, \logo{\includegraphics[height=0.8cm]{logo}}, and footnotes on slides have their own quirks, covered in Footnotes in Beamer. The table of contents guide covers outline styling in more depth.
Handouts and Notes
The handout class option collapses every overlay, so each frame becomes a single page with all content visible. That is the version to hand out or upload after the talk:
\documentclass[handout]{beamer}
\usepackage{pgfpages}
\pgfpagesuselayout{4 on 1}[a4paper, border shrink=5mm, landscape]
\begin{document}
\begin{frame}{One page per frame}
\begin{itemize}[<+->]
\item In the handout
\item all items
\item appear at once.
\end{itemize}
\end{frame}
\end{document}pgfpages is optional; the 4 on 1 layout puts four frames on each sheet, and 2 on 1 or 8 on 1 also work. Overlays can be kept or dropped per mode with specifications such as \only<handout:0>{...} (never in the handout) or <1-| handout:2>.
Speaker notes go in \note{...}, inside or right after a frame. By default they are not shown; one option decides where they go:
\documentclass{beamer}
\usepackage{pgfpages}
\setbeameroption{show notes on second screen=right} % slide left, notes right
% \setbeameroption{show only notes} % a notes-only PDF to print
\begin{document}
\begin{frame}{Results}
The chart.
\note{Mention the outlier in March before moving on.}
\end{frame}
\end{document}The second-screen layout produces double-width pages. A PDF presenter such as pdfpc splits them so the audience sees the slide and you see the notes.
Common Errors and Fixes
| Message or symptom | Cause | Fix |
|---|---|---|
| Frame is too large: content runs off the bottom, Overfull \vbox | Beamer never moves content to a new slide by itself | Split the frame, or use [allowframebreaks] (bibliographies, long lists) or [shrink=10] |
| Missing } inserted, \verb illegal in command argument or File ended while scanning use of \@xverbatim | \verb, verbatim, lstlisting or minted in a normal frame | \begin{frame}[fragile], with \end{frame} alone on its line |
Undefined control sequence on \usetheme | The document class is not beamer (e.g. article) | \documentclass{beamer}; for an article version of the slides use \usepackage{beamerarticle} |
| File `beamerthemeMadird.sty' not found | Misspelled theme name (names are case-sensitive) | Check the spelling: Madrid, CambridgeUS, metropolis |
| Text outside frames does not appear | Only frame content is typeset | Move it into a frame |
| Layout jumps between overlay steps | \only removes content and its space | Use \onslide or \uncover, or wrap the alternatives in an overlayarea |
| Figure numbers or caption labels missing | Beamer captions are unnumbered by default | \setbeamertemplate{caption}[numbered] |
Code listings are the most common reason to need [fragile]:
\documentclass{beamer}
\usepackage{listings}
\begin{document}
\begin{frame}[fragile]{Code on a slide}
\begin{lstlisting}[language=Python]
def square(x):
return x * x
\end{lstlisting}
Inline code works too: \verb|square(3)|.
\end{frame}
\end{document}Frequently Asked Questions
What is Beamer in LaTeX?
Beamer is a LaTeX document class for presentations. You write \documentclass{beamer} instead of article, put each slide in a frame environment, and compile to a PDF in which every page is a slide. It ships with every TeX distribution, so there is nothing extra to install.
What is a frame in LaTeX Beamer?
A frame is one slide: everything between \begin{frame} and \end{frame}. The frame title goes in braces after \begin{frame} or in \frametitle. With overlays such as \pause, one frame can produce several PDF pages that build up step by step.
How do I change the Beamer theme?
Add \usetheme{Madrid} (or Berlin, Warsaw, Copenhagen, CambridgeUS, metropolis and so on) to the preamble. The colors can be changed separately with \usecolortheme{beaver}, \usecolortheme{dolphin} or another color theme, and the fonts with \usefonttheme{serif}.
How do I make text appear one item at a time in Beamer?
Put \pause between the items, or give the list an overlay specification: \begin{itemize}[<+->] reveals one \item per slide. For finer control use \item<2-> or \onslide<2->{...}, which reserve space for hidden content, and \only<2>{...}, which does not.
How do I fix content that does not fit on a Beamer frame?
Beamer does not move overflowing content to a new slide; it simply runs off the bottom. Split the frame, use \begin{frame}[allowframebreaks] to continue it on extra slides (useful for bibliographies), or \begin{frame}[shrink=10] to scale the content down. Reducing the font with \small inside the frame also works.
Why does verbatim or lstlisting fail inside a Beamer frame?
Beamer reads the whole frame as an argument before typesetting it, and verbatim material cannot be read that way. Add the fragile option: \begin{frame}[fragile]. Without it you get errors such as “Missing } inserted” or “File ended while scanning use of \@xverbatim”. The \end{frame} of a fragile frame must be on a line of its own.
Next Steps
- Footnotes in Beamer – Footnotes in columns, without numbers and on the title page
- Beamer Tutorial (blog) – Building a complete talk from outline to handout
- TikZ in LaTeX – Diagrams that build up with overlays
- LaTeX Font Size – Class options and size commands for slides
- Spacing in LaTeX – Vertical space, line spacing and spacing in math
- Learn LaTeX: Tutorial for Beginners – The basics every deck builds on
Free Beamer Tools
- Beamer Presentation Template – A ready-made deck with title page, sections, columns and overlays
- LaTeX Preview – Compile a frame and see the slide instantly
- AI LaTeX Generator – Describe a slide and get the Beamer code
Related Beamer Articles
View all articlesBuild Beamer slides with AI
Describe your talk and let Octree's AI write the frames, pick a theme, add the overlays and fix the errors, with the PDF compiled next to your code.
Try Octree Free →