[Tex/LaTex] Beamer with Warsaw Theme: Two column navigation

beamerpresentationstable of contents

I am using Beamer with the Warsaw theme to make a presentation. I quite like having a mini-outline of the TOC at the start of each slide. However, I have found that it tends to take up quite a bit of vertical space. Hence, I am wondering if it is possible for the per-slide TOC (\sections and \subsections) to be split over two columns so:

A
B
C
D

to

A B  or  A C
C D      B D

I am aware of the compress option which forces list of sections and subsections to be on a single line but this is a bit too extreme. I have also seen a couple of questions relating to splitting the global table of contents over two columns — however I am interested in the mini-TOC which appears at the start of every frame (with the Warsaw theme at least).

Best Answer

Here's a possible solution; the idea is to redefine \insertsectionnavigation and \insertsubsectionnavigation (implemented in beamerbasenavigation.sty) to use a two-column layout produced using the multicols environment from the multicol package; a redefinition of the headline template is also needed to reduce the height of the headline with this new layout:

\documentclass{beamer}
\usetheme{Warsaw}
\usepackage{multicol}

\makeatletter
\def\insertsectionnavigation#1{%
  \hbox to #1{\vbox{{\usebeamerfont{section in head/foot}%
     \usebeamercolor[fg]{section in head/foot}%
     \def\slideentry##1##2##3##4##5##6{}%
     \def\sectionentry##1##2##3##4##5{%
       \ifnum##5=\c@part%
       \def\insertsectionhead{##2\hskip1em}%
       \def\insertsectionheadnumber{##1}%
       \def\insertpartheadnumber{##5}%
         \hyperlink{Navigation##3}{%
             \ifnum\c@section=##1%
               {\usebeamertemplate{section in head/foot}}%
             \else%
               {\usebeamertemplate{section in head/foot shaded}}%
             \fi%
         }\par
       \fi}%
       \parbox[c][0cm][c]{.5\paperwidth}{%
       \begin{multicols}{2}
       \dohead
       \end{multicols}}\space}
     }%
  \hfil}%
}

\def\insertsubsectionnavigation#1{%
  \hbox to #1{%
    \vbox{{%
      \usebeamerfont{subsection in head/foot}\usebeamercolor[fg]{subsection in head/foot}%
      \vskip0.5625ex%
      \beamer@currentsubsection=0%
      \def\sectionentry##1##2##3##4##5{}%
      \def\slideentry##1##2##3##4##5##6{\ifnum##6=\c@part\ifnum##1=\c@section%
        \ifnum##2>\beamer@currentsubsection%
        \beamer@currentsubsection=##2%
        \def\insertsubsectionhead{##5}%
        \def\insertsectionheadnumber{##1}%
        \def\insertsubsectionheadnumber{##2}%
        \def\insertpartheadnumber{##6}%
        \beamer@link(##4){%
              \ifnum\c@subsection=##2%
                {\usebeamertemplate{subsection in head/foot}}%
              \else%
                {\usebeamertemplate{subsection in head/foot shaded}}%
              \fi\hfill}\par
        \fi\fi\fi}%
       \hspace*{0.5em}\parbox[c][0cm][c]{\dimexpr.5\paperwidth-1em\relax}{%
       \begin{multicols}{2}
       \dohead\vskip0.5625ex\end{multicols}
       }\space
   }\hfil
}}}

\setbeamertemplate{headline}
{%
  \leavevmode\@tempdimb=2.4375ex%
  \ifnum\beamer@subsectionmax<\beamer@sectionmax%
    \multiply\@tempdimb by\beamer@sectionmax%
  \else%
    \multiply\@tempdimb by\beamer@subsectionmax%
  \fi%
  \ifdim\@tempdimb>0pt%
    \advance\@tempdimb by 1.125ex%
    \begin{beamercolorbox}[wd=.5\paperwidth,ht=0.5\@tempdimb,dp=2ex]{section in head/foot}%
      \vbox to0.5\@tempdimb{\vfill\insertsectionnavigation{.5\paperwidth}\vfill}%
    \end{beamercolorbox}%
    \begin{beamercolorbox}[wd=.5\paperwidth,ht=0.5\@tempdimb,dp=2ex]{subsection in head/foot}%
      \vbox to0.5\@tempdimb{\vfill\insertsubsectionnavigation{.5\paperwidth}\vfill}%
    \end{beamercolorbox}%
  \fi%
}
\makeatother

\begin{document}

\section{Test Section One}
\frame{test}
\subsection{Test Subsection One One}
\frame{test}
\subsection{Test Subsection One Two}
\frame{test}
\subsection{Test Subsection One Three}
\frame{test}
\subsection{Test Subsection One Four}
\frame{test}
\section{Test Section Two}
\frame{test}
\section{Test Section Three}
\frame{test}
\section{Test Section Four}
\frame{test}
\section{Test Section Five}
\frame{test}
\section{Test Section Six}
\frame{test}
\section{Test Section Seven}
\frame{test}

\end{document}

An image of the headline of one the frames, showing the sections and subsections with the requested two-column layout:

enter image description here

and just for comparison, the same headline using the default Warsaw theme:

enter image description here