Tuesday, November 24, 2009

Zotero to JabRef: switching reference software

If you know the academic me, you know I love, and regularly tout, using Zotero to manage my ever-growing bibliography. There is one problem with Zotero, however, that I just cannot move past: its inability to use relative links for linking to files.

update: I edited the following paragraph to clear up some confusion pointed out in a posted comment. I should also point out that on Zotero's website, there are numerous posts from users requesting relative links, but with absolutely no reply from Zotero. This again makes me think that the way Zotero is written, relative links are not possible. Otherwise, they would have it, wouldn't they?

I love being able to sync my Zotero database between my personal Mac and school PC, but the syncing breaks the file links. If you sync your database to a second computer, it shows the links as still being there, but if you try to click on a file to open it within Zotero you get an error message saying Zotero cannot find it. You can tell Zotero where the file is, but you would have to do this for every file in the database. I am guessing this has something to do with Zotero running as a FireFox plug-in. When you add a PDF from another directory, Zotero copies it into its own internal structure, which is confusing and involves folders with random letter names. This is just not working for me. I want to be able to sync my database between my computers, and have functional links to the associated files.

I just switched today to JabRef and love it. It is free, works on Windows, Linux, and Mac, and let's you use relative links. It is simply a frontend for your BibTex file, but it has some really cool tricks:

1. It can autogenerate bibtex keys based on a format you specify
2. It can automatically link entries to files in any directory you specify based on the bibtex keys.
3. It is all stored in a small, easily transferable, BibTex file
4. It supports online searches so you can find and easily capture references online
5. It supports field-based views, but let's you view and directly edit the BibTex code as well as
4. I am sure there are a ton more, but I just started using it today

There are a couple tricks to switching over, so here is what I did:

1. Export the Zotero library in RIS format (my BibTex format export from Zotero caused issues with JabRef)

2. Import the RIS file into a new database in JabRef and save it

3. The internal PDF links from Zotero were written out to the URL field, meaning there are now a bunch of broken URL links in JabRef. To fix this, I navigated to the location of my new database file via terminal (or Cygwin in Windows) and did the following:

egrep -v "internal-pdf" original.bib > new.bib

This will delete all those pesky broken URLs that think they are internal PDF links, but still keep any legit URL links

4. Open the new.bib with JabRef (you can close out the old database now).

5. Under Options -> Preferences -> External Programs: Set the file and PDF directories to whatever directories you are already using (ex: /Users/mwolfson/Documents/School/Articles). Also check the "Autolink files with names starting with BibTex Key" option

6. Under the BibTex Key generator options, setup your BibTex key to match how you name your PDFs. My PDFs are named: author_year.pdf. So my BibTex Keys were set to [auth]_[year].

7. Select all your entries in your database, then go to Tools -> autogenerate BibTex Keys (let it overwrite old keys if necessary). Now all your entries should have the proper BibTex Key appended to them

8. While still selecting all records, Tools -> Scan Database -> Synchronize File Links (they have a specific PDF link, which works, but does not add the PDF icon to the entries for some reason -- perhaps because it uses a special pdf = {} in the bibtex code instead of file = {} -- so there is no way to know which entries have PDFs and which don't). Allow overwriting and hit OK. Now, if your PDF/file names in the specified directory match any of the BibTex keys, they will be auto-linked to the JabRef entry. Entries with linked PDFs should now show a PDF icon next to it.

update: There is an option under preferences to "show PDF/PS column" which would then, in fact, display the PDF icon if you choose to PDF sync rather than File sync. I have heard PDF/PS sync is being phased out since File sync handles these file types and more though, so I still recommend using File sync instead.

Viola! You should now have a working BibTex database in JabRef with all your articles linked. If you work across multiple computers like me, simply open up this database in JabRef on the new machine, set up your file directories to point to the appropriate files, and you are done. All your PDF links will work because the links themselves are relative! This is especially awesome when working cross-platform between Windows, Linux, and Mac.

Here is a screen grab showing what JabRef looks like running on my Mac:


If you get stuck feel free to drop me a comment and I'll try to help.

9 comments:

  1. Hello, great article. I linked it here http://www.sciplore.org/software/sciplore_mindmapping/manual/en/#zotero

    if you ever might want to try mind mapping e.g. to draft your papers, you might want to try http://www.sciplore.org/software/sciplore_mindmapping/ which is a software that i am currently developing and which works quite well with JabRef/BibTeX :-)

    ReplyDelete
  2. Hi Jöran,
    Thanks! I have actually used Freemind a couple times to help organize my research thoughts and I really like it! I see that your software is based off this, so I will definitely check it out.

    ReplyDelete
  3. I use & like both JabRef & Zotero, but noticed that you might not have understood Zotero's capabilities.

    I love being able to sync my Zotero database between my personal Mac and school PC, but I cannot link the files.

    If you are using the 2.0 beta, you should be able to sync any stored files.

    I am guessing that because Zotero runs as a FireFox plug-in, it cannot see beyond the Firefox directory structure.

    This is simply not true & you can choose to change the location of the zotero storage directory to store all attachments somewhere that isn't in your firefox profile. You can, alternatively, link to files & not store them. You'd have to manually sync files, rather than using Zotero's sync features. But you are doing that with JabRef now anyway.

    (my BibTex format export from Zotero caused issues with JabRef)

    Can you elaborate on this?


    3. The internal PDF links from Zotero were written out to the URL field

    Zotero does not make 'internal-pdf://' uris. Were you using EndNote?

    ReplyDelete
  4. Hi Anonymous,

    "If you are using the 2.0 beta, you should be able to sync any stored files. "

    Zotero 2.0b only allows you to sync files up to 100 MB, a pretty meager allowance.

    "This is simply not true & you can choose to change the location of the zotero storage directory to store all attachments somewhere that isn't in your firefox profile. You can, alternatively, link to files & not store them."

    Yes, you are right. I was wrong to have said Zotero cannot see outside of FireFox. In fact, I had changed my data storage directory for Zotero when I first started using it over a year ago, but this DOES NOT change how it stores PDFs. It still stores them in its own structure which involves randomly named folders. Zotero simply CANNOT do relative links. I thought that this might have something to do with it being a browser plug-in.

    "Zotero does not make 'internal-pdf://' uris. Were you using EndNote?"

    Nope, you are wrong on this point. Try exporting your library as a RIS file and you will see for yourself. It writes out the link to the PDF in the UR tag in the RIS file. I do not think this occurs on BibTex output, so perhaps that is the source of your confusion.

    I have not used EndNote in a long time

    ReplyDelete
  5. Also Anonymous, please see my updates in the blog post.

    ReplyDelete
  6. Is there any update to this? When will zotero store PDFs with relative file structures?

    ReplyDelete
  7. Hi Tim,
    I am not sure. I have not looked lately to see if anything has been done about relative links in Zotero. Quite frankly, I find JabRef to be way more user friendly anyway. I tend to write all my papers in Latex, so having a reference software that is natively based on BibTex is much more appealing to me. I can directly view the Bibtex entry from the JabRef GUI and edit if if I so need.

    ReplyDelete
  8. So you decided not to use Zotero in the end?

    I am wondering because I am starting my PhD, and thus I want to find the most efficient way to organize my bibliography.

    I used Jabref extensively in the past, so i was sure to use it. I discovered zotero when coming in my new group.

    The big Interest I foind to Zotero is the data harvesting it automaticaly do (ok, with google scholar > export citation as bibtex its quick to have the same with jabref). Another GOOD point is given for the groupd sharing option. It allows the group to have a shared folder of articles.

    But then, how to synchronize pdfs with Jabref (to use the bibtex file with SciPlore) ? If someone is doing it I am interested. If no-one is doing it, I will quite zotero, and use only Jabref/SciPlore

    ReplyDelete
  9. Hi Jice,
    See one of my later posts: http://the-moni-blog.blogspot.com/2009/11/zotero-and-jabref-how-to-make-both-work.html

    I use both now. I use Zotero for collecting references because of it's awesome ability to capture reference information from the web, but I use JabRef to organize the references and link to the pdfs.

    I found that only the RIS export option from Zotero works with JabRef though. The Bibtex export format actually doesn't work right because it rights out broken URL links. So just export your collected entries as a RIS file, and import that same file in JabRef, and voila!

    ReplyDelete