Why does Hayagriva with this .csl file not produce year disambiguation?

tl;dr Does Hayagriva process year disambiguation requirements in current .csl files?

This is very much a followup to my previous question:

tl;dr for alphanumeric sorting in citations and bibligraphy, I ended up using

However, while on Zotero, this file seems to implement year disambiguation, using Hayagriva seems to not do so.

For my case, I have the two citations:

OverlappingDiv:
  type: article
  title: On Overlapping Divergences
  author: Kreimer, Dirk
  date: 1999
  page-range: 669-689
  url: https://doi.org/10.1007/s002200050661
  serial-number:
    doi: 10.1007/s002200050661
    issn: 0010-3616
  parent:
    type: periodical
    title: Comm. Math. Phys.
    issue: 3
    volume: 204

ChenIterated:
  type: article
  title: Chen's Iterated Integral Represents the Operator Product Expansion
  author: Kreimer, D.
  date: 1999
  page-range: 627-670
  url: https://doi.org/10.4310/ATMP.1999.v3.n3.a7
  serial-number:
    doi: 10.4310/ATMP.1999.v3.n3.a7
    issn: 1095-0761
  parent:
    type: periodical
    title: Adv. Theor. Math. Phys.
    issue: 3
    volume: 3

Using hayagriva with these two produces [Kre99] and [Kre99], along with:

[Krei99] Kreimer, Dirk: Chen’s iterated integral represents the operator product expansion. In: Advances in Theoretical and Mathematical Physics Bd. 3 (1999), Nr. 3, S. 627–670
[Krei99] Kreimer, Dirk: On overlapping divergences. In: Communications in Mathematical Physics Bd. 204 (1999), Nr. 3, S. 669–689

Meanwhile, Zotero properly handles this with [Krei99a] and [Krei99b], along with:

[Krei99a] Kreimer, Dirk: Chen’s iterated integral represents the operator product expansion. In: Advances in Theoretical and Mathematical Physics Bd. 3 (1999), Nr. 3, S. 627–670
[Krei99b] Kreimer, Dirk: On overlapping divergences. In: Communications in Mathematical Physics Bd. 204 (1999), Nr. 3, S. 669–689

Looking at the xml, the .csl file include year disambiguation at least for citations, on line 222:

<citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="false" disambiguate-add-givenname="false" collapse="year">

and I assume it must have it as well for the bibliography, since Zotero outputted the same (I can’t find it though).

So does Hayagriva not support year disambiguation right now?

I didn’t test with your CSL file but in general Hayagriva does support year disambiguation, it was added with Typst 0.12. Note there is currently an open issue, because the keys aren’t correctly shown in the bibilography.

Hey @Paul744, I believe you need to add <text variable="year-suffix"/> in the citation explicitly for it to appear (see the Hayagriva’s own alphanumeric CSL: hayagriva/styles/alphanumeric.csl at 9df6db230edd0f8f08dd11253c564426f5085156 · typst/hayagriva · GitHub). However, I believe it won’t show up in the bibliography unless you do the same there (the issue linked above by @flokl). Not sure if this is a bug with Hayagriva or with styles themselves, but worth mentioning.

Hey, so I was actually playing around with the XML, and I did get the citations working by using:

<citation
    et-al-min="3"
    et-al-use-first="1"
    disambiguate-add-year-suffix="true"
    disambiguate-add-names="false"
    disambiguate-add-givenname="false"
    collapse="year"
>
    <sort>
        <key variable="citation-label" />
    </sort>
    <layout prefix="[" suffix="]" delimiter="; ">
        <group delimiter="">
            <text variable="citation-label" />
            <text variable="year-suffix" />
        </group>
        <group>
            <label variable="locator" form="short" />
            <text variable="locator" />
        </group>
    </layout>
</citation>

However, when trying to do something similar with the bibliography, I get a mess of results.

For instance, here are a variety of attempts and their outputs (where I only show the XML that has changed:

  <bibliography et-al-min="9" et-al-use-first="8" second-field-align="flush">
    <sort>
      <key variable="citation-label"/>
    </sort>
    <layout>
      <group delimiter="" prefix="[" suffix="]">
        <text variable="citation-label"/>
        <text variable="year-suffix"/>
      </group>
      <group delimiter=" ; " suffix=":">
        <text macro="author"/>

produces:

Kre99 [a] Kreimer, Dirk: On Overlapping Divergences. In: Comm. Math. Phys. vol. 204 (1999), Nr. 3, pp. 669–689

Kre99 [b] Kreimer, D.: Chen’s Iterated Integral Represents the Operator Product Expansion. In: Adv. Theor. Math. Phys. vol. 3 (1999), Nr. 3, pp. 627–670

where [a] and [b] are being treated as part of the actual bibliography entry, rather than the label.

Another one that got fairly close is:

  <bibliography et-al-min="9" et-al-use-first="8" second-field-align="flush">
    <sort>
      <key variable="citation-label"/>
    </sort>
    <layout>
      <text variable="citation-label" prefix="[" />
      <text variable="year-suffix" />
      <text value="] " />
      <group delimiter=" ; " suffix=":">

which produces:

[Kre99 a] Kreimer, Dirk: On Overlapping Divergences. In: Comm. Math. Phys. vol. 204 (1999), Nr. 3, pp. 669–689

[Kre99 b] Kreimer, D.: Chen’s Iterated Integral Represents the Operator Product Expansion. In: Adv. Theor. Math. Phys. vol. 3 (1999), Nr. 3, pp. 627–670

So I am not sure what’s going on with the .csl file or Hayagriva.

Removing second-field-align="flush" from <bibliography> fixes the first one for me.

Tried that, and while that does get the bibliography labels to include year disambiguation, it proceeds to break the indenting behavior separating the labels from the actual entries. I can’t easily the difference here, since I don’t know how to show hanging indents here.