Keeping research notes: my Markdown-LaTeX-Zotero-Pandoc workflow

Date: 2015-11-20

After creating a nice writing environment, my next objective was to be able to take quick research notes, with the following conditions:

Than this:

So, here is the solution I’ve come up with and the things you need to do to have a similar setup.

  1. Install Zotero with Better BibTeX. Import references from the web as you stumble across them with the Zotero extension for your browser.
  2. Set your Better BibTeX preferences to enable automatic export of your citations better-bibtex-preferences-screenshot
  3. Create a folder in Zotero for your notes, drag and drop the papers you want to cite into the folder, then right click the folder name and click ‘Export Collection’, making sure the ‘Keep updated’ box is checked. Then save the .bib file in the same folder as you want to write your notes.
  4. Set Zotero to export Pandoc citation keys pandoc-citekey-screenshot
  5. For easier citing, change the default citekey format easier-citing-screenshot
  6. Write your notes in markdown format - basically just create a text file with the extension .md instead of .txt. You can do this from the terminal with touch (Or just use Vim :))
  7. When you want to cite a paper in your notes, type in the citekey like this follows: blah blah (???). You can also grab the citekey from Zotero by clicking on the paper name, and pressing Cmd+Shift+C (on Mac, shortcut will vary on other systems).
  8. Install Pandoc - a ‘swiss army knife’ application that can convert between a number of document formats. If you have a Mac and Homebrew installed, this is as easy as typing in brew install pandoc-citeproc at the terminal prompt.
  9. At the top of your file, insert a YAML header that contains information for Pandoc. In the example below:

‘CSL’ stands for ‘custom style language’. Basically, it sets the citation style for the document. The default citation style follows the Chicago Style Manual, but you can download a custom citation style from here and modify it to your heart’s desire. Similarly, you can use a modified copy of the default LaTeX template that Pandoc provides (Located at /usr/local/Cellar/pandoc/, for example) if you want to use certain packages, styles, etc. 10. In the terminal, change to the directory that contains and notes.bib, then type in at the prompt: pandoc -s --filter pandoc-citeproc --latex-engine=pdflatex -o notes.pdf for a PDF file. You can convert to other formats too, with the appropriate commands.

Here is an example screenshot comparing the markdown and TeX versions of the same document: markdown-vs-tex-screenshot

And here is the typeset PDF version: notes-blog-pdf

Enjoy :)

  1. A lightweight markup language that was originally created to produce websites without the overhead of HTML and CSS tags, but is now widely adopted in many other contexts, including academia.