It’s nothing new that I am a big fan of Markdown and Pandoc for everything related to writing and publishing. For the last conference paper I wrote, I wanted to go all the way: write exclusively in Markdown and let Pandoc/LaTeX do the conversion and typesetting. I’m not going to show the actual example because the review process is double-blind…

Body text

Usually, LaTeX style files are provided for sending in journal or conference papers. The traditional approach would be to start from a provided template and use LaTeX syntax to type the text. I did something else. I replaced the body (the part between \begin{document} and \end{document}) of the provided template tex file with the following:


This file is now the template, let’s call it template.tex. We now create a markdown file in which we put some content using Markdown syntax: The markdown file can be converted into a PDF using the following Pandoc instruction:

pandoc -o paper.pdf --template template.tex

That’s it! All style information is covered in the template (the provided style file) and the content is provided by the Markdown file. You might have guessed that Pandoc uses $body$ as a placeholder for pasting the content from the Markdown file (after converting it to LaTeX format).

Well, actually, we’re not finished yet. We don’t yet have a title, an author, an abstract, references, graphics, …

Title, Author, Date

Adding the title, an author and/or the date is similarly easy as the body of the text. Pandoc has since long supported this by means of a special syntax in the beginning of the Markdown file:

% A title for the paper
% T Verbeiren
% 2/4/2014

This is automatically converted into variables that can be used in the template as such:

<pre class="lang:tex decode:true">\title{$title$}

Later, in the body of the document a \maketitle line should be present in order to print the title.

This is just the basics. Have multiple authors? Check the documentation or the template that is provided by Pandoc itself.


Pandoc does not have a default way of handling abstracts. But since Pandoc v. 1.12.2, YAML blocks can be added to the beginning of a Markdown file and Pandoc knows how to deal with them. This allows for custom parsing of variables like an abstract. In our file, we put the following YAML block:

abstract: |
  This is the abstract.
  Multiple lines are not problem.
  They are all included.

In the template.tex file, the following is sufficient to add the abstract to the title:


Citations and References

Pandoc has support for citations in different styles, but unfortunately the one I needed to use was not there. If you find it in the list of available styles, use this method. I reverted to using plain old LaTeX syntax in the Markdown file. Pandoc makes sure it passes the LaTeX command along.

In the same vein, I used LaTeX references (\label{foo} and \ref{foo}) for referring to floating figures.


Adding figures is simply a matter of providing the template with the correct snippet. I derived mine from the template that is provided by Pandoc:


Add this to the preamble of the template file and in the Markdown file you can use the usual syntax to refer to a figure:

![This is where the caption goes.\label{foo}](foo.png)

That’s it!

Additional tuning can be done, extra packages can be loaded. Also, by using the YAML code blocks, one can add affiliations, keywords, acknowledgments and other information to the Markdown document that depending on the template is used to generate the PDF/HTML/… output.