1

I would like to create a new command/macro with the same functionalities \institute has in beamer (\shortinstitute, \insertinstitute, \insertshortinstitute). I search on this site has showed to me that the macro for \author (which, as far as I can see, has the same functionalities) is defined in LaTeX as

def\author#1{\gdef\@author{#1}}
\def\@author{\@latex@error{No \noexpand\author given}\@ehc}

which, I am pretty sure, is not the one beamer uses. I have also checked the definitions provided in the amsart.cls file, but it is beyond my knowledge.

Is there any elegant way, one which, because the way is defined, has all the commands \shortfoo, \insertfoo, \insertshortfoo , etc., automatically established by LaTeX?

Thank you in advance.

1 Answer 1

2
\documentclass{beamer}

\makeatletter
\newcommand{\foo}{\@dblarg\beamer@foo}
\long\def\beamer@foo[#1]#2{%
  \def\insertfoo{#2}%
  \def\insertshortfoo{#1}%
  }
\foo{}
\makeatother


\foo[short foo]{long foo}

\begin{document}
    
\begin{frame}
    abc
  
  \insertfoo
  
  \insertshortfoo
\end{frame} 
    
\end{document}

enter image description here

3
  • +1: What is the benefit of using \@dblarg\beamer@ over "just" using a non-beamer specific \newcommand? Maybe my question is naive :). Commented Sep 19, 2022 at 12:07
  • 1
    @Dr.ManuelKuehner The "advantage" is that like this one can simply copy the beamer code and only has to change the name :) Commented Sep 19, 2022 at 12:13
  • 1
    @Dr.ManuelKuehner ... but more seriously, this way one does not have to worry about the different cases for when the short title is specified or not. Commented Sep 19, 2022 at 12:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .