BibTeX files are typically manually maintained and thus often contain inconsistencies, mistakes, or are missing information. betterbib helps maintaining your BibTeX files by comparing them with online sources and correcting whatever entries are faulty.
Install with
pip install betterbib
and simply run
betterbib update in.bib # or short `betterbib up`
to improve your BibTeX file with default settings. For example, the input BibTeX
@article {krylov,
author = {Liesen and Gaul and Nabben},
title = {Framework Deflation Krylov Augmented}
}
is converted to
@article{krylov,
author = {Gaul, André and Gutknecht, Martin H. and Liesen, Jörg and Nabben, Reinhard},
title = {A Framework for Deflated and Augmented {Krylov} Subspace Methods},
doi = {10.1137/110820713},
number = {2},
pages = {495-518},
source = {Crossref},
url = {https://doi.org/10.1137/110820713},
volume = {34},
journal = {SIAM J. Matrix Anal. \& Appl.},
publisher = {Society for Industrial \& Applied Mathematics (SIAM)},
issn = {0895-4798, 1095-7162},
year = {2013},
month = jan,
}
Use -i
/--in-place
to modify the input file in place. Use -h
/--help
to see all
options.
betterbib up -h
usage: betterbib update [-h] [-i] [-b] [-t] [-d {braces,quotes}]
[--doi-url-type {unchanged,new,short}]
[-p PAGE_RANGE_SEPARATOR] [-s {crossref,dblp}] [-l]
[--extra-abbrev-file EXTRA_ABBREV_FILE] [-c N] [-u]
infiles [infiles ...]
positional arguments:
infiles input BibTeX files (default: stdin)
options:
-h, --help show this help message and exit
-i, --in-place modify infile in place
-s {crossref,dblp}, --source {crossref,dblp}
data source (default: crossref)
-l, --long-journal-names
prefer long journal names (default: false)
--extra-abbrev-file EXTRA_ABBREV_FILE
custom journal abbreviations, as JSON file
-c N, --num-concurrent-requests N
number of concurrent HTTPS requests (default: 10)
-u, --unicode-output unicode output (default: escape special characters)
Formatting:
-b, --sort-by-bibkey sort entries by BibTeX key (default: false)
-t, --tab-indent use tabs for indentation (default: false)
-d {braces,quotes}, --delimiter-type {braces,quotes}
which delimiters to use in the output file (default:
braces {...})
--doi-url-type {unchanged,new,short}
DOI URL (new: https://doi.org/<DOI> (default), short:
https://doi.org/abcde)
-p PAGE_RANGE_SEPARATOR, --page-range-separator PAGE_RANGE_SEPARATOR
page range separator (default: --)
betterbib fetches data from
The tool
betterbib format in.bib
allows you to apply consistent formatting to you BibTeX file. See -h
/--help
for
options.
The tool
betterbib abbreviate-journal-names in.bib
allows you to apply consistent abbreviation of journal names. See -h
/--help
for
options.
To use custom abbrebiations for journal names, create a file as a JSON dictionary, and
provide that as a command line argument with --extra-abbrev-file
. For example, if the
file correct_pnas.json
is:
{ "PNAS": "Proc. Natl. Acad. Sci. U.S.A." }
and you call betterbib-journal-abbrev --extra-abbrev-file=correct_pnas.json
, this will
replace any bibtex entries listed with journal "PNAS" with the correct abbreviation.
This option is included in the betterbib
and betterbib-journal-abbrev
commands.
When combined with the --long-journal-names
option, this will override default options
only if both have the same abbreviation.
In BibTeX titles, some words need to be protected by curly brackets such that they are
capitalized correctly, e.g., {Einstein}
. betterbib automatically recognizes some of
them (if they are in the default dictionary, like Einstein
), but you might want to add
some. To this end, create the config file
~/.config/betterbib/config.toml
and fill it with, e.g.,
[DICTIONARY]
add=["Abrikosov", "Arnoldi", "Bergman", "Bernstein",
"Bruijn", "Chebyshev", "Danilewski", "Darboux", "Galerkin",
"Ginzburg", "Goldbach", "Hermite", "Hermitian", "Hopf",
"Hopfield", "Hölder", "Jacobi", "Jacobian", "Kolmogorov",
"Kronrod", "Krylov", "Kuratowski", "Kutta", "Lanczos",
"Liouville", "Lyapunov", "Magnus", "Manin", "Minkowski",
"Navier", "Peano", "Pell", "Pezzo", "Pitaevskii", "Pólya",
"Ramanujan", "Ricatti", "Runge", "Scholz", "Schur", "Siebeck",
"Sommerfeld", "Stieltjes", "Tausworthe", "Tchebycheff",
"Toeplitz", "Voronoi", "Voronoï", "Wieland", "Wronski",
"Wronskian"]
remove=["hermitian", "boolean" ]