I would like to use the functionalities provided by the package authblk and get automatically the right author metadata in my PDF. Normally, the pdfusetitle option of hyperref sets the right title and author metadata. With authblk, however, this works for the title but not for authors. I suppose it’s because authblk changes the “author” mechanism.
Can I patch this easily? Or is there a package similar to authblk that is compatible with this functionality of hyperref?
Even better if the patch also works when multiple authors are given, in which case the pdf metadata should show the author names separated by commas.
Here is a minimal example that illustrates the incompatibility. If authblk is loaded before hyperref, and with pdfusetitle, loading hyperref fails with Illegal parameter number in definition of \Hy@author. If loading authblk after hyperref (as illustrated here), the document gets compiled, but contains no author metadata. When uncommenting the hypersetup block, the author metadata reads: immediate LaTeX Warning: No given..
\documentclass{scrartcl}
\usepackage[pdfusetitle]{hyperref}
\usepackage{authblk}
%\makeatletter
%\hypersetup{pdfauthor={\@author}}
%\makeatother
\begin{document}
\title{The title}
\author{Myself}
Content.
\end{document}
Here is an example of my current usage. I would like to get rid of the redundant \hypersetup part.
\title{The title}
\author{Firstname Lastname}
\author{Second author}
\affil{First affiliation\\
\href{mailto:firstname.fastname@affiliation}{firstname.fastname@affiliation}
}
\author{Name3}
\affil{Second affiliation}
\makeatletter
\hypersetup{
pdfauthor={Firstname Lastname, Second author, Name3}
}
\makeatother
\maketitle

\iftoggle), they do not work. I’d like to patch only conditionally, because I do not necessarily needauthblk. Any idea? Also, I’d like to hide all of this in the preamble (thus avoidhypersetupafter the titling part), is it possible? – Olivier Cailloux Jan 27 '19 at 19:47authblk, then it will patch the regular\authorcommand instead (without any effects on the command itself). – Marijn Feb 11 '19 at 10:20\iffirstauthorconstruct). – Marijn Feb 11 '19 at 10:46