Skip to main content

Bib Cleaner removes unnecessary entries from your bib files.

Project description

Bib Cleaner Documentation Status

Bib Cleaner removes unnecessary entries from your bib files. Documentation @

Use case

  1. You have been writing a TeX document for a while, and adding citation entries to your .bib file (say it’s called master.bib).

  2. In the course of writing, some entries in your master.bib have become obsolete. You don’t use them in your TeX document anymore.

  3. Of course, LaTeX compiles quite happily with these extra entries.

  4. You take a step back, sip some coffee, go for a walk, all the while pondering “Man, I wish I could just remove those extra bib entries”. You yearn for a world where all .bib files everywhere carry only what they have to, and no more.

I gotchu. Enter bib_cleaner.


This should work:

$ pip install bib_cleaner

Verify if it installed by typing the following in the command-line:

$ bib_cleaner -h

You should see the help:

usage: bib_cleaner [-h] [-t TEXFILES [TEXFILES ...]] [-o OUTPUTBIB] masterfile

Produce a minimal bib file with only the entries found in your .tex file(s)

positional arguments:
masterfile            master bib file with used and unused citations (.bib)

optional arguments:
-h, --help            show this help message and exit
                        content files to select entries from (.tex)
                        output file name with extension


After installation, navigate to your TeX directory try:

$ bib_cleaner master.bib

Of course, replace master.bib with the name of your bib file with obsolete bib entries. bib_cleaner will automatically detect all the TeX files (.tex) in that directory and use them to determine which bib entries are obsolete.

Specify TeX files

If you only want to use some TeX files, specify them with:

$ bib_cleaner master.bib --texfiles chapter1.tex chapter2.tex


$ bib_cleaner master.bib -t chapter1.tex chapter2.tex

Specify output file name

If you want to change the output bib file name from the default new.bib, do:

$ bib_cleaner master.bib -t chapter1.tex --outputbib chapter1.bib


$ bib_cleaner master.bib -t chapter1.tex -o chapter1.bib


  • Remove typically unused lines from .bib files (like file = {...} or abstract = {...})

  • Detect and remove bib entries with identical tags / raise conflict

  • Add tests for the command-line interface


This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.


0.3.0 (2019-12-20)


  • Option to store output in new.bib

  • Intro and examples to README.rst

0.2.1 (2019-12-20)


  • get_minimal_bibs function.

  • tests for tex_to_tags and get_minimal_bibs.


  • Documentation builds.

  • Deploy from Travis.


  • Support for Python 3.5 (no f-string support)

0.1.0 (2019-12-16)

  • First release on PyPI.

Project details

Download files

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

Source Distribution

bib_cleaner-0.3.2.tar.gz (13.3 kB view hashes)

Uploaded Source

Built Distribution

bib_cleaner-0.3.2-py2.py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 2 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