BibLaTeX `@collection`/`@incollection` incorrectly mapped to CSL `collection` type
BibLaTeX @collection/@incollection entries render incorrectly in some styles, including APA. The reason seems to be that they are mapped to the wrong CSL types. I think the origin of the problem is that collection has different semantic meanings in BibLaTeX and CSL:
-
BibLaTeX
@collection: "A single-volume collection with multiple, self-contained contributions by distinct authors which have their own title. The work as a whole has no overall author but it will usually have an editor." (biblatex manual §2.1.1) -
CSL
collection: "An archival collection in a museum or other institution" (CSL specification)
Hayagriva currently maps the BibLaTeX entries like so:
| BibLaTeX | Hayagriva | CSL |
|---|---|---|
@collection |
Anthology |
collection |
@incollection |
Anthos |
(none) |
I believe the mapping should be:
| BibLaTeX | Hayagriva | CSL |
|---|---|---|
@collection |
Book |
book |
@incollection |
Chapter |
chapter |
The current mapping causes Hayagriva to incorrectly format @collection/@incollection BibLaTeX entries. The bugs manifest differently depending on the CSL style used.
Example
This example is from #357 and the associated issue_357 test in interop.rs, rendered here using the APA style.
%%% test.bib %%%
@collection{cassell-2004-essen-guide,
editor = {Catherine Cassell and Gillian Symon},
title = {Essential Guide to Qualitative Methods in Organizational Research},
year = 2004,
publisher = {SAGE Publications Ltd},
url = {http://dx.doi.org/10.4135/9781446280119},
doi = {10.4135/9781446280119},
}
@incollection{king-2004-using-interv,
author = {Nigel King},
title = {Using interviews in qualitative research},
booktitle = {Essential Guide to Qualitative Methods in Organizational Research},
crossref = {cassell-2004-essen-guide},
publisher = {SAGE Publications Ltd},
year = 2004,
editor = {Catherine Cassell and Gillian Symon},
chapter = 2,
pages = {11--22},
}
Observed behavior
Typst code
Cite collection: @cassell-2004-essen-guide
Cite incollection: @king-2004-using-interv
#bibliography("test.bib", style: "apa")
Hayagriva output
Cassell, C., & Symon, G. (Eds.). (2004, ). Essential Guide to Qualitative Methods in
Organizational Research [Archival collection]. SAGE Publications Ltd.
https://doi.org/10.4135/9781446280119
King, N. (2004). Using interviews in qualitative research. In C. Cassell & G.
Symon (Eds.), Essential Guide to Qualitative Methods in Organizational
Research: Essential Guide to Qualitative Methods in Organizational Research
(pp. 11–22). SAGE Publications Ltd. https://doi.org/10.4135/9781446280119
Expected behavior
LaTeX code (using pdfLaTeX with biblatex-apa)
\documentclass{article}
\usepackage[style=apa]{biblatex}
\addbibresource{test.bib}
\begin{document}
Cite collection: \textcite{cassell-2004-essen-guide}
Cite incollection: \textcite{king-2004-using-interv}
\printbibliography
\end{document}
Output (correct with respect to APA 7th edition formatting prescription):
Cassell, C., & Symon, G. (Eds.). (2004). Essential guide to qualitative methods
in organizational research. SAGE Publications Ltd.
https://doi.org/10.4135/9781446280119
King, N. (2004). Using interviews in qualitative research. In C. Cassell & G.
Symon (Eds.), Essential guide to qualitative methods in organizational
research (pp. 11–22). SAGE Publications Ltd.
https://doi.org/10.4135/9781446280119
Problems Identified
While the specific formatting problems depend on the style used, the underlying mapping issues are general problems that can affect many styles.
1. [Archival collection] annotation on @collection entries
@collection maps to the Anthology type, which maps to CSL collection. This triggers the APA style's archival collection formatting, which adds the [Archival collection] annotation.
In taxonomy.rs:601-604, Anthology matches Kind::Collection:
let is_collection = self.entry_type() == &EntryType::Anthology;
if kind == Kind::Collection {
return is_collection;
}
2. @incollection (Anthos) does not match any CSL type
BibLaTeX's @incollection maps to Hayagriva's Anthos type (interop.rs:186), but Anthos does not match any CSL type.
Kind::Chapter => {
select!(Chapter > (Book | Anthology | Proceedings)).matches(self)
}
This selector only matches EntryType::Chapter, not EntryType::Anthos. Consequently, @incollection entries are not recognized as CSL chapter type.
For comparison, @inbook correctly maps to EntryType::Chapter (interop.rs:185), which does match CSL chapter.
3. Title duplication in @incollection entries
The parent book title appears twice: Essential Guide to Qualitative Methods in Organizational Research: Essential Guide to Qualitative Methods in Organizational Research.
This is the same as #309. It occurs because Hayagriva's Anthos type resolves both container-title and volume-title to the parent's title, and CSL APA renders both. Other styles may not exhibit this if they only render one of these variables.
Changing the mapping of @incollection from Anthos to Chapter would resolve this for @incollection entries, but there might still be a bug in the rendering of Anthos data.
4. Malformed date formatting on @collection entries
The date renders as (2004, ) with a trailing comma and space, instead of (2004).
This is the same as #246. APA treats CSL collection type as requiring a full date with month/day (apa.csl:364-369), but when only year is provided, the comma delimiter appears with empty month/day parts. Changing the mapping of @collection from Anthology to Book would resolve this, since CSL APA only renders year for book type.
Suggested Fix
BibLaTeX @collection and @incollection should behave like @book and @inbook. The simplest fix is to change the BibTeX import mappings in src/interop.rs:
Current
{ tex::EntryType::Collection, EntryType::Anthology, None, true },
{ tex::EntryType::InCollection, EntryType::Anthos, Some(EntryType::Anthology), true },
Suggested
{ tex::EntryType::Collection, EntryType::Book, None, true },
{ tex::EntryType::InCollection, EntryType::Chapter, Some(EntryType::Book), true },
This would make @collection/@incollection behave identically to @book/@inbook when imported from BibLaTeX, which matches BibLaTeX's semantics.
Other related issues
This issue is distinct from #357, despite both affecting @incollection entries. #357 was about the chapter field causing metadata loss (the field value was used to create a new Chapter entry, discarding the original title/author). The present issue is about the semantic mismatch in base entry type mappings. PR 361 fixed #357 but does not address this issue. The bugs described here occur regardless of whether the chapter field is present.
It's possible that #203 stems from the mapping for @incollection to Anthos and that mapping it to Chapter would have an effect, but I'm not sure.
Environment
- Typst version: 0.14.2
- Hayagriva version: 0.9.1 (bundled with Typst)
- Style tested: APA (built-in)
Workaround
To get correct APA output users must currently use @book and @inbook instead of @collection and @incollection, respectively. It would be great if Hayagriva's behavior matched BibLaTeX's for BibLaTeX data.