var alwaysMap = {
"|":"{\\textbar}",
"<":"{\\textless}",
">":"{\\textgreater}",
"~":"{\\textasciitilde}",
"^":"{\\textasciicircum}",
"\\":"{\\textbackslash}",
"{" : "\\{",
"}" : "\\}"
};
to
var alwaysMap = {
"|":"{\\textbar}",
"<":"{\\textless}",
">":"{\\textgreater}",
"~":"{\\textasciitilde}"//,
//"^":"{\\textasciicircum}",
//"\\":"{\\textbackslash}",
//"{" : "\\{",
//"}" : "\\}"
};
and in the function writeField() change
value = value.replace(/[|\<\>\~\^\\\{\}]/g, mapEscape).replace(/([\#\$\%\&\_])/g, "\\$1");
to
value = value.replace(/[|\<\>\~]/g, mapEscape).replace(/([\#\%\&])/g, "\\$1");
//extra protect all math against capitalization
value = value.replace(/(\$.*?\$)/g,"{$1}");
The last line is needed to protect math from being auto-capitalized or auto-uncapitalized with two pairs of brackets. Without this line it's only surrounded by one pair of brackets, which is not always enough. Before fixing this, I had a problem where BibTeX kept changing \Lambda to \lambda, uncapitalizing my greek letters in inappropriate places.References:
https://ohadsc.wordpress.com/2012/06/20/zotero-exporting-unicode-and-latex-constructs-to-bibtex/
https://forums.zotero.org/discussion/5324/bibtex-and-greek-characters/
No comments:
Post a Comment