quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.59k stars 294 forks source link

References are inserted twice with default typst format #5560

Closed cderv closed 1 year ago

cderv commented 1 year ago

Let's take this reference in References.bib

@article{Cronbach_1951,
    doi = {10.1007/bf02310555},
    year = 1951,
    month = {sep},
    publisher = {Springer Science and Business Media {LLC}},
    vol = {16},
    number = {3},
    pages = {297--334},
    author = {Lee J. Cronbach},
    title = {Coefficient alpha and the internal structure of tests},
    journal = {Psychometrika}
}

If we do with no reference

---
title: "Untitled"
format: typst
bibliography: References.bib
bibliographystyle: "chicago-author-date"
keep-typ: true
---

Hello

There will be at the bottom of the file

#set bibliography(style: "chicago-author-date")

#bibliography("References.bib")

It will cause typst to create a Bibliography section anyway.

When a citation is added, it seems Pandoc will add some bibliography content

---
title: "Untitled"
format: typst
bibliography: References.bib
bibliographystyle: "chicago-author-date"
---

Hello [@Cronbach_1951]
#label("refs")
#label("ref-Cronbach_1951")
Cronbach, Lee J. 1951. “Coefficient Alpha and the Internal Structure of Tests.” #emph[Psychometrika], no. 3 (September): 297–334. #link("https://doi.org/10.1007/bf02310555").

#set bibliography(style: "chicago-author-date")

#bibliography("References.bib")

It seems from https://github.com/jgm/pandoc/issues/8763#issuecomment-1500387547 that it requires some tweak when citation processing is done by Pandoc. (which happens when citeproc is used)

Adding citeproc: false to YAML header

---
title: "Untitled"
format: typst
bibliography: References.bib
bibliographystyle: "chicago-author-date"
citeproc: false
---

Hello [@Cronbach_1951]

Will correctly output only the native typst citation processing.

So it seems :

Originally posted by @cderv in https://github.com/quarto-dev/quarto-cli/discussions/5502#discussioncomment-5915093

cderv commented 1 year ago

@jjallaire do you think we should use Pandoc's citeproc by default with typst format, or should we use the native citation support ?

Small note that format typst-citations will be only possible in next version as this is a recent fix in templates https://github.com/jgm/pandoc/commit/e89a3edf24a025d5bb0fe8c4c7a8e6e0208fa846