Bibtex keys (\cite) are different than the exported in the .bib file...
Hi,
I have checked all discussions related to bibtex export bibtex keys and German umlauts but I couldn't find any help...
I discovered the following problem:
exporting the library to bibtex gives me the following entry (example):
@article{baecker_zukunftsfahigkeit:_2011,
title = {Zukunftsfähigkeit: 16 Thesen zur nächsten Gesellschaft},
volume = {9},
hyphenation = {german},
journal = {Revue für Postheroisches Management},
author = {Baecker, Dirk},
year = {2011},
pages = {8--9},
}
which is not very elegant but fine...
however, if I choose default output format "BiBTeX (\cite)" the output is:
\cite{baecker_zukunftsfaehigkeit:_2011}
although it should be:
\cite{baecker_zukunftsfahigkeit:_2011}
somehow the bibtex key that is created exporting the library using bibtex (utf-8) is different from the bibtex key using (\cite) in the default output (cmd+shift+c)...
My knowledge how to manipulate the bibtex translator .js (if it is a translator problem) is very limited... can anyone please help me?
cheers,
I have checked all discussions related to bibtex export bibtex keys and German umlauts but I couldn't find any help...
I discovered the following problem:
exporting the library to bibtex gives me the following entry (example):
@article{baecker_zukunftsfahigkeit:_2011,
title = {Zukunftsfähigkeit: 16 Thesen zur nächsten Gesellschaft},
volume = {9},
hyphenation = {german},
journal = {Revue für Postheroisches Management},
author = {Baecker, Dirk},
year = {2011},
pages = {8--9},
}
which is not very elegant but fine...
however, if I choose default output format "BiBTeX (\cite)" the output is:
\cite{baecker_zukunftsfaehigkeit:_2011}
although it should be:
\cite{baecker_zukunftsfahigkeit:_2011}
somehow the bibtex key that is created exporting the library using bibtex (utf-8) is different from the bibtex key using (\cite) in the default output (cmd+shift+c)...
My knowledge how to manipulate the bibtex translator .js (if it is a translator problem) is very limited... can anyone please help me?
cheers,
BibTeX-cite-keys-only.js
BibTeX (\cite) is only what shows in the preference pane.
I use this for drag and drop bibtex cite keys (like: \cite{key1}) by using the standard shortcut cmd+shift+c... I can't remember where I got it from. but: I figured it out. I found the table at the end that was causing the problem... and I replaced "ae", "oe", "ue" by "a", "o", "u" and its all fine.
But I still don't understand the problem really, because the bibtex.js translator contains the very same table at the end with ae ue oe so it should replace umlauts by these right? or do I have to activate this replacement first? I don't understand the comment in the code here:
// a little substitution function for BibTeX keys, where we don't want LaTeX
// escaping, but we do want to preserve the base characters
function tidyAccents(s) {
var r=s.toLowerCase();
// XXX Remove conditional when we drop Zotero 2.1.x support
// This is supported in Zotero 3.0 and higher
if (ZU.removeDiacritics !== undefined)
r = ZU.removeDiacritics(r, true);
else {
// We fall back on the replacement list we used previously
r = r.replace(new RegExp("[ä]", 'g'),"ae");
r = r.replace(new RegExp("[ö]", 'g'),"oe");
r = r.replace(new RegExp("[ü]", 'g'),"ue");
r = r.replace(new RegExp("[àáâãå]", 'g'),"a");
r = r.replace(new RegExp("æ", 'g'),"ae");
r = r.replace(new RegExp("ç", 'g'),"c");
r = r.replace(new RegExp("[èéêë]", 'g'),"e");
r = r.replace(new RegExp("[ìíîï]", 'g'),"i");
r = r.replace(new RegExp("ñ", 'g'),"n");
r = r.replace(new RegExp("[òóôõ]", 'g'),"o");
r = r.replace(new RegExp("œ", 'g'),"oe");
r = r.replace(new RegExp("[ùúû]", 'g'),"u");
r = r.replace(new RegExp("[ýÿ]", 'g'),"y");
}
return r;
};
and since it now works I'm almost happy, but one problem I couldn't figure out:
the code snipped I quoted is from the bibtex.js file and it shows the exact same table for replacing the umlauts in the exported bibtex keys as the BibTeX-cite-keys-only.js file that I use for Quicke Copy - only that one was exporting bibtex keys with "ae" the other with "a" (both replacing "ä")... any ideas why? what do I miss?
I 'solved' it by forcing also the BibTeX-cite-keys-only.js to export "ä" as "a" although this one was capable of exporting it as "ae"... I have really no clue...
But that's a custom translator. We have nothing to do with that, so I can't help you with it.
A better bibtex support would be nice. There are the improvements by spartanroc but I am hesitating since they involve changes that I cannot understand. and I really like to understand :)
cheers, obs
The difference is likely the conditional:
"if (ZU.removeDiacritics !== undefined)" ... then it uses the new code.
See the end of the discussion here which I just updated:
http://forums.zotero.org/discussion/5094/drag-and-drop-bibtex-cite/#Item_18