Skip to main content

Better BibTeX data

Project description

betterbib

PyPi Version PyPI pyversions GitHub stars Downloads

Discord

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,
}

Besides correcting entries, betterbib also checks if the article was retracted or if there exists and erratum for it (via Open retractions).

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]
                        [-m MINIMUM_SCORE] [-q]
                        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)
  -m MINIMUM_SCORE, --minimum-score MINIMUM_SCORE
                        minimum score to count as a match (default: 0.0)
  -q, --quiet           don't show progress info (default: show)

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

Format

The tool

betterbib format in.bib

allows you to apply consistent formatting to you BibTeX file. See -h/--help for options.

(Un)abbreviate journal names

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.

Check for retractions/corrections

The tool

betterbib check-retractions in.bib

checks all entries in BibTeX database for existing retractions or corrections.

Configuration

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", "Bruijn", "Chebyshev", "Danilewski",
"Darboux", "Galerkin", "Goldbach", "Hermitian", "Hopf", "Hopfield", "Hölder",
"Kolmogorov", "Kronrod", "Krylov", "Kuratowski", "Kutta", "Lanczos",
"Liouville", "Lyapunov", "Manin", "Minkowski", "Navier", "Peano", "Pell",
"Pezzo", "Pitaevskii", "Pólya", "Ricatti", "Schur", "Siebeck", "Sommerfeld",
"Stieltjes", "Tausworthe", "Tchebycheff", "Toeplitz", "Voronoi", "Voronoï",
"Wieland", "Wronski"]

remove=["hermitian", "boolean" ]

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Built Distribution

betterbib-4.3.8-py3-none-any.whl (9.9 MB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page