josephwright / beamer

A LaTeX class for producing presentations and slides
Other
1.35k stars 139 forks source link

Undefined `\beamer@andstripped` when `usepdftitle=false` with `Bergen` theme #885

Closed alekhe closed 4 months ago

alekhe commented 4 months ago

When Bergen theme is used with the option usepdftitle=false, the following error arises:

! Undefined control sequence.
\beamer@@tmpl@author ...fter {\beamer@andstripped 
                                                  }{}{\begin {block}{\insert...

even if the \author is not filled (\author is not shown in the slide anyway).

Everything is alright if usepdftitle=true or with other themes.

Minimal example:

\documentclass[usepdftitle=false]{beamer}
%\documentclass[usepdftitle=true]{beamer} % <-- Works fine

\author{Lecturer Name}

\usetheme{Bergen}

\begin{document}
\maketitle
\end{document}
samcarter commented 4 months ago

Thanks for the report!

As a quick workaround, this should allow you to compile your document:

\documentclass[usepdftitle=false]{beamer}

\author{Lecturer Name}

\usetheme{Bergen}

\setbeamertemplate{author}{%
%  \expandafter\ifblank\expandafter{\beamer@andstripped}{}{%
  \begin{block}{\insertauthorindicator}
    \usebeamercolor[fg]{author}\usebeamerfont{author}\insertauthor\par
  \end{block}
%  }
}

\begin{document}
\maketitle
\end{document}
samcarter commented 4 months ago

The main problem should be fixed. However there is a very specific edge case in which the author is missing on the title page:

\documentclass[
usepdftitle=false
]{beamer}

\author[]{Lecturer Name}

\usetheme{Bergen}

\begin{document}
\maketitle
\end{document}
samcarter commented 4 months ago

I'm wondering if there would be any disadvantages of making \beamer@andstripped generally available instead of only if \ifbeamer@autopdfinfo is true:

\def\author{\@dblarg\beamer@author}
\long\def\beamer@author[#1]#2{%
  \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}#2}%
  \def\beamer@shortauthor{#1}%
  \def\beamer@andstripped{}%
  \beamer@stripands#2 \and\relax
  {\let\inst=\@gobble\let\thanks=\@gobble\def\and{, }  \ifbeamer@autopdfinfo\hypersetup{pdfauthor={\beamer@andstripped}}\fi}
}
samcarter commented 4 months ago

close https://github.com/josephwright/beamer/commit/1b04c51a596a51530adeff278ca2c43aa963c9b1