Cleaner and Formatter for BibTeX files


Tidy bibtex files. Try it out.

Screen Recording 2020-10-23 at 16 25 26(1)

bibtex-tidy is free to use at https://flamingtempura.github.io/bibtex-tidy/



@ARTICLE {feinberg1983technique,
  title={A technique for radiolabeling DNA restriction endonuclease fragments to high specific activity},
author={Feinberg, Andrew P and Vogelstein, Bert},
  journal    = {Analytical biochemistry},
  volume = 132,
    title={Qualitative data analysis: A sourcebook},
    author={Miles, Matthew B and Huberman, A Michael and Saldana, J},
    journal={Beverly Hills},

After bibtex-tidy references.bib:

  title         = {A technique for radiolabeling DNA restriction endonuclease fragments to high specific activity},
  author        = {Feinberg, Andrew P and Vogelstein, Bert},
  year          = 1983,
  journal       = {Analytical biochemistry},
  publisher     = {Elsevier},
  volume        = 132,
  number        = 1,
  pages         = {6--13}
  title         = {Qualitative data analysis: A sourcebook},
  author        = {Miles, Matthew B and Huberman, A Michael and Saldana, J},
  year          = 1984,
  journal       = {Beverly Hills}


Requires node v12 or later.

npm install -g bibtex-tidy
bibtex-tidy references.bib
Usage: bibtex-tidy [OPTION]... FILE.BIB
BibTeX Tidy v1.8.5 - cleaner and formatter for BibTeX files.

  --help, -h               Show help

  --omit                   Remove specified fields from bibliography entries.

  --curly, --no-curly      Enclose all property values in braces. Quoted values
                           will be converted to braces. For example, "Journal of
                           Tea" will become {Journal of Tea}.

  --numeric, --no-numeric  Strip quotes and braces from numeric/month values. For
                           example, {1998} will become 1998.

  --space                  Indent all fields with the specified number of spaces.
                           Ignored if tab is set.
                           --space=2 (default)

  --tab, --no-tab          Intent all fields with a tab.

  --align, --no-align      Insert whitespace between fields and values so that
                           values are visually aligned.
                           --align=14 (default)

  --sort, --no-sort        Sort entries by specified fields. For descending order,
                           prefix the field with a dash (-).
                           --sort (sort by id)
                           --sort=-year,name (sort year descending then name

  --duplicates             Warn if duplicates are found, which are entries where
                           DOI, abstract, or author and title are the same.
                           --duplicates doi (same DOIs)
                           --duplicates key (same IDs)
                           --duplicates abstract (similar abstracts)
                           --duplicates citation (similar author and titles)
                           --duplicates doi, key (identical DOI or keys)
                           --duplicates (same DOI, key, abstract, or citation)

  --merge, --no-merge      Merge duplicates entries. Use the duplicates option to
                           determine how duplicates are identified. There are
                           different ways to merge:
                           - first: only keep the original entry
                           - last: only keep the last found duplicate
                           - combine: keep original entry and merge in fields of
                           duplicates if they do not already exist
                           - overwrite: keep original entry and merge in fields of
                           duplicates, overwriting existing fields if they exist

  --strip-enclosing-braces Where an entire value is enclosed in double braces,
                           remove the extra braces. For example, {{Journal of Tea}}
                           will become {Journal of Tea}.

  --drop-all-caps          Where values are all caps, make them title case. For
                           example, {JOURNAL OF TEA} will become {Journal of Tea}.

  --escape, --no-escape    Escape special characters, such as umlaut. This ensures
                           correct typesetting with latex. Enabled by default.

  --sort-fields            Sort the fields within entries.
                           If no fields are specified fields will be sorted by:
                           title, shorttitle, author, year, month, day, journal,
                           booktitle, location, on, publisher, address, series,
                           volume, number, pages, doi, isbn, issn, url, urldate,
                           copyright, category, note, metadata

  --strip-comments,        Remove all comments from the bibtex source.

  --trailing-commas,       End the last key value pair in each entry with a comma.

  --encode-urls,           Replace invalid URL characters with percent encoded
  --no-encode-urls         values.

  --tidy-comments,         Remove whitespace surrounding comments.

  --remove-empty-fields,   Remove any fields that have empty values.

  --remove-dupe-fields,    Only allow one of each field in each entry. Enabled by
  --no-remove-dupe-fields  default.

  --generate-keys          [Experimental] For all entries replace the key with a
                           new key of the form <author><year><title>.

  --max-authors            Truncate authors if above a given number into "and

  --no-lowercase           Lowercase field names and entry type. Enabled by

  --enclosing-braces       Enclose the given fields in double braces, such that
                           case is preserved during BibTeX compilation.
                           --enclosing-braces=title,journal (output title and
                           journal fields will be of the form {{This is a title}})
                           --enclosing-braces (equivalent to

  --wrap, --no-wrap        Wrap long values at the given column
                           --wrap (80 by default)

  --version, -v            Show bibtex-tidy version.

  --quiet                  Suppress logs and warnings.

  --backup, --no-backup    Make a backup <filename>.original. Enabled by default.

Full documentation <https://github.com/FlamingTempura/bibtex-tidy>

Programmatic usage

npm install bibtex-tidy
const tidy = require('bibtex-tidy');
const bibtex = fs.readFileSync('references.bib', 'utf8');
tidy.tidy(bibtex, { curly: true });

Documentation for the options can be found here

Repo Not Found