typst / hayagriva

Rusty bibliography management.
Apache License 2.0
350 stars 55 forks source link

APA date not working properly with bibtex and YAML #246

Open gkourgkoutas opened 1 month ago

gkourgkoutas commented 1 month ago

Description

When I'm using my bibliography and I choose APA7 as cite style, it doesn't matter if I use a biblatex file or YAML (typst hayagriva). In both cases, if the date (year) is added, there are some formatting issues.

Bibtex file:

@online{nistCVE,
    author = {NIST},
    title = {CVE-2021-44228},
    url = {https://nvd.nist.gov/vuln/detail/CVE-2021-44228},
        date = {2021},
    urldate = {2024-10-18},
}

YAML:

nistCVE:
 author: "NIST"
 type: "Web"
 title: "CVE-2021-44228"
 date: "2021"
 url: 
    value: "https://nvd.nist.gov/vuln/detail/CVE-2021-44228"
    date: 2024-10-28

These produce the following output:

grafik

While the output seems fine, there is no "Retrieved + Date", which is the case in latex when \urldate is used.

Note that there is also a comma after the year (2021,) which should not be there if only the year of publication is given. typst expects a full date like 2021-01-01.

If the date (publication year or year in bibtex) is removed...

@online{nistCVE,
    author = {NIST},
    title = {CVE-2021-44228},
    url = {https://nvd.nist.gov/vuln/detail/CVE-2021-44228},
    urldate = {2024-10-18},
}
nistCVE:
 author: "NIST"
 type: "Web"
 title: "CVE-2021-44228"
 url: 
    value: "https://nvd.nist.gov/vuln/detail/CVE-2021-44228"
    date: 2024-10-28

... it shows "Retrieved + Date" what I want to achieve.

grafik

However, as you can see in the screenshot above, after the author, the year is missing!. The desired output should look like this:

grafik

Steps to reproduce

This can be done as follows bibtex:

urldate = {2024-10-18},

yaml

 url: 
    value: "https://nvd.nist.gov/vuln/detail/CVE-2021-44228"
    date: 2024-10-28

//OR

 url: {value: "https://nvd.nist.gov/vuln/detail/CVE-2021-44228", date: 2024-10-28}

Import the bibliography with APA style:

#bibliography("references.bib", title: "References", style: "apa")

Versions used

Newest version of typst (Webapp) Newest version of typst (macOS)

Note: I encountered this issue when I use APA style (required by the institution). When using IEEE, everyting works!

Reproduction URL

No response

Browsers

Firefox, Chrome

OS

macOS