From c65b7c78c1f10ebadfffb6a755e2210719290202 Mon Sep 17 00:00:00 2001 From: Michael Goerz Date: Fri, 15 Sep 2023 01:38:39 -0400 Subject: [PATCH] Add support for biorXiv and HAL preprint servers --- NEWS.md | 9 +++- docs/src/refs.bib | 67 +++++++++++++++++++++++++++++- docs/src/syntax.md | 20 +++++++-- src/formatting.jl | 18 ++++++++ test/test_formatting.jl | 18 ++++++++ test/test_formatting/preprints.bib | 18 ++++++++ 6 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 test/test_formatting/preprints.bib diff --git a/NEWS.md b/NEWS.md index 0bfd112..4d647a3 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,8 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * New `style=AlphaStyle()` that generates unique citation labels. This can mostly be considered internal, as `style=:alpha` is automatically upgraded to `style=AlphaStyle()`. -* Support for `eprint` field. It is recommended to add the arXiv ID in the `eprint` field for any article whose DOI is behind a paywall. -* Support for `note` field. +* Support for `eprint` field. It is recommended to add the arXiv ID in the `eprint` field for any article whose DOI is behind a paywall [[#32][]] +* Support for non-arXiv preprint servers BiorXiv and HAL [[#35][], [#36][]] +* Support for `note` field. [[#20][]] ### Changed @@ -55,3 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [Unreleased]: https://github.com/JuliaDocs/DocumenterCitations.jl/compare/v1.0.0...HEAD [1.0.0]: https://github.com/JuliaDocs/DocumenterCitations.jl/compare/v0.2.12...v1.0.0 +[#36]: https://github.com/JuliaDocs/DocumenterCitations.jl/pull/36 +[#35]: https://github.com/JuliaDocs/DocumenterCitations.jl/issues/35 +[#32]: https://github.com/JuliaDocs/DocumenterCitations.jl/pull/32 +[#20]: https://github.com/JuliaDocs/DocumenterCitations.jl/issues/20 diff --git a/docs/src/refs.bib b/docs/src/refs.bib index 35b962e..522f708 100644 --- a/docs/src/refs.bib +++ b/docs/src/refs.bib @@ -420,7 +420,7 @@ @article{ImamogluPRE2015 Pages = {022714}, Volume = {91}, Number = {2}, - arxiv = {1408.5798}, + eprint = {1408.5798}, } @unpublished{Evans1983, @@ -531,6 +531,71 @@ @article{Wilhelm2003.10132 Doi = {10.48550/ARXIV.2003.10132}, } +@article{TuriniciHAL00640217, + Title = {Quantum control}, + Author = {Turinici, Gabriel}, + Journal = {HAL:hal-00640217}, + Year = {2012}, + Url = {https://hal.science/hal-00640217}, +} + +@article{SauvagePRXQ2020, + Author = {Sauvage, Frédéric and Mintert, Florian}, + Title = {Optimal Quantum Control with Poor Statistics}, + Journal = prxq, + Year = {2020}, + Doi = {10.1103/prxquantum.1.020322}, + Pages = {020322}, + Volume = {1}, + Number = {2}, + eprint = {hal-03612955}, + Archiveprefix = {HAL}, +} + + +@article{LarrouyPRX2020, + Author = {Larrouy, Arthur and Patsch, Sabrina and Richaud, Rémi and Raimond, Jean-Michel and Brune, Michel and Koch, Christiane P. and Gleyzes, Sébastien}, + Title = {Fast Navigation in a Large Hilbert Space Using Quantum Optimal Control}, + Journal = prx, + Year = {2020}, + Doi = {10.1103/physrevx.10.021058}, + Pages = {021058}, + Volume = {10}, + Number = {2}, + eprint = {hal-02887773}, + Archiveprefix = {Hal}, +} + +@phdthesis{BrionPhd2004, + Author = {Brion, Etienne}, + Title = {Contrôle Quantique et Protection de la Cohérence par effet Zénon, Applications à l'Informatique Quantique}, + School = {Université Pierre et Marie Curie - Paris VI}, + eprint = {tel-00007910v2}, + Archiveprefix= {hal}, + Year = {2014}, +} + +@article{Vecheck2022.09.09.507322, + Author = {Amy M. Vecheck and Cameron McNamee and Renee Reijo Pera and Robert J. Usselman}, + Title = {Quantum Biology in Cellular Migration}, + Year = {2022}, + Doi = {10.1101/2022.09.09.507322}, + journal = {bioRxiv:2022.09.09.507322} +} + +@article{KatrukhaNC2017, + Author = {Katrukha, Eugene A. and Mikhaylova, Marina and van Brakel, Hugo X. and van Bergen en Henegouwen, Paul M. and Akhmanova, Anna and Hoogenraad, Casper C. and Kapitein, Lukas C.}, + Title = {Probing cytoskeletal modulation of passive and active intracellular dynamics using nanobody-functionalized quantum dots}, + Journal = natcom, + Year = {2017}, + Doi = {10.1038/ncomms14772}, + Pages = {14772}, + Volume = {8}, + Number = {1}, + eprint = {089284}, + Archiveprefix = {biorxiv}, +} + @misc{QCRoadmap, editor = {Todd Heinrichs}, title = {Quantum Computation Roadmap}, diff --git a/docs/src/syntax.md b/docs/src/syntax.md index eb1f977..64a8815 100644 --- a/docs/src/syntax.md +++ b/docs/src/syntax.md @@ -195,10 +195,24 @@ Some tips to keep in mind when editing a `.bib` file to be used with `Documenter * You do not need to use [braces to protect capitalization](https://texfaq.org/FAQ-capbibtex). `DocumenterCitations` is not always able to remove such braces. But, unlike `bibtex`, `DocumenterCitation` will preserve the capitalization of titles. * Use a consistent scheme for citation keys. Shorter keys are better. * All entries should have a `Doi` field, or a `Url` field if no DOI is available. -* If the published paper (`Doi` link) is not open-access, but a version of the paper is available on the [arXiv](https://arxiv.org), include the arXiv ID as `eprint` in the BibTeX entry. In the rendered bibliography, there will be a link to `https://arxiv.org/abs/`. -* It is not necessary to define `Archiveprefix` in the `.bib` file. A missing `Archiveprefix` is assumed to be `arXiv`. -* For documents that are available only as an arXiv eprint, the best result is obtained with a BibTeX entry using the `@article` class, with, e.g., `arXiv:2003.10132` in the `Journal` field, and, e.g., `10.48550/ARXIV.2003.10132` in the `Doi` field (but no `eprint` field). * Use `@string` macros for abbreviated journal names, with the caveat of [#31](https://github.com/Humans-of-Julia/BibParser.jl/issues/31) and [#32](https://github.com/Humans-of-Julia/BibParser.jl/issues/32) in the [BibParser.jl issues](https://github.com/Humans-of-Julia/BibParser.jl/issues). You may be interested in using (or forking) the [`getbibtex` script](https://github.com/goerz/getbibtex) to generate consistent `.bib` files. + + +### Preprint support + +If the published paper (`Doi` link) is not open-access, but a version of the paper is available on a preprint server like the [arXiv](https://arxiv.org), your are strongly encouraged to add the arXiv ID as `Eprint` in the BibTeX entry. In the rendered bibliography, the preprint information will be shown and automatically link to `https://arxiv.org/abs/`. +If necessary, you may also add a `Primaryclass` field to indicate a category, see ["BibTeX and Eprints" in the arXiv documentation](https://info.arxiv.org/help/hypertex/bibstyles/index.html). + +Note that unlike in [default](https://tex.stackexchange.com/questions/386078/workaround-for-missing-archiveprefix-in-bib-entry) BibTeX, it is not necessary to define `Archiveprefix` in the `.bib` file. A missing `Archiveprefix` is assumed to be `arXiv`. The field name `Eprinttype` (which in BibTeX is an alias for `Archiveprefix`) is currently not yet supported, nor is `Eprintclass` as an alias for `Primaryclass`. + +For documents that are available *only* as an arXiv eprint, the best result is obtained with a BibTeX entry using the `@article` class, with, e.g., `arXiv:2003.10132` in the `Journal` field, and, e.g., `10.48550/ARXIV.2003.10132` in the `Doi` field (but no `Eprint` field) [Wilhelm2003.10132](@cite). + +Beyond arXiv, other preprint servers are supported. The `Archiveprefix` field for non-arXiv preprints is mandatory. For any defined `Archiveprefix`, `Eprint`, and `Primaryclass` fields, the rendered bibliography will include the preprint information in the format `ArchivePrefix:Eprint [Primaryclass]`. However, only certain preprint servers (known `ArchivePrefix`) will automatically be linked. Besides arXiv, the currently supported preprint servers are: + +* [BiorXiv](https://www.biorxiv.org). The `Archiveprefix` is `biorXiv`. The `Eprint` should be the final part of the DOI, e.g. `2022.09.09.507322` [KatrukhaNC2017](@cite). +* [HAL](https://hal.science). The `Archiveprefix` is `HAL`. The `Eprint` should include the prefix (usually `hal-`, but sometimes `tel-`, etc.), e.g., Refs [SauvagePRXQ2020](@cite) and [BrionPhd2004](@cite). + +If you would like support for any additional preprint server, [please open an issue](https://github.com/JuliaDocs/DocumenterCitations.jl/issues/new/choose). diff --git a/src/formatting.jl b/src/formatting.jl index 5a1bc24..6da190d 100644 --- a/src/formatting.jl +++ b/src/formatting.jl @@ -301,24 +301,42 @@ end function format_eprint(entry) + eprint = entry.eprint.eprint if isempty(eprint) return "" end archive_prefix = entry.eprint.archive_prefix primary_class = entry.eprint.primary_class + + # standardize prefix for supported preprint repositories if isempty(archive_prefix) || (lowercase(archive_prefix) == "arxiv") archive_prefix = "arXiv" end + if lowercase(archive_prefix) == "hal" + archive_prefix = "HAL" + end + if lowercase(archive_prefix) == "biorxiv" + archive_prefix = "biorXiv" + end + text = "$(archive_prefix):$eprint" if !isempty(primary_class) text *= " [$(primary_class)]" end + + # link url for supported preprint repositories link = "" if archive_prefix == "arXiv" link = "https://arxiv.org/abs/$eprint" + elseif archive_prefix == "HAL" + link = "https://hal.science/$eprint" + elseif archive_prefix == "biorXiv" + link = "https://www.biorxiv.org/content/10.1101/$eprint" end + return linkify(text, link) + end diff --git a/test/test_formatting.jl b/test/test_formatting.jl index 48c0657..cc483d8 100644 --- a/test/test_formatting.jl +++ b/test/test_formatting.jl @@ -89,6 +89,24 @@ end end +@testset "format_biliography_reference (preprints)" begin + bib = CitationBibliography(joinpath(@__DIR__, "..", "docs", "src", "refs.bib"),) + bib0 = CitationBibliography(joinpath(splitext(@__FILE__)[1], "preprints.bib")) + merge!(bib.entries, bib0.entries) + html(key) = format_bibliography_reference(Val(:numeric), bib.entries[key]) + @Test html("LarrouyPRX2020") == + "A. Larrouy, S. Patsch, R. Richaud, J.-M. Raimond, M. Brune, C. P. Koch and S. Gleyzes. Fast Navigation in a Large Hilbert Space Using Quantum Optimal Control. Phys. Rev. X 10, 021058 (2020). HAL:hal-02887773." + @Test html("TuriniciHAL00640217") == + "G. Turinici. Quantum control. HAL:hal-00640217 (2012)." + @Test html("BrionPhd2004") == + "E. Brion. Contrôle Quantique et Protection de la Cohérence par effet Zénon, Applications à l'Informatique Quantique. Phd thesis, Université Pierre et Marie Curie - Paris VI (2014). HAL:tel-00007910v2." + @Test html("KatrukhaNC2017") == + "E. A. Katrukha, M. Mikhaylova, H. X. van Brakel, P. M. van Bergen en Henegouwen, A. Akhmanova, C. C. Hoogenraad and L. C. Kapitein. Probing cytoskeletal modulation of passive and active intracellular dynamics using nanobody-functionalized quantum dots. Nat. Commun. 8, 14772 (2017), biorXiv:089284." + @Test html("NonStandardPreprint") == + "M. Tomza, M. H. Goerz, M. Musiał, R. Moszynski and C. P. Koch. Optimized production of ultracold ground-state molecules: Stabilization employing potentials with ion-pair character and strong spin-orbit coupling. Phys. Rev. A 86, 043424 (2012), xxx-preprint:1208.4331." +end + + @testset "format_bibliography_reference(:authoryear)" begin bib = CitationBibliography(joinpath(@__DIR__, "..", "docs", "src", "refs.bib"),) html(key) = format_bibliography_reference(Val(:authoryear), bib.entries[key]) diff --git a/test/test_formatting/preprints.bib b/test/test_formatting/preprints.bib new file mode 100644 index 0000000..3459b36 --- /dev/null +++ b/test/test_formatting/preprints.bib @@ -0,0 +1,18 @@ +% Additionally to the main .bib file +@string{pra = "Phys. Rev. A"} + +% https://github.com/Humans-of-Julia/BibParser.jl/issues/32 +@string{XXXclearparser = ""} + +@article{NonStandardPreprint, + Author = {Tomza, Micha\l{} and Goerz, Michael H. and Musia\l{}, Monika and Moszynski, Robert and Koch, Christiane P.}, + Title = {Optimized production of ultracold ground-state molecules: Stabilization employing potentials with ion-pair character and strong spin-orbit coupling}, + Journal = pra, + Year = {2012}, + Doi = {10.1103/PhysRevA.86.043424}, + Pages = {043424}, + Volume = {86}, + eprint = {1208.4331}, + Archiveprefix = {xxx-preprint}, +} +