     @doc.activate()
 
 Zotero.BetterBibTeX.CAYW.Formatter = {
+  latex: (citations, config) ->
+    config.command ||= 'cite'
+
+    return '' if citations.length == 0
+
+    state = {
+      prefix: 0
+      suffix: 0
+      'suppress-author': 0
+      locator: 0
+      label: 0
+    }
+    if citations.length > 1
+      for citation in citations
+        for own k of citation
+          state[k] ?= 0
+          state[k]++
+
+    if state.suffix == 0 && state.prefix == 0 && state.locator == 0 && state['suppress-author'] in [0, citations.length]
+      # simple case where everything can be put in a single cite
+      return "\\#{if citations[0]['suppress-author'] then 'citeyear' else config.command}{#{(citation.citekey for citation in citations).join(',')}}"
+
+    formatted = ''
+    for citation in citations
+      formatted += ' ' + citation.prefix + ' ' if citation.prefix
+      formatted += "\\"
+      formatted += if citation['suppress-author'] then 'citeyear' else config.command
+
+      switch
+        when citation.locator && citation.suffix
+          formatted += '[' + Zotero.BetterBibTeX.CAYW.shortLocator[citation.label] + ' ' + citation.locator + ', ' + citation.suffix + ']'
+        when citation.locator
+          formatted += '[' + Zotero.BetterBibTeX.CAYW.shortLocator[citation.label] + ' ' + citation.locator + ']'
+        when citation.suffix
+          formatted += '[' + citation.suffix + ']'
+      formatted += '{' + citation.citekey + '}'
+
+    return formatted.trim()
+
   mmd: (citations) ->
     formatted = []
     for citation in citations

    for own key of @config
      @config[key] = config[key] if config[key]

  getItems: -> Q.fcall(-> [])

  accept: (progressCallback) ->

Zotero.BetterBibTeX.CAYW =
  shortLocator:
    article: "art."
    chapter: "ch."
    subchapter: "subch."
    column: "col."
    figure: "fig."
    line: "l."
    note: "n."
    issue: "no."
    opus: "op."
    page: "p."
    paragraph: "para."
    subparagraph: "subpara."
    part: "pt."
    rule: "r."
    section: "sec."
    subsection: "subsec."
    Section: "Sec."
    'sub verbo': "sv."
    schedule: "sch."
    title: "tit."
    verse: "vrs."
    volume: "vol."

class Zotero.BetterBibTeX.CAYW.Document
  constructor: ->
