30

In my LaTeX beamer presentation I have a long Table of Contents, which has been split across two columns by using the multicol package. The problem is that I have not found any way to control vertical alignment in the multicols environment. Right now the left column starts lower than the right column, which looks weird. Instead, I would like the left column, or both columns, to be vertically aligned to the top.

I've found some related questions but nothing that solves my problem.

Look at the MWE shown below. As you can see right before Section 3, I tried adding a \vfill along a manual column break, but it didn't help... (The manual column break was added in order to keep Section 3's subsections together with the section in ToC).

Do you have any tricks?

Screenshot of the ToC slide:

enter image description here

MWE:

% MWE showing problems with vertical spacing in multicol ToC
\pagenumbering{arabic}
\documentclass[compress,14pt,t]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{multicol}
\usepackage{charter}
\frenchspacing

\begin{document}

\begin{frame}
    \frametitle{Outline}
    \begin{multicols}{2}
        \tableofcontents
    \end{multicols}
\end{frame}

\section{Section 1}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 4}
    \begin{frame}Test\end{frame}

\section{Section 2}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}

\addtocontents{toc}{\newpage}           % Splits manually the ToC into 2 columns
%\addtocontents{toc}{\vfill\newpage}    % No difference
\section{Section 3}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}

\section{Section 4}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 4}
    \begin{frame}Test\end{frame}

\section{Section 5}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}

\end{document}

2 Answers 2

28
+50

If you do not mind to set the "breaking point" yourself, this should work. At least with this approach you do not have to mess with ToC entries.

\pagenumbering{arabic}
\documentclass[compress,14pt,t]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{multicol}
\usepackage{charter}
\frenchspacing

\begin{document}

\begin{frame}
    \frametitle{Outline}
    \begin{columns}[t]
        \begin{column}{.5\textwidth}
            \tableofcontents[sections={1-3}]
        \end{column}
        \begin{column}{.5\textwidth}
            \tableofcontents[sections={4-5}]
        \end{column}
    \end{columns}
\end{frame}

    \section{Section 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 4}
    \begin{frame}Test\end{frame}

    \section{Section 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}

    \section{Section 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}

    \section{Section 4}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 4}
    \begin{frame}Test\end{frame}

    \section{Section 5}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}

\end{document}

enter image description here

2
  • 1
    Thanks, this was a nice and simple solution (although still not fully automatic).
    – anderfo
    Commented Oct 3, 2013 at 12:22
  • I was looking for something like multitoc, which sadly does not work with beamer.
    – Rico
    Commented Oct 6, 2013 at 9:31
6

Until someone comes out with a proper solution for this, you may want to consider the following dirty dirty hack:

\pagenumbering{arabic}
\documentclass[compress,14pt,t]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{multicol}
\usepackage{charter}
\frenchspacing

\begin{document}

\begin{frame}
    \frametitle{Outline}
    \begin{multicols}{2}
      \tableofcontents
      \end{multicols}
\end{frame}
\addtocontents{toc}{\vskip -1.9cm}  %new code
\section{Section 1}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 4}
    \begin{frame}Test\end{frame}
\addtocontents{toc}{\vskip -1.9cm}     %new code
\section{Section 2}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}

\addtocontents{toc}{\vfill\newpage}
\section{Section 3}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}

\section{Section 4}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 4}
    \begin{frame}Test\end{frame}

\section{Section 5}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}

\end{document}

enter image description here

The idea is to play with \addtocontents{toc} to add negative vskips before the first and second section of the toc so to manually determine their vertical alignment. This only works if the column break is invoked with a \vfill\newpage and of course it will break as soon as you add or remove a section/subsection (you'll have to recalculate the required vskips). Don't forget to compile two times to get the final result (like in the screenshot).

Dirty Hack #2

\pagenumbering{arabic}
\documentclass[compress,14pt,t]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{multicol}
\usepackage{charter}
\frenchspacing

\begin{document}
\begin{frame}
    \frametitle{Outline}
    \begin{multicols}{2}
      \tableofcontents
      \end{multicols}
\end{frame}
\addtocontents{toc}{\vskip -0.1cm} %new code
\section{Section 1}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 4}
    \begin{frame}Test\end{frame}
\section{Section 2}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
\section{Section 3}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
\addtocontents{toc}{\vfill\newpage} %new code
\section{Section 4}
\begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 3}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 4}
    \begin{frame}Test\end{frame}    
\section{Section 5}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 1}
    \begin{frame}Test\end{frame}
    \subsection{Subsection 2} 
\addtocontents{toc}{\vskip 3cm} %new code   
    \begin{frame}Test\end{frame}

\end{document}

enter image description here
This time I just added the \newpage (as before) and to move up section 5 some positive vskip after \section{Section 5} but before the last section 5 frame. It does not work otherwise. Since I felt the second column was a bit higher than the first, I added a small negative vskip before section one.

4
  • Thank you! I agree, that's dirty. Squeezing the first two sections makes it look like the third section should also be in the left column, though. I managed to squeeze it in, but then there's suddently plenty of space between sections 4 and 5... I guess I have to continue tweaking it, until someone finds a better solution :) So I'll wait and see before marking any answer as "accepted".
    – anderfo
    Commented Apr 20, 2013 at 19:50
  • Here is an illustration of the problem I described in my comment.
    – anderfo
    Commented Apr 20, 2013 at 19:58
  • I managed to align also the second column, I'll add the new hack to my answer. Plase do not accept my answer because I'm also interested in a proper solution to your problem :)
    – d-cmst
    Commented Apr 20, 2013 at 21:34
  • great, it works as a preliminary solution. waiting for the oracle to appear ;)
    – anderfo
    Commented Apr 20, 2013 at 22:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .