I found there are hundreds of cases of duplicated citation keys in one of my bib file. It seems generated by Mendeley but I'd rather believe it was me who made such mistake (I didnt remember I ever copied another bib file into this one, though). Anyway, now my problem is how to assign different citation keys to the enties sharing the same key (they are different articles). Doing this manually would be a bit time-consuming though could be fun if I try to make it ;). Is there some way by which this job can be done in one stroke? or I need to compose a Python script for this task?

  • JabRef has the functionality to cycle through duplicates (from reading the documentation).
    – Werner
    Oct 20 '20 at 23:11
  • 1
    Effectively, JabRef can make unique keys for all the database with just one click. The problem is only if you also have some text citing these references, that in some cases will point to the wrong key an in others to the lost key, and there are no programs to solve this.
    – Fran
    Oct 21 '20 at 5:45
  • 2
  • Finding duplicate cite keys should be fairly straightforward, but then you still need to decide if the two entries are the same or different (I wouldn't want to assume that they are always different). In a second step you may also want a feature to find duplicate entries. That is much harder. I've heard that JabRef does very good things at that front as well, but I'd expect it's possible that automated solutions simply don't catch everything. In the end you may also need to worry about changed entry keys if you have old documents that you want to use with your new .bib file.
    – moewe
    Oct 21 '20 at 6:22
  • 1
    Does this answer your question? Cleaning up a .bib file
    – Elad Den
    Oct 21 '20 at 7:11

Found the solution. You need to install the BBT plug-in on Zotero first. Then, a. Import the bib file into Zotero. b. Select all. Right click and select Better Bib TeX – Pin Bib TeX key. The BBT will automatically regenerate ALL citation keys - the previous ones will all be discarded. c. Export to a new bib file. The regenerated keys are pretty long, for example, "accessDrivingSaferGreenera". But it is ok for me. At least I dont need to set the duplicated keys one by one...

  • Import, export and odd bibkeys. All of this is can be avoided with JabRef, and as I explaned above, Jabref can make all the keys at once, not one by one, and moverover, you can specify the desired pattern for the auto generation of the bibkeys. You should take a closer look to this program.
    – Fran
    Oct 22 '20 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.