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="http://purl.org/net/xbiblio/csl" class="note" xml:lang="en">
    <info>
        <title>Nature Journals</title>
        <id>http://purl.org/net/xbiblio/csl/styles/nature.csl</id>
        <link>http://purl.org/net/xbiblio/csl/styles/nature.csl</link>
        <author>
            <name>Michael Berkowitz</name>
            <email>michael@songsaboutsnow.com</email>
        </author>
        <category term="biology"/>
        <category term="generic-base"/>
        <updated>2007-08-29T15:15:00+08:00</updated>
    </info>
    <macro name="author">
        <names variable="author">
            <name sort-separator=", " delimiter=", " and="symbol" initialize-with="." delimiter-precedes-last="never" name-as-sort-order="all"/>
        </names>
    </macro>
    <macro name="access">
        <text variable="DOI" prefix=" doi: "/>
        <substitute>
            <text variable="URL" prefix=" at <" suffix=">"/>
        </substitute>
    </macro>
    <citation></citation>
    <bibliography>
        <option name="et-al-min" value="4"/>
        <option name="et-al-use-first" value="1"/>
        <layout>
            <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"/>
            </date>
        </layout>
    </bibliography>
</style>

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.