0

The quarto document quarto-file.md repeats the same affiliations:

---
title: "Hey!"
author:
  - name: Birdy Bird
    affiliations:
      - University of Birds
  - name: None
    affiliations:
      - University of Birds
format: 
  pdf:
    keep-tex: true
    template-partials: 
      - title.tex
    include-in-header:
      text: |
        \usepackage[noblocks]{authblk}
        \renewcommand*{\Authsep}{, }
        \renewcommand*{\Authand}{, }
        \renewcommand*{\Authands}{, }
        \renewcommand\Affilfont{\small}
---

## Quarto

Quarto enables you to weave together content and executable code into a finished
document. To learn more about Quarto see <https://quarto.org>.

quarto-file-render

I want the same affiliations not to be repeated, but this does not work using the title.tex in the answer to a similar question:

$if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$

$if(subtitle)$
\subtitle{$subtitle$}
$endif$

$for(by-author)$
\author[$for(by-author.affiliations)$$it.number$$sep$,$endfor$]{$by-author.name.literal$}
$endfor$

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


\date{$date$}

How to make the same affiliations to appear only once (with the same superscript)?

shafee
  • 15,566
  • 3
  • 19
  • 47
Crimc
  • 195
  • 17

2 Answers2

2

You could use the authors-block extension, e.g.

---
title: "Hey!"
authors:
  - name: Birdy Bird
    affiliations:
      - ref: bird
  - name: None
    affiliations:
      - ref: bird

affiliations:
  - id: bird
    name: University of Birds.
      
filters:
  - authors-block

format: pdf
---

## Quarto

Quarto enables you to weave together content and executable code into a finished
document. To learn more about Quarto see <https://quarto.org>.

enter image description here

Julian
  • 6,586
  • 2
  • 9
  • 33
  • I tried this, but I get an output without the authors' names, only with the affiliation. This may be due to the fact that I "manually" installed the authors-block extension (copying the lua filters from the repo), as I couldn't find a way to install extensions in RStudio – Crimc Apr 12 '23 at 15:11
  • you can use the terminal to install extension. – Julian Apr 12 '23 at 15:18
  • 1
    It finally worked, thanks. I had missed that for quarto >=1.3 one should install the extension with `quarto add kapsner/authors-block@v0.2.0` – Crimc Apr 12 '23 at 15:54
  • **Note: `authors-block` adds the authors' affiliation info in the document body, not in the document preamble and it leads to a big gap between the authors and affiliations. Also if you use an abstract, the affiliations will be positioned after the document abstract.** (And I think, this extension is intended for docx file, not for pdf output) – shafee Apr 14 '23 at 15:44
1

The use of authors-block has a major flaw in that, it adds the affiliations in the document body not in the document preamble (which you can verify if you look into the underlying tex file) which results in a large gap between the authors name and affiliations and also if you use abstract, the affiliations will be positioned after the abstract, which is visually not good.

Therefore, I think, the use of title.tex latex-partial to accommodate the authblk latex package should be preferable for proper and nice formatting of the affiliations.

Now the key thing to note that the option affil-id which needs to be a number that will link the authors and their affiliations and it will correspond to the id under the affiliations key.

---
title: "Hey!"
abstract: This is the abstract of the document. And you can see the author affiliations is nicely formatted.
author:
  - name: Birdy Bird
    affil-id: 1
  - name: None
    affil-id: 1

affiliations: 
  - id: 1
    name: University of Birds
format: 
  pdf:
    keep-tex: true
    template-partials: 
      - title.tex
    include-in-header:
      text: |
        \usepackage[noblocks]{authblk}
        \renewcommand*{\Authsep}{, }
        \renewcommand*{\Authand}{, }
        \renewcommand*{\Authands}{, }
        \renewcommand\Affilfont{\small}
---

## Quarto

Quarto enables you to weave together content and executable code into a finished
document. To learn more about Quarto see <https://quarto.org>.

title.tex

$if(title)$
\title{$title$$if(thanks)$\thanks{$thanks$}$endif$}
$endif$

$if(subtitle)$
\subtitle{$subtitle$}
$endif$

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

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


\date{$date$}

Nicely formatted author affiliations


And to add multiple affiliations per author, specify the affiliation id numbers (comma separated) in the affil-id key. See the updated answer here for example.

shafee
  • 15,566
  • 3
  • 19
  • 47
  • 1
    Thanks, @shafee! This is a more straightforward answer to the OP. I agree with the problematic distance from authors and the affiliations using `authors-block` – Crimc Apr 15 '23 at 14:08