Could I know how to set the width of the left margin of the Berkeley theme please? (that is where the section titles appear)
[Tex/LaTex] How to set beamer Berkeley margins
beamer
Related Solutions
Although beamer
provides many hooks for modifying the way things look, the author couldn't think of every possible tweak, and so some things that you might think would be simple are not. This is one of those cases, since it involves hunting through the beamer
source code (specifically in beamerouterthemesidebar.sty
) to find the definition of the frametitle and then modifying a copy of the relevant code in the preamble of the document.
\documentclass{beamer}
\usetheme{Berkeley}
\makeatletter
\setbeamertemplate{frametitle}{%
\nointerlineskip%
\vskip-\beamer@headheight%
\vbox to \beamer@headheight{%
\vfil
\leftskip=-\beamer@leftmargin%
\advance\leftskip by0.3cm%
\rightskip=-\beamer@rightmargin%
\advance\rightskip by0.3cm plus1fil%
{\usebeamercolor[fg]{frametitle}
\usebeamerfont{frametitle}\insertframetitle\hfill\insertframenumber\par}% added number
{\usebeamercolor[fg]{framesubtitle}
\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
\vbox{}%
\vskip-1em%
\vfil
}%
}
\makeatother
\begin{document}
\section{A section}
\begin{frame}{A frame}
\end{frame}
\end{document}
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}
Best Answer
The width of the bar can be set with the
width=
option passed to the\usetheme{Berkeley}
command. In this example I've set it unreasonably wide for demonstration purposes. You can set the size of the text in the sidebar using\setbeamerfont{section in sidebar}{size= ...}
.