Collisions in BibTeX export
The topic of BibTeX export has been discussed many times
https://forums.zotero.org/discussion/17847/2/improving-bibtex-export/
https://forums.zotero.org/discussion/28663/bibtex-export-in-zotero-40-please-help/
yet I could not find answers to several questions:
1) how is it possible to start enumerating colliding Bibtex keys from the first one? Currently, one gets: NameYear, NameYear-1, NameYear-2, ... I would like to see: NameYear-1, NameYear-2, NameYear-3, ...
2) could the exported references be pre-sorted in a given way? The problem is that the enumeration of colliding Bibtex keys depends on the order of the references, as viewed in Zotero.
https://forums.zotero.org/discussion/17847/2/improving-bibtex-export/
https://forums.zotero.org/discussion/28663/bibtex-export-in-zotero-40-please-help/
yet I could not find answers to several questions:
1) how is it possible to start enumerating colliding Bibtex keys from the first one? Currently, one gets: NameYear, NameYear-1, NameYear-2, ... I would like to see: NameYear-1, NameYear-2, NameYear-3, ...
2) could the exported references be pre-sorted in a given way? The problem is that the enumeration of colliding Bibtex keys depends on the order of the references, as viewed in Zotero.
just as comment; some might be interested in exporting keys like NameYearABC (with alphabetic suffix, i.e. letter a,b,c). For example, Smith2000b or Wang1999c.
To do so, one can modify a copy of BibTeX.js in translators directory
var citekey = basekey;
var i = 0;
while(citekeys[citekey]) {
i++;
citekey = basekey + "-" + i;
}
citekeys[citekey] = true;
return citekey;
to
var citekey = basekey;
var i = 0;
var alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
while(citekeys[citekey]) {
citekey = basekey + alphabet[i];
i++;
}
citekeys[citekey] = true;
refkey = citekey[0].toUpperCase() + citekey.substr(1);
return refkey;
This is only for personal usage, at one's own risk. I would be glad if someone points to a more elegant solution.