sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.61k stars 97 forks source link

Bibtex implementation lacks crossref support for inheritance #2021

Closed Omikhleia closed 1 week ago

Omikhleia commented 1 month ago

SILE 0.14.17 or 0.15-develop

(Modern) bibtex/bitlatex/biber etc. define a special crossref field, indicating that the entry inherits any fields it is missing from the entry it cross-references.

The current implementation ignores it, resulting in incomplete references.

Example

@book{DragonDeBrume5,
  title     = {On some stars, flowers & places in Middle-earth},
  booktitle = {On some stars, flowers & places in Middle-earth},
  year      = 2023,
  publisher = "Le Dragon de Brume",
}

@inbook{LefevreMercury2023,
  author    = "Lefèvre, Alain",
  title     = "On the lost tale of Mercury",
  crossref  = "DragonDeBrume5",
  pages     = "7--12",
}

The second reference, when output, should use the missing fields from the first, and thus yield: Lefèvre, “On the lost tale of Mercury.” In On some stars, flowers & places in Middle-earth, 7–12. Le Dragon de Brume, 2023.

In other terms, it should be equivalent to:

@inbook{LefevreMercury2023,
  author    = "Lefèvre, Alain",
  title     = "On the lost tale of Mercury",
  booktitle = {On some stars, flowers & places in Middle-earth},
  year      = 2023,
  publisher = "Le Dragon de Brume",
  pages     = "7--12",
}

Rationale

This inheritance mechanism is useful for collections, avoiding to repeat identical fields.

Omikhleia commented 3 weeks ago

For the record, BibLaTeX (and Biber) also support @xdata entries, that normally can't be cited or listed, and may be referenced in two ways:

The crossref field also has another implicit use (... speak of clear separation of concerns in such matters...), with the idea that over a certain (configurable) threshold value, entries often cross-referenced would be included in the bibliography automatically....

In this issue, I suggest going for the easiest part and the "quick win", i.e. basic crossref support (without counting and automated inclusion later in a bibliography, which we don't have yet at this point) and basic @xdata/data support (without the in-field granular attribute expansion).

As far as I know, it covers the most usual need (avoiding to repeat entries e.g. in @incollection entries referring to the same @book, or likewise for journal articles etc.) The other constructs are quite insane and would require list fields (such as author, etc.) to already have been split and parsed -- It could be doable eventually, but it's another hornet's nest for fairly rare use cases IMHO.

Omikhleia commented 3 weeks ago

Lol, Biber/BibLaTeX also have xref which doesn't supplement any field, but counts for entries to include in a bibliography when mincrossref (yep, there's still a typo in the March 2024 edition of the Biber manuel, spelling "mincrosref") is reached. It's of no concern for this present issue here -- but It's sort of funny to see how Bib(La)TeX is insane in its feature creeping madness.