Skip to main content

Better BibTeX data

Project description

betterbib

PyPi Version PyPI pyversions GitHub stars

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.

Installation

Install betterbib from PyPI with

pip install betterbib

See here on licensing information.

Using betterbib

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,pubmed}] [-l]
                        [--extra-abbrev-file EXTRA_ABBREV_FILE] [-c N] [-u]
                        [-m MINIMUM_SCORE] [-r] [-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, --source {crossref,dblp,pubmed}
                        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, --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 to count as a match (default: 0.0)
  -r, --check-retractions
                        check if an article has been retracted on
                        openretractions.com (default: don't check)
  -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, --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 (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

~/.local/share/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"
]

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

betterbib-5.0.13-py3-none-any.whl (9.8 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page