-
-
Notifications
You must be signed in to change notification settings - Fork 74
Add arXiv identifier #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add arXiv identifier #326
Conversation
|
The problem is that the CSL spec has no variable for arXiv and therefore no CSL style will use it. I propose opening an issue on the CSL spec repo as well |
I opened a PR to add the identifier to their schema as well. |
|
Thank you for the contribution. For the time being, I'll consider this blocked on upstream (CSL schema). I'll note however that I've seen some styles which seemed to use some unofficial CSL variables, including ARXIV (but also identifiers for some less known journals and publishers), which is also why they aren't supported by hayagriva, so it is not unheard of. |
|
You make a great point for custom bibliography variables and styles. It feels weird that hayagriva has to know of a journal in order to display an entry. There are custom bib styles but one cannot add variables without compiling a custom hayagriva. Maybe it would be nice to add a way to configure a map of I think the CSL styles should be a large list of styles that users can depend on for professional style and should never be a constraint. Sounds dramatic but look at this lovely open issue citation-style-language/schema#131 from 2016 where the proposed workaround is using another field (PMID). Or this one citation-style-language/schema#350 from 2020. However, this proposed identifier is exactly what we already have in hayagriva in the Current write-only implementation of the arXiv
|
| | **Description:** | Any serial number, including article numbers. If you have serial numbers of well-known schemes like `doi`, you should put them into the serial number as a dictionary like in the second example. Hayagriva will recognize and specially treat `doi`, `isbn` `issn`, `pmid`, `pmcid`, and `arxiv`. You can also include `serial` for the serial number when you provide other formats as well. | |
Line 70 in 0c3c700
| - Interpret the `eprint` BibTeX key as `serial-number.arxiv` if the `eprinttype` is set to `arxiv` |
Lines 716 to 724 in 0c3c700
| /// ArXiv identifier. | |
| pub fn arxiv(&self) -> Option<&str> { | |
| self.keyed_serial_number("arxiv") | |
| } | |
| /// Set the `arxiv` field. | |
| pub fn set_arxiv(&mut self, arxiv: String) { | |
| self.set_keyed_serial_number("arxiv", arxiv); | |
| } |
Lines 454 to 456 in 0c3c700
| if eprint_type == Some("arxiv") { | |
| item.set_arxiv(eprint); | |
| } else if eprint_type == Some("pubmed") { |
|
I find it highly unlikely that CSL would introduce a new variable just for a single preprint server. Even if it's large. |
I already linked the discussion on the topic: citation-style-language/schema#350 (comment) |
I have given it some thought. PropositionWhat do you think about adding a This would allow
both without interferring with the CSL spec. We could even go for something longer like If you are interested I can throw together a PR. |
|
I can see the value in having something like that, but I would hold off from adding this for now. Hayagriva's format so far has attempted to be fairly independent from CSL itself (there was also a period where it didn't use CSL at all, though it was much more limited then). I wouldn't discard the idea entirely, but for now, I think we'll want to focus on developing Typst-side solutions allowing full customization of rendered bibliography entries. This PR typst/typst#5932 was the closest we have gotten so far to getting this to work, though some technical challenges made it not progress. I hope we can find a solution to them soon. |
Summary
Adds an arXiv identifier
ARXIVsimilar toPMID,PMCIDandDOI.Makes it possible to add the recommended form of citing arXiv submissions to a bibliography template with
<text variable="ARXIV" prefix="arXiv:"/>.Context
The arXiv references come in two forms
arXiv:hep-th/9603067arXiv:2412.11645 [hep-ex]where the identifier itself can also have a version, e.g.
2412.11645v2.See also the biblatex manual section "3.14.7 Electronic Publishing Information", which basically says that arXiv submissions are given in their format as
with a few aliases like
primaryclassforeprintclasswhich are already implemented in typst/biblatex#75 but are not yet in the published release.Related discussions
The actual change
Before this PR a hayagriva import of a bibtex file ignores the eprintclass and saves only the identifier as a serial number. Neither class or identifier are accessible from the CSL styles. After this PR the class is also added to the arXiv serial number but it still works without the class.
For the tests I added it to the end of the APS style, which looks like this
First two commits are the discussed changes and I sneaked in two "cleanup" commits. One deletes an unused file in the tests folder and the other one adds custom error types for the cli.
Fixes #302.
Depends on typst/biblatex#75 and typst/citationberg#24.