Skip to content

cleaning the bibliography

João M. Lourenço edited this page Nov 10, 2021 · 1 revision

Cleaning up the bibliography

Sometimes you get some weird errors while processing the bibliography file, most specially when it was exported from Mendeley or Zotero, such as

Package inputenc Error: Invalid UTF-8 byte sequence

You may clean the bibliography file with the following python3 script from David Magalhães Sousa ([email protected])

https://github.com/joaomlourenco/novathesis-extras/raw/main/Scripts/ntcleanbib.py

For example, to create a file clean.bib from a dirty file dirty.bib do:

python ntcleanbib.py -i dirty.bib -o clean.bib

Exporting from Mendeley

Bibliography exported from Mendeley may have invalid characters in the cite key, namely "(" and ")". If you run the script with the addition option -k, it will also replace those invalid characters with "_".

python ntcleanbib.py -k -i dirty.bib -o clean.bib