beamer icon indicating copy to clipboard operation
beamer copied to clipboard

Make `\beamersidebarwidth` defined (but possibly null) in all circumstances

Open dbitouze opened this issue 4 years ago • 0 comments

It would be nice for \beamersidebarwidth (and, maybe, \beamer@sidebarwidth) to be, not undefined, but equal to 0pt in case of sidebar-less themes. Indeed, I used to use the following hack (in order to make titles in plain frames horizontally centered with sidebar themes, see #274):

\begingroup
% Hack that centers the title in the page in case of theme with sidebar.
\ifcsdef{beamer@sidebarwidth}{\setlength{\hoffset}{-.5\csuse{beamer@sidebarwidth}}}{}
\begin{frame}[plain]
  \maketitle
\end{frame}
\endgroup

and I hoped \beamersidebarwidth could, in all circumstances, let me simplify it as follows:

\begingroup
% Hack that centers the title in the page in case of theme with sidebar.
\setlength{\hoffset}{-.5\beamersidebarwidth}
\begin{frame}[plain]
  \maketitle
\end{frame}
\endgroup

but this fails with sidebar-less themes (e.g. the default one).

Here is an MCE which:

\documentclass{beamer}
\usetheme{PaloAlto} % If commented, the compilation fails
\begin{document}
\title{Foo}
\author{Bar Baz}
\begingroup
% Hack that centers the title in the page in case of theme with sidebar.
\setlength{\hoffset}{-.5\beamersidebarwidth}
\begin{frame}[plain]
  \maketitle
\end{frame}
\endgroup
\end{document}

dbitouze avatar Jan 28 '22 09:01 dbitouze