BibTeX citation key import, editing, and export
I did this for myself, but thought I'd share in case others would like my simple solution.
I've tweaked the default bibtex translator to use tags prefixed with "bibtex:" as the bibtex citation key. So, to set the citekey for something you've added, simply add a tag called "bibtex:my_cool_citekey" -- then when you export, you can use \cite{my_cool_citekey}. It will also handle .bib imports correctly, adding the appropriate tag for the input citekey.
The complete translator source file which replaces the existing bibtex translator is here: https://gist.github.com/1836549
I've tweaked the default bibtex translator to use tags prefixed with "bibtex:" as the bibtex citation key. So, to set the citekey for something you've added, simply add a tag called "bibtex:my_cool_citekey" -- then when you export, you can use \cite{my_cool_citekey}. It will also handle .bib imports correctly, adding the appropriate tag for the input citekey.
The complete translator source file which replaces the existing bibtex translator is here: https://gist.github.com/1836549
works great :)
https://github.com/zotero/translators/commits/master
... or we could clean it up and get it into the official translator
Before you put any effort into cleaning this up, you should ask over at zotero-dev whether this would be likely to get accepted as a patch. For my taste it's a bit more of a hack than I would like. There is a longstanding plan to allow some type of custom keys which could be used for bibtex (but maybe also for an improved RTF scan) that would solve this on a more fundamental level - maybe in 3.5?
I've updated the gist to match the latest BibTeX.js ... so now this code should live independently at least so you can re-enable auto updates. Since I updated it, I went ahead and submitted a pull request on github anyway, so we'll see what comments they have.
Yeah the custom fields have been "planned" for a number of years now, I'm not really holding my breath on that one...
I just had a problem during the import: the bibtexkey tag was created only when there were no other keywords.
I do not know js, but modifying the code at line 1672, I could get it right:
} else if(field == "keywords" || field == "keyword") {
var re = new RegExp(keywordDelimRe, keywordDelimReFlags);
if(!value.match(re) && keywordSplitOnSpace) {
// keywords/tags
//modified by pezzacolori
for (t in value.split(" ")) {item.tags.push(value.split(" ")[t]);}
//item.tags = value.split(" ");
} else {
//modified by pezzacolori
for (t in value.split(re)) {item.tags.push(value.split(re)[t]);}
//item.tags = value.split(re);
}
Surely you can write a better code, and maybe update your gist.
I did not chek if also the export has this problem ...
Cheers
item.tags.push.apply(value.split(" "));
For some reason github won't let me update the gist right now.
See also:
http://forums.zotero.org/discussion/26083/#Item_2
http://forums.zotero.org/discussion/17847/improving-bibtex-export/