dragonfly-science / mpi-latex-templates

Latex templates for the New Zealand Ministry for Primary Industries fisheries reports
MIT License
0 stars 2 forks source link

PDF metadata - authors field #47

Open dmiddleton opened 10 months ago

dmiddleton commented 10 months ago

The templates use \hypersetup{pdfinfo={}} to set the title and author metadata that appears in PDF files. Since v1.28 the author information that is put into the PDF has been less than ideal. The v1.28 changes introduces a more complex format for the \author{} field, to capture author affiliations that are now required as part of the FAR/AEBR Executive Summary. However, the changes to the PDF metadata went unnoticed, at the time, and have been neglected since.

After some experimentation, it appears that fixing up the information passed to pdfinfo from the template will be difficult. A proper fix will probably require another refactoring of the way authors are specified, for example multiple \author[1]{name}{affliiation} fields, and code to process these.

However, a workaround is to post-process the PDF after the LaTeX build. For example, the following line can be included as part of the PDF rule in a makefile (assuming exiftool is available in the build environment):

exiftool -Author="$$(exiftool -s3 -Author $@ | sed 's/given=//g' | sed 's/, family=/ /g' | sed 's/, affiliation=, nametemplates=affiliation//g' | sed 's/ and/,/g')" $@

(adapt for bash scrips by removing the double $ and changing the file specifier). This produces a comma-separated list of authors.

Note that, as written, this modifies the original file rather than producing a separate output file. More importantly, it assumes that the \author field is formatted as per the examples, i.e. no additional spaces etc.

dmiddleton commented 10 months ago

Other things to thing about: ORCID links and XML formats for bibliography data (as there is no mainstream support for affiliation information in BibTeX).