Skip to content

Hayagriva Issue Tracking #1

@daeh

Description

@daeh

This document tracks verified Hayagriva bugs relevant to this template, the CSL APA style, and BibLaTeX interoperability.

Summary

Bug Issues/PRs Workaround
institution field mapping typst/hayagriva#265, typst/hayagriva#112
type field rendered literally Use specific entry type
@collection/@incollection CSL mapping typst/hayagriva#437 Use @book/@inbook
@incollection title duplication typst/hayagriva#309, typst/hayagriva#437 Use @inbook
Trailing comma in dates typst/hayagriva#246, typst/hayagriva#437
Narrative & vs and typst/hayagriva#188 Show rule
Prose citations don't collapse typst/hayagriva#322
Issue number formatting typst/hayagriva#387
Publisher "and" parsing typst/hayagriva#306 Use {and}
Title case not converted typst/hayagriva#339 Sentence case bib data
UTF-8/non-ASCII sorting typst/hayagriva#193, typst/hayagriva#314

Related

Hayagriva:

CSL:

BibLaTeX:


Details

institution Field Mapping for Theses and Reports

Ancillary:

BibLaTeX institution maps to Hayagriva organization → CSL authority, but CSL styles expect institution data in publisher for thesis and report entries. This affects @thesis, @phdthesis, @mastersthesis, @report, and @techreport.

Root cause: In interop.rs, institutionorganization. In taxonomy.rs, organization → CSL authority. But CSL styles use publisher for thesis/report institutions, so the data ends up in a field that gets ignored.

Hayagriva YAML workaround: Use publisher for institution and archive for database/repository:

eg-thesis:
  type: thesis
  author: Person, Example G.
  title: A thesis title
  genre: Doctoral dissertation
  publisher: Some University
  archive: SU Repository
  url: https://repo.some.edu/handle/10150/620615
  date: 2001

BibLaTeX has no workaround. The field mapping in interop.rs needs to be fixed for thesis/report types.


type Field Rendered Literally

No specific upstream issue tracks this bug.

Ancillary:

Relevant code: src/interop.rs (BibLaTeX → Hayagriva translation). BibLaTeX type key values are passed through to genre without translation.

The BibLaTeX type field maps to Hayagriva genre. This creates a BibLaTeX interoperability bug: in BibLaTeX, the type value acts as a dictionary key that maps to a localized string, e.g.:

  • @thesis: phdthesis → "Doctoral dissertation", mathesis → "Master's thesis"
  • @report: techreport → "Technical report"

But Hayagriva renders genre values as literal (sentence-cased) strings, so type = {phdthesis} becomes "[Phdthesis]" instead of "[Doctoral dissertation]".

Note: When using the specific entry types (@phdthesis, @mastersthesis, @techreport) without a type field, Hayagriva correctly defaults the genre (NB capitalization inconsistency):

  • @phdthesis → "Doctoral dissertation"
  • @mastersthesis → "Master's thesis"
  • @techreport → "technical report"

BibLaTeX input:

@thesis{eg-thesis,
  author      = {Person, Example G.},
  title       = {A thesis title},
  type        = {phdthesis},
  publisher   = {Some University},
  date        = {2001}
}

Actual output:

Person, E. G. (2001). A thesis title [Phdthesis]. Some University.

Expected output:

Person, E. G. (2001). A thesis title [Doctoral dissertation]. Some University.

N.B. Since this is specific to the type field bug, the expected output inherits the "Thesis Institution Placement" bug. To be BibLaTeX interoperable and APA7 compliant, both the type bug and the institution placement bug would need to be rectified.

Workaround:
(i) Use the specific entry type (@phdthesis, @mastersthesis, @techreport) without specifying a type, e.g.

@phdthesis{eg-thesis,
  author      = {Person, Example G.},
  title       = {A thesis title},
  publisher   = {Some University},
  date        = {2001}
}

or

(ii) Use a literal string for the type value, e.g.

@thesis{eg-thesis,
  author      = {Person, Example G.},
  title       = {A thesis title},
  type        = {Doctoral dissertation},
  publisher   = {Some University},
  date        = {2001}
}

@collection/@incollection CSL Mapping

Affects template entries: Lobsang2023 (edited volume, uses @book workaround), Issa1963 (book chapter, uses @inbook workaround)

BibLaTeX @collection and @incollection map to incorrect CSL types:

BibLaTeX Hayagriva CSL actual CSL expected Problem
@collection Anthology collection book Incorrect [Archival collection] annotation
@incollection Anthos (none) chapter Title duplication

The term collection has different semantics in BibLaTeX and CSL:

  • BibLaTeX: "A single-volume collection with multiple, self-contained contributions by distinct authors...usually has an editor" (i.e., an edited volume)
  • CSL: Archival materials (physical archives, museum holdings)

The type mappings are defined in src/interop.rs (TryFrom<&tex::Entry> implementation for BibLaTeX → Hayagriva) and src/csl/taxonomy.rs (matches_entry_type() for Hayagriva → CSL). The Anthos type has no match in any matches_entry_type() branch, so it receives no CSL type designation.

BibLaTeX input:

@collection{CollectionMapping,
  editor = {Smith, John},
  title = {Handbook of Cognitive Science},
  date = {2020},
  publisher = {Academic Press}
}

Actual output:

Smith, J. (Ed.). (2020, ). Handbook of Cognitive Science [Archival collection]. Academic Press.

Expected output:

Smith, J. (Ed.). (2020). Handbook of Cognitive Science. Academic Press.

Workaround: Use @book with editor field for @collection, and @inbook for @incollection


@incollection Title Duplication

Related to the CSL mapping issue above: @incollection entries have the parent book title duplicated.

Cause: For Anthos > Anthology entries, both CSL variables resolve to the parent anthology title (see StandardVariable::ContainerTitle and StandardVariable::VolumeTitle in src/csl/taxonomy.rs):

  • ContainerTitle uses get_container() → parent title
  • VolumeTitle has explicit selector (Anthos > ("p":Anthology)) → parent title

APA style uses both variables, causing the title to appear twice.

BibLaTeX input:

@incollection{IncollectionDuplication,
  title = {Chapter in Edited Volume},
  author = {Author, Test},
  editor = {Editor, Test},
  booktitle = {The Edited Volume Title},
  date = {2020},
  publisher = {Academic Press}
}

Actual output:

Author, T. (2020). Chapter in Edited Volume. In T. Editor (Ed.), The Edited Volume Title: The Edited Volume Title. Academic Press.

Expected output:

Author, T. (2020). Chapter in Edited Volume. In T. Editor (Ed.), The Edited Volume Title. Academic Press.

Workaround: Use @inbook instead. Trade-off: may lose "(Ed.)" designation in some cases


Trailing Comma in Dates

Erroneous trailing comma appears in date formatting "(2020, )" in multiple contexts:

1. @collection entries (year-only dates):

Smith, J. (Ed.). (2020, ). Handbook of Cognitive Science [Archival collection]. Academic Press.

2. @online entries with urldate:

@online{DateUrldate,
  author = {Webber, Site},
  title = {Article With Both Dates},
  url = {https://www.example.com/dated},
  date = {2021},
  urldate = {2025-04-30}
}

Actual output:

Webber, S. (2021, ). Article With Both Dates. https://www.example.com/dated

Expected output:

Webber, S. (2021). Article With Both Dates. https://www.example.com/dated

Workaround: For @online, omit urldate when date is present. For @collection, use @book workaround


Narrative Citations Use & Instead of and

Typst input:

#cite(<NarrativeCitation>, form: "prose")

Actual output:

Kheiri & Keedwell (2015)

Expected output (APA):

Kheiri and Keedwell (2015)

Workaround:

#show cite.where(form: "prose"): it => {
  show "&": "and"
  it
}

Prose Citations Don't Collapse

Typst input:

#cite(<ProseCollapse1>, form: "prose") #cite(<ProseCollapse2>, form: "prose")

Actual output:

Jones (2000); Jones (2005)

Expected output:

Jones (2000, 2005)

Workaround: None


Issue Number Formatting When Volume Missing

Note: Labeled csl-upstream — this is a bug in the APA CSL style, not Hayagriva.

BibLaTeX input:

@article{MissingVolume,
  author = {Volume, Missing},
  title = {Article Without Volume},
  journaltitle = {Journal of Missing Data},
  number = {13},
  date = {2020},
  pages = {1--10}
}

Actual output:

Volume, M. (2020). Article Without Volume. Journal of Missing Data, 13, 1–10.

Expected output (APA):

Volume, M. (2020). Article Without Volume. Journal of Missing Data, (13), 1–10.

Issue number should be in parentheses when volume is missing.

Workaround: None


Publisher Field Parsing with "and"

BibLaTeX input:

@book{PublisherAnd,
  author = {Writer, Test},
  title = {Book With And Publisher},
  publisher = {Canada Mortgage and Housing Corporation},
  date = {2020}
}

Actual output:

Writer, T. (2020). Book With And Publisher. Canada Mortgage, Housing Corporation.

Expected output:

Writer, T. (2020). Book With And Publisher. Canada Mortgage and Housing Corporation.

Workaround: Protect with braces, e.g.

publisher = {Canada Mortgage {and} Housing Corporation}

Title Case Not Applied Automatically

Typst renders titles exactly as stored, without style-specific case conversion.

BibLaTeX input:

@book{TitleCaseTest,
  author = {Caser, Title},
  title = {This Is An Incredible Book With Title Case},
  publisher = {Test Press},
  date = {2023}
}

Actual output:

Caser, T. (2023). This Is An Incredible Book With Title Case. Test Press.

Expected output (APA sentence case):

Caser, T. (2023). This is an incredible book with title case. Test Press.

Workaround: Store titles in sentence case in .bib file


UTF-8/Non-ASCII Sorting

Ancillary:

Non-ASCII characters sorted by Unicode code points, not linguistic rules.

Test entries:

@book{Utf8SortPolish,
  author = {Łakomy, Henryk},
  title = {Polish Author Book},
  publisher = {Polish Press},
  date = {2006}
}

@book{Utf8SortFrench,
  author = {Roux, François},
  title = {French Author Book},
  publisher = {French Press},
  date = {2010}
}

Actual citation order:

(Roux, 2010; Łakomy, 2006)

Actual bibliography order: Łakomy appears at the very end (after all ASCII entries).

Expected: Łakomy should sort near "L" entries alphabetically.

Workaround: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions