A BibTeX toolbox for LaTeX projects — clean, merge, check, and more.
Project description
Bibkit: A BibTeX Toolbox for LaTeX Projects
中文文档:README_CN.md
Bibkit is a command-line toolbox for managing BibTeX (.bib) files in LaTeX projects. It analyzes your .tex source to understand what references are actually used, and provides utilities to keep your bibliography clean and consistent.
Table of Contents
- Installation
- Commands
- Roadmap
- Supported Citation Commands
- Supported BibTeX Features
- Contributing
- License
Installation
git clone https://github.com/ZBigFish/bibkit.git
cd bibkit
pip install -e .
The bibkit command is available globally after installation. You can also use python -m bibkit.
Commands
bibkit clean
Remove or comment out unused entries from your .bib files based on actual \cite usage.
# Run from your LaTeX project root
bibkit clean
# Or specify a path
bibkit clean /path/to/my-paper
# Preview first
bibkit clean --dry-run
Features:
- Auto-detects the main
.texvia\documentclass; prompts for choice when multiple versions exist - Recursively follows
\input/\includeto collect all citations across sub-files - Auto-discovers
.bibfiles from\bibliography{...}and\addbibresource{...} - Non-destructive by default — writes a
new_XXX.bib, never touches originals crossrefparent entries are kept automatically (transitive resolution)- Handles
\nocite{*}— all entries preserved
Options:
| Flag | Effect |
|---|---|
| (none) | Write new_XXX.bib with unused entries removed |
--comment |
Comment out unused entries with % instead of removing |
--in-place |
Modify the original .bib file directly |
--in-place --comment |
Modify original, comment out unused |
--dry-run |
Preview only — no files changed |
--keep "key1,key2" |
Comma-separated list of keys to always preserve |
--bib references.bib |
Process a specific bib file (overrides auto-discovery) |
--no-recursive |
Don't search subdirectories for .tex files |
Example output:
$ bibkit clean /path/to/paper
Main file: main.tex
(with 7 included .tex file(s))
Scanned 8 .tex file(s), found 55 unique citation key(s).
--- refs.bib ---
Total entries: 75
Entries to keep: 55
Entries to removed: 20
- spencer2016causes
- goodfellow2014generative
...
Wrote to new_refs.bib (20 entries removed).
Done.
Roadmap
Commands planned for future releases:
| Command | Description |
|---|---|
bibkit clean |
Done. Remove unused entries from .bib files |
bibkit merge |
Merge multiple .bib files with deduplication |
bibkit check |
Validate .bib entries (missing fields, malformed keys, broken crossrefs) |
bibkit sort |
Sort entries by key, author, or year |
bibkit fmt |
Normalize formatting (capitalize titles, unify venue abbreviations) |
bibkit diff |
Show differences between two .bib files |
Have a feature request? Open an issue.
Supported Citation Commands
\cite \citep \citet \citeauthor \citeyear \citealp \citealt
\parencite \textcite \footcite \autocite \supercite \fullcite
\Cite \Citep \Citet (capitalized) \cite* (starred)
Supports optional arguments (\cite[page 3]{key}), multi-key (\cite{key1,key2}), and \nocite{*}.
Supported BibTeX Features
- All standard entry types:
@article,@inproceedings,@book,@incollection,@misc, and more @string,@comment,@preambleblocks are always preserved- Nested braces in field values (
{CNN},{\L}ukasz) handled correctly crossreffields resolved transitively — parent entries kept automatically
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Star History
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bibkit-1.0.0.tar.gz.
File metadata
- Download URL: bibkit-1.0.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70759d3c9cfa4df5ef9487171835749196c10777cf6991ade0c9ad1f394cc5ea
|
|
| MD5 |
6f3ec446dfb4cb91589a3fd583782941
|
|
| BLAKE2b-256 |
57e52eea9c85e51c50d12ccbbae8c5f8fefc22b488dcb225025eee7cdc705f5a
|
File details
Details for the file bibkit-1.0.0-py3-none-any.whl.
File metadata
- Download URL: bibkit-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dcafcef8cfde68160aabf4cb145c19ccb288ac2993f9e2460fb218e713b8fd9
|
|
| MD5 |
5dc5a89ba817c84b88a5f6ea21b1aa2c
|
|
| BLAKE2b-256 |
dd5370f2b6c9ff3e850ea033a25a06d15e5654120f6415447d8d2995fa9779d9
|