## Zotero – exporting Unicode and LaTeX constructs to BibTex

Zotero is a great reference manager, especially if you’re using Firefox. Its BibTeX export is invaluable for LaTeX / LyX users. However, it has a couple of sticking points whose solutions are not well documented. These issues can be especially annoying for researchers working in exact sciences (math, physics, etc.)

Problem 1: Article info contains special Unicode characters (such as é). As BibTeX doesn’t support Unicode, LaTeX compilation fails.

Solution:

1. Zotero Preferences -> Export -> check Display character encoding option on export
2. Whenever you export your database, pick a non-Unicode character encoding such as ISO-8859-1

Zotero will now convert the Unicode characters to their native LaTeX equivalents (for example, é will be converted into ‘{e}).

Note: You could also solve this on the LaTeX side by using Biblatex and biber. However, I wasn’t able to make them work under LyX.

Problem 2:Article info contains Latex constructs (e.g. \$O_{3}\$). Zotero escapes these and so they appear verbatim in the reference (e.g. \$O_{3}\$ instead of O₃)

Solution:

1. Locate your Zotero data directory and open translatorsBibTeX.js with your favorite text editor
2. Change the following:
var alwaysMap = {
"|":"{\textbar}",
"<":"{\textless}",
">":"{\textgreater}",
"~":"{\textasciitilde}",
"^":"{\textasciicircum}",
"\":"{\textbackslash}"
};

to the following:

var alwaysMap = {
"|":"{\textbar}",
"<":"{\textless}",
">":"{\textgreater}" //,
// "~":"{\textasciitilde}",
// "^":"{\textasciicircum}"
// "\":"{\textbackslash}"
};
3. Change the following:
value = value.replace(/[|<>~^\]/g, mapEscape).replace(/([#\$%&_])/g, "\\$1");

to the following:

value = value.replace(/[|<>]/g, mapEscape).replace(/([#%&])/g, "\\$1");
4. Save the file.

Escaping of ~, ^, ,\$,_ is now disabled, preserving your LaTeX constructs.