Skip to content

dalf/bibtex-normalizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BibTeX Normalizer

A small Python program to normalize .bib files.

Motivation

During my PhD, I've gathered an extensive collection of BibTeX entries in my bibliography. I've observed inconsistencies in the formatting of these entries, which might require manual adjustments depending on the citation style you want to apply. This program is designed to standardize the BibTeX formats and introduce some basic rules for capitalizing titles.

Features

The core of this tool revolves around iterating through entries in a .bib file and applying normalization rules, with a particular focus on title formatting. The capitalize_title function encapsulates the logic for intelligent title capitalization, considering various linguistic and typographic conventions.

Installation

  1. Clone the repository:
git clone git@github.com:jknafou/bibtex-normalizer.git
  1. Navigate to the project directory:
cd bibtex-normalizer/
  1. (Option 1) Install dependencies using Rye:
rye sync
. .venv/bin/activate      # .\venv\Scripts\activate on Windows```
  1. (Option 2) Install dependencies using pip on a venv:
python -m venv .venv
.venv/bin/activate      # .\venv\Scripts\activate on Windows```
pip install .

One shot installation using pip+git on a venv:

Here, skip step 1 & 2 and run the following commands:

python -m venv .venv
.venv/bin/activate      # .\venv\Scripts\activate on Windows```
pip install git+https://github.com/jknafou/bibtex-normalizer.git

Usage

Normalize a .bib file:

bibtex-normalizer --input <input_file> --output <output_file>

Demo

To test the program, you can use the provided example file references.bib by running the following command:

bibtex-normalizer

Examples

  1. Specify both input and output files:
bibtex-normalizer --input example.bib --output example_normalized.bib
  1. Use default output naming (input filename + "_normalized" suffix):
bibtex-normalizer --input example.bib

Contributing

We welcome contributions.

About

Normalize a .bib file with multiple citations by casing the first letter of each word of the title if a bibtex was not correctly generated. The current state makes it easy to modify other fields that could require normalization.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors