Skip to content

Support author roles in default template #10410

Open

Description

@fredguth

Bug description

When you create a brand new Manuscript project, Quarto creates an article with Norah Jones author and roles: writing.
But when I render with keep-typ: true and check the code, I get:

...
authors: (
    ( name: [Norah Jones],
      affiliation: [The University],
      email: [] ),
    ),...

I tried to create a custom template and change typst-show.typ to:

...
$if(it.name.literal)$
    ( name: [$it.name.literal$],
      affiliation: [$for(it.affiliations)$$it.name$$sep$, $endfor$],
      roles: [$for(it.roless)$$it.name$$sep$, $endfor$],
      email: [$it.email$] ),
$endif$
...

But then I get ....

...
authors: (
    ( name: [Norah Jones],
      affiliation: [The University],
      email: [],
      roles: [] ),
    ),...

Steps to reproduce

  1. create new Manuscript project
  2. change format typst with keep-typ: true
  3. quarto preview index.qmd
  4. check index.typ

Expected behavior

...
authors: (
    ( name: [Norah Jones],
      affiliation: [The University],
      email: [],
      roles: [writing] ),
    ),...

Actual behavior

...
authors: (
    ( name: [Norah Jones],
      affiliation: [The University],
      email: [] ),
    ),...

Your environment

IDE: Positron, MacOS Sonoma 14.5

Quarto check output

❯ quarto check
Quarto 1.5.54
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.2.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.41.0: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.5.54
      Path: /Applications/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2023.01
      Chromium: 869685

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /Users/fredguth/Library/TinyTeX/bin/universal-darwin
      Version: 2022

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.12.4
      Path: /Users/fredguth/Code/sus/desid_pdf/.venv/bin/python3
      Jupyter: 5.7.2
      Kernels: python3, mojo-jupyter-kernel, fastduck

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources
      LibPaths:
        - /Users/fredguth/Library/R/arm64/4.4/library
        - /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
      knitr: 1.48
      rmarkdown: 2.27

[✓] Checking Knitr engine render......OK

Activity

  1. added
    bug
    on Jul 29, 2024
  2. cderv commented on Jul 29, 2024

    @cderv
    Member

    roles is indeed not part of the typst template default. You can indeed add it using partials, but you need to use the right fields.

    Some information at : https://quarto.org/docs/journals/authors.html#roles

    Especially, it does not have a name field. So

     roles: [$for(it.roless)$$it.name$$sep$, $endfor$],
    

    is not correct. Use

     roles: [$for(it.roless)$$it.role$$sep$, $endfor$],
    

    if you want the value.

    And when modifying a typst template for YAML metadata, there are two places to modify in Typst template

    • typst-show.typ as you did,
    • typst-template so that value is used in typst. #authors.roles need to be added
      if authors != none {
      let count = authors.len()
      let ncols = calc.min(count, 3)
      grid(
      columns: (1fr,) * ncols,
      row-gutter: 1.5em,
      ..authors.map(author =>
      align(center)[
      #author.name \
      #author.affiliation \
      #author.email
      ]
      )
      )
      }

    Hope this helps.

    Overall, I don't think roles is used in any of the templates, except for JATS output in Manuscript, so I am not sure we'll add it in default template. It is available to use as partials as you tried.

  3. added
    enhancement
    and removed
    bug
    on Jul 29, 2024
  4. changed the title [-]Typst does not show author roles[/-] [+]Support author roles in default template[/+] on Jul 29, 2024
  5. added this to the Future milestone on Jul 29, 2024
  6. fredguth commented on Jul 30, 2024

    @fredguth
    Author

    I created a template github.com/desid-ms/desid_report which uses it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementtypst

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions