[Tex/LaTex] How to remove the sidebar but keep the upper-left logo in the beamer ‘sidebar’ outer theme

beamer

I need to customize either the Berkeley or PaloAlto themes, or just the sidebar outer theme, in order to keep the logo in its default position (upper-left corner) while removing the sidebar. At the moment I have only been able to remove the sidebar (by using the width=0 option, but this removes the logo as well.

As a side issue, I would also like to add an horizontal gray rectangle along the bottom of the slides, that would be immaterial to content layout, that is, that its presence does not alter the output of any contents in the slides, in the sense of scaling or rearranging it anyhow.

Best Answer

You can redefine the headline and frametitle templates; an auxiliary length can be used to save the original sidebar width for later use. For the horizontal rectangle at the bottom, define the footline template using a beamercolorbox of the desired width, height (and depth) and use a previously defined color:

\documentclass{beamer}
\usetheme{PaloAlto}

\setbeamercolor{footlinebox}{fg=gray,bg=gray!60}

\makeatletter
\newdimen\tmpsbwd
\tmpsbwd=\beamer@sidebarwidth
\beamer@sidebarwidth=0pt
\setbeamertemplate{headline}
{%
  \begin{beamercolorbox}[wd=\paperwidth]{frametitle}
    \usebeamercolor[bg]{logo}%
    \hbox to \tmpsbwd{\hss\vbox to
      \beamer@headheight{\vss\hbox{\color{fg}\insertlogo}\vss}\hss}%
 \end{beamercolorbox}
}
\setbeamertemplate{frametitle}
{%
  \nointerlineskip%
  \vskip-\beamer@headheight%
  \vbox to \beamer@headheight{%
    \vfil
    \leftskip=-\beamer@leftmargin%
    \advance\leftskip by\tmpsbwd%
    \advance\leftskip by0.3cm%
    \rightskip=-\beamer@rightmargin%
    \advance\rightskip by0.3cm plus1fil%
    {\usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\insertframetitle\par}%
    {\usebeamercolor[fg]
{framesubtitle}\usebeamerfont{framesubtitle}\insertframesubtitle\par}%
    \vbox{}%
    \vskip-1em%
    \vfil
  }%
}
\setbeamertemplate{footline}
{%
  \begin{beamercolorbox}[wd=\paperwidth,ht=1ex,dp=1ex]{footlinebox}
  \end{beamercolorbox}
}
\makeatother

\setbeamersize{sidebar width left=0cm}

\logo{\includegraphics[width=1.5cm]{cat}}

\begin{document}

\begin{frame}
\frametitle{Test title}
\framesubtitle{Test subtitle}
Test frame
\end{frame}

\end{document}

enter image description here

Related Question