How to parse BibTex "@incollection" or Hayagriva "type: anthos, parent-type: anthology" entry in CSL?

Hi all,

I’m trying to parse a BibTex entry of type “incollection” with a custom CSL style file in the typst web app - either directly, or by first converting the .bib file to .yml with Hayagriva CLI.

When trying to parse the .bib file directly, I only get it to work if I change the entry type to “inbook”: then CSL understands the .bib entry as a chapter in a book, correctly showing up in the bibliography, using “booktitle” from .bib as “container-title” in .csl. However, if leaving the .bib entry as “incollection”, I don’t get it to show up in the bibliography at all.

When converting the incollection entry from the .bib file to a .yml file with Hayagriva CLI, the entry type in the .yml file is converted to “anthos” and the parent type to “anthology”. This is correct. However, again I don’t get it to show up in the bibliography at all. It only works, if I change the entry type to “chapter” instead of “anthos” (then it works, no matter if the parent type is “anthology” or “book”).

So this .bib entry works:

@inbook{Example2025,
 title = {Title},
 booktitle = {Anthology title},
}

…as does this corresponding conversion to .yml:

Example2025:
  type: chapter
  title: Title
  parent:
    type: book
    title: Anthology title

The original Bib(La)Tex entry, however, I can’t get to parse with CSL:

@incollection{Example2025,
 title = {Title},
 booktitle = {Anthology title},
}

…and neither this corresponding conversion to .yml:

Example2025:
  type: anthos
  title: Title
  parent:
    type: anthology
    title: Anthology title

Any advice? Is it just not possible to parse Bib(La)Tex “incollection” or Hayagriva “type: anthos” entries in CSL (but if so, why does Hayagriva converts “incollection” to “type: anthos” in the first place)? Or did I just miss the corresponding types in CSL that these types map to?

The relevant part in my .csl file looks like this (excerpt):

<if type="chapter" match="any">
  <text variable="title" suffix=". "/>
  <text variable="container-title" suffix=". "/>
</if>

As said this works if entry type is “inbook” or “type: chapter”. What type instead of “chapter” would work for parsing “type: anthos” entries in hayagriva.yml?

Hello,
According to the relevant code[1], it appears that you have to set type: anthology in your YAML (hayagriva format) bibliography, as well as check for type="collection" in your CSL file.

type: anthos is not at all translated for CSL styles to use, which could be a bug. Consider opening an issue on GitHub - typst/hayagriva: Rusty bibliography management. so we can discuss if and how this should be changed. Thanks!


  1. Hayagriva source code:

    ↩︎