Getting started with Zotero citation styles

Any bibliography management system needs a good selection of citation styles and/or an easy way for users to add their own. As an incentive to write that Nature paper, Zotero now includes a Nature journals style.

I think it would be great if the bioinformatics community contributed some useful styles to Zotero. The process is not well documented, but goes something like this.

First, get yourself an sqlite3 client (as easy as “sudo apt-get install sqlite3” on Ubuntu). Next, investigate your Zotero database. Citation styles are stored in a table named “csl” which you can dump like so:

sqlite3 zotero.sqlite
sqlite> .output csl.sql
sqlite> .dump csl
sqlite> .exit

Here’s what the nature.csl XML looks like:

<style xmlns="" class="note" xml:lang="en">
        <title>Nature Journals</title>
            <name>Michael Berkowitz</name>
        <category term="biology"/>
        <category term="generic-base"/>
    <macro name="author">
        <names variable="author">
            <name sort-separator=", " delimiter=", " and="symbol" initialize-with="." delimiter-precedes-last="never" name-as-sort-order="all"/>
    <macro name="access">
        <text variable="DOI" prefix=" doi: "/>
            <text variable="URL" prefix=" at <" suffix=">"/>
        <option name="et-al-min" value="4"/>
        <option name="et-al-use-first" value="1"/>
            <text variable="citation-number" suffix=". "/>
            <text macro="author"/>
            <text variable="title" prefix=" " suffix=". "/>
            <text variable="container-title" font-style="italic" suffix=" "/>
            <text variable="volume" suffix=", " font-weight="bold"/>
            <text variable="page"/>
            <text macro="access"/>
            <date prefix=" (" suffix=")." variable="issued">
                <date-part name="year"/>

And a couple of useful links:

In theory, it shouldn’t be too hard to edit the XML file for your journal of choice, validate, insert into the csl table, test and submit to the Zotero project. Emacs users might appreciate nxml mode and rnc-mode for editing (Ubuntu: “sudo apt-get install nxml-mode rnc-mode”).

2 thoughts on “Getting started with Zotero citation styles

Comments are closed.