Skip to content
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

Add support for biorXiv and HAL preprint servers #36

Merged
merged 1 commit into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
67 changes: 66 additions & 1 deletion docs/src/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ @article{ImamogluPRE2015
Pages = {022714},
Volume = {91},
Number = {2},
arxiv = {1408.5798},
eprint = {1408.5798},
}

@unpublished{Evans1983,
Expand Down Expand Up @@ -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},
Expand Down
20 changes: 17 additions & 3 deletions docs/src/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/<ID>`.
* 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/<ID>`.
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` ID 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` ID 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).
18 changes: 18 additions & 0 deletions src/formatting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
18 changes: 18 additions & 0 deletions test/test_formatting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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. <i>Fast Navigation in a Large Hilbert Space Using Quantum Optimal Control</i>. <a href='https://doi.org/10.1103/physrevx.10.021058'>Phys. Rev. X <b>10</b>, 021058 (2020)</a>. <a href='https://hal.science/hal-02887773'>HAL:hal-02887773</a>."
@Test html("TuriniciHAL00640217") ==
"G. Turinici. <a href='https://hal.science/hal-00640217'><i>Quantum control</i></a>. HAL:hal-00640217 (2012)."
@Test html("BrionPhd2004") ==
"E. Brion. <i>Contrôle Quantique et Protection de la Cohérence par effet Zénon, Applications à l'Informatique Quantique</i>. Phd thesis, Université Pierre et Marie Curie - Paris VI (2014). <a href='https://hal.science/tel-00007910v2'>HAL:tel-00007910v2</a>."
@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. <i>Probing cytoskeletal modulation of passive and active intracellular dynamics using nanobody-functionalized quantum dots</i>. <a href='https://doi.org/10.1038/ncomms14772'>Nat. Commun. <b>8</b>, 14772 (2017)</a>, <a href='https://www.biorxiv.org/content/10.1101/089284'>biorXiv:089284</a>."
@Test html("NonStandardPreprint") ==
"M. Tomza, M. H. Goerz, M. Musiał, R. Moszynski and C. P. Koch. <i>Optimized production of ultracold ground-state molecules: Stabilization employing potentials with ion-pair character and strong spin-orbit coupling</i>. <a href='https://doi.org/10.1103/PhysRevA.86.043424'>Phys. Rev. A <b>86</b>, 043424 (2012)</a>, 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])
Expand Down
18 changes: 18 additions & 0 deletions test/test_formatting/preprints.bib
Original file line number Diff line number Diff line change
@@ -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},
}