Look! References without URLs!

Removing URLs from Zotero bibtex exports

When you export bibtex from zotero, it includes the URLs in the bibtex records. Some LaTeX bibliography styles include this information, and sometimes this is not what you want, for example because the URLs take up unnecessary space and are hard to wrap.

It’s quite easy to get zotero to export bibtex without the URLs.

  1. Go to Preferences | Advanced and click on the “Show Data Directory” button.
  2. Edit translators/BibTeX.js with your favourite text editor.
  3. In function doExport(), at around line 2040 in Zotero 3.0.7, change the “for (var field in fieldMap)” loop by adding a single line of code like this:
for(var field in fieldMap) {
    # only add the following line:
    if (field == "url") continue;
    if(item[fieldMap[field]]) {
        writeField(field, item[fieldMap[field]]);

If your changes don’t seem to take, make sure that your text editor did not make a backup of the old BibTeX.js (vim does this, with an ~ appended), as Zotero could possible pick up the backed up version instead of your edited version.

Let me know in the comments if this helped!

Look! References without URLs!

Update on 2013-02-17: Added tip concerning editor backups of BibTeX.js (I ran into this problem myself).

9 thoughts on “Removing URLs from Zotero bibtex exports”

  1. Cool, but why does this method not work to eliminate the entries ‘urldate’ and ‘file’ in a similar way? Is there another way?
    thanks in advance.

  2. Thanks, you may also want to avoid exporting the “file” category which only applies if you keep your PDFs in Zotero – this is also a long string which doesn’t wrap in TeXstudio. To remove this field, just comment out (“//” before the line) this line which is a few lines down from the url section:
    writeField(“file”, attachmentString.substr(1));

  3. Thank you for the post! It helped me a lot!!! However, the directory translators/BibTeX.js was a little bit different in my case: zotero/translators/BibTeX.js

    Also, doExport() function do not have the code presented and I had to look directly for “var field in fieldMap” to add the line suggested.

Leave a Reply

Your email address will not be published. Required fields are marked *