simfish:

Reference Database

This workflow provides configuration for managing references using Emacs ebib package.

cover image

Introduction

GNU/Emacs ebib package is used for organizing .bib files into a unified reference database. A .bib file entry can be imported either from clipboard or from online source such as arXiv directly.

Customization

;;;////////////////////////////////////////////////////////
;; Customization Variables
;;;////////////////////////////////////////////////////////

(defcustom refdb:bib-dir
 (expand-file-name "~/Documents/research/bib")
 "Storage location for global bibtex .bib files")

(defcustom refdb:pdf-dir
 (expand-file-name "~/Documents/research/pdf")
 "Storage location for PDF files")

(defcustom refdb:notes-dir (expand-file-name "~/Documents/research/notes")
  "Storage location for org note files")

Key Bindings

Loading Databases

;;;/////////////////////////////////////////////////////
;;; Key bindings
;;;//////////////////////////////////////////////////////
(kb::def :states 'normal
  "r"    '(:ignore t                :which-key "reference database")
  "rr"   '(refdb::open-db           :which-key "main database")
  "rp"   '(refdb::project-db-open   :which-key "project database"))

Database Commands

(kb::defg
  :states  'normal
  :keymaps '(ebib-index-mode-map   ebib-entry-mode-map)
  "r"  '(:ignore t                    :which-key "reference")

  "rr" '(ebib-view-file               :which-key "read paper")
  "rd" '(ebib-download-url            :which-key "download paper")

  "rs"  '(refdb::save-db              :which-key "save")
  "rh"  '(refdb::hide-db              :which-key "hide")
  "rq"  '(refdb::quit-db              :which-key "close")

  "ri"   '(:ignore t                    :which-key "import")
  "rib"  '(refdb-biblio::start-import   :which-key "biblio")
  "ric"  '(refdb::clipboard-import      :which-key "clipboard"))

Importing from Biblio

(kb::def
  :states   'normal
  :keymaps  'biblio-selection-mode-map
  "r"       '(:ignore t                    :which-key "reference")
  "ra"      '(refdb::biblio-add-import     :which-key "add import")
  "ri"      '(refdb::biblio-finish-import  :which-key "finish import"))

Org-mode Citation, inserting citation links, opening cited reference, and literature review note inside org-mode

(kb::def
 :states  'normal
 :keymaps 'org-mode-map
 "rc"      '(:ignore t                     :which-key "citation")
 "rci"     '(refdb::citation-insert     :which-key "insert")
 "rco"     '(refdb::citation-open       :which-key "open"))

Functions

File storage locations

;;;//////////////////////////////////////////////////////////
;;Functions
;;///////////////////////////////////////////////////////////
(defun refdb::bib-dir ( )
  "Returns global storage location for .bib files"
  (expand-file-name "bib" refdb:bib-dir))

(defun refdb::pdf-dir ( )
  "Returns the root downloaded reference database dir"
  (expand-file-name refdb:pdf-dir))

(defun refdb::notes-dir ( )
  "Returns the root downloaded reference database dir"
  (expand-file-name refdb:notes-dir))

Utility for listing bib files

(cl-defun refdb::bib-dir-files ( )
  "Lists all .bib files found in `refdb:bib-dir'"
  (require 'log)
  (require 'files)
  (require 'cl-lib)
  (let ((bib-dir   (expand-file-name refdb:bib-dir)))
    (when  (or (null bib-dir) (not (stringp bib-dir)))
      (log::info
       "research directory `refdb:root-dir' is not set
        to directory path: <%s>"  bib-dir)
      (cl-return-from refdb::bib-dir-files))

    (cl-loop
     for bib-file in (directory-files bib-dir t "\\.bib")
     collect bib-file)))

System wide reference databases,

;; ////////////////////////////////////////
;; system db
;; ///////////////////////////////////////
(defun refdb::open-db ( )
  "Runs `ebib' reference database browser"
  (interactive)
  (require 'ebib)
  (ebib))

(defun refdb::quit-db ( )
  "Quits ebib reference browser"
  (interactive)
  (when (featurep  'ebib)
    (ebib-quit)))

(defun refdb::save-db ( )
  "Save the current database"
  (interactive)
  (when (featurep 'ebib)
    (ebib-save-current-database)))

(defun refdb::hide-db ( )
  "Hide ebib browser"
  (interactive)
  (when (featurep 'ebib)
    (ebib-lower)))

(defun refdb::init ( )
  "Initializes reference management for the current org-mode buffer"
  (interactive)
  (require 'org-ref)
  (require 'pm)
  (when (or
         ;; inside the main org-mode document of the current project?
         (not (null (pm::root-dir)))
         (eq major-mode 'org-mode))
    (with-current-buffer (current-buffer)
      ;; ensure project bibliography file ref.bib file is available
      (let ((bib-re         "^\s*\\\#\\\+bibliography:")
            (bib-style-re    "^\s*\\\#\\\+print_bibliography:")
            (has-bib        nil)
            (has-bib-print  nil)
            )
        ;; initialize has-bib and has-bib-style
        ;; flags that detect wether the document biblography file(ref.bib)
        ;; and biblography style have been specified.
        (save-excursion
          ;;(widen)

          ;;does it have bib print instruction?
          (goto-char (point-min))
          (setq has-bib-print
                (not (null (search-forward-regexp bib-style-re nil t ))))

          (goto-char (point-min))
          (setq has-bib
                (not (null (search-forward-regexp bib-re nil t ))))

          ;; deos it have bib reference?
          (refdb::goto-ref-section)
          (unless has-bib
            (let ((org-ref-default-bibliography `( ,(refdb::project-db-file-path) ) ))
              (org-ref-insert-bibliography-link)
              (org-newline-and-indent)
              ))

          ;;(unless has-bib-style
          ;;  (org-ref-insert-bibliographystyle-link)
          ;;  (org-newline-and-indent)
          ;;  )

          )))))

;; /////////////////////////////////////
;; project ref db
;; /////////////////////////////////////

(defun refdb::project-init ( &optional dont-open-browser )
  "Setup and optionally open the reference database for the current project"
  (interactive)
  (require 'ebib)
  (require 'pm)
  (require 'fs)
  (require 'log)

  (let ((project-dir     (pm::root-dir))
        (project-db-file (refdb::project-db-file-path))
        (main-db-file    (expand-file-name "main.bib" refdb:bib-dir))
        (main-db)
        )
    (when (not (null project-dir))
      (log::sub-info "project: %s" project-dir)

      ;; init ebib
      (unless ebib--initialized
        (ebib-init)
        (setq ebib--needs-update t))
      (setq main-db (ebib--load-bibtex-file-internal main-db-file))

      ;; is project database available?
      (if (file-exists-p project-db-file)

          (setq ebib--cur-db  (ebib--load-bibtex-file-internal project-db-file))

        (let ((project-db))
          (log::info "creating project reference  ...")
          (log::sub-info "database: %s" project-db-file)
          (fs::dir-ensure     (file-name-directory  project-db-file))
          (setq project-db      (ebib--create-new-database ebib--cur-db))
          (ebib-db-set-filename project-db-file project-db)
          (setq ebib--cur-db  project-db)
          (ebib-save-current-database 'force )))


      (unless dont-open-browser
        (ebib)))))

(defun refdb::project-db-open ( )
  "Run reference management with ebib for the current project"
  (interactive)
  (refdb::project-init))

(defun refdb::project-db-file-path ( )
  "Retruns the bib reference database file for the current project"
  (require 'f)
  (let ((project-dir       (pm::root-dir))
        (project-db-file   nil))

    (when (file-directory-p project-dir)
      (setq project-db-file  "./.config/etc/biblatex/ref.bib" )
      (fs::dir-ensure (file-name-directory (f-relative project-db-file project-dir) )))

    project-db-file))


;; util
(defun refdb::goto-ref-section ( )
  (interactive)
  (goto-char (point-min))
  (let* ((ast             (org-element-parse-buffer))
         (ref-hl-end-pos   nil))

    (org-element-map
        ast
        'headline
      (lambda (hl)
        (when (and (= (org-element-property :level hl) 1)
                   (string= (org-element-property :raw-value hl) "References"))

          (goto-char (org-element-property :end hl) )
          (org-end-of-line)
          (org-newline-and-indent)
          (setq ref-hl-end-pos (point))

          )))

    (unless ref-hl-end-pos
      (end-of-buffer)
      (insert "** References\n")
      (org-beginning-of-line)
      (setq ref-hl-end-pos (point)))

    ref-hl-end-pos))

Clipboard Import

(defun refdb::clipboard-import (  )
  "import biblatex reference from the kill-ring"
  (interactive)
  (require 'ebib)
  (with-temp-buffer
    (yank)
    (ebib-import)
    (call-interactively #'ebib)))

Biblio Import

(defvar refdb:biblio-import-list nil
  "list of biblatex entries waiting import into ebib")

(defun refdb-biblio::start-import ( )
  (interactive)
  (setq refdb:biblio-import-list nil)
  (biblio-lookup))


(defun refdb::biblio-add-import ( )
  "Collect selected biblio reference"
  (interactive)
  (require 'ebib)
  (require 'ebib-biblio)
  (biblio--selection-forward-bibtex
   (lambda ( bibtex _entry )
     (cl-pushnew bibtex refdb:biblio-import-list))))


(defun refdb::biblio-finish-import ( )
  "Import collected biblatex references into ebib"
  (interactive)
  (require 'ebib)

  (unless (zerop (length refdb:biblio-import-list) )
    (with-temp-buffer
      (cl-loop
       for import in refdb:biblio-import-list
       do (insert import "\n"))
      (goto-char (point-min))
      (call-interactively #'ebib-import)
      (quit-window))))

Org-Mode Citations

;;; Citation
(defun refdb::citation-insert ( &optional arg )
  "Insert org-ref citation"
  (interactive "P")
  ;;(require 'org-ref-cite)
  ;;(require 'ebib)
  (refdb::init)
  (org-cite-insert arg))


(defun refdb::citation-open ()
  (interactive)
  (let ((bib-key   nil)
        (bib-file  nil)
        )
    (when (and
           (eq major-mode  'org-mode)
           (or
            (setq bib-key   (org-ref-get-bibtex-key-under-cursor))
            (setq bib-file  (org-ref-find-bibliography))))
      (ebib bib-file bib-key))))

Packages

Package: ebib

(use-package ebib
  :guix (  :name emacs-ebib)
  :demand t
  :custom
  ;; use internal pdf viewer
  (ebib-file-associations '(("pdf" . "~/opt/sioyek/sioyek")))
  ;; extra fields
  (ebib-extra-fields
   '((BibTeX   "crossref" "annote" "abstract" "keywords" "file" "tags" "timestamp" "url" "doi")
     (biblatex "crossref" "annotation" "abstract" "keywords" "file" "tags" "timestamp")))
  ;; bib dialect can be bibtex or biblatex
  ;; *biblatex is recommended
  (ebib-bibtex-dialect 'biblatex)
  ;;; setup file paths
  ;;pdf files
  (ebib-file-search-dirs `(,(refdb::pdf-dir)))
  ;; note files
  (ebib-notes-directory   (refdb::notes-dir))
  ;; bib files
  (ebib-preload-bib-files (refdb::bib-dir-files))
  :general
  <<ebib-kb>>
  :config
  (require 'evil-collection)
  (evil-collection-init 'ebib))

Package: biblio

;; online databases
(use-package  biblio
  :guix ( :profile write :name emacs-biblio)
  :after ebib
  :custom
  (biblio-download-directory (refdb::pdf-dir))
  :general
  <<biblio-kb>>)

Package: reftex

(use-package reftex
  :demand t
  :config
  (setq reftex-default-bibliography (refdb::bib-dir-files)))

Package: bibtex

Builtin GNU/Emacs bibtex file editing mode.

(use-package bibtex-completion :demand t)
(use-package bibtex
  :demand t)

Package: ivy-bibtex

(use-package ivy-bibtex
  :guix ( :name emacs-helm-bibtex)
  :config
  (setq
   ;;bibtex-completion-additional-search-fields '(keywords)
   bibtex-completion-bibliography  (refdb::bib-dir)
   bibtex-completion-library-path  (refdb::pdf-dir)
   bibtex-completion-notes-path    (refdb::notes-dir)
   bibtex-completion-notes-template-multiple-files "#+TITLE: Notes on: ${author-or-editor} (${year}): ${title}\n\nSee [cite/t:@${=key=}]\n"
   bibtex-completion-display-formats
   '((article       . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${journal:40}")
	 (inbook        . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} Chapter ${chapter:32}")
	 (incollection  . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
	 (inproceedings . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}")
	 (t             . "${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*}"))
   bibtex-autokey-year-length           4
   bibtex-autokey-titleword-separator  "-"
   bibtex-autokey-name-year-separator  "-"
   bibtex-autokey-year-title-separator "-"
   bibtex-autokey-titleword-length      8
   bibtex-autokey-titlewords            3)

  (setq bibtex-completion-pdf-field "File")
  ;;icons used for indicating availability
  ;;of notes and pdf files
  (setq bibtex-completion-pdf-symbol   "⌘")
  (setq bibtex-completion-notes-symbol "✎")

  ;;optional using external pdf viewer
  ;;(setq bibtex-completion-pdf-open-function
  ;;      (lambda (fpath)
  ;;      (call-process "evince" nil 0 nil fpath)))
  (setq bibtex-completion-pdf-extension '(".pdf" ".djvu"))
  (setq bibtex-completion-browser-function
        (lambda (url)
          ;;TODO: implement browser launcher
          )))

Package: org-ref

Org-ref provides features for managing citations, cross-referencing, linking and labeling text suitable for LaTex.

;; org ref
(use-package org-ref
  :after org-mode
  :guix (:name emacs-org-ref)
  :general
  <<org-ref-kb>>
  :config
  (setq org-ref-insert-cite-function      (lambda () (org-cite-insert nil)))
  (setq org-ref-get-pdf-filename-function   #'org-ref-get-pdf-filename)
  (setq org-ref-default-bibliography        (refdb::bib-dir-files))
  (setq org-ref-notes-directory             (refdb::notes-dir))
  (setq org-ref-pdf-directory               (refdb::pdf-dir)))

Package: citeproc-el

(use-package citeproc-el
  :guix ( :name emacs-citeproc-el )
  :after org-ref
  :disabled)

Resources

styles: IEEE

ieee.csl

<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="sort-only">
  <info>
    <title>IEEE</title>
    <id>http://www.zotero.org/styles/ieee</id>
    <link href="http://www.zotero.org/styles/ieee" rel="self"/>
    <!-- <link href="https://ieeeauthorcenter.ieee.org/wp-content/uploads/IEEE-Reference-Guide.pdf" rel="documentation"/> - 2018 guidelines -->
    <link href="http://journals.ieeeauthorcenter.ieee.org/wp-content/uploads/sites/7/IEEE_Reference_Guide.pdf" rel="documentation"/>
    <link href="https://journals.ieeeauthorcenter.ieee.org/your-role-in-article-production/ieee-editorial-style-manual/" rel="documentation"/>
    <author>
      <name>Michael Berkowitz</name>
      <email>mberkowi@gmu.edu</email>
    </author>
    <contributor>
      <name>Julian Onions</name>
      <email>julian.onions@gmail.com</email>
    </contributor>
    <contributor>
      <name>Rintze Zelle</name>
      <uri>http://twitter.com/rintzezelle</uri>
    </contributor>
    <contributor>
      <name>Stephen Frank</name>
      <uri>http://www.zotero.org/sfrank</uri>
    </contributor>
    <contributor>
      <name>Sebastian Karcher</name>
    </contributor>
    <contributor>
      <name>Giuseppe Silano</name>
      <email>g.silano89@gmail.com</email>
      <uri>http://giuseppesilano.net</uri>
    </contributor>
    <contributor>
      <name>Patrick O'Brien</name>
    </contributor>
    <contributor>
      <name>Brenton M. Wiernik</name>
    </contributor>
    <contributor>
      <name>Oliver Couch</name>
      <email>oliver.couch@gmail.com</email>
    </contributor>
    <category citation-format="numeric"/>
    <category field="engineering"/>
    <category field="generic-base"/>
    <summary>IEEE style as per the 2021 guidelines, V 01.29.2021.</summary>
    <updated>2021-05-07T00:52:46+10:00</updated>
    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
  </info>
  <locale xml:lang="en">
    <terms>
      <term name="chapter" form="short">ch.</term>
      <term name="presented at">presented at the</term>
      <term name="available at">available</term>
    </terms>
  </locale>
  <!-- Macros -->
  <macro name="status">
    <choose>
      <if variable="page issue volume" match="none">
        <text variable="status" text-case="capitalize-first" suffix="" font-weight="bold"/>
      </if>
    </choose>
  </macro>
  <macro name="edition">
    <choose>
      <if type="bill book chapter graphic legal_case legislation motion_picture paper-conference report song" match="any">
        <choose>
          <if is-numeric="edition">
            <group delimiter=" ">
              <number variable="edition" form="ordinal"/>
              <text term="edition" form="short"/>
            </group>
          </if>
          <else>
            <text variable="edition" text-case="capitalize-first" suffix="."/>
          </else>
        </choose>
      </if>
    </choose>
  </macro>
  <macro name="issued">
    <choose>
      <if type="article-journal report" match="any">
        <date variable="issued">
          <date-part name="month" form="short" suffix=" "/>
          <date-part name="year" form="long"/>
        </date>
      </if>
      <else-if type="bill book chapter graphic legal_case legislation song thesis" match="any">
        <date variable="issued">
          <date-part name="year" form="long"/>
        </date>
      </else-if>
      <else-if type="paper-conference" match="any">
        <date variable="issued">
          <date-part name="month" form="short"/>
          <date-part name="year" prefix=" "/>
        </date>
      </else-if>
      <else-if type="motion_picture" match="any">
        <date variable="issued" prefix="(" suffix=")">
          <date-part name="month" form="short" suffix=" "/>
          <date-part name="day" form="numeric-leading-zeros" suffix=", "/>
          <date-part name="year"/>
        </date>
      </else-if>
      <else>
        <date variable="issued">
          <date-part name="month" form="short" suffix=" "/>
          <date-part name="day" form="numeric-leading-zeros" suffix=", "/>
          <date-part name="year"/>
        </date>
      </else>
    </choose>
  </macro>
  <macro name="author">
    <names variable="author">
      <name and="text" et-al-min="7" et-al-use-first="1" initialize-with=". "/>
      <label form="short" prefix=", " text-case="capitalize-first"/>
      <et-al font-style="italic"/>
      <substitute>
        <names variable="editor"/>
        <names variable="translator"/>
      </substitute>
    </names>
  </macro>
  <macro name="editor">
    <names variable="editor">
      <name initialize-with=". " delimiter=", " and="text"/>
      <label form="short" prefix=", " text-case="capitalize-first"/>
    </names>
  </macro>
  <macro name="locators">
    <group delimiter=", ">
      <text macro="edition"/>
      <group delimiter=" ">
        <text term="volume" form="short"/>
        <number variable="volume" form="numeric"/>
      </group>
      <group delimiter=" ">
        <number variable="number-of-volumes" form="numeric"/>
        <text term="volume" form="short" plural="true"/>
      </group>
      <group delimiter=" ">
        <text term="issue" form="short"/>
        <number variable="issue" form="numeric"/>
      </group>
    </group>
  </macro>
  <macro name="title">
    <choose>
      <if type="bill book graphic legal_case legislation motion_picture song" match="any">
        <text variable="title" font-style="italic"/>
      </if>
      <else>
        <text variable="title" quotes="true"/>
      </else>
    </choose>
  </macro>
  <macro name="publisher">
    <choose>
      <if type="bill book chapter graphic legal_case legislation motion_picture paper-conference song" match="any">
        <group delimiter=": ">
          <text variable="publisher-place"/>
          <text variable="publisher"/>
        </group>
      </if>
      <else>
        <group delimiter=", ">
          <text variable="publisher"/>
          <text variable="publisher-place"/>
        </group>
      </else>
    </choose>
  </macro>
  <macro name="event">
    <choose>
      <if type="paper-conference speech" match="any">
        <choose>
          <!-- Published Conference Paper -->
          <if variable="collection-editor editor editorial-director issue page volume" match="any">
            <group delimiter=", ">
              <group delimiter=" ">
                <text term="in"/>
                <text variable="container-title" font-style="italic"/>
              </group>
              <text variable="event-place"/>
            </group>
          </if>
          <!-- Unpublished Conference Paper -->
          <else>
            <group delimiter=", ">
              <group delimiter=" ">
                <text term="presented at"/>
                <text variable="event"/>
              </group>
              <text variable="event-place"/>
            </group>
          </else>
        </choose>
      </if>
    </choose>
  </macro>
  <macro name="access">
    <choose>
      <if type="webpage post post-weblog" match="any">
        <!-- https://url.com/ (accessed Mon. DD, YYYY). -->
        <choose>
          <if variable="URL">
            <group prefix=" " delimiter=" ">
              <text variable="URL"/>
              <group delimiter=" " prefix="(" suffix=").">
                <text term="accessed"/>
                <date variable="accessed">
                  <date-part name="month" form="short"/>
                  <date-part name="day" form="numeric-leading-zeros" prefix=" " suffix=", "/>
                  <date-part name="year" form="long"/>
                </date>
              </group>
            </group>
          </if>
        </choose>
      </if>
      <else-if match="any" variable="DOI">
        <!-- doi: 10.1000/xyz123. -->
        <text variable="DOI" prefix=" doi: " suffix="."/>
      </else-if>
      <else-if variable="URL">
        <!-- Accessed: Mon. DD, YYYY. [Medium]. Available: https://URL.com/ -->
        <group delimiter=". " prefix=" " suffix=". ">
          <!-- Accessed: Mon. DD, YYYY. -->
          <group delimiter=": ">
            <text term="accessed" text-case="capitalize-first"/>
            <date variable="accessed">
              <date-part name="month" form="short" suffix=" "/>
              <date-part name="day" form="numeric-leading-zeros" suffix=", "/>
              <date-part name="year"/>
              </date>
          </group>
          <!-- [Online Video]. -->
          <group prefix="[" suffix="]" delimiter=" ">
            <text term="online" text-case="capitalize-first"/>
            <choose>
              <if type="motion_picture">
                <text value="video" text-case="capitalize-first"/>
              </if>
            </choose>
          </group>
        </group>
        <!-- Available: https://URL.com/ -->
        <group delimiter=": ">
          <text term="available at" text-case="capitalize-first"/>
          <text variable="URL"/>
        </group>
      </else-if>
    </choose>
  </macro>
  <macro name="page">
    <choose>
      <if type="article-journal" variable="number" match="all">
        <group delimiter=" ">
          <text value="Art."/>
          <text term="issue" form="short"/>
          <text variable="number"/>
        </group>
      </if>
      <else>
        <group delimiter=" ">
          <label variable="page" form="short"/>
          <text variable="page"/>
        </group>
      </else>
    </choose>
  </macro>
  <macro name="citation-locator">
    <group delimiter=" ">
      <choose>
        <if locator="page">
          <label variable="locator" form="short"/>
        </if>
        <else>
          <label variable="locator" form="short" text-case="capitalize-first"/>
        </else>
      </choose>
      <text variable="locator"/>
    </group>
  </macro>
  <macro name="geographic-location">
    <group delimiter=", " suffix=".">
      <choose>
        <if variable="publisher-place">
          <text variable="publisher-place" text-case="title"/>
        </if>
        <else-if variable="event-place">
          <text variable="event-place" text-case="title"/>
        </else-if>
      </choose>
    </group>
  </macro>
  <!-- Citation -->
  <citation collapse="citation-number">
    <sort>
      <key variable="citation-number"/>
    </sort>
    <layout delimiter=", ">
      <group prefix="[" suffix="]" delimiter=", ">
        <text variable="citation-number"/>
        <text macro="citation-locator"/>
      </group>
    </layout>
  </citation>
  <!-- Bibliography -->
  <bibliography entry-spacing="0" second-field-align="flush">
    <layout>
      <!-- Citation Number -->
      <text variable="citation-number" prefix="[" suffix="]"/>
      <!-- Author(s) -->
      <text macro="author" suffix=", "/>
      <!-- Rest of Citation -->
      <choose>
        <!-- Specific Formats -->
        <if type="article-journal">
          <group delimiter=", " >
            <text macro="title"/>
            <text variable="container-title" font-style="italic" form="short"/>
            <text macro="locators"/>
            <text macro="page"/>
            <text macro="issued"/>
            <text macro="status"/>
          </group>
          <choose>
          <if variable="URL DOI" match="none">
            <text value="." />
          </if>
          <else>
            <text value="," />
          </else>
        </choose>
          <text macro="access"/>
        </if>
        <else-if type="paper-conference speech" match="any">
          <group delimiter=", " suffix=".">
            <text macro="title"/>
            <text macro="event"/>
            <text macro="issued"/>
            <text macro="locators"/>
            <text macro="page"/>
            <text macro="status"/>
          </group>
          <text macro="access"/>
        </else-if>
        <else-if type="report">
            <group delimiter=", " suffix=".">
              <text macro="title"/>
              <text macro="publisher"/>
              <group delimiter=" ">
                <text variable="genre"/>
                <text variable="number"/>
              </group>
              <text macro="issued"/>
            </group>
            <text macro="access"/>
        </else-if>
        <else-if type="thesis">
          <group delimiter=", " suffix=".">
            <text macro="title"/>
            <text variable="genre"/>
            <text macro="publisher"/>
            <text macro="issued"/>
          </group>
          <text macro="access"/>
        </else-if>
        <else-if type="webpage post-weblog post" match="any">
          <group delimiter=", " suffix=".">
            <text macro="title"/>
            <text variable="container-title" font-style="italic"/>
            <text macro="issued"/>
          </group>
          <text macro="access"/>
        </else-if>
        <else-if type="patent">
          <group delimiter=", ">
            <text macro="title"/>
            <text variable="number"/>
            <text macro="issued"/>
          </group>
          <text macro="access"/>
        </else-if>
		    <!-- Online Video -->
        <else-if type="motion_picture">
          <text macro="geographic-location" suffix=". "/>
          <group delimiter=", " suffix=".">
            <text macro="title"/>
            <text macro="issued"/>
          </group>
          <text macro="access"/>
        </else-if>
        <!-- Generic/Fallback Formats -->
        <else-if type="bill book graphic legal_case legislation report song" match="any">
          <group delimiter=", " suffix=". ">
            <text macro="title"/>
            <text macro="locators"/>
          </group>
          <group delimiter=", " suffix=".">
            <text macro="publisher"/>
            <text macro="issued"/>
            <text macro="page"/>
          </group>
          <text macro="access"/>
        </else-if>
        <else-if type="article-magazine article-newspaper broadcast interview manuscript map patent personal_communication song speech thesis webpage" match="any">
          <group delimiter=", " suffix=".">
            <text macro="title"/>
            <text variable="container-title" font-style="italic"/>
            <text macro="locators"/>
            <text macro="publisher"/>
            <text macro="page"/>
            <text macro="issued"/>
          </group>
          <text macro="access"/>
        </else-if>
        <else-if type="chapter paper-conference" match="any">
          <group delimiter=", " suffix=", ">
            <text macro="title"/>
            <group delimiter=" ">
              <text term="in"/>
              <text variable="container-title" font-style="italic"/>
            </group>
            <text macro="locators"/>
          </group>
          <text macro="editor" suffix=" "/>
          <group delimiter=", " suffix=".">
            <text macro="publisher"/>
            <text macro="issued"/>
            <text macro="page"/>
          </group>
          <text macro="access"/>
        </else-if>
        <else>
          <group delimiter=", " suffix=". ">
            <text macro="title"/>
            <text variable="container-title" font-style="italic"/>
            <text macro="locators"/>
          </group>
          <group delimiter=", " suffix=".">
            <text macro="publisher"/>
            <text macro="page"/>
            <text macro="issued"/>
          </group>
          <text macro="access"/>
        </else>
      </choose>
    </layout>
  </bibliography>
</style>

locales.en-US

<?xml version="1.0" encoding="utf-8"?>
<locale xmlns="http://purl.org/net/xbiblio/csl" version="1.0" xml:lang="en-US">
  <info>
    <translator>
      <name>Andrew Dunning</name>
    </translator>
    <translator>
      <name>Sebastian Karcher</name>
    </translator>
    <translator>
      <name>Rintze M. Zelle</name>
    </translator>
    <rights license="http://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
    <updated>2015-10-10T23:31:02+00:00</updated>
  </info>
  <style-options punctuation-in-quote="true"/>
  <date form="text">
    <date-part name="month" suffix=" "/>
    <date-part name="day" suffix=", "/>
    <date-part name="year"/>
  </date>
  <date form="numeric">
    <date-part name="month" form="numeric-leading-zeros" suffix="/"/>
    <date-part name="day" form="numeric-leading-zeros" suffix="/"/>
    <date-part name="year"/>
  </date>
  <terms>
    <term name="accessed">accessed</term>
    <term name="and">and</term>
    <term name="and others">and others</term>
    <term name="anonymous">anonymous</term>
    <term name="anonymous" form="short">anon.</term>
    <term name="at">at</term>
    <term name="available at">available at</term>
    <term name="by">by</term>
    <term name="circa">circa</term>
    <term name="circa" form="short">c.</term>
    <term name="cited">cited</term>
    <term name="edition">
      <single>edition</single>
      <multiple>editions</multiple>
    </term>
    <term name="edition" form="short">ed.</term>
    <term name="et-al">et al.</term>
    <term name="forthcoming">forthcoming</term>
    <term name="from">from</term>
    <term name="ibid">ibid.</term>
    <term name="in">in</term>
    <term name="in press">in press</term>
    <term name="internet">internet</term>
    <term name="interview">interview</term>
    <term name="letter">letter</term>
    <term name="no date">no date</term>
    <term name="no date" form="short">n.d.</term>
    <term name="online">online</term>
    <term name="presented at">presented at the</term>
    <term name="reference">
      <single>reference</single>
      <multiple>references</multiple>
    </term>
    <term name="reference" form="short">
      <single>ref.</single>
      <multiple>refs.</multiple>
    </term>
    <term name="retrieved">retrieved</term>
    <term name="scale">scale</term>
    <term name="version">version</term>

    <!-- ANNO DOMINI; BEFORE CHRIST -->
    <term name="ad">AD</term>
    <term name="bc">BC</term>

    <!-- PUNCTUATION -->
    <term name="open-quote"></term>
    <term name="close-quote"></term>
    <term name="open-inner-quote"></term>
    <term name="close-inner-quote"></term>
    <term name="page-range-delimiter"></term>

    <!-- ORDINALS -->
    <term name="ordinal">th</term>
    <term name="ordinal-01">st</term>
    <term name="ordinal-02">nd</term>
    <term name="ordinal-03">rd</term>
    <term name="ordinal-11">th</term>
    <term name="ordinal-12">th</term>
    <term name="ordinal-13">th</term>

    <!-- LONG ORDINALS -->
    <term name="long-ordinal-01">first</term>
    <term name="long-ordinal-02">second</term>
    <term name="long-ordinal-03">third</term>
    <term name="long-ordinal-04">fourth</term>
    <term name="long-ordinal-05">fifth</term>
    <term name="long-ordinal-06">sixth</term>
    <term name="long-ordinal-07">seventh</term>
    <term name="long-ordinal-08">eighth</term>
    <term name="long-ordinal-09">ninth</term>
    <term name="long-ordinal-10">tenth</term>

    <!-- LONG LOCATOR FORMS -->
    <term name="book">
      <single>book</single>
      <multiple>books</multiple>
    </term>
    <term name="chapter">
      <single>chapter</single>
      <multiple>chapters</multiple>
    </term>
    <term name="column">
      <single>column</single>
      <multiple>columns</multiple>
    </term>
    <term name="figure">
      <single>figure</single>
      <multiple>figures</multiple>
    </term>
    <term name="folio">
      <single>folio</single>
      <multiple>folios</multiple>
    </term>
    <term name="issue">
      <single>number</single>
      <multiple>numbers</multiple>
    </term>
    <term name="line">
      <single>line</single>
      <multiple>lines</multiple>
    </term>
    <term name="note">
      <single>note</single>
      <multiple>notes</multiple>
    </term>
    <term name="opus">
      <single>opus</single>
      <multiple>opera</multiple>
    </term>
    <term name="page">
      <single>page</single>
      <multiple>pages</multiple>
    </term>
    <term name="number-of-pages">
      <single>page</single>
      <multiple>pages</multiple>
    </term>
    <term name="paragraph">
      <single>paragraph</single>
      <multiple>paragraphs</multiple>
    </term>
    <term name="part">
      <single>part</single>
      <multiple>parts</multiple>
    </term>
    <term name="section">
      <single>section</single>
      <multiple>sections</multiple>
    </term>
    <term name="sub verbo">
      <single>sub verbo</single>
      <multiple>sub verbis</multiple>
    </term>
    <term name="verse">
      <single>verse</single>
      <multiple>verses</multiple>
    </term>
    <term name="volume">
      <single>volume</single>
      <multiple>volumes</multiple>
    </term>

    <!-- SHORT LOCATOR FORMS -->
    <term name="book" form="short">
      <single>bk.</single>
      <multiple>bks.</multiple>
    </term>
    <term name="chapter" form="short">
      <single>chap.</single>
      <multiple>chaps.</multiple>
    </term>
    <term name="column" form="short">
      <single>col.</single>
      <multiple>cols.</multiple>
    </term>
    <term name="figure" form="short">
      <single>fig.</single>
      <multiple>figs.</multiple>
    </term>
    <term name="folio" form="short">
      <single>fol.</single>
      <multiple>fols.</multiple>
    </term>
    <term name="issue" form="short">
      <single>no.</single>
      <multiple>nos.</multiple>
    </term>
    <term name="line" form="short">
      <single>l.</single>
      <multiple>ll.</multiple>
    </term>
    <term name="note" form="short">
      <single>n.</single>
      <multiple>nn.</multiple>
    </term>
    <term name="opus" form="short">
      <single>op.</single>
      <multiple>opp.</multiple>
    </term>
    <term name="page" form="short">
      <single>p.</single>
      <multiple>pp.</multiple>
    </term>
    <term name="number-of-pages" form="short">
      <single>p.</single>
      <multiple>pp.</multiple>
    </term>
    <term name="paragraph" form="short">
      <single>para.</single>
      <multiple>paras.</multiple>
    </term>
    <term name="part" form="short">
      <single>pt.</single>
      <multiple>pts.</multiple>
    </term>
    <term name="section" form="short">
      <single>sec.</single>
      <multiple>secs.</multiple>
    </term>
    <term name="sub verbo" form="short">
      <single>s.v.</single>
      <multiple>s.vv.</multiple>
    </term>
    <term name="verse" form="short">
      <single>v.</single>
      <multiple>vv.</multiple>
    </term>
    <term name="volume" form="short">
      <single>vol.</single>
      <multiple>vols.</multiple>
    </term>

    <!-- SYMBOL LOCATOR FORMS -->
    <term name="paragraph" form="symbol">
      <single></single>
      <multiple>¶¶</multiple>
    </term>
    <term name="section" form="symbol">
      <single>§</single>
      <multiple>§§</multiple>
    </term>

    <!-- LONG ROLE FORMS -->
    <term name="director">
      <single>director</single>
      <multiple>directors</multiple>
    </term>
    <term name="editor">
      <single>editor</single>
      <multiple>editors</multiple>
    </term>
    <term name="editorial-director">
      <single>editor</single>
      <multiple>editors</multiple>
    </term>
    <term name="illustrator">
      <single>illustrator</single>
      <multiple>illustrators</multiple>
    </term>
    <term name="translator">
      <single>translator</single>
      <multiple>translators</multiple>
    </term>
    <term name="editortranslator">
      <single>editor &amp; translator</single>
      <multiple>editors &amp; translators</multiple>
    </term>

    <!-- SHORT ROLE FORMS -->
    <term name="director" form="short">
      <single>dir.</single>
      <multiple>dirs.</multiple>
    </term>
    <term name="editor" form="short">
      <single>ed.</single>
      <multiple>eds.</multiple>
    </term>
    <term name="editorial-director" form="short">
      <single>ed.</single>
      <multiple>eds.</multiple>
    </term>
    <term name="illustrator" form="short">
      <single>ill.</single>
      <multiple>ills.</multiple>
    </term>
    <term name="translator" form="short">
      <single>tran.</single>
      <multiple>trans.</multiple>
    </term>
    <term name="editortranslator" form="short">
      <single>ed. &amp; tran.</single>
      <multiple>eds. &amp; trans.</multiple>
    </term>

    <!-- VERB ROLE FORMS -->
    <term name="container-author" form="verb">by</term>
    <term name="director" form="verb">directed by</term>
    <term name="editor" form="verb">edited by</term>
    <term name="editorial-director" form="verb">edited by</term>
    <term name="illustrator" form="verb">illustrated by</term>
    <term name="interviewer" form="verb">interview by</term>
    <term name="recipient" form="verb">to</term>
    <term name="reviewed-author" form="verb">by</term>
    <term name="translator" form="verb">translated by</term>
    <term name="editortranslator" form="verb">edited &amp; translated by</term>

    <!-- SHORT VERB ROLE FORMS -->
    <term name="director" form="verb-short">dir. by</term>
    <term name="editor" form="verb-short">ed. by</term>
    <term name="editorial-director" form="verb-short">ed. by</term>
    <term name="illustrator" form="verb-short">illus. by</term>
    <term name="translator" form="verb-short">trans. by</term>
    <term name="editortranslator" form="verb-short">ed. &amp; trans. by</term>

    <!-- LONG MONTH FORMS -->
    <term name="month-01">January</term>
    <term name="month-02">February</term>
    <term name="month-03">March</term>
    <term name="month-04">April</term>
    <term name="month-05">May</term>
    <term name="month-06">June</term>
    <term name="month-07">July</term>
    <term name="month-08">August</term>
    <term name="month-09">September</term>
    <term name="month-10">October</term>
    <term name="month-11">November</term>
    <term name="month-12">December</term>

    <!-- SHORT MONTH FORMS -->
    <term name="month-01" form="short">Jan.</term>
    <term name="month-02" form="short">Feb.</term>
    <term name="month-03" form="short">Mar.</term>
    <term name="month-04" form="short">Apr.</term>
    <term name="month-05" form="short">May</term>
    <term name="month-06" form="short">Jun.</term>
    <term name="month-07" form="short">Jul.</term>
    <term name="month-08" form="short">Aug.</term>
    <term name="month-09" form="short">Sep.</term>
    <term name="month-10" form="short">Oct.</term>
    <term name="month-11" form="short">Nov.</term>
    <term name="month-12" form="short">Dec.</term>

    <!-- SEASONS -->
    <term name="season-01">Spring</term>
    <term name="season-02">Summer</term>
    <term name="season-03">Autumn</term>
    <term name="season-04">Winter</term>
  </terms>
</locale>