Formatting author names with orcid and affiliations in RMarkdown

439 Views Asked by At

I am unable to make the title page using RMarkdown the way I usually do using LaTeX.

Here is my current code in markdown:

---
title: 'Research on the use of mirrors on rooftops to focus on Starlink satellites to burn them down because they interfere with amateur astronomy'
author:
- Heinz Doof, University of Okomba, Lucario 52500, Wakanda.
- Phenias Krill, Barry University, Millet Department, Dublin DD 0562, Ireland.
- Ferb Mayo, University of Okomba, Lucario 52500, Wakanda.
- Pablo Macro, Barry University, Millet Department, Dublin DD 0562, Ireland.
date: "19 June 2023"
output:
  pdf_document:
    number_sections: yes
  word_document: default
  html_document:
    df_print: paged
---

And this is the corresponding output:

Current

I want to add the ORCiD links and group the affiliations using numberings. Something like this:

Expected

1

There are 1 best solutions below

0
shafee On

For pdf output, to format author names with orcid link and affiliations, you may try the authblk and orcidlink latex package.

Now to include the affiliations for each author, I have used the yaml keys name, affil-id, id, affiliations. These will act as interpolated variables as pandoc template. So copy the contents of pandoc template for latex into a file default.tex and then replace the line in the default.tex file \author{$for(author)$$author$$sep$ \and $endfor$} with the following,

\usepackage{authblk}
\usepackage{orcidlink}
\renewcommand\Affilfont{\small}

$for(author)$
\author$if(it.affil-id)$[$it.affil-id$]$endif${$it.name$}
$endfor$

$if(affiliations)$
$for(affiliations)$
\affil[$it.id$]{$it.name$}
$endfor$
$endif$

and then use this template in the rmarkdown file using template yaml key.

---
title: 'Research on the use of mirrors on rooftops to focus on Starlink satellites to burn them down because they interfere with amateur astronomy'
author:
  - name: Heinz Doof \orcidlink{0000-0000-0000-0001}
    affil-id: 1,3
  - name: Phenias Krill \orcidlink{0000-0000-0000-0002}
    affil-id: 2
  - name: Ferb Mayo \orcidlink{0000-0000-0000-0003}
    affil-id: 1
  - name: Pablo Macro \orcidlink{0000-0000-0000-0004}
    affil-id: 1
affiliations: 
  - id: 1
    name: University of Okomba, Lucario 52500, Wakanda.
  - id: 2
    name: Barry University, Millet Department, Dublin DD 0562, Ireland.
  - id: 3
    name: University of Ubuntu, some address.
date: July 6, 2023
geometry:
- margin=1in
output:
  pdf_document:
    number_sections: yes
    template: default.tex
---

knitting the above rmarkdown file generates the following,

authors names with affiliations and orcidlink