Making references easier in Latex

Scientific knowledge is built "on the shoulders of giants", to paraphrase de Chartres. Hence the need for appropriate referencing of the work of researchers around the world. To meet this need, the scientific community has adopted citation standards and tools to identify publications. Among these, the doi (Digital Object Identifier, a unique and formatted character string) has been in use since 2000 [5]. But currently, when writing a report, a thesis or an article with \( \LaTeX \), a popular formatting language, an external tool is needed to gather bibliographic information by ourselves. This could be done automatically by directly using such unique identifiers.

This statement is presented and explained in this short paper [1]. Basically, the idea is to refer to a publication with a direct, unique and global id, instead of giving a reference key linked to a dictionnary in a .bib file that might change from one project to another. This Bibtex file must either be constructed by hand or be exported from your favorite references manager. And this has to be carried out every time a new reference is added to your draft or your dissertation.

Besides, I start to have an extended collection of articles in my Zotero... So when I export a folder to a bibtex file, there are several unused references so it can make it unnecessarily weighty. And more problematically, there also might be some omissions... that lead to errors while compiling the \( \LaTeX \) project.

This is a bit a shame as most of cited content in scientific litterature has an unique id that could serve directly as the reference key for Bibtex. This is what is proposed in the example from my github [3] where I adapted python codes from [1] and [2]. This goes along from a \( \LaTeX \) demo (inspired from Overleaf documentation [4]). In order to run it, just execute the script in Python_libs/Split.py and it will generate a .bib reference file.

The script browses all the .tex files contained in the directories and sub-directories of your \( \LaTeX \) project. It detects the citation keys \cite{key} in either DOI or arXiv id format. For each identifier, the information is retrieved and a .bib file is generated. A list of existing reference files .bib can be merged with the new file (in case there is no arXiv/doi id).

As an exemple, if you use arXiv format \cite{2003.02751v2} or a doi \cite{10.1016/j.jcp.2018.10.045}, the following information will be added in the generated .bib file

 @article{2003.02751v2, 
  Author = {Ehsan Haghighat and Maziar Raissi and Adrian Moure and Hector Gomez and Ruben Juanes}, 
  Title = {A deep learning framework for solution and discovery in solid mechanics},
  ... }

@article{10.1016/j.jcp.2018.10.045,
  doi = {10.1016/j.jcp.2018.10.045}, 
  url = {https://doi.org/10.1016%2Fj.jcp.2018.10.045},
  year = 2019, 
  month = {feb}, 
  ... }

The arXiv format detection and retrieving uses the library arxiv2bib [2].

I adapted a code from [1] with some changes as :

  • Format verification for doi format
  • Replacing the usual reference key by the doi so that it matches the \cite{doi} and nothing is to change in the \( \LaTeX \) document
  • Proper export to bib file and merging with an existing bibtex dictionnary
  • Sub folder checking for .tex files research
  • arXiv id support thanks to arxiv2bib module
  • Adding some comments

Then the idea might be to launch it during \( \LaTeX \) compilation. This could be done with adding this piece of code in your main .tex file :

\usepackage{python}
\begin{python}[Python_libs/Split.py]
\end{python}

Don't hesitate if you have ideas of improvements or questions. The code is publicly available at my github [3].

 

[1] Simplifying the management of scientific reference and citation with a minimalist DOI-BibTex-LaTeX approach, Wei Li, dx.doi.org/10.15761/CMID.1000139

[2] arxiv2bib repository package, https://pypi.org/project/arxiv2bib/

[3] My GitHub repository https://github.com/GRaynaud/doi-arxiv-to-bibtex-refs

[4] Bibliography management with bibtex, Overleaf documentation https://www.overleaf.com/learn/latex/bibliography_management_with_bibtex

[5] https://www.doi.org/factsheets/DOIKeyFacts.html