# BibTeX-friendly PDF management with Zotero

For years I’ve been jealous of colleagues with Macs who apparently all use BibDesk for managing their article PDF collections and BibTeX citations in one nice program. I think I’ve finally figured out how to do both things on Linux: Zotero, with the Better BibTeX and ZotFile add-ons.

Zotero is first of all a citation management system. It’s multi-platform, open-source, not tied to a commercial publisher, widely used and well-supported. Your article database lives on your computer, but is synced with a central server. So any changes you make to the citation database gets automatically mirrored to your other computers (even if they run different OSs), and you can access it online as well. The browser extension Zotero Connector lets you import & download references and PDFs from publishers’ websites, JSTOR, etc., with a single click. It does everything a reference manager does, e.g., give you bibliographies and citations in Word or LibreOffice.

All of this has worked to some extent for a while, and also works with other reference managers. What has kept me from using them is that I want my reference manager to play nice with BibTeX. That means it should export BibTeX files with (a) proper capitalization, (b) LaTeX code where necessary (e.g., mathematical formulas in titles), (c) keep track of BibTeX fields like the crossref and note fields, which may contain LaTeX code itself (e.g., “Reprinted in \cite{...}“), and (d) not change cite keys on you. On the other hand, the database itself should look as normal as possible and avoid LaTeX code whenever possible (e.g., I want Gödel’s papers to be indexed under “Gödel”, not under “G{\”o}del”). When I tried Zotero the last time (and other reference managers), it would deal with (a) by enclosing the entire title field in braces. That meant BibTeX would not lowercase anything; and sometimes the style does require lowercasing things. I don’t remember if (b) or (c) ever worked.

Anyway, Zotero’s Better BibTeX extension does an excellent job.  You can put in “Gödel” as the author name, and it will export to “G{\”o}del”. It assigns cite keys according to a configurable pattern, but it keeps cite keys the same when importing BibTeX files. You can change them manually, and it will remember them. Additional BibTeX fields not already supported by Zotero are saved on import and included on export.  It will convert HTML tags (which Zotero understands as well) to LaTeX code on export (e.g., <i>...</i> to \emph{...}). If you need LaTeX code, just enclose it in <pre>...</pre> tags. It does a very good job with capitalization and is even smart enough to do its transformations only to English language titles. Especially nice: Better BibTeX will keep your exported BibTeX files up to date. So, e.g., you can put all the references for a paper you’re working on in a Zotero “collection”, tell Better BibTeX to export it, and the .bib file will stay up to date if you change or add something to the collection in Zotero.

Want to try it?

• Install Zotero Standalone and Connector
• Install ZotFile
• Install Better BibTeX
• Check your preferences, e.g., whether you want Zotero to rename PDFs or look up metadata when saving them.
• If you want your PDFs to be linked and collected in, say, your Dropbox, set the attachment base directory in Preferences: Advanced: Files and Folders.
• Tell ZotFile where your downloaded files and your PDF direcories are, so it knows where to look for the most recent PDF to attach (in Tools > ZotFile preferences) and where to move them to. Make sure you set the ZotFile PDF naming pattern there to something you like.
• Set up an account on zotero.org and link your library to it in Preferences: Sync (but uncheck “Sync attachment files” if you don’t want your PDFs on zotero.org)
• Tweak your Better BibTeX settings, esp. the cite key pattern to make sure imported cite keys are the way you want them.