Open ashprice opened 7 months ago
OK, I don't know if this is a preferred solution but I tracked down the issue. Anthos isn't given the CSL type for chapter, as I suspected. Still not sure I really understand 'what' is happening there, I don't know rust (although I wish to learn) and I am a relative beginner at all things code.
A fix, whether hacky or not, is to simply use the selector to select anthos and make it into a chapter for CSL. See the commit here: https://github.com/ashprice/hayagriva/commit/49d88b2d37d1e9b72e115bd675ccaaf87bee4101
diff --git a/src/csl/taxonomy.rs b/src/csl/taxonomy.rs
index c691ed3..e3108b7 100644
--- a/src/csl/taxonomy.rs
+++ b/src/csl/taxonomy.rs
@@ -564,7 +564,8 @@ impl EntryLike for Entry {
!(is_periodical || is_collection)
}
Kind::Chapter => {
- select!(Chapter > (Book | Anthology | Proceedings)).matches(self)
+ select!((Chapter | Anthos) > (Book | Anthology | Proceedings))
+ .matches(self)
}
Kind::Entry | Kind::EntryDictionary | Kind::EntryEncyclopedia => {
if kind == Kind::EntryDictionary {
I can make this into a PR, but I am not sure that this is the preferred way to deal with this. FWIW, we are dealing here with a regular book that contains a series of chapters with different authors, I am not quite sure I would call that an anthology
to begin with, but I am guessing that the type exists to differentiate it from chapters with the same authors...
@ashprice Have you tried changing @incollection
to @InBook
(which worked for me)? I had the same problem with using @InCollection
for custom Chicago CSL, and @inBook
is probably what Hayagriva considers incollection
in its own language. Below attached is an APA example:
@InBook{cr2015, title = {The cartography of syntactic structures}, booktitle = {The {{Oxford}} handbook of linguistic analysis}, author = {Cinque, Guglielmo and Rizzi, Luigi}, editor = {Heine, Bernd and Narrog, Heiko}, date = {2015}, series = {Oxford handbooks in linguistics}, edition = {Second edition}, pages = {51--65}, publisher = {Oxford University Press}, location = {New York, NY}, isbn = {978-0-19-967707-8}, langid = {english}, language = {English}, }
I ran into this problem as well for referencing using the American Political Science Association style. I think that @ashprice's edit could make sense in lieu of more changes in how incollection is handled. inbook does not seem like an appropriate type for a self-contained chapter with its own author within an edited book. There is a difference between Bibtex and Biblatex over the meaning of inbook and incollection. For Bibtex, inbook is simply a part of a book, whereas Biblatex has the additional requirement that it is a self-contained part of a book:
3.1 The Entry Type [@]inbook Use the [@]inbook entry type for a self-contained part of a book with its own title only. It relates to [@]book just like [@]incollection relates to [@]collection. See § 2.3.5 for examples. If you want to refer to a chapter or section of a book, simply use the book type and add a chapter and/or pages field. Whether a bibliography should at all include references to chapters or sections is controversial because a chapter is not a bibliographic entity.
In either case, inbook does not seem appropriate because it implies that the authorship of the part of the book is the same as the whole book. incollection is explicit about authorship being assigned to the self-contained section. Hayagriva seems to follow the Biblatex definition with regards to inbook by treating the entry as a titled chapter, as opposed to simply a part of a book that may or may not have its own title.
@jaylangford Yeah, that was a provisionary aid on my part. Still, @incollection
is somehow treated as an @anthos
when converted by Hayagriva from biblatex:
Concerning the @inbook
’s conversion:
Strangely, the point is that @incollection
from biblatex is not recognized by Hayagriva as a chapter.
@ironupiwada I believe the relevant code for identifying incollection as an Anthos entry with an Anthology parent is here;
{ tex::EntryType::InCollection, EntryType::Anthos, Some(EntryType::Anthology), true },
If I understand it correctly, it just treats all inCollection BibTex entries as Anthos. Then, it fails to match as a Chapter when being converted to CSL because of this line (the one that @ashprice referred to earlier in their commit):
Kind::Chapter => {
select!(Chapter > (Book | Anthology | Proceedings)).matches(self)
}
Hello, I am trying to format a bibliography in typst.
Consider the following biblatex reference:
And the following CSL:
This will print a blank line:
Its type inside hayagriva (after conversion from a
.bib
file) is given asanthos
, and the parent reference has the typeanthology
(not sure this is what I would call it, but whatever).I can get it to print using the CSL by eg. within the CSL, calling all reference types, matching for references that have titles, etc. But I cannot call it by
type="chapter"
, while this should be possible, and such works using other tools that use CSL.Not sure if this is a bug, or if I am making a mistake. Thank you for any help & let me know what further info I can provide.