Contents

doi2bib

doi2bib is a perl, jq script to generate the bibTeX entry, according to my own standard and with my own conventions, from the doi of a scientific reference.

More details on the script (including the genesis of its creation) can be found in this blog post.

Usage

Pass a valid doi to the script.

doi2bib 10.1103/PhysRevLett.80.3483

The above example returns:

Article{saleh98a,
  author =       {B. E. A. Saleh and B. M. Jost and H. Fei and M. C. Teich},
  title =        {Entangled-Photon Virtual-State Spectroscopy},
  journal =      prl,
  year =         1998,
  volume =       80,
  pages =        3483,
  pdf =          {sci/saleh98a},
  url =          {doi:10.1103/physrevlett.80.3483}
}

You may have to put the doi between quotes if there are escape characters:

doi2bib "10.1016/0030-4018(91)90618-N"

Versions

  1. 30 July (2023): v°0.1 achieves the basic functionality.

Possible improvements

  1. more robust on firstnames and particles, e.g., does not truncate by its initials lowercases strings, that are typically "de", "del", "von", etc.
  2. generate the correct bibkey (that is, the letter 'a', 'b', etc.) depending on the last key in the bib.sci file. For instance, if laussy23a already exists and a laussy23 key must be generated, it will go directly to laussy23b.
  3. as part of the above, also provide the previous and next key in the bib file, for easy insertion.
  4. Support for arXiv, which although it has a doi, that points to the html page instead:
curl -LH "Accept: application/json" "http://dx.doi.org/10.48550/arXiv.2305.15827"

Installation

Copy the chmod +x script in the local bin directory. Two additional files should be put somewhere, as defined by

  • iso4 -- substitution rules for journals.
  • bibnames -- substitution rules for authors.

(in my case, these files are in ~/bib/doi2bib/).

Script

Links