Are you tired of copying, pasting, and hopping between websites while preparing your bibliography? As high-energy physicists, we have plenty of other things to worry about. Let this Python script update your BibTeX file using official InspireHEP records. It automatically matches entries by arXiv ID, DOI, or title+year, and logs any citation key changes for easy LaTeX file updates.
- Batch updates all BibTeX entries from InspireHEP
- Searches in order: arXiv, DOI, then title+year
- Works with any BibTeX entry type
- Logs citation key changes (
old_key → new_key
) tocitation_key_changes.log
- Backs up your original
.bib
asfilename-old.bib
and writes updates to the original filename - Quiet by default; enable per-entry logs with
--verbose
pip install bibtexparser requests tqdm
python inspireCitation.py [options] <bibfile>
<bibfile>
: your BibTeX file (e.g.reference.bib
)- Options:
-v
,--verbose
Enable per-entry 🔎/✅/❌ logs
Example:
# quiet (default)
python inspireCitation.py reference.bib
# verbose output
python inspireCitation.py reference.bib --verbose
After running:
-
Your original
reference.bib
is renamed toreference-old.bib
-
Updated entries are written to
reference.bib
-
If any keys changed, see
citation_key_changes.log
:oldkey1 -> newkey1 oldkey2 -> newkey2
The updated reference.bib
now exactly matches the citations from InspireHEP. Enjoy!
- For best results, you just need to make sure that there is an
arxiv
ordoi
field in each bibliography entry Title+year
matching is a fallback when no arXiv ID or DOI is found.
Enjoy a smoother bibliography workflow 🍶🥃