# Separation space between tableofcontents items in beamer

In beamer, I guess, the separation space between the items from tableofcontents is stretchable:

Can you set it to a fixed value? e.g. to equal the value used in the itemize environment.

\begin{minipage}{\textwidth}
\tableofcontents
\end{minipage}

Could someone patch this command with etoolbox and make it happen whenever typing only \tableofcontents? Thanks!

Here is a MWE (with default theme):

\documentclass{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{lipsum}

\title{Whatever Title Works}
\author{Remus M. Prunescu$^1$}
\institute{\tiny$^{1}$ Automation and Control Group, Department of Electrical Engineering, Technical University of Denmark (DTU)}

\begin{document}
\frame{
\maketitle
}

\frame{
\frametitle{Outline}
\begin{minipage}{\textwidth}
\tableofcontents
\end{minipage}
}

\section{Introduction}
\frame{
\frametitle{Random}
\lipsum[1]
}

\section{Project Description}
\frame{
\frametitle{Random}
\lipsum[2]
}

\end{document}
• I think you can include your MWE :) – percusse Apr 8 '14 at 10:08
• @samcarter Thanks! The minipage approach works but I would like it embedded into \tableofcontents (maybe by patching the command using etoolbox). Do you know how to do that? – remus Apr 8 '14 at 12:18
• sorry, I think this is beyond my ability. Some experts anywhere around here? – samcarter_is_at_topanswers.xyz Apr 8 '14 at 12:32
• @percusse I added a MWE with default theme - looks different than the screenshot but the effect is still there. – remus Apr 8 '14 at 13:20

And here's the proper way to do it in beamer: the inner command \beamer@sectionintoc (defined in beamerbasetoc.sty) inserts \vfill after each section entry in the ToC; patch the command to suppress \vfill and use a vertical skip of \itemsep (the separation between items in a list) or any other length that suits your needs:

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{etoolbox}
\usepackage{lipsum}

\makeatletter
\patchcmd{\beamer@sectionintoc}
{\vfill}
{\vskip\itemsep}
{}
{}
\makeatother

\title{Whatever Title Works}
\author{Remus M. Prunescu$^1$}
\institute{\tiny$^{1}$ Automation and Control Group, Department of Electrical Engineering, Technical University of Denmark (DTU)}

\begin{document}

\frame{
\frametitle{Outline}
\tableofcontents
}

\section{Introduction}
\frame{
\frametitle{Random}
\lipsum[1]
}

\section{Project Description}
\frame{
\frametitle{Random}
\lipsum[2]
}

\end{document}

• Thanks! I also added \pretocmd{\beamer@subsectionintoc} {\vskip0.5\itemsep}{}{} for subsections (which, I guess, are not using \vfill inbetween). Is this the correct way to do it? And yes, I only need to skip 0.5\itemsep to get the impression that subsections are grouped with the section. – remus Apr 9 '14 at 6:46
• @remus Yes, you're right; in the case of subsections no \vfill is added and your addition will give you some little extra spacing (you could have patched \beamer@subsection to add there the space to the ToC, but you're approach will give the desired extra spacing). – Gonzalo Medina Apr 9 '14 at 12:36
• This works for the TOC at the beginning of the presentation, but it doesn't appear to have any effect on the TOC that is repeated at the beginning of sections with \AtBeginSection etc. Is there a way of making this consistent? – Guido Vanden Wyngaerd Mar 3 '19 at 7:59

Here is a way to patch \tableofcontents such that its contents are embedded inside a minipage:

\pretocmd{\tableofcontents}{\begin{minipage}{\textwidth}}{}{}
\apptocmd{\tableofcontents}{\end{minipage}}{}{}

The MWE then becomes:

\documentclass{beamer}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{etoolbox}

\title{Whatever Title Works}
\author{Remus M. Prunescu$^1$}
\institute{\tiny$^{1}$ Automation and Control Group, Department of Electrical Engineering, Technical University of Denmark (DTU)}

\pretocmd{\tableofcontents}{\begin{minipage}{\textwidth}}{}{}
\apptocmd{\tableofcontents}{\end{minipage}}{}{}

\begin{document}
\frame{
\maketitle
}

\frame{
\frametitle{Outline}
\tableofcontents
}

\section{Introduction}
\frame{
\frametitle{Random}
\lipsum[1]
}

\section{Project Description}
\frame{
\frametitle{Random}
\lipsum[2]
}

\end{document}

You could use the following work-around for your first frame and then play with the second argument of \fontsize to adjust the space between the lines:

\frame{
\frametitle{Outline}
\bgroup
\vskip1\baselineskip
\fontsize{10}{18}\selectfont
\tableofcontents
\vskip0pt plus 1filll
\egroup
}