mvuorre / quarto-preprint

A Quarto extension for preprints using Typst
https://mvuorre.github.io/quarto-preprint/index.pdf
Creative Commons Attribution 4.0 International
34 stars 2 forks source link

Too much space before author and coma for authors ( at least 3 authors without orcid) #27

Closed danieltomasz closed 2 weeks ago

danieltomasz commented 2 weeks ago

When the coma appears (at least 3 authors) and the authors doesnt have orcid and they aren't corresponding, additional space appears after affiliation superscript and before coma, example below:

---
title: Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...
running-head: Running head
author:
  - name: My Name
    email: myemail@example.com
    orcid: 0000-0000-0000-0000
    url: https://
    corresponding: true
    affiliation:
    - ref: 1
  - name: My Name
    url: https://
    affiliation:
      - ref: 1
  - name: My Name
    url: https://
    affiliation:
      - ref: 1
  - name: My Name
    url: https://
    affiliation:
      - ref: 1
affiliations:
  - id: 1
    name: Example University
    department: Example Department
abstract: |
  Abstract.
keywords: [list, keywords, here]
authornote: This is an example author note.
bibliography: bibliography.bib
format: preprint-typst
---
danieltomasz commented 2 weeks ago

I will push in next PR code fixing this (a slightly changing the way author_string is created, [] was the culprit https://forum.typst.app/t/suppresing-space-between-affiliataon-superscipt-name-and-comma-in-custom-template/1589/6?u=danborek

  // Format author strings here, so can use in author note
  let author_strings = ()
  if authors != none {
    for a in authors {
      let author_string = box[#{
        a.name
        if authors.len() > 1 {super(a.affiliation)}
        if a.keys().contains("email") {[\*]}
        if a.keys().contains("orcid") {
            box(
              height: 1em,
              link(
                a.orcid,
                figure(
                  image("orcid.svg", height: 0.9em)
                )
              )
            )
           }
      }]
      if a.keys().contains("corresponding") {
        authornote = [\*Send correspondence to: #a.name, #a.email.\ #authornote]
      }
      author_strings.push( author_string)
    }
  }

@mvuorre with my changes and box around the string gone, the spacing between is much more tight now, I replicate current behaviour by adding double spaces after the comma (EDIT: after testing I am not adding any additional space)

 if authors != none {
    titleblock(
      weight: "regular", size: 1.25em,
      [#author_strings.join(",  ", last: " & ")]
    )
  }