[Tex/LaTex] How to align objects within a side bar in beamer

beamerhorizontal alignmentnavigation

I'm using Beamer with the Marburg theme to create a presentation. I have a custom vertical navigation bar on the left side of the slides and I'd like to add the frame number as well as a small logo on it.

The problem is that I'd like both objects to be horizontally centered, but when I try to use the \centering or \begin{center}… commands, the objects go off the navigation bar, so I have to center them manually, so it's not perfect. I must say though, that the author and the title are horizontally centered.

Here I provide the MWE.

\documentclass[serif]{beamer}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[spanish]{babel}
\usepackage{mathpazo}
\linespread{1.05} 

\author{Lorem ipsum}
\title{Lorem ipsum}
\setbeamertemplate{navigation symbols}{}
 \usetheme[hideallsubsections,left,width=2cm]{Marburg}

\usecolortheme{rose}
 \setbeamercolor{titlelike}{bg=structure,fg=white}

\logo{ \includegraphics[height=1.5cm]{Logo.png}}

  \setbeamertemplate{sidebar left}{
      \vspace{-2\baselineskip}
      \insertlogo

      \vspace{\baselineskip}
      \color{white}{\insertshorttitle[width={2cm},center,respectlinebreaks]}

\insertshortauthor[width={2cm},center,respectlinebreaks] \vspace{\baselineskip}

\insertverticalnavigation{2cm}

\vspace{4\baselineskip}

\insertframenumber

  }


\begin{document}


\section{Lorem Ipsum}

\begin{frame}
\begin{minipage}[t]{0.45\textwidth}
fgns

\end{minipage}
\hfil
\begin{minipage}[t]{0.45\textwidth}
dtyjdy

\end{minipage}
\end{frame}
\section{Lorem Ipsum1}
\begin{frame}
\begin{minipage}[t]{0.45\textwidth}
fgns

\end{minipage}
\hfil
\begin{minipage}[t]{0.45\textwidth}
dtyjdy

\end{minipage}
\end{frame}


\end{document}

Any suggestions?

Thanks in advance,

Charlie

Best Answer

You can use a minipage, if you know the width of the sidebar. Then, \centering works as expected.

\documentclass[serif]{beamer}

\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[spanish]{babel}
\usepackage{mathpazo}
\linespread{1.05} 

\author{Lorem ipsum}
\title{Lorem ipsum}
\setbeamertemplate{navigation symbols}{}
 \usetheme[hideallsubsections,left,width=2cm]{Marburg}

\usecolortheme{rose}
 \setbeamercolor{titlelike}{bg=structure,fg=white}

\logo{ \rule{1.4cm}{1.5cm}}%\includegraphics[height=1.5cm]{Logo.png}}

  \setbeamertemplate{sidebar left}{
\begin{minipage}{2cm}
\centering
      \vspace{-2\baselineskip}
      \insertlogo

      \vspace{\baselineskip}
      \color{white}{\insertshorttitle[width={2cm},center,respectlinebreaks]}

\insertshortauthor[width={2cm},center,respectlinebreaks] \vspace{\baselineskip}

\insertverticalnavigation{2cm}

\vspace{4\baselineskip}

\insertframenumber

\end{minipage}
  }


\begin{document}


\section{Lorem Ipsum}

\begin{frame}
\begin{minipage}[t]{0.45\textwidth}
fgns

\end{minipage}
\hfil
\begin{minipage}[t]{0.45\textwidth}
dtyjdy

\end{minipage}
\end{frame}
\section{Lorem Ipsum1}
\begin{frame}
\begin{minipage}[t]{0.45\textwidth}
fgns

\end{minipage}
\hfil
\begin{minipage}[t]{0.45\textwidth}
dtyjdy

\end{minipage}
\end{frame}


\end{document}

enter image description here

Related Question