1

I am trying to understand the following code:

\def\author{\@dblarg\beamer@author}
\long\def\beamer@author[#1]#2{%
  \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}#2}%
}

Patterns similar to the above example turn up in beamerbasetitle.sty.

What I understood so far

\def\author{\@dblarg\beamer@author}

This line is explained in the SE post q/56329. We need this line to define \beamer@author in a way that it handles the cases \author{abc} and \author[xyz]{abc}.

\long\def\beamer@author[#1]#2{%

This line (re-)defines the \beamer@author command (?)

\def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}#2}%

This line is the line that confuses me the most. The \def\insertauthor defines the \insertauthor command, and, from what I got from the question q/541515, a call like \insertauthor{J. Doe} would then expand to

\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}J. Doe

Correct? Why do we need to add \def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}? I feel like

\def\insertauthor{#2}%

would also do the job. I also noticed the following part in beamerbasetitle.sty.:

% Aux commands for \author
\def\beamer@insttitle#1{\textsuperscript{#1}}
\def\beamer@andtitle{\quad}

I would like to understand how the nested \defs are expanded and how to read the initial example.

  • 1
    a call like \insertauthor{J. Doe} no \insertauthor is not defined to take an argument, see the line you show, it is \def\insertauthor{... not \def\insertauthor#1{... – David Carlisle Mar 19 '22 at 09:09
  • @DavidCarlisle Thank you for this explanation. If I understand correctly, the line \def\insertauthor{.. only defines the command \insertauthor which expands to \def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}J. Doe if I call \author{J. Doe}? – el_tenedor Mar 19 '22 at 09:22
  • 1
    You can give more than one author, e.g. \author[Hemaspaandra et al.]{L. Hemaspaandra\inst{1} \and T. Tantau\inst{2}}, your two \def ensure that \inst and \and then have locally the needed definition. – Ulrike Fischer Mar 19 '22 at 09:24
  • 1
    yes and so the author name specified in \author isn't directly used but whatever beamer template is being used can use \insertauthor where it wants to insert the author name – David Carlisle Mar 19 '22 at 09:24
  • @UlrikeFischer Thank you for pointing out this instructive example. Found it now also in the beameruserguide. It makes completely sense to specify \inst and \and for a command like \author that should be able to handle these commands in its argument. – el_tenedor Mar 19 '22 at 09:41

0 Answers0