Article metadata
  • Copyright CC BY-SA 4.0. See licensing for additional details
  • Author
  • Created 2014-10-05
  • Last updated: 2015-01-25
  • Changes
    • 2015-01-25: Moved from docs to erpetu and updated metadata

Zotero/Pandoc Integration

The zotxt firefox addon used in conjuction with pandoc-zotxt allows easy integration of citations in pandoc's markdown format

Requirements

  • Firefox
  • Zotero Firefox add-on

Exporter option

I have found two of the exporters useful. For me the primary definition of useful is that it provides a way to have a consistent reference tag.

  • zotxt by Erick Hetzner gives real time access to your Zotero database but requires that Firefox be up when exporting
  • zotero-better-bibtex requires the export from Zotero to biblatex (.bib) file. For my purposes this one is better since the bibliography can be included in the websites git repo.

zotxt option1

Additional Requirements

Installation

  • Firefox add-on
  • Zotero configuration
    • Select the Actions Menu (Gear Icon)
    • Select Preferences
    • Select the Export Tab
    • Set the Default Output Format to "Easy Citekey"
  • pandoc-zotxt

    sudo pip install pandoc-zotxt

Usage

  • To run the filter manually

    pandoc -F pandoc-zotxt -F pandoc-citeproc document.md

zotero-better-bibtex2

Installation

Usage

  • Set a fixed tag

    • In firefox right-click on reference
    • select "Generate BibTeX Key"
    • Key is available from "Extras" field on right
  • Export library

    • In firefox right-click on the collection to export
    • Select "Export Collection"
    • Set Format to "Better BibLaTex" and select "OK"
    • Name file and select "Save"
  • Manually Applying bibliography

    pandoc --filter pandoc-citeproc --bibliography **EXPORTEDFILE**.bib document.md
  • example nanoc rule to apply bibliography to all markdown files

    ...
    
    when 'md'
      opts = {:to => :html5,
              'base-header-level' => 2,
              :filter => 'pandoc-citeproc',
              'data-dir' => 'content/bibliography/',
              :bibliography => 'content/bibliography/erpetu.bib',
              :csl => 'content/bibliography/elsevier-with-titles.csl'}
      filter :pandoc, opts  
    ...

References

Hetzner, Erik. “Egh / Zotxt — Bitbucket.” Accessed October 5, 2014. https://bitbucket.org/egh/zotxt.

MacFarlane, John. “Pandoc User’s Guide.” Accessed January 31, 2015. http://johnmacfarlane.net/pandoc/README.html#citations.

Zotero. “Creating_bibliographies [Zotero Documentation],” February 26, 2013. https://www.zotero.org/support/creating_bibliographies.

ZotPlus. “Zotero: Better Bib(La)TeX.” Accessed January 31, 2015. https://github.com/ZotPlus/zotero-better-bibtex.


  1. Hetzner, “Egh / Zotxt — Bitbucket.”

  2. ZotPlus, “Zotero.”