Pandoc Templates

GitHub Repo


A collection of support files for use with Pandoc, and specifically for helping to turn pandoc markdown files into nice HTML, LaTeX, PDF, and Microsoft Word Document output. These files go in your ~/.pandoc/ folder.


To install, simply run this command from your Terminal:

python git clone ~/.pandoc

This will clone this repositorty into the appropriate Pandoc templates directory.


What’s included?

  • Under templates, some Pandoc templates for an article in PDF (via LaTeX) or HTML. These can be be pointed to directly with the --template= switch as appropriate. The html.template, latex.template, and xelatex.template files are all forked from KJ Healy’s pandoc-templates repo. The reference.docx file, however, is of my own creation. It can be used via the --reference-docx pandoc option. The .docx template uses Hoefler Text as its font. It is double spaced, with small caps headers and 1” indented, single-line block quotes. It works well for academic papers. The latex.template and xelatex.template depend on the style files in latex-custom-kjh.
  • Under marked, a single CSS file for generating HTML previews of Markdown documents using Marked, a very handy HTML live previewer for markdown files. The css file in the marked/ folder is meant to be used together with pandoc and Marked. To have Marked work with Pandoc, simply go to Marked > Preferences > Advanced. Then specify the filepath to Pandoc like this (e.g.): /usr/bin/pandoc and the various switches and arguments to pandoc in the ‘Args’ field below it, like this: shell -r markdown -w html -s -S --bibliography=biblio.bib Then check the box telling Marked to use this by default. The pandoc CSS file can be added in Marked > Style > Custom CSS. Marked can then use it to format the HTML output such that it looks like the final .docx file will.
  • The CSL files in the csl/ folder format the bibliography generated by pandoc and citeproc. (For simplicity we avoid dealing with biblatex directly at all.) The chicago-syllabus.csl file makes a tiny change to a standard Chicago Notes CSL file so you can use it to output citation information in the body text of a document. This makes it useful for lists of references in CVs and course syllabuses. The other files are the APA, MLA, and Chicago standard files from the main CSL styles repository.
  • Under defaults, you will find all of Pandoc’s standard templates for the many of its output formats. These can be helpful in creating your own templates.
  • Finally, under examples, you will find one plain text Markdown file, one BibTeX .bib file and a .docx file. These demonstrate how these templates can be used to generate a beautiful Microsoft Word file from Pandoc. To generate the files for youself, use this pandoc command: shell -r markdown -w docx -s -S --bibliography=Thesis.bib --csl=/Users/smargheim/Documents/GitHub/pandoc-templates/csl/chicago-author-date.csl --reference-docx=/Users/smargheim/Documents/GitHub/pandoc-templates/templates/reference.docx academic_test.txt --output=academic_test.docx