0

Is there an option to vertically align the sidebar to the middle? Using the following minimal working example I can obtain this result:

I'm trying to vertically align sidebar

\documentclass{beamer}
\usetheme{Marburg}


\makeatletter
  \setbeamertemplate{sidebar \beamer@sidebarside}
  {
    \beamer@tempdim=\beamer@sidebarwidth%
    \advance\beamer@tempdim by -6pt%
    \vskip4em%
    \insertverticalnavigation{\beamer@sidebarwidth}%
    \vfill
    \ifx\beamer@sidebarside\beamer@lefttext%
    \else%
      \usebeamercolor{normal text}%
      \llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
      \vskip2pt%
    \fi%
  }%

  \ifx\beamer@sidebarside\beamer@lefttext%
    \defbeamertemplate*{sidebar right}{sidebar theme}
    {%
      \vfill%
      \llap{\usebeamertemplate***{navigation symbols}\hskip0.1cm}%
      \vskip2pt}
  \fi
\makeatother



\title{Some title}
\author{author}
\institute{my workplace}
\date{\today}

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection,currentsubsection]
  \end{frame}
}


\begin{document}

\begin{frame}
\titlepage
\end{frame}

\section[Outline]{}
\frame{\tableofcontents}

\section{Introdution}

\begin{frame}
\frametitle{Basics}
\begin{itemize}
\item A
\pause
\item B
\pause
\item C
\end{itemize}
\end{frame}

\subsection{More basics}

\begin{frame}
\frametitle{something goes here}
more stuff
\end{frame}

\section{My work}

\begin{frame}
my stuff...
\end{frame}

\end{document}

I know that I could use the \vskip command, although I want to have a flexible theme that aligns the sidebar even if it has more items.

1 Answer 1

2

Changing the your line 10,

\vskip4em%

to this:

\vfill%

Will center the text vertically like so: enter image description here

2
  • Thank you! I have some additional related questions. What is the purpose of % at the end of the line? I thought it was only used for comments.
    – karlosos
    Commented Feb 15, 2021 at 17:36
  • 1
    You're right, the % is for comments. Sometimes you need it at the end of lines to prevent an unwanted bit of space. In this case, you really dont need it; I put it on to match the style of the rest of the code. An example of when you do need it is when putting two minipages side by side.
    – Will
    Commented Feb 15, 2021 at 17:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .