# two (or more) columns navigation in beamer sidebar

I have a long presentation which basically is a collection of exercises. Each excercise has its own subsection, shown in the sidebar, like this:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usetheme[hideothersubsections,left,width=1.4cm]{Goettingen}

\begin{document}
\begin{frame}
\frametitle{Start page}
\end{frame}
\begin{frame}
\section{section 1}
\subsection{1}
\subsection{2}
\subsection{3}
\subsection{4}
\subsection{5}
\subsection{6}
\subsection{7}
\end{frame}
\end{document}


eventually I got this: After a certain number the sidebar is filled and some numbers end outside of the frame.

What I would like is a two (or more) columns sidebar navigation, so that I can add more exercises.

Looks like a similar problem was solved here, but I'm not skilled enough to adapt that solution to a vertical sidebar.

Any help is much appreciated.

## Followup#1

Now i've got to this point:
What I can't still do is:

1) exclude sections from the multicol environment, i.e. the section 2 should be in the first row, not the second

2) the first subsection of the second column should be horizontally aligned with the first subsection of the first column, i.e. 1.5 should be aligned to 1.1.

This is the code, I just added a multicol environment at the end of the \insertverticalnavigation definition:

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{multicol}

\usetheme[hideothersubsections,left,width=1.4cm]{Goettingen}

\makeatletter
\vbox{%
\def\sectionentry##1##2##3##4##5{%
\ifnum##5=\c@part%
\hbox{{%
\usebeamerfont{section in sidebar}\usebeamercolor[fg]{section in sidebar}%
\ifnum\c@section=##1%
\ifnum\c@subsection=0\relax%
{\usebeamertemplate{section in sidebar}}%
\else%
\ifx\beamer@nav@css\beamer@hidetext%
{\usebeamertemplate{section in sidebar}}%
\else%
\fi%
\fi%
\else
\fi}}}%
\beamer@currentsubsection=0\relax\fi}%
\def\slideentry##1##2##3##4##5##6{}%
\def\beamer@subsectionentry##1##2##3##4##5{%
\ifnum##1=\c@part%
\beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
{\hbox{{%
\usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
\ifnum\c@section=##2%
\ifnum\c@subsection=##3%
\ifnum\c@subsubsection=0\relax%
{\usebeamertemplate{subsection in sidebar}}%
\else%
\fi%
\else%
\fi%
\else%
\fi}}}%
}%
\fi}%
\def\beamer@subsubsectionentry##1##2##3##4##5##6{%
\ifnum##1=\c@part%
\beamer@tocifnothide{\ifnum\c@section=##2\ifnum\c@subsection=##3\beamer@nav@css\else\beamer@nav@oss\fi\else\beamer@nav@ooss\fi}%
{\hbox{{%
\usebeamerfont{subsubsection in sidebar}\usebeamercolor[fg]{subsubsection in sidebar}%
\ifnum\c@section=##2%
\ifnum\c@subsection=##3%
\ifnum\c@subsubsection=##4%
{\usebeamertemplate{subsubsection in sidebar}}%
\else
\fi%
\else%
\fi%
\else%
\fi}}}%
}%
\fi}%
\hspace*{0.1em}\parbox[c][1cm][c]{1cm}{              %%%%%%%%%%%%%%%%
\begin{multicols}{2}                                 % multicol     %
}                                                    %%%%%%%%%%%%%%%%
}%
}
\makeatother

\begin{document}
\section{1}
\subsection{1.1}
\frame{test}
\subsection{1.2}
\frame{test}
\subsection{1.3}
\frame{test}
\subsection{1.4}
\frame{test}
\subsection{1.5}
\frame{test}
\subsection{1.6}
\frame{test}
\subsection{1.7}
\frame{test}
\section{2}
\subsection{2.1}
\frame{test}
\subsection{2.2}
\frame{test}
\end{document}


Since customizing \insertverticalnavigation seemed too complicated I tried a different approach and managed to obtain what I wanted. I wasn't able to exclude the sections from the multicol environment, so I decided to separate section and subsection navigation, placing the latter at the end of the former.

Here is the code:

\documentclass{beamer}

\usepackage{multicol}

\usetheme[hideothersubsections,left,width=1.4cm]{Goettingen}

\makeatletter
\hbox to #1{%
\vbox{{%
\usebeamerfont{subsection in sidebar}\usebeamercolor[fg]{subsection in sidebar}%
\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%
\ifnum\c@subsection=##2%
\else%
\fi\hfill}\par
\fi\fi\fi}%
\hspace*{0.1em}\parbox[c][1cm][c]{1.4cm}{%
\begin{multicols}{3}
}\space
}\hfil
}}}

\setbeamertemplate{sidebar left}
{%
\leavevmode\@tempdimb=2.7ex%
\multiply\@tempdimb by\beamer@sectionmax%
\begin{beamercolorbox}[wd=1.4cm,ht=0.5cm,dp=2ex]{title in sidebar}%
{\par\centering\inserttitle\par}%
\end{beamercolorbox}\\
\begin{beamercolorbox}[wd=1.4cm,ht=0.5cm,dp=2ex]{author in sidebar}%
{\par\centering\insertauthor\par}%
\end{beamercolorbox}\\
\begin{beamercolorbox}[wd=1.4cm,ht=\@tempdimb,dp=2ex]{section in sidebar}%
\end{beamercolorbox}\\
\begin{beamercolorbox}[wd=1.4cm,ht=0.8cm]{subsection in sidebar}%
\end{beamercolorbox}%
}
\makeatother

\title{Title}
\author{Author}

\begin{document}
\section{Section 1}
\subsection{1}
\frame{test}
\subsection{2}
\frame{test}
\subsection{3}
\frame{test}
\subsection{4}
\frame{test}
\subsection{5}
\frame{test}
\subsection{6}
\frame{test}
\subsection{7}
\frame{test}
\subsection{8}
\frame{test}
\subsection{9}
\frame{test}
\subsection{10}
\frame{test}
\subsection{11}
\frame{test}
\subsection{12}
\frame{test}
\section{Section 2}
\subsection{1}
\frame{test}
\subsection{2}
\frame{test}
\subsection{3}
\frame{test}
\subsection{4}
\frame{test}
\subsection{5}
\frame{test}
\subsection{6}
\frame{test}
\subsection{7}
\frame{test}
\subsection{8}
\frame{test}
\subsection{9}
\frame{test}
\subsection{10}
\frame{test}
\subsection{11}
\frame{test}
\subsection{12}
\frame{test}
\end{document}


Mandatory screenshot:

In short, I redefined \insertsubsectionnavigation to include a three columns layout and then set a new sidebar template with all the content from the default Goettingen template but with the subsection navigation moved at the end of the section navigation. For some reason i had to use head/foot subsection template instead of the sidebar one, because the latter screwed up the multicolumn navigation.