Skip to content

fix(templates/default.typst): wrong syntax for bibliography inclusion#11233

Merged
jgm merged 1 commit intojgm:mainfrom
mcanouil:patch-1
Oct 23, 2025
Merged

fix(templates/default.typst): wrong syntax for bibliography inclusion#11233
jgm merged 1 commit intojgm:mainfrom
mcanouil:patch-1

Conversation

@mcanouil
Copy link
Contributor

@mcanouil mcanouil commented Oct 23, 2025

#bibliography(...) should be an array when multiple bibliography files are provided (https://typst.app/docs/reference/model/bibliography/#parameters-sources).

Currently, #bibliography("path/one.bib", "path/two.bib") is produced instead of #bibliography(("path/one.bib", "path/two.bib"))

@mcanouil mcanouil changed the title fix: syntax for bibliography inclusion in Typst fix(templates/default.typst): wrong syntax for bibliography inclusion Oct 23, 2025
$if(bibliography)$

#bibliography($for(bibliography)$"$bibliography$"$sep$,$endfor$$if(full-bibliography)$, full: true$endif$)
#bibliography(($for(bibliography)$"$bibliography$"$sep$,$endfor$)$if(full-bibliography)$, full: true$endif$)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still going to work for the case where there is just one entry?
Don't you need ("mybib",) rather than ("mybib") for it to be treated as an array?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe it's okay if it isn't treated as an array? In any case, I just want to make sure this has been tested with both one and multiple bib files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checking this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this issue was found on Quarto CLI initially.

I've double checked and #bibliography(("references.bib")) works in Typst.
So, to me it's pretty safe to always have the array (...) form.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think that in this case it resolves to a string -- however, it works because bibliography can take either an array or a string.

Copy link
Contributor Author

@mcanouil mcanouil Oct 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. It also supports "bytes" type. The array should be an array of strings and/or bytes. Thus why I think, it's pretty safe to always use an array.

@jgm jgm merged commit ba64240 into jgm:main Oct 23, 2025
11 of 14 checks passed
@mcanouil
Copy link
Contributor Author

For reference; I've checked the syntax produced with:

echo "@book{article-1,\n  title = {Article A}\n}" > references.bib
echo "@book{article-2,\n  title = {Article B}\n}" > references-1.bib
echo "@article-1 @article-2" | pandoc -f markdown -t typst \
  --bibliography references.bib \
  --bibliography references-1.bib \
  --template default.typst

@mcanouil mcanouil deleted the patch-1 branch October 23, 2025 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants