Command-line tools

GBibClean

Clean a BibTeX database:

  • Stripping it from unnecessary fields.

  • Unifying the formatting of authors.

  • Ensuring the proper special characters and math mode settings.

  • Removing duplicates.

  • Finding/unifying arxivid and doi.

This script preserves order to help tracking changes.

usage: GBibClean [-h] [-o OUTPUT] [--in-place] [-j JOURNAL_TYPE]
                 [--journals JOURNALS] [--arxiv ARXIV]
                 [--rename-field RENAME_FIELD RENAME_FIELD]
                 [--add-field ADD_FIELD] [--remove-field REMOVE_FIELD]
                 [--no-title] [--author-sep AUTHOR_SEP]
                 [--journal-sep JOURNAL_SEP] [--raw-author RAW_AUTHOR]
                 [--ignore-case] [--ignore-math] [--ignore-unicode]
                 [--rename RENAME RENAME] [--merge MERGE MERGE]
                 [--sort-entries] [--unique UNIQUE] [--diff DIFF]
                 [--diff-context] [--diff-numlines DIFF_NUMLINES]
                 [--diff-type DIFF_TYPE] [--diff-keys DIFF_KEYS] [-f] [-v]
                 [files ...]

Positional Arguments

files

Input files. If using --in-place files are treated separately. Otherwise they are merged to single output file.

Named Arguments

-o, --output

Output file (required unless --in-place is used).

--in-place

If specified, each input file is separately treated and formatted in-place.

Default: False

-j, --journal-type

Unify journal titles (if recognised). If “acronym” is selected, “abbreviation” is used for journals without an “acronym”.

Default: “abbreviation”

--journals

Database(s) with official journal names, abbreviations, and acronyms. To make no modifications to journals use --journal="".

Default: “pnas,physics,mechanics”

--arxiv

Format arXiv preprints using a specific formatter. Use “{}” in the formatter to include the arxivid, e.g.: “arXiv preprint {}”.

--rename-field

Rename field (e.g. “arxivid” to “eprint”).

--add-field

Add field. For all types "field", only for one type typename:field.

--remove-field

Remove field. For all types "field", only for one type typename:field.

--no-title

Remove title from BibTeX file.

Default: False

--author-sep

Character to separate authors’ initials.

Default: “”

--journal-sep

Character to separate journal abbreviations.

Default: “”

--raw-author

List entries for which names are not abbreviated.

--ignore-case

Do apply case protection of title.

Default: False

--ignore-math

Do not apply math-mode fix.

Default: False

--ignore-unicode

Do not apply unicode fix.

Default: False

--rename

Rename citation keys (applied after merging).

--merge

Force merging of items.

--sort-entries

Sort output by entries.

Default: False

--unique

Merge identical entries with different keys. Argument: output YAML file.

--diff

Write diff to HTML file which shows the old and the reformatted file side-by-side. See difflib.HtmlDiff.make_file.

--diff-context

Show contextual differences. See difflib.HtmlDiff.make_file.

Default: False

--diff-numlines

Controls the number of context lines which surround the difference highlights.

Default: 5

--diff-type

Show difference between <output> and compared to <input> that is: * raw: not parsed at all (can lead to a mess because of sorting). * plain: parsed as little as possible. * select: parsed as little as possible, but with only selected output fields.

Default: “select”

--diff-keys

Limit diff to certain keys separated by spaces (e.g. “author,journal,doi”).

-f, --force

Force overwrite of existing output file.

Default: False

-v, --version

show program’s version number and exit

GbibDiscover

Check online databases (can be slow!).

usage: GbibDiscover [-h] -o OUTPUT [--arxiv] [-f] [-s] [-v] [files ...]

Positional Arguments

files

Bib-file(s) considered concatenated if more files are specified.

Named Arguments

-o, --output

Output file (yaml).

--arxiv

Check arXiv as follows:

  1. If the item is an arXiv preprint: check if a journal doi was registered at arXiv.

  2. If the item is a journal article: try to find the arxivid based on the journal doi.

Default: False

-f, --force

Force overwrite output file.

Default: False

-s, --silent

Run without status bars.

Default: False

-v, --version

show program’s version number and exit