[Tex/LaTex] Reduce fontsize beamer sidebar

beamerfontsize

I want to reduce the font size of my beamer sidebar in the berkeley theme because is not enough for all my sections. How can I save some space to fit all my titles?

enter image description here

Best Answer

Corrected answer with respect to @Gonzales Medinas comment:

Just set the beamer fonts ...section in sidebar.

\setbeamerfont{section in sidebar}{size=\fontsize{2}{4}\selectfont}
\setbeamerfont{subsection in sidebar}{size=\fontsize{2}{4}\selectfont}
\setbeamerfont{subsubsection in sidebar}{size=\fontsize{2}{4}\selectfont}

With the first parameter of fontsize you can change the size of the font and with the second one the distance between the elements.


Original answer:

You have to set the beamer templates section in sidebar and section in sidebar shaded (change \fontsize{2}{2} to your liking). Probably it also makes sense to reduce the vksip between the sections. This can be done in the beamer@sidebarformat macro. I also added this to the MWE.

\documentclass{beamer}
\usetheme{Berkeley}
\useoutertheme{sidebar}

\makeatletter
\def\beamer@sidebarformat#1#2#3{%
  \begin{beamercolorbox}[wd=\beamer@sidebarwidth,leftskip=#1,rightskip=1ex plus1fil,vmode]{#2}
    \vbox{}%
    #3\par%
    \vbox{}%
    \vskip-3ex% Change vskip between section here 
  \end{beamercolorbox}
}

\setbeamertemplate{section in sidebar}
{%
  \vbox{%
    \vskip1ex%
    \beamer@sidebarformat{3pt}{section in sidebar}{\fontsize{2}{2} \selectfont \insertsectionhead}%
  }%
}

\setbeamertemplate{section in sidebar shaded}
{%
  \vbox{%
    \vskip1ex%
    \beamer@sidebarformat{3pt}{section in sidebar shaded}{\fontsize{2}{2} \selectfont \insertsectionhead}%
  }%
}
\makeatother

\begin{document}

\section{Section 1}
\begin{frame}{Frame 1}
    Frame 1
\end{frame}

\section{Section 2}
\begin{frame}{Frame 2}
    Frame 2
\end{frame}

\section{Section 3}
\begin{frame}{Frame 3}
    Frame 3
\end{frame}

\section{Section 4}
\begin{frame}{Frame 4}
    Frame 4
\end{frame}

\section{Section 5}
\begin{frame}{Frame 5}
    Frame 5
\end{frame}

\section{Section 6}
\begin{frame}{Frame 6}
    Frame 6
\end{frame}

\section{Section 7}
\begin{frame}{Frame 7}
    Frame 7
\end{frame}

\section{Section 8}
\begin{frame}{Frame 8}
    Frame 8
\end{frame}

\section{Section 9}
\begin{frame}{Frame 9}
    Frame 9
\end{frame}

\section{Section 10}
\begin{frame}{Frame 10}
    Frame 10
\end{frame}

\section{Section 11}
\begin{frame}{Frame 11}
    Frame 11
\end{frame}

\section{Section 12}
\begin{frame}{Frame 12}
    Frame 12
\end{frame}

\section{Section 13}
\begin{frame}{Frame 13}
    Frame 13
\end{frame}

\section{Section 14}
\begin{frame}{Frame 14}
    Frame 14
\end{frame}

\section{Section 15}
\begin{frame}{Frame 15}
    Frame 15
\end{frame}

\section{Section 16}
\begin{frame}{Frame 16}
    Frame 16
\end{frame}

\section{Section 17}
\begin{frame}{Frame 17}
    Frame 17
\end{frame}

\section{Section 18}
\begin{frame}{Frame 18}
    Frame 18
\end{frame}

\section{Section 19}
\begin{frame}{Frame 19}
    Frame 19
\end{frame}

\section{Section 20}
\begin{frame}{Frame 20}
    Frame 20
\end{frame}

\end{document}