I found this question: Authblk for chapters? - Author and affiliations per chapter which defines a very nice framework for including author affiliations in chapters in a TeX document. I want to tweak it slightly, to allow the optional inclusion of more than one affiliation per author.
I managed to do it by defining \chapterauthormulti like so:
\makeatletter
\def\chapterauthormulti[#1][#2]#3{\ifnewauthor\sffamily\else, \fi
#3\textsuperscript{\hyperref[authaffil\the\value{chapter}.#1]{#1},}%
\textsuperscript{\hyperref[authaffil\the\value{chapter}.#2]{#2}}%
\ifnewauthor\newauthorfalse\gdef\chapterauthors{#2}\else
\g@addto@macro\chapterauthors{, #2}\fi
\ifnewauthor\newauthorfalse\gdef\chapterauthors{#2}\else
\g@addto@macro\chapterauthors{, #3}\fi
\ignorespaces % to remove end of line spaces from
% \chapterauthor[foo]{bar} input lines
}
\makeatother
which allows me to add up to 2 affiliations and can be generalized in a straightforward is bulky way to more. This works, but seems very inelegant. Is there a cleaner way to modify that example to allow an arbitrary (within reason) number of affiliations to be added to each author in a single definition?
\chapterauthorcommand you define needs to be enclosed in\makeatletterand\makeatotherto work – KBriggs Apr 04 '18 at 15:05