<span class="mw-page-title-main">Doi2bib</span>
Fabrice P. Laussđ•Ș’s â„€oometric Web

doi2bib

doi2bib (Version 2.1.2 as of 3 November (2026)) is a perl and 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.-B. 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"

The flags, which may be written on either side of the doi:

doi2bib DOI          # show the entry, write nothing
doi2bib -w DOI       # write it, at its alphabetical place in sci.bib
doi2bib -a DOI       # -w, then push Template:<Key> with bib2wiki -force
doi2bib -f DOI       # do it anyway: a doi already on file is fetched again and
                     # rewritten in place, under the key it is cited by
doi2bib -a -f KEY    # an entry knows its own doi, so its key is the short way
                     # of saying redo this one
doi2bib -d KEY ...   # delete the entry (entries) with that key
doi2bib -j DOI       # do not ask about an unknown journal, take the key proposed
doi2bib -t "TITLE"   # what a title becomes, writing nothing; -t alone reads titles from stdin
doi2bib URL          # a paper with no doi, from its page (JETP, JETP Lett., citation_* meta tags)
doi2bib -e [FILE]    # a paper with no doi, from a BibTeX entry in FILE or pasted on stdin
doi2bib -h           # this list

From the doi to both wikis

Since 9 August (2026), the whole journey of a new paper is three commands:

doi2bib -a 10.1103/...   # the sci.bib entry + Template:<Key> on the local wiki
llw2lw --doit            # the template reaches laussy.org
bib2wiki -uo             # [[Scientific articles]] online, rebuilt now

The third command is only for impatience: the lists on both wikis otherwise refresh themselves at the daily lw-warm cron. A re-push of an existing key (doi2bib -a key) goes through bib2wiki -force, which since v4.0 keeps whatever {{pdf|File:...}} link the template already carries.

The journal has to be a key

Of all the fields in an entry, the journal is the only one not written as it arrives. It has to be a bare @string key that sci.bib defines -- journal = prl, not journal = {Phys. Rev. Lett.} -- and the name the publisher sends is turned into that key by iso4, a sed script run over it twice.

When iso4 has no rule for a journal there is nothing to fall back on, and until 11 September (2026) the name went in raw. journal = J. Phys. F: Met. Phys., is not BibTeX at all: bibtex stops on it, skips the remainder of the entry, and the year, the volume and the pages go with it, while the template built from that entry renders an empty [[]] because an undefined string resolves to nothing and bib2wiki sends its own warnings to /dev/null.

doi2bib now checks, on every path, that the journal is a key and that sci.bib defines it, and offers j2bib for what it cannot resolve. That offer is made on a plain look-up too, since that is the moment one finds out; accepting it writes the iso4 rule and the @string line, never an entry, and only ever after showing both. Decline it, or be somewhere the question cannot be asked, and the name is written in braces, which bibtex at least accepts, with the j2bib line to run printed underneath. -j takes the proposed key without asking.

Names and titles

Since v°2.0.0 (6 October (2026)), the names and the title are written in the conventions of sci.bib rather than as the publisher sends them.

Every word of a given name gives an initial. Until then the given name was split on hyphens only, so CrossRef's T. B. came out as T.: Demonstration of nondeterministic quantum logic operations using linear optical elements. T. B. Pittman, B. C. Jacobs and J. D. Franson in Phys. Rev. Lett. 88:257902 (2002). had lost its middle initials, and so had 424 other entries, all mended the same day from CrossRef. A family name of two capitalised words is braced, J. C. {L\'opez Carre{\~n}o}, otherwise bibTeX takes its first word for a given name; a particle stays outside, E. del Valle. An accented initial is one braced character, {\'A}.: the style cuts a raw Á. in the middle of its UTF-8 bytes, which stops LaTeX.

Titles are in sentence case with the names and acronyms braced—Climbing the {Jaynes--Cummings} ladder and observing its $\sqrt{n}$ nonlinearity in a cavity {QED} system—because naturemag.bst lowercases whatever is not braced: an unbraced QED prints as "qed". A Title Case title, as APS sends them, is brought down word by word, the titles already in sci.bib, its author surnames and the system dictionary deciding which words are names; a word that none of them knows is kept capitalised, braced, and named on the terminal. MathML in a title becomes TeX in the style of the file, {MgF$_{2}$} or {$N$}-photon, and a bare % is escaped (one of them, in Detecting telecom single photons with $99.5^{+0.5}_{-2.07}$% system detection efficiency and high time resolution. J. Chang, J. W. N. Los, J. O. Tenorio-Pearl, N. Noordzij, R. Gourgues, A. Guardiani, J. R. Zichi, S. F. Pereira, H. P. Urbach, V. Zwiller, S. N. Dorenbos and I. Esmaeil Zadeh in APL Photon. 6:036114 (2021)., cut every bibliography short at that entry). doi2bib -t shows what a title becomes without fetching anything; it was run over every title of sci.bib, which now goes through bibtex and LaTeX whole without a single error.

A page or a volume that is not a plain number (L061701, e1501143) is braced: bare, bibtex read it as an undefined @string and printed nothing.

Papers with no doi

Since v°2.1.0 (3 November (2026)), a paper the publisher never registered goes in all the same, in the shape of the rest of sci.bib. The typical case is the Soviet literature: JETP Letters up to volume 62 (1995) and JETP up to the late 1990s have no doi.

doi2bib -a http://jetpletters.ru/ps/1420/article_21579.shtml   # from the paper's page
doi2bib -a -e entry.bib                                         # from a BibTeX entry
doi2bib -a -e                                                   # ... pasted, then Ctrl-D

The first returns Effect of Bose condensation on inelastic processes in gases. Yu. Kagan, B. V. Svistunov and G. V. Shlyapnikov in JETP Lett. 42:209 (1985).:

@Article{kagan85a,
  author = 	 {Yu. Kagan and B. V. Svistunov and G. V. Shlyapnikov},
  title = 	 {Effect of {Bose} condensation on inelastic processes in gases},
  journal = 	 jetplett,
  year = 	 1985,
  volume = 	 42,
  pages = 	 209,
  note = {[Pis'ma Zh. Eksp. Teor. Fiz. \textbf{42}, 169 (1985)]},
  pdf = {sci/kagan85a},
  url = {http://jetpletters.ru/ps/1420/article_21579.shtml}
}

jetpletters.ru and jetp.ras.ru have readers of their own: the English volume and page are what is cited, and the Russian original goes in the note. The site's own "BibTex record" gives the Russian page as the page—that is how Effect of Bose condensation on inelastic processes in gases. Yu. Kagan, B. V. Svistunov and G. V. Shlyapnikov in JETP Lett. 42:209 (1985). had come to cite JETP Lett. 42, 169 (and to lose Svistunov) for what is 42, 209. Up to 1992 the translation is filed as sovjetp (Sov. Phys. JETP), after it as jetp. From volume 63 on, jetpletters.ru carries the Russian edition only, and JETP from 1997 is at Springer: CrossRef is then asked for the English doi, and the entry goes the doi way. Any other site is read from the citation_* meta tags most publishers put in their pages (Springer sends scripts a page of its own instead); a page with a doi in it hands that doi over.

-e takes an entry written by hand or copied from somewhere and puts it through the same mill as a fetched one: its key is replaced by doi2bib's, TeX accents and braces are read back so that the names get their initials and the title its casing, and its note and url are kept. A journal that iso4 has no rule for is also looked up among the values of the @string block, so that "JETP Lett." is jetplett rather than a new key.

With no doi to match on, an entry is already on file when it has the same url, or a key of the same name and year and the same title; -f rewrites it under the key it is cited by, and doi2bib -a -f KEY on an entry with a url but no doi reads that url again. Such a refresh keeps the title on file (the JETP sites' titles are scanned, "durlng" for "during") and the authors when they are the same people in the same order (hand transliterations such as Burshte\={\i}n stay).

All 21 entries of sci.bib with a JETP or JETP Letters page were refreshed this way on 3 November (2026). Six had the Russian volume or page where the English is cited (Effect of Bose condensation on inelastic processes in gases. Yu. Kagan, B. V. Svistunov and G. V. Shlyapnikov in JETP Lett. 42:209 (1985)., Coulomb interaction in thin semiconductor and semimetal films. L. V. Keldysh in JETP Lett. 29:658 (1979)., Line and point singularities in superfluid He$^3$. G.E. Volovik and V.P. Mineev in JETP Lett. 24:561 (1976)., Population trapping and coherent bleaching of a three-level medium by a periodic train of ultrashort pulses. O. A. Kocharovskaya and Ya. I. Khanin in Sov. Phys. JETP 63:945 (1986)., Exact Dicke superradiance theory: Bethe wavefunctions in the discrete atom model. V. I. Rupasov and V. I. Yudson in Sov. Phys. JETP 59:478 (1984)., Bose condensation of finite-lifetime particles with excitons as an example. S.G. Tikhodeev in Sov. Phys. JETP 70:380 (1990)., the last two also filed under zetf), Interference effects in the emission spectra of quantum dots in high-quality cavities. L. V. Keldysh, V. D. Kulakovskii, S. Reitzenstein, M. N. Makhonin and A. Forchel in JETP Lett. 84:494 (2007). was the Russian Pis'ma and is now its English doi, and all got their Russian original in a note and a url to the article's page instead of its pdf or the dead www.jetpletters.ac.ru.

The 19 entries in a JETP journal with no url at all were then matched by hand against an index of the site—every article of the ZhETF volumes concerned, with its Russian page and the English translation it went into, and the issue lists of JETP Letters, which give both pages—and given their url, after which doi2bib -f did the rest. Most cited the Russian volume and page under the English journal: Dispersion of electromagnetic waves in crystals. V. M. Agranovich in Sov. Phys. JETP 10:307 (1960). (ZhETF 37, 430 for JETP 10, 307), Theory of electromagnetic waves in a crystal in which excitons arise. S. I. Pekar in Sov. Phys. JETP 6:785 (1958)., On the theory of Mott excitons in high magnetic fields. L. P. Gor'kov and I. E. Dzyaloshinskii in Sov. Phys. JETP 26:449 (1968)., Relaxation of a quantum oscillator. B. Ya. Zel'dovich, A. M. Perelomov and V. S. Popov in Sov. Phys. JETP 28:308 (1969)., Rigorous theory of cooperative spontaneous emission of radiation from a lumped system of two-level atoms: Bethe ansatz method. V. I. Rupasov and V. I. Yudson in Sov. Phys. JETP 60:927 (1984)., Dynamics of integrable quantum systems. V. I. Yudson in Sov. Phys. JETP 61:1043 (1985)., and the JETP Letters Effect of retarded interaction on the exciton spectrum in one-dimensional and two-dimensional crystals. V. M. Agranovich and O. A. Dubovskii in JETP Lett. 3:223 (1966)., Interference states of optical excitons. Observation of additional waves. V. A. Kiselev, B. S. Razbirin and I. N. Ural'tsev in JETP Lett. 18:296 (1973).; Phenomenological theory of superfluidity near the $\lambda$ point. L.P. Pitaevskii in Sov. Phys. JETP 8:282 (1959). mixed the Russian volume with the English page; On the possibility of superfluidity of spatially separated electrons and holes due to their coupling: new mechanism of superfluidity. Yu. E. Lozovik and V.I. Yudson in JETP Lett. 22:274 (1975). had the Russian page of another letter of the same authors (22, 26 for the famous 22, 274); Collective modes of quantum dot ensembles in microcavities. N. S. Averkiev, M. M. Glazov and A. N. Poddubnyi in J. Exp. Th. Phys. 108:836 (2009). is now its doi. On the magnetic properties of superconductors of the second group. A. A. Abrikosov in Sov. Phys. JETP 5:1174 (1957). carried the title of Kosterlitz and Thouless; it is On the magnetic properties of superconductors of the second group. The two before any translation, Zur Theorie der Phasenumwandlungen I, II. L. D. Landau in Zh. Eksp. Teor. Fiz 7:19 (1937). and On the theory of superconductivity. V. L. Ginzburg and L. D. Landau in Zh. Eksp. Teor. Fiz 20:1064 (1950)., are not online and were corrected by hand: ZhETF 7, 19 and 627 (1937), and Ginzburg and Landau, 20, 1064 (1950).

Possible improvements

  1. Doesn't detect well doi with escape characters, e.g., 10.1016/0038-1098(95)00389-4 (kavokin95a). This doesn't seem easy to fix besides invoking the doi in quotes at the shell level!
  2. more robust on first names and particles, e.g., does not truncate by its initials lowercases strings, that are typically "de", "del", "von", etc. Done in v°2.0.0: a particle stays as it is, outside the braces of the family name.
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, kept by j2bib.
  • bibnames -- substitution rules for authors.

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

Script

  • File:doi2bib.zip v°0.1 (also with minimal bibnames & iso4 files) on 30 July (2023).
  • File:doi2bib.gz v°0.2 support escape characters.
  • File:doi2bib-v0.5.17.gz v°0.5.17 on 8 September (2025), inserts directly in bib.
  • v0.6.4 on 14 September (2025), fix bug of Authors listing & download less metadata.
  • File:doi2bib-v0.6.5.gz v°0.6.5 on 20 September (2025), "remove - in key".
  • File:doi2bib-v0.7.0.gz v°0.7.0 on 28 December (2025), fix bug of inserting extra line in bib & better fetch of journal title.
  • File:doi2bib-v0.8.0.gz v°0.8.0 on 29 December (2025), add robust support for sanitizing diacritics in ascii keys.
  • v°0.9.0 on 3 April (2026).
  • v°0.9.1 on 21 July (2026), -a writes the entry and then pushes its template with bib2wiki.
  • v°0.9.2 on 6 August (2026), a flag written before the doi was eaten by perl's -s and did nothing at all, silently.
  • v°0.10.0 to v°0.13.1, 7 August (2026) to 10 August (2026): -d deletes an entry, -f fetches a doi already on file and rewrites it in place under the key it is cited by, either will take that key in place of the doi, and an author with no given name no longer crashes the parsing.
  • v°0.14.0 on 11 September (2026), -h lists the options.
  • v°0.15.0 to v°0.16.0 on 11 September (2026), a journal iso4 does not know is caught on every path and handed to j2bib instead of being written raw.
  • v°1.0.0 on 11 September (2026), three years on from v°0.1. The journal was the last field doi2bib could get wrong by itself; with that closed, what it writes is what bibtex reads.
  • v°1.1.0 on 3 October (2026), a doi pasted with the punctuation of its sentence ("10.1038/nphys3433.") no longer 404s.
  • v°2.0.0 on 6 October (2026), the names keep all their initials and the titles follow the file: sentence case, names and acronyms braced, MathML turned into TeX (see Names and titles).
  • v°2.0.1 on 20 October (2026), a journal name sent HTML-escaped ("Matter &amp; Light") is unescaped on arrival.
  • v°2.1.0 on 3 November (2026), papers with no doi, from their page or from a BibTeX entry (see Papers with no doi).
  • v°2.1.1 on 3 November (2026), what the sweep of the JETP entries taught: the title and hand-transliterated names on file are kept, the English doi is looked up past the years the sites cover, and author lists lose their affiliation marks.
  • v°2.1.2 on 3 November (2026), the year of the Russian original in a JETP note is that of the ZhETF volume, not of the translation it went into (ZhETF 37 is 1959, JETP 10 is 1960).

Links