How to Put a Table of Contents in a Beamer Headline
At a glance
- 1. Choose the layout
Use Beamer’s section navigation for a compact headline; use a regular frame for a true multi-column table of contents.
- 2. Set the headline
Insert the horizontal section navigation inside a beamercolorbox and give it a fixed height.
- 3. Make TOC columns
Load multicol and put the table of contents inside a multicols environment in the frame body.
- 4. Check the result
Compile twice and check that long section names fit the headline and the TOC columns.
Beamer can show section links across the top of each slide, but that headline is a narrow strip rather than a regular page area. For a reliable layout, use the built-in section navigation in the headline and put a multi-column table of contents on a separate frame. The example below shows both.
Use section navigation in the headline
The command \insertsectionnavigationhorizontal prints links to the presentation’s sections across a specified width. Put it in the headline template to show the navigation at the top of each frame:
\setbeamertemplate{headline}{%
\begin{beamercolorbox}[
wd=\paperwidth,
ht=2.5ex,
dp=1ex,
leftskip=.3cm,
rightskip=.3cm
]{section in head/foot}%
\usebeamerfont{section in head/foot}%
\insertsectionnavigationhorizontal
{\dimexpr\paperwidth-.6cm\relax}{}{}%
\end{beamercolorbox}%
}
Here, wd=\paperwidth makes the color box span the slide. The ht and dp options reserve space above and below the baseline. The navigation width subtracts the two side margins. If you use a theme with a different header design, you may need to adjust these dimensions or its colors.
This navigation is horizontal; it does not create two columns. It is intended as a compact way to jump between sections, and long section titles may need shorter wording or a smaller font.
Put a full table of contents in columns
For a multi-column contents page, use Beamer’s native columns environment and split the table of contents across calls to \tableofcontents, filtering each call to a range of sections. The following complete example puts section navigation in the headline and a two-column contents list on a frame:
\documentclass{beamer}
\setbeamertemplate{headline}{%
\begin{beamercolorbox}[
wd=\paperwidth,
ht=2.5ex,
dp=1ex,
leftskip=.3cm,
rightskip=.3cm
]{section in head/foot}%
\usebeamerfont{section in head/foot}%
\insertsectionnavigationhorizontal
{\dimexpr\paperwidth-.6cm\relax}{}{}%
\end{beamercolorbox}%
}
\begin{document}
\begin{frame}{Contents}
\begin{columns}[T]
\begin{column}{.48\textwidth}
\tableofcontents[sections={1-2},hideallsubsections]
\end{column}
\begin{column}{.48\textwidth}
\tableofcontents[sections={3-4},hideallsubsections]
\end{column}
\end{columns}
\end{frame}
\section{Introduction}
\begin{frame}{Introduction}
First section content.
\end{frame}
\section{Methods}
\begin{frame}{Methods}
Second section content.
\end{frame}
\section{Results}
\begin{frame}{Results}
Third section content.
\end{frame}
\section{Discussion}
\begin{frame}{Discussion}
Fourth section content.
\end{frame}
\end{document}
The hideallsubsections option keeps the contents list to section entries; remove it if you want subsections included. Adjust the section ranges to suit your presentation. Beamer’s columns environment is designed for frame content, unlike the multicols environment, which relies on LaTeX’s output routine and is not suitable inside Beamer’s boxed frame content.
Common mistakes
- Using a multi-column contents list in the headline. A headline has limited, template-controlled height, so a contents list there can overflow or behave inconsistently.
- Confusing navigation with a contents page.
\insertsectionnavigationhorizontalcreates section links in one horizontal strip; it does not make columns. - Using
multicolin a Beamer frame. Use Beamer’s nativecolumnsenvironment for frame content instead. - Expecting a populated contents list on the first compile. Beamer records section information in auxiliary files. Compile the document again if entries are missing or out of date.
- Trying to fit too much in the header. Use brief section names in the headline and place detailed section and subsection listings on the contents frame.
References
- The beamer class User Guide
- The multicol package
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.