% \iffalse      THIS IS A META-COMMENT
%<*dtx>
\ProvidesFile
%========================================================================
                       {AUTHBLK.DTX}
%========================================================================
%</dtx>
%% Copyright 1997-1999 Patrick W Daly
%% Max-Planck-Institut f\"ur Aeronomie
%% Max-Planck-Str. 2
%% D-37191 Katlenburg-Lindau
%% Germany
%% E-mail: daly@linmpi.mpg.de
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% This is a contributed file to the LaTeX2e system.
% -------------------------------------------------
%         This is a LaTeX package to prepare author/affiliation blocks
% Installation:
%    LaTeX this file: creates docstrip installation file authblk.ins
%                         AND the (LaTeX2e) documentation
%    (La)TeX authblk.ins: creates package files authblk.sty, and optionally
%                         documentation driver authblk.drv
%    (authblk.ins may be edited as needed)
%     Docstrip options available:
%        package - to produce a .sty file with the uncommented coding
%        driver  - to produce a driver file to print the documentation
%        209     - (with package) for package that runs under LaTeX 2.09
%        subpack - (with package) for coding included in other packages
%     LaTeX the unstripped version to obtain the documentation
%     (Documentation can be produced with LaTeX2e only)
%--------------------------------------------------------------------------
%<*!subpack>
%<package&209>\def\ProvidesPackage#1#2]
%<package&209>  {\typeout{Style option `#1'#2]}}
%
%  *** Identify the package file:-
%<package&!209>\NeedsTeXFormat{LaTeX2e}[1995/06/01]
%<package>\ProvidesPackage{authblk}
%</!subpack>
%
%  *** Provide command to dislay module version
%<package&subpack>\def\ModuleVersion#1[#2]{}
%<package&subpack>    \ModuleVersion{authblk}
%
%  *** Identify the driver file:-
%<driver>\NeedsTeXFormat{LaTeX2e}
%<driver>\ProvidesFile{authblk.drv}
%
%  *** The DATE, VERSION, and other INFO
%\fi
%\ProvidesFile{authblk}
          [2001/02/27 1.3 (PWD)]
%\iffalse
%<*package>
%<*!subpack>
 %-------------------------------------------------------------------
 % NOTICE:
 % This file may be used for non-profit purposes.
 % It may not be distributed in exchange for money,
 %   other than distribution costs.
 %
 % The author provides it `as is' and does not guarantee it in any way.
 %
%</!subpack>
%</package>
%% authblk coding copyright (C) 1997 Patrick W. Daly
%<*package>
%<*!subpack>
 % Max-Planck-Institut f\"ur Aeronomie
 % Max-Planck-Str. 2
 % D-37191 Katlenburg-Lindau
 % Germany
 %
 % E-mail: daly@linmpi.mpg.de
 %-----------------------------------------------------------
%</!subpack>
%</package>
%                    END META-COMMENT \fi
% \changes{1.0}{1997 Apr 22}{First version}
% \changes{1.1}{1997 Aug 28}{Allow standard \cs{author} to come before package
%               loaded}
% \changes{1.1a}{1998 Jul 14}{A 2.09 fixup}
% \changes{1.2}{1999 Feb 23}{Update copyright notice}
% \changes{1.3}{2001 Feb 27}{Make stand-alone by changing \cs{maketitle} to center}
%
% \CheckSum{404}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \iffalse
%<*install>
%^^A =============================================
%^^A    Here is the docstrip installation file
%^^A    It is written on first LaTeX run if it
%^^A    does not already exist
%^^A =============================================
\begin{filecontents*}{authblk.ins}
% File: authblk.ins
% Copyright 1999 Patrick W. Daly
%
% This file can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% It is an installation file for extracting package and driver
% files from the original source file. Simply process it under
% TeX or LaTeX.

\input docstrip

\preamble
=============================================
IMPORTANT NOTICE:

This program can be redistributed and/or modified under the terms
of the LaTeX Project Public License Distributed from CTAN
archives in directory macros/latex/base/lppl.txt; either
version 1 of the License, or any later version.

This is a generated file.
It may not be distributed without the original source file \inFileName.

Full documentation can be obtained by LaTeXing that original file.
Only a few abbreviated comments remain here to describe the usage.
=============================================
\endpreamble
\postamble

<<<<< End of generated file <<<<<<
\endpostamble

\declarepreamble\driver
============================================
This is the driver file to produce the LaTeX documentation
from the original source file \inFileName.

Make changes to it as needed. (Never change the file \inFileName!)
============================================
\endpreamble

\declarepostamble\driverq

End of documentation driver file.
\endpostamble

\keepsilent
\askforoverwritefalse

\generate{\file{authblk.sty}{\from{authblk.dtx}{package}}
          \file{authblk.drv}{\usepreamble\driver\usepostamble\driverq
                           \from{authblk.dtx}{driver}}
         }

\obeyspaces
\Msg{******************************************}%
\Msg{* For documentation, process authblk.dtx *}%
\Msg{*    or the driver file      authblk.drv *}%
\Msg{******************************************}

\endbatchfile
\end{filecontents*}
%</install>
%<*driver>
\documentclass{ltxdoc}
%<driver>%\documentclass[twoside]{ltxdoc}
%<driver>%\documentclass[a4paper]{ltxdoc}
%<driver>%\documentclass[twoside,a4paper]{ltxdoc}
\raggedbottom

 %** To include the detailed explanation of the coding, comment out
 %**   the next line
\OnlyDescription

 %** To produce a command index: add the following line for one run,
 %**   then run  makeindex -s gind.ist authblk
 %**   and reprocess, with or without this line (much faster without)
%<driver>% \EnableCrossrefs\CodelineIndex

 %** To produce a change history: add the following line for one run,
 %**   then run  makeindex -s gglo.ist -o authblk.gls authblk.glo
 %**   and reprocess, with or without this line (faster without)
%<driver>% \RecordChanges

\DisableCrossrefs %May stay; zapped by \EnableCrossrefs
\CodelineNumbered %May stay

\begin{document}
   \DocInput{authblk.dtx}
\end{document}
%</driver>
%\fi
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
% \DoNotIndex{\ClassWarning,\PackageWarning,\ClassWarningNoLine}
% \DoNotIndex{\PackageWarningNoLine,\ClassInfo,\PackageInfo,\MessageBreak}
% \DoNotIndex{\space,\protect,\DeclareRobustCommand,\CheckCommand}
% \DoNotIndex{\newcommand,\renewcommand,\providecommand,\newenvironment}
% \DoNotIndex{\renewenvironment,\newif,\newlength,\newcounter,\setlength}
% \DoNotIndex{\setcounter,\if,\ifx,\ifcase,\ifnum,\ifdim,\else,\fi}
% \DoNotIndex{\texttt,\textbf,\textrm,\textsl,\textsc}
% \DoNotIndex{\textup,\textit,\textmd,\textsf,\emph}
% \DoNotIndex{\ttfamily,\rmfamily,\sffamily,\mdseries,\bfseries,\upshape}
% \DoNotIndex{\slshape,\scshape,\itshape,\em,\LaTeX,\LaTeXe}
% \DoNotIndex{\filename,\fileversion,\filedate,\let}
% \DoNotIndex{\\,\@empty,\@namedef,\@nameuse,\@tempa,\@temptokena}
% \DoNotIndex{\@unexpandable@protect,\addtocounter,\and,\arabic}
% \DoNotIndex{\begingroup,\c@authors,\edef,\endgroup,\expandafter}
% \DoNotIndex{\ignorespaces,\large,\maxdimen,\noexpand,\normalfont,\number}
% \DoNotIndex{\relax,\textsuperscript,\the,\value,\xdef,\z@}
% \DoNotIndex{\@ifundefined,\@ifnextchar,\document,\gdef,\global,\rm}
% \DoNotIndex{\rlap,\footnote,\thanks}
%
% \setcounter{IndexColumns}{2}
% \setlength{\IndexMin}{10cm}
% \setcounter{StandardModuleDepth}{1}
%
% \GetFileInfo{authblk}
%
% \title{\bfseries A \LaTeX\ Package to Prepare Author and Affiliation Blocks}
%
% \author{Patrick W. Daly}
%
% \date{This paper describes \LaTeXe\ package \texttt{\filename}\\
%       version \fileversion{} from \filedate\\[1ex]
%     \textsl{It is part of the \texttt{preprint} collection of packages}
%  }
%
% \maketitle
%
% \pagestyle{myheadings}
% \markboth{P. W. Daly}{Author/Affiliation Blocks}
%
%^^A In order to keep all marginal notes on the one (left) side:
%^^A (otherwise they switch sides disasterously with twoside option)
% \makeatletter \@mparswitchfalse \makeatother
%
%\begin{small}\begin{center}\textbf{Summary}\end{center}
% The stripped version of this file contains the following brief description:
%\iffalse
%<*package&!subpack>
 % Author/Affiliation Blocks
%\fi
% \begin{verbatim}
 % A LaTeX2e package to redefine the \author command to work as normal or
 % to allow a footnote style of author/affiliation input.
 %
 % Three methods of input:
 %  1. Standard LaTeX
 %     \author{Name1//Affil1 /and Name2 and Name3//Affil2 . . .}
 % (use \authorcr, not \\, to force new line within the author text)
 %  2. Automatic mode (selects modes 1 or 3 depending on number of affiliations)
 %     \author{Name1}
 %     \affil{Affil1}
 %     \author{Name2}
 %     \author{Name3}
 %     \affil{Affil2}
 %     . . .
 %  3. Footnotes explicitly
 %     \author[*]{Name1}
 %     \author[**]{Name2}
 %     \author[**]{Name3}
 %     \affil[*]{Affil1}
 %     \affil[**]{Affil2}
 %     . . .
% \end{verbatim}
%\iffalse
 % See documentation in authblk.dtx for further configuration possibilities.
 %-----------------------------------------------------------
%</package&!subpack>
%\fi
%\end{small}
% \newcommand\brsl{/\discretionary{}{}{}}
%
% \section{Introduction}
% The standard \LaTeX\ syntax for entering author names and their
% affiliations is rather limited. The standard is to have \emph{author
% blocks} consisting of all authors from one institute grouped together.
% However, if there are many institutes, or if the authors are ordered in
% some other way (e.g.\ alphabetically) it is more appropriate to use a
% footnote system. Both methods should be available for any paper since the
% style depends more on the number of authors and affiliations and their
% mixture.
%
% This package offers a syntax for entering author names and their
% affiliations that permits both styles, and is also compatible with the
% standard \LaTeX\ syntax. It places its results in the control sequence
% |\@author|, which is the standard container for the author\brsl{}affiliation
% names; in this way it can be used immediately with standard \LaTeX\
% classes, or with packages that modify the title\brsl{}author block.
%
% \section{Invoking the Package}
% The macros in this package are included in the main document
% with the |\usepackage| command of \LaTeXe,
% \begin{quote}
% |\documentclass[..]{...}|\\
% |\usepackage[|\emph{options}|]{|\texttt{\filename}|}|
% \end{quote}
% where the possible \emph{options} are described below in Section~\ref{opts}.
%
% \section{Usage}
%
% Authors and affiliations can be printed in author blocks, as
% \begin{center}
% \begin{tabular}[t]{c}
% J. B. Smith\\Institute for Research\\Hamilton, Ontario
% \end{tabular}\\[1ex]
% \begin{tabular}[t]{c}
% C. T. Appleton and P. R. Bailey\\NASA, Greenbelt, MD
% \end{tabular}
% \end{center}
% or in a line with footnote markers for the affiliations, as
% \begin{center}
% J. B. Smith\textsuperscript{1}, C. T. Appleton\textsuperscript{2}, and
% P. R. Bailey\textsuperscript{2}\\[1ex]
% \textsuperscript{1}Institute for Research, Hamilton, Ontario\\
% \textsuperscript{2}NASA, Greenbelt, MD
% \end{center}
%
% \DescribeMacro{\author}
% \DescribeMacro{\affil}
% The user can enter the author and affiliation information in a number of
% different manners.
% \begin{enumerate}
%   \item \label{ab}Standard \LaTeX, with syntax
%     \begin{quote}
%       |\author{|\dots|\and|\dots|\and|\dots|}|
%     \end{quote}
%       where each block of author(s)\brsl{}affiliation comes between the
%       |\and| commands, containing possibly |\\| for new lines;
%
%   \item \label{abfn} Automatic switching between author block or footnote
%      style, information input with a series of |\author|, |\affil|
%      commands as
%     \begin{quote}
%       |\author{|\emph{author1}|}|\\
%       |\author{|\emph{author2}|}|\\
%       |\affil{|\emph{affil1}|}|\\
%       |\author{|\emph{author3}|}|\\
%       |\author{|\emph{author4}|}|\\
%       |\affil{|\emph{affil2}|}|\\
%       $\cdots$
%     \end{quote}
%     where the authors will appear all in one (possibly continued) line
%     with automatic footnotes, and the affiliations appear in separate lines
%     below;
%
%   \item \label{fn}Footnote style with manual footnote markers given as
%       optional arguments; in this case, the |\author| and |\affil| commands
%       can be fully separated:
%     \begin{quote}
%       |\author[1]{|\emph{author1}|}|\\
%       |\author[1]{|\emph{author2}|}|\\
%       |\author[2]{|\emph{author3}|}|\\
%       |\author[2]{|\emph{author4}|}|\\
%       |\affil[1]{|\emph{affil1}|}|\\
%       |\affil[2]{|\emph{affil2}|}|\\
%       $\cdots$
%     \end{quote}
% \end{enumerate}
% Method \ref{ab} can only produce author blocks; method \ref{fn} only
% footnotes, while \ref{abfn} can produce both. If the number of affiliations
% is greater than \texttt{Maxaffil}, footnotes are used, otherwise author
% blocks.
%
% \DescribeMacro{\authorcr}
% With method \ref{ab}, the |\\| command is used to switch to affiliation
% text, possibly changing the font; if the author text is to be forced to a
% new line, use |\authorcr| instead.
%
% \noindent\textbf{Warning:}
% methods \ref{abfn} and \ref{fn} can only be used \emph{after}
% \texttt{\filename} has been loaded, since |\affil| is otherwise
% not defined. However, a single |\author| command (method \ref{ab})
% can appear before |\usepackage|, or even before |\documentclass|,
% as is allowed in standard \LaTeX.
%
% \section{Configuration}
%
% Certain aspects of the author\brsl{}affiliation blocks can be controlled by
% the user through redefinitions.
%
% As already \marginpar{\raggedleft\texttt{Maxaffil}}
% mentioned, the maximum number of affiliations before automatically
% switching from author block to footnote mode is set in the counter
% |Maxaffil|. Redefine this with
% \begin{quote}|\setcounter{Maxaffil}{2}|\end{quote}
% The default is 2.
%
% \DescribeMacro{\Authfont}
% \DescribeMacro{\Affilfont}
% The author and affiliation lines can be set in different fonts, determined
% by these macros. By default they are |\normalfont|. Redefine them with
% |\renewcommand|, for example:
% \begin{quote}\begin{verbatim}
% \renewcommand\Authfont{\scshape}
% \renewcommand\Affilfont{\itshape\small}
% \end{verbatim}
% \end{quote}
%
% \DescribeMacro{\affilsep}
% The interline spacing between the author and affiliation lines is set by
% the length |\affilsep|. Change this with |\setlength|, as
% \begin{quote}|\setlength{\affilsep}{1em}|\end{quote}
% This spacing applies to both footnote and author block modes.
%
% \DescribeMacro{\Authsep}
% \DescribeMacro{\Authand}
% \DescribeMacro{\Authands}
% In footnote mode, one can change the texts that comes between the
% authors' names, between two authors, and before the last author when there
% are more than two. For example,
% \begin{quote}\begin{verbatim}
% \renewcommand\Authsep{, }
% \renewcommand\Authand{ and }
% \renewcommand\Authands{, and }
% \end{verbatim}
% \end{quote}
% This example actually shows the defaults.
%
% \section{Options during Loading}\label{opts}
% Some reconfigurations are provided for by means of options to the
% |\usepackage| command. These are:
% \begin{description}
% \item[\ttfamily blocks]
%   sets |Maxaffil| to $\infty$ so that the automatic selection will always be
%   author\brsl{}affiliation blocks;
%
% \item[\ttfamily noblocks]
%   sets |Maxaffil| to 0 so that the automatic selection will always be
%   footnote mode;
%
% \item[\ttfamily max$n$] ($n=2,6$) sets |Maxaffil| to $n$;
%
% \item[\ttfamily auth-sc] sets author font to small caps;
%
% \item[\ttfamily auth-sc-lg] sets author font to small caps, but with size
%     |\large|;
%
% \item[\ttfamily auth-lg] sets author font to normal, but in size |\large|;
%
% \item[\ttfamily affil-sl] sets affiliation font to slanted;
%
% \item[\ttfamily affil-it] sets affiliation font to italic;
%
% \item[\ttfamily german] changes `and' to `und' in author lists.
% \end{description}
%
% \StopEventually{\PrintIndex\PrintChanges}
%
% \section{Options with \texttt{docstrip}}
% The source \texttt{.dtx} file is meant to be processed with
% \texttt{docstrip}, for which a number of options are available:
% \begin{description}
% \item[\ttfamily package] to produce a \texttt{.sty} package file with most
%     comments removed;
%
% \item[\ttfamily subpack] (together with \texttt{package}) for coding that
%     is to be included inside a larger package; even more comments are
%     removed, as well as \LaTeXe{} option handling and identification;
%
% \item[\ttfamily 209] (together with \texttt{package}) for a style option
%     file that will run under the older \LaTeX~2.09;
%
% \item[\ttfamily driver] to produce a driver \texttt{.drv} file that will
%     print out the documentation under \LaTeXe. The documentation cannot
%     be printed under \LaTeX~2.09.
%
% \end{description}
% The source file \texttt{\filename.dtx} is itself a driver file and can
% be processed directly by \LaTeXe.
%
% \section{The Coding}
% This section presents and explains the actual coding of the macros.
% It is nested between |%<*package>| and |%</package>|, which
% are indicators to \texttt{docstrip} that this coding belongs to the package
% file.
%
% The \texttt{docstrip} option |<subpack>| should only be called if the
% coding is to be included as part of another package, in which case the
% announcement text and \LaTeXe{} options are suppressed.
%
% An alternative version of this coding is provided for running as a
% style file under \LaTeX~2.09. Code lines belonging to this are
% indicated with guard |<209>|; those for LaTeXe{} only with |<!209>|.
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% \subsection{Basic Idea}
%
% In the standard \LaTeX\ classes, the authors and their affiliations are
% input through the |\author| command, which simply stores the argument in
% |\@author|. The text is then output by the |\maketitle| macro within a
% |tabular| environment, as
% \begin{quote}\begin{verbatim}
% \begin{tabular}[t]{c}%
%   \@author
% \end{tabular}
% \end{verbatim}
% \end{quote}
% Different blocks within the |\author| text are separated by the |\and|
% command, defined as
% \begin{quote}\begin{verbatim}
% \def\and{%
%   \end{tabular}%
%   \hskip 1em \@plus.17fil%
%   \begin{tabular}[t]{c}}%
% \end{verbatim}
% \end{quote}
% Clearly, the definition of |\and| must be compatible with the environment
% in which |\@author| is output.
%
% The \texttt{\filename} package provides a new way to enter the author and
% affiliation data, but puts the results into |\@author|, which means it can
% be used with the standard classes or with any class that has the author
% information in |\@author|. Since \texttt{\filename} controls all the font
% formatting for author and affiliation lines, |\maketitle| should not do
% this.
%
% \subsection{Configurable Commands}
%
% All internal commands are designated with |\AB@..| to avoid name conflicts
% with other packages. Commands that may be redefined for local configuration
% contain no |@| and begin with an uppercase letter, like |\Authfont|.
%
% The following allow the author and affiliation blocks to be formatted.
% These may be changed in the document or in packages that input (include)
% \texttt{\filename}.
%
% \begin{macro}{\Authfont}
% \begin{macro}{\Affilfont}
% Declarations that are to be issued for the authors and affiliations are
% defined here. Redefine these, for example, as
% \begin{quote}\begin{verbatim}
% \renewcommand\Authfont{\scshape}
% \renewcommand\Affilfont{\itshape\small}
% \end{verbatim}
% \end{quote}
% By default, they are the |\normalfont|.
%    \begin{macrocode}
\newcommand\Authfont{\normalfont}
\newcommand\Affilfont{\normalfont}
%<209>\@ifundefined{normalfont}{\let\normalfont\rm}{}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\Authsep}
% \begin{macro}{\Authand}
% \begin{macro}{\Authands}
% Three macros determine what comes between author names,
%    \begin{macrocode}
\newcommand\Authsep{, }
%    \end{macrocode}
% what comes between the last and second last names for more than two authors,
%    \begin{macrocode}
\newcommand\Authands{, and }
%    \end{macrocode}
% and for exactly two authors.
%    \begin{macrocode}
\newcommand\Authand{ and }
%    \end{macrocode}
% These could be language dependent.
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\affilsep}
% The vertical spacing between an author and affiliation line. The length
% |\@affilsep| comes between affiliation lines and switches between
% |\affilsep| and 0~pt as needed.
%    \begin{macrocode}
\newlength{\affilsep}\setlength{\affilsep}{1em}
\newlength{\@affilsep}
%    \end{macrocode}
% \end{macro}
% Also part of the local configuration is the maximum number of affiliations
% before switching to footnote mode. Redefine this with |\setcounter|.
%    \begin{macrocode}
\newcounter{Maxaffil}
\setcounter{Maxaffil}{2}
%    \end{macrocode}
%
% \subsection{Package Options}
%
% Options are provided to select some author and affiliation fonts, and
% certain values of |Maxaffil|, including 0 (always footnote mode) and
% infinity (always block mode).
%    \begin{macrocode}
%<*!subpack&!209>
\DeclareOption{blocks}{\setcounter{Maxaffil}{\maxdimen}}
\DeclareOption{noblocks}{\setcounter{Maxaffil}{0}}
\DeclareOption{max2}{\setcounter{Maxaffil}{2}}
\DeclareOption{max3}{\setcounter{Maxaffil}{3}}
\DeclareOption{max4}{\setcounter{Maxaffil}{4}}
\DeclareOption{max5}{\setcounter{Maxaffil}{5}}
\DeclareOption{max6}{\setcounter{Maxaffil}{6}}
\DeclareOption{auth-sc}{\renewcommand\Authfont{\scshape}}
\DeclareOption{auth-sc-lg}{\renewcommand\Authfont{\large\scshape}}
\DeclareOption{auth-lg}{\renewcommand\Authfont{\large}}
\DeclareOption{affil-sl}{\renewcommand\Affilfont{\slshape}}
\DeclareOption{affil-it}{\renewcommand\Affilfont{\itshape}}
\DeclareOption{german}{\renewcommand\Authand{, und }%
                       \renewcommand\Authands{, und }}
\ProcessOptions
%</!subpack&!209>
%    \end{macrocode}
%
% \subsection{Supporting Macros}
%
% First declare some counters and flags. The number of authors, affiliations,
% and a flag to mark a new affiliation.
%    \begin{macrocode}
\newcounter{authors}
\newcounter{affil}
\newif\ifnewaffil \newaffiltrue
%    \end{macrocode}
%
% \begin{macro}{\AB@authnote}
% \begin{macro}{\AB@affilnote}
% The formatting of the footnote markers in the author and affiliation lines.
% The |\textsuperscript| command must be defined for 2.09 and provided for
% earlier version of \LaTeXe\ (before 1995/06/01).
%    \begin{macrocode}
\newcommand\AB@authnote[1]{\textsuperscript{\normalfont#1}}
\newcommand\AB@affilnote[1]{\textsuperscript{\normalfont#1}}
%<209>\@ifundefined{textsuperscript}{\newcommand\textsuperscript[1]{$^{#1}$}}{}
%<!209>\providecommand\textsuperscript[1]{$^{#1}$}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\AB@blk@and}
% The macro that comes between author blocks. Initially this is nothing other
% than setting the author font, but will be set to |\and| after the first
% invocation. Again, everything in this definition must be robust, either
% intrinsically or with |\protect| commands. The macro |\AB@setsep|
% sets |\@affilsep| to the author-affiliation separation.
%    \begin{macrocode}
\newcommand\AB@blk@and{\protect\Authfont\protect\AB@setsep}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\AB@pand}
% The `protected' version of |\and| that is inserted in |\AB@authors| between
% authors and affiliations; since it begins a new author block, it sets the
% font to the author font, and the interline spacing to the
% author\brsl{}affiliation spacing.
%    \begin{macrocode}
\newcommand\AB@pand{\protect\and \protect\Authfont \protect\AB@setsep}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@sep1}\begin{macro}{\@sep2}
% The $n$th author in |\AB@authlist| is preceeded by
% |\@sep|$n$; this is defined as empty for $n$=1 and the as the
% two-author separation for $n$=2, to be altered later.
%    \begin{macrocode}
\@namedef{@sep1}{}
\@namedef{@sep2}{\Authand}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\AB@affilsep}
% \begin{macro}{\AB@affilsepx}
% What comes before the very first footnote affiliation, and before all
% successive affiliations. These should be separate lines within some
% tabular environment, so reset the font every time to the affiliation one.
% (Note: |\\| is robust in \LaTeXe, but not in 2.09; adding the |\protect|
% before |\\| does not hurt, though.)
%    \begin{macrocode}
\newcommand\AB@affilsep{\protect\Affilfont}
\newcommand\AB@affilsepx{\protect\\\protect\Affilfont}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\AB@setsep}
% \begin{macro}{\AB@resetsep}
% The current interline spacing within affiliations is |\@affilsep|; the
% initial spacing (between authors and first affiliation line) is
% |\affilsep|; switching |\@affilsep| between 0~pt and |\affilsep| is done
% with these macros.
%    \begin{macrocode}
\newcommand\AB@setsep{\setlength{\@affilsep}{\affilsep}}
\newcommand\AB@resetsep{\setlength{\@affilsep}{\z@}}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\AB@authlist}
% \begin{macro}{\AB@affillist}
% \begin{macro}{\AB@authors}
% There are three `lists' that are filled up with various commands:
% \begin{itemize}
%   \item |\AB@authlist| containing all the authors;
%
%   \item |\AB@affillist| containing all the affiliations;
%
%   \item |\AB@authors| ($\equiv$|\@author|) containing the input of the
%      standard \LaTeX\ |\author| command,  a mixture of authors and
%      affiliations, with blocks separated by |\and| commands.
% \end{itemize}
% |\AB@empty| is provided for testing the emptiness of |\AB@affillist|
% later. (Do not use |\@empty|, because that is not a `long' macro.)
%
% Here these lists are initialized.
%    \begin{macrocode}
\newcommand\AB@authlist{}
\newcommand\AB@affillist{}
\newcommand\AB@authors{}
\newcommand\AB@empty{}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\AB@author}
% \changes{1.1}{1997 Aug 28}{Initialize to existing \cs{@author}}
% \changes{1.1a}{1998 Jul 14}{Define \cs{@author} for 2.09}
% The |\AB@author| macro holds the argument of the last issued |\author|
% command, normally stored in |\@author|. Equate these now in case
% |\author| was issued before the class and/or packages were loaded,
% something that is allowed in standard \LaTeX. Of course, the new
% features with |\affil| and multiple |\author| commands will not
% function before this package is loaded.
%
% For \LaTeX~2.09, must provisionally define |\@author|.
%    \begin{macrocode}
%<209>\@ifundefined{@author}{\def\@author}{}
\xdef\AB@author{\noexpand\AB@blk@and\@author}
%    \end{macrocode}
% \end{macro}
%
% \subsection{User Interfacing Commands}
%
% \begin{macro}{\author}
% Three lists are maintained for authors and affiliations. In |\AB@authors|,
% the text for the author block is stored; both |\author| and |\affil| add
% their arguments to this list, with |\\| between author and affiliation, and
% |\and| between the affiliation and the next author text. If one only uses
% the |\author| command (standard \LaTeX) one must add these separators
% explicitly in the argument.
%
% In addition, both |\author| and |\affil| store their arguments in
% |\AB@authlist| and |\AB@affillist|, adding footnote marks determined either
% automatically, or by the optional arguments.
%
% Finally, |\@author| will be made up either by |AB@author|, |\AB@authors|, or
% |\AB@authlist| plus |\AB@affillist|.
%
% Consequently, |\author| and |\affil| are fairly complex.
%    \begin{macrocode}
%<209>\renewcommand\author{\@ifnextchar[%]
%<209>  {\@Xauthor}{\@Xauthor[]}}
%<209>\def\@Xauthor[#1]#2%
%<!209>\renewcommand\author[2][]%
%    \end{macrocode}
% The flag |\ifnewaffil| is set by |\affil| to tell |\author| that a new
% author block is beginning. This flag is set to \meta{false} at the end
% if this macro.
%    \begin{macrocode}
      {\ifnewaffil\addtocounter{affil}{1}%
       \edef\AB@thenote{\arabic{affil}}\fi
%    \end{macrocode}
% Argument |#1| is the optional footnote marker; if it is present, force the
% footnote mode by setting |Maxaffil| counter to zero.
%    \begin{macrocode}
      \if\relax#1\relax\def\AB@note{\AB@thenote}\else\def\AB@note{#1}%
        \setcounter{Maxaffil}{0}\fi
%    \end{macrocode}
% The author list in |\AB@authlist| is to have commas (|\Authsep|) between
% the names, nothing before the first one, and `and' (|\Authands|) before the
% last one. If only two names are present, they are separated by |\Authand|.
% To accomplish this, place |@sep|$n$ before author $n$ which
% is defined to be |\Authands|; at the same time, define the previous one to
% be |\Authsep|, taking care that |\@sep1| (empty) is never redefined, and
% that |\@sep2| (|\Authand|) is only redefined after the third author. Note
% that at this point in the coding, the |authors| counter is not yet
% incremented, so its value is $n-1$.
%    \begin{macrocode}
      \ifnum\value{authors}>1\relax
      \@namedef{@sep\number\c@authors}{\Authsep}\fi
      \addtocounter{authors}{1}%
%    \end{macrocode}
% Put the new author text in |#2| into the lists |\AB@authors| and
% |\AB@authlist|. Because of the expansion method of getting the existing
% contents of these lists, all commands in the arguments must be robust. For
% this reason, make |\thanks| and |\footnote| robust (they normally are
% fragile).
%
% Note that every new line inserted into |\AB@authors| must contain
% formatting declarations, like |\Authfont| and |\Affilfont|.
% The newline command |\\| switches to affiliation, with extra interline
% spacing and a different font. The extra spacing is in |\@affilsep| which is
% either zero or |\affilsep|, as set by commands |\AB@resetsep| and
% |\AB@setsep|. The extra spacing is meant only to come between author and
% first affiliation lines.
%
% The newline command should behave differently in |\AB@authlist|; the
% |\authorcr| macro is adequate for this (new line and |\Authfont|).
%
% Reminder: the font declarations must be made on each new line since
% |\@author| is normally placed within a |tabular| environment where each
% line has local scope so all declarations and definitions apply only within
% it.
%    \begin{macrocode}
      \begingroup
          \let\protect\@unexpandable@protect \let\and\AB@pand
          \def\thanks{\protect\thanks}\def\footnote{\protect\footnote}%
         \@temptokena=\expandafter{\AB@authors}%
         {\def\\{\protect\\[\@affilsep]\protect\Affilfont
              \protect\AB@resetsep}%
%    \end{macrocode}
% To allow for the standard \LaTeX\ syntax with only one |\author| command
% for everything, put the argument |#2| into |\AB@author| with the
% appropriate preamble |\AB@blk@and|. If |\affil| is never called, this
% will be the final content of |\@author|. Otherwise it will become
% |\AB@authors|. Here the previous author is |\AB@au@str| is put into
% |\AB@authors|, and then |#2| is stored for the next |\author| or |\affil|
% call. |\AB@as| is the separator between authors in one sub-block; |\AB@las|
% is the separator before the last author in a sub-block; this is entered by
% |\affil| which signals the end of a sub-block of authors.
% (This delayed entry method cannot be used for |\AB@authlist| because there
% one needs to know the very last author, but one never knows if another
% |\affil| command might come along.)
%    \begin{macrocode}
              \xdef\AB@author{\AB@blk@and#2}%
       \ifnewaffil\gdef\AB@las{}\gdef\AB@lasx{\protect\Authand}\gdef\AB@as{}%
           \xdef\AB@authors{\the\@temptokena\AB@blk@and}%
       \else
          \xdef\AB@authors{\the\@temptokena\AB@as\AB@au@str}%
          \global\let\AB@las\AB@lasx\gdef\AB@lasx{\protect\Authands}%
          \gdef\AB@as{\Authsep}%
       \fi
       \gdef\AB@au@str{#2}}%
         \@temptokena=\expandafter{\AB@authlist}%
         \let\\=\authorcr
         \xdef\AB@authlist{\the\@temptokena
           \protect\@nameuse{@sep\number\c@authors}%
           \protect\Authfont#2\AB@authnote{\AB@note}}%
      \endgroup
%    \end{macrocode}
% Define |\@sep|$n$ preceeding the current author to be |\Authands|, in case
% this should turn out to be the last author. If another author comes, he
% will redefine this (see above).
%    \begin{macrocode}
      \ifnum\value{authors}>2\relax
      \@namedef{@sep\number\c@authors}{\Authands}\fi
      \newaffilfalse
}
%    \end{macrocode}
%
% For \LaTeX~2.09, we must define this \LaTeXe\ macro.
%    \begin{macrocode}
%<209>\def\@unexpandable@protect{\noexpand \protect \noexpand}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\authorcr}
% In the author blocks made up with the |\author| command alone, the |\\|
% command is used to start a new line and to switch to affiliation formatting.
% In order to force a new line within the author line, use |\authorcr|.
%    \begin{macrocode}
\newcommand\authorcr{\protect\\ \protect\Authfont \protect\AB@setsep}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\affil}
% The affiliation information is also written into |\AB@authors| and
% |\AB@affillist|. The |\ifnewaffil| flag is set to inform |\author|, the
% `blank-or-and' macro |\AB@blk@and| is set to (protected) `and', and if
% there is an optional argument, the counter |Maxaffil| is set to zero to
% force footnote mode.
%    \begin{macrocode}
%<209>\newcommand\affil{\@ifnextchar[%]
%<209>  {\@Xaffil}{\@Xaffil[]}}
%<209>\def\@Xaffil[#1]#2%
%<!209>\newcommand\affil[2][]%
   {\newaffiltrue\let\AB@blk@and\AB@pand
      \if\relax#1\relax\def\AB@note{\AB@thenote}\else\def\AB@note{#1}%
        \setcounter{Maxaffil}{0}\fi
%    \end{macrocode}
% As for |\author|, the newline command must be highjacked and altered. For
% |\AB@authors|, it issues a new line and declares the affiliation font. For
% |\AB@authlist|, where each affiliation is to appear on a single line, it is
% converted into a comma.
%    \begin{macrocode}
      \begingroup
        \let\protect\@unexpandable@protect
        \def\thanks{\protect\thanks}\def\footnote{\protect\footnote}%
        \@temptokena=\expandafter{\AB@authors}%
        {\def\\{\protect\\\protect\Affilfont}\xdef\AB@temp{#2}}%
         \xdef\AB@authors{\the\@temptokena\AB@las\AB@au@str
         \protect\\[\affilsep]\protect\Affilfont\AB@temp}%
         \gdef\AB@las{}\gdef\AB@au@str{}%
        {\def\\{, \ignorespaces}\xdef\AB@temp{#2}}%
        \@temptokena=\expandafter{\AB@affillist}%
        \xdef\AB@affillist{\the\@temptokena \AB@affilsep
          \AB@affilnote{\AB@note}\protect\Affilfont\AB@temp}%
      \endgroup
%    \end{macrocode}
% The item before each affiliation is |\AB@affilsep|, which changes from its
% initial definition to |\AB@affilsepx| after the first call.
%    \begin{macrocode}
       \let\AB@affilsep\AB@affilsepx
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@author}
% Define |\@author| to be the last |\author| call if |\affil| was
% never used (standard \LaTeX), or define it to be either |\AB@authors| or a
% combination of |\AB@authlist| and |\AB@authlist| depending on number of
% affiliations.
%
% The standard classes put any footnote markers (with |\thanks| or
% |\footnote|) into |\rlap| so they overlap with punctuation. Unfortunately,
% they also overlap any other affiliation footnote markers. Thus turn off
% |\rlap| for footnote style. Since |\@author| is normally called within
% some environment, this change is local.
%    \begin{macrocode}
\def\@author{}
\renewcommand\@author{\ifx\AB@affillist\AB@empty\AB@author\else
      \ifnum\value{affil}>\value{Maxaffil}\def\rlap##1{##1}%
    \AB@authlist\\[\affilsep]\AB@affillist
    \else  \AB@authors\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\maketitle}
% \changes{1.3}{2001 Feb 27}{Modify standard macro}
% The standard definitions of |\maketitle| place the |\@author| text in a
% |tabular| environment, which is not appropriate for the long author list
% possible with \texttt{\filename}. Instead, use the |center| environment.
% Other packages that call \texttt{\filename} such as \texttt{mpaehead} redefine
% |\maketitle| accordingly. But if \texttt{\filename} is used on its own, this
% will not be done. Thus highjack the |\maketitle| command and redefine
% |tabular| to be |center|.
%    \begin{macrocode}
\let\AB@maketitle=\maketitle
\def\maketitle
  {{\renewenvironment{tabular}[2][]{\begin{center}}
                                   {\end{center}}
  \AB@maketitle}}
%</package>
%    \end{macrocode}
% \end{macro}
%
% \Finale
