bibtex key format cutomizable?
Is it possible to customize the format in which bibtex keys are automatically generated? I would simply like to change _ to - for better compatibility with my editor's auto-complete feature.
This is an old discussion that has not been active in a long time. Before commenting here, you should strongly consider starting a new discussion instead. If you think the content of this discussion is still relevant, you can link to it from your new discussion.
//%a = first author surname
//%y = year
//%t = first word of title
var citeKeyFormat = "%a_%t_%y";
One way to do this is to make these changes in a renamed copy of BibTeX.js file so as not to have your changes clobbered whenever there is an update in the file. It's not too hard. Copy the file to BibTeX-myversion.js and just change those underscores to hyphens. You also need to generate a new ID for the translator. There are instructions under Roll Your Own" at the link below. It will show up as an export format when you restart Firefox.
For what it's worth I have a few hacked version of BibTeX.js here.
http://github.com/commonman/zotero-bibtex-sb
I've made other changes, but haven't changed that line (I'm still trying to decide how I want my keys to look), but the README tells where the file is, and details some changes I had to make.
The other way is to postprocess your .bib file and re-generate the keys. There are a few cross platform tools which can do that. The ones I know about are in the link above.
.mozilla/firefox/xxxxxx/zotero/translators/BibTeX.js
replace the line:
var citekey = buildCiteKey(item, citekeys);
by:
// Take the extra field as citekey
var citekey = item.extra;
if (citekey == "") {
// if empty then create a unique citation key
var citekey = buildCiteKey(item, citekeys);
}
Before I try to change my export style to suit, I'd like to check that this isn't just an arbitrary choice that hasn't been changed for historical reasons...
Is there a way to do it for Better BibTeX.js translation directory? I assume I would have to edit this one if this is my setup. I can't find the lines in the file though.
Thanks