Zotero and BibTeX

zoteroI love using Zotero as my bibliography management system.  It is easy to use, free, and open-source.  However, I’ve recently encountered a minor technical problem exporting my Zotero database to a BibTeX file: I was having trouble preserving the capitalization in the titles of journal articles.  This problem stumped me for longer than I can to report, so in the hopes of saving others some times, here’s how I solved the problem.

Problem: When Zotero was exporting to a BibTeX file, it was not properly preserving the capitalization for words in the titles of papers.  For example, I have a paper with the title “An analysis of respondent driven sampling with injection drug users (IDU) in Albania and the Russian Federation”.  When you export it, the title Zotero creates for BibTeX is: “An analysis of respondent driven sampling with injection drug users ({IDU)} in Albania and the Russian Federation”.  The problem here is that given this formatting, BibTeX does not know that “Albania” and “Russian Federation” are proper nouns that should be capitalized.  To tell that to BibTeX the appropriate title in the BibTeX file should be: “An analysis of respondent driven sampling with injection drug users ({IDU)} in {Albania} and the {Russian Federation}”.  Using the {} tells BibTeX to preserve the case .  So, now the question: how can I get Zotero to create that as the BibTeX file?  As a first guess I tried in Zotero: “An analysis of respondent driven sampling with injection drug users (IDU) in {Albania} and the {Russian Federation}” but that produced in BibTeX something like: “An analysis of respondent driven sampling with injection drug users (IDU) in {\{Albania\}} and the {\{Russian Federation\}”.  In essence, Zotero was thinking that I actually wanted the “{” to appear in the title so it was adding the “\” to preserve them.  After trying many variations and doing lots of web searching, I found a great blog post by Ohad Schneider, which lead me to a solution.

To get things to work as I wanted, I needed to manually edit the Zotero BibTeX export function.  It might sound a bit scary, but Ohad’s blog post led me to the right spot.  Here’s what you can do.  Find this part of the file BibTeX.js located in the “translators” sub-directory of your Zotero data directory

Change it to (note the changes in line 8 and 9):

After making this change, I closed Firefox and everything seems to work now.

Update: You may need to do this change more than once.  It seems that every time that Zotero updates itself, it overwrites this change.

One thought on “Zotero and BibTeX

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s