How to order disambiguated bibliography entries (author-year style)

In APA style bibliografies multiple works with the same author get disambiguated by adding a lowercase letter after the year like so:

Author (2024a). A Title.
Author (2024b). Different Title

However when using the bibliography function in typst, they get ordered alphabetically by title. But the lowercase letter seem to get assigned in reverse order. So you end up with:

Author (2024b). A Title.
Author (2024a). Different title.

Minimal Example


@article{article_a,
  title={B is the first letter},
  author={Lastname, Firstname},
  year={2024}
}

@article{article_b,
  title={A is the first letter},
  author={Lastname, Firstname},
  year={2024}
}


@article{article_1,
  title={A is the first letter},
  author={Lastname, Firstname},
  year={2026}
}

@article{article_2,
  title={B is the first letter},
  author={Lastname, Firstname},
  year={2026}
}


@article_a

@article_b

@article_1

@article_2

#bibliography("incollection.bib", style: "apa")

renders as:

Is this a known behaviour?

If not and anyone runs into this:

My solution was to add a space before the title I wanted to go first in the bibtex file. This doesn’t get rendered but moves it before any other characters.

It is still technically wrong as the references should be in alphabetical order by title but having a and b in the wrong order is much more noticeable.

Disambiguation year suffixes are not sorted · Issue #330 · typst/hayagriva · GitHub looks related. Someone there said:

…either the APA is missing title check for citations (CSL style bug), or the Rust code is broken somewhere.

I guess the former is more likely, because not all author-date styles have this problem.
For example, style: "gb-7714-2015-author-date" generates 2024a, 2024b, 2026a, 2026b as expected.

1 Like

I noticed that the references actually are sorted correctly by title as required by the APA Manual (Citing works with the same author and date).

Yet the disambiguation letters are not assigned correctly: B is the first letter should be assigned 2024b and A is the first letter should be assigned 2024a.

These letters are assigned when the references are placed in order in the reference list (alphabetically by title, following the guidelines in Section 9.47).