# Customizing TOC in beamer sidebar (with a custom theme)

I have a beamer presentation with a sidebar and the table of content is too long to fit, like this guy. The difference is that I am using a custom theme (just a color-modified Boadilla, so the following MWE does the same:


\documentclass[a4paper]{beamer}

\usetheme{Boadilla} % load /usr/share/texlive/texmf-dist/tex/latex/beamer/themes/theme/beamerthemeBoadilla.sty
\useoutertheme[left]{sidebar}

\title{PhD stuff}
\author{Me \textsc{Myself}}
\date{\today}

\begin{frame}[plain]{}
\titlepage
\end{frame}

\begin{frame}[plain, allowframebreaks]
\tableofcontents
\end{frame}

\section{Introduction}
\subsection{The genetics of speciation}\begin{frame}{}\end{frame}
\subsection{Models of diversification}\begin{frame}{}\end{frame}
\subsection{Consequences of gene duplication}\begin{frame}{}\end{frame}
\subsection{Fates of gene duplicates}\begin{frame}{}\end{frame}
\subsection{Population genetics models for the fate of gene duplicates}\begin{frame}{}\end{frame}
\subsection{How to narrow down the topic?}\begin{frame}{}\end{frame}

\section{Date gene duplications}
\subsection{Method: infer synonymous substitution rates}
\subsubsection{pipeline}\begin{frame}{}\end{frame}
\subsection{Method: convert synonymous substitution rates to million years}\begin{frame}{}\end{frame}
\subsection{Method: data pre-filtering}\begin{frame}{}\end{frame}
\subsection{A methodological bias?}\begin{frame}{}\end{frame}

\section{Evaluating hypothetical bias}
\subsection{Do some gene trees have incorrect'' branch lengths?}\begin{frame}{}\end{frame}
\subsection{Unequal branch lengths biasing MPL?}\begin{frame}{}\end{frame}
\subsection{Wrong codeml computation?}\begin{frame}{}\end{frame}
\subsection{Are input tree topologies wrong?}
\subsubsection{Which distance measure is best? treebest VS codeml dS}\begin{frame}{}\end{frame}

\section[Correlation between duplication and diversification]{Next: phylogenetic
\subsection{Existing phylogenetic correlation tools}\begin{frame}{}\end{frame}
\subsubsection{trait VS trait}\begin{frame}{}\end{frame}
\subsubsection{trait VS tree (diversification)}\begin{frame}{}\end{frame}

\end{document}


I would like to avoid putting the code in the presentation itself (as suggested here), but rather inside the theme, in order to be reusable.

What do I need to add in my beamertheme file to either:

1. Only display subsections of the current section, like solution 2 here, using the equivalent of \tableofcontents[currentsection, hideothersubsections]?
2. Progressively "scroll down" the TOC as I progress through the talk, to center on the current section-subsection?

Thanks in advance for any help/suggestion :)

## 1 Answer

How about using \useoutertheme[hideothersubsections,left]{sidebar}? This will only show the subsections of the current section.

\documentclass[a4paper]{beamer}

\usetheme{Boadilla}
\useoutertheme[hideothersubsections,left]{sidebar}

\title{PhD stuff}
\author{Me \textsc{Myself}}
\date{\today}

\begin{document}

\begin{frame}[plain]{}
\titlepage
\end{frame}

\begin{frame}[plain, allowframebreaks]
\tableofcontents
\end{frame}

\section{Introduction}
\subsection{The genetics of speciation}\begin{frame}{}\end{frame}
\subsection{Models of diversification}\begin{frame}{}\end{frame}
\subsection{Consequences of gene duplication}\begin{frame}{}\end{frame}
\subsection{Fates of gene duplicates}\begin{frame}{}\end{frame}
\subsection{Population genetics models for the fate of gene duplicates}\begin{frame}{}\end{frame}
\subsection{How to narrow down the topic?}\begin{frame}{}\end{frame}

\section{Date gene duplications}
\subsection{Method: infer synonymous substitution rates}
\subsubsection{pipeline}\begin{frame}{}\end{frame}
\subsection{Method: convert synonymous substitution rates to million years}\begin{frame}{}\end{frame}
\subsection{Method: data pre-filtering}\begin{frame}{}\end{frame}
\subsection{A methodological bias?}\begin{frame}{}\end{frame}

\section{Evaluating hypothetical bias}
\subsection{Do some gene trees have incorrect'' branch lengths?}\begin{frame}{}\end{frame}
\subsection{Unequal branch lengths biasing MPL?}\begin{frame}{}\end{frame}
\subsection{Wrong codeml computation?}\begin{frame}{}\end{frame}
\subsection{Are input tree topologies wrong?}
\subsubsection{Which distance measure is best? treebest VS codeml dS}\begin{frame}{}\end{frame}

\section[Correlation between duplication and diversification]{Next: phylogenetic}
\subsection{Existing phylogenetic correlation tools}\begin{frame}{}\end{frame}
\subsubsection{trait VS trait}\begin{frame}{}\end{frame}
\subsubsection{trait VS tree (diversification)}\begin{frame}{}\end{frame}

\end{document}


• Ah yes, that's the option I needed! Additionally, I would like to remove the title and author from the sidebar, any idea on how to do this? – PlasmaBinturong Sep 12 '17 at 14:54
• @PlasmaBinturong You could do \author[]{name} or redefine the sidebar template. – user36296 Sep 12 '17 at 14:56
• alright thanks, in my case I would have to redefine the template because the short author is used somewhere else (in the bottom line). – PlasmaBinturong Sep 12 '17 at 14:59
• @PlasmaBinturong For redefining the sidebar template, see for example tex.stackexchange.com/a/352825/36296 – user36296 Sep 12 '17 at 15:02