Line by line commentary
\gdef\@author{\mbox{}}
Initialize \@author
to an empty box
\def\author{\@ifnextchar [{\@authortwo}{\@authorone}}
Define \author
(the user level command) to execute \@authortwo
if followed by [
, \@authorone
otherwise.
\def\@authortwo[#1]#2{\gdef\@author{\uppercase{#2}}\gdef\@shortauthor{#1}}
Define \@authortwo
to absorb input of the form \author[x]{y}
(we know [
is there; store the bracket-delimited argument into \@shortauthor
and the normal argument in \@author
but surrounded by \uppercase
(programming error here).
\def\@authorone#1{\gdef\@author{#1}
\begingroup\gdef\@shortauthor{#1}\endgroup}
Define \@authorone
to store its argument in \@author
and also store it in \@shortauthor
. Why is the latter command done inside a group is something only the code author can explain. Also, why in only one case the author name is uppercased is a big mystery.
\def\shortauthor#1{\gdef\@shortauthor{#1}}
\gdef\@shortauthor{}
A user level command for storing the short author name in \@shortauthor
; the variable is initialized to empty.
Example 1
\author{Abigail Uthor}
We end up with \@author
and \@shortauthor
both containing Abigail Uthor
Example 2
\author[A. Uthor]{Abigail Uthor}
We end up with \@author
containing \uppercase{Abigail Uthor}
and \@shortauthor
containing A. Uthor
Example 3
\author{Abigail Uthor}
\shortauthor{A. Uthor}
Like in example 2, but without the \uppercase
.
Example 4
\shortauthor{A. Uthor}
\author{Abigail Uthor}
Like in example 1, because the redefinition of \@shortauthor
by \shortauthor
is overridden by the code in \author
Why is \uppercase
a programming error?
Obviously, the different behavior when the optional argument is used is an error. However uppercasing should be done when \@author
is used, not when it is stored. And \MakeUppercase
should be used, anyway.
\author[JH Well and MJ Baide]{John Haide Well and Maxwell John Baide}
that will be set when you issue\maketitle
.