Use the Crossref API to fix BibTex Entries.
This script is still in a very early stage of development, but can be potentially useful in some cases. Definitely NOT for production! As a result, there is no PyPI entry (yet), but can be installed with pip
via its repo URL:
pip install https://github.com/jaimergp/fixbibtex/archive/v0.1.zip
I will be tagging new releases as more features and fixes are added. There will be breaking changes, so do not trust the (pseudo)API until we reach v1.0
.
pip
will handle them, but in case you want to install them manually, fixbibtex
relies on:
async
features.pybtex
: BibTeX parser and writer.habanero
: CrossRef API.tqdm
: Progress bar.After installation, a fixbibtex
command will be available. Run it like this:
$> fixbibtex <your_references>.bib
Two *.bib
files will be generated:
<your_references>.new.bib
: A new BibTeX database including the fixes.<your_references>.old.bib
: A copy your original file with the same format rules as *.new.bib
so you can diff
them and compare changes easily.I recommend using code --diff *.old.bib *.new.bib
for a better experience, but you can use colordiff
and similar tools as well.
The excellent CrossRef project offers it API free of charge for everybody, without keys, tokens, OAuth... It is truly mind-blowing! Such a good service must be respected, so please do not try to modify the code to overcome the limitations imposed. CrossRef devs are very nice, and if you voluntarily include your email address in the requests, they will grant you access to a priority queue. That way, if you accidentally misuse the service, they can notify you about the mistake.
Set an environment variable CROSSREF_MAILTO
to a valid email address to use this feature with fixbibtex
.
fixbibtex
will parse your *.bib
file with PybTeX
. Then, it will iterate over the entries performing the following checks:
article
entries, excluding pre-prints. We are not trying to amend books, chapters and other resources for now. (This will change in the future, though).The resulting entries will be written with PybTex in a new file, as explained above.
IMPORTANT: In its current state, fixbibtex
is far from perfect, so please review the changes it introduces before blindly applying the fixes in your LaTeX projects!
There are several ways it can be improved, though. Help is appreciated! Some ideas: