Bibtex key translator for Markdown (pandoc)

Hi,

I recently started writing a paper in Markdown with pandoc and a Zotero exported bibtex file. As I wanted to get the corresponding citation key directly from the Zotero ui I modified the transloator BibTeX-citep (https://forums.zotero.org/discussion/5094/) to output markdown citation keys: @key; @2ndkey; ...

You can find it here:
https://gist.github.com/liob/6009553

Instructions:

>> save the file to your Zotero translator's directory and restart Zotero.
>>
>> If you don't know where your translator's directory is: go to Zotero Preferences. Open the Advanced pane. Click on "Show Data Directory." This will take you to a "zotero" folder. The "zotero" folder will contain a "translators" folder. Save the.BibTexCiteKeyForMarkdown.js file here.
>>
>> After you restart Zotero, you can use the drag and drop functionality by going to the "Export" preferences pane and choosing "BibTeX key for Markdown" as the Default Output Format. Now, you can select a reference and drag it off the screen into a waiting text editor. Alternatively you can use Cmd+Shift+C to copy the @key to your clipboard.

Enjoy.
  • Thank you for sharing, just what I needed for pandoc.
  • Thanks for this.

    For anyone using the Better BibTex/Better BibLatex (https://github.com/ZotPlus/zotero-better-bibtex) exporters, I've modified this code to output citations as `@Author1999`, to match Better BibLatex, rather than the original `@author_title_1999`.

    https://gist.github.com/EoinTravers/50364a0db5b3bb22bc39
  • EoinTravers:
    As far as I understand, BetterBibTeX already has this functionality integrated, so no need for a custom translator. See https://zotplus.github.io/better-bibtex/Citation-Keys.html#drag-and-drophotkey-citations
  • edited January 29, 2015
    So much as I can tell, the integrated exporter seems to be for LaTex only - if I set the citation command to `@`, for Markdown, it still exports as `\@{AuthorYEAR}`, rather than @AuthorYEAR. I modified wbwinther's exporter, rather than the BetterBibTex one, because I was using it before I installed better BetterBibTex, and because it was easier to understand how it worked.
  • I see. I was to quick in interpreting this. I don't use markdown myself. But don't feel afraid to start an issue on better-bibtex on github. Emiliano is usually very quick to add/fix things.
  • Go to Preferences->Export->Default Output Format, and select the "Pandoc Citation" style. Pandoc Citation is included in BBT.
  • I started doing this just the other day too.

    A related bug, I think, is that Zotero will export "$" as part of the citation key when it occurs in a title. pandoc barfs on this, as use of $ seems not to be recommended, if not a technical error.

    (Didn't find an authoritative ref for that, just a bunch of comments here and there.)
  • 'Pandoc Citation' uses the BBT citation keys; '$' signs are filtered out by default, although they'll be retained if you add them yourself.
  • Yes, I was talking about Zotero's native BibTeX export. Should've been clearer about that.
  • Is there any reason why "Pandoc Citation" would be absent from Default Output Format? It's present as a QuickCopy format under the Better BibTeX section of Preferences.
  • Pandoc Citation (and other quick copy formats) have been merged into a single "Better BibTeX Quick Copy" translator to cut down the overhead in the list of translators. You can select "Better BibTeX Quick Copy" as the Default Output Format, and the actual output it generates can be set in the BBT preferences.
Sign In or Register to comment.