All you need is text – Markdown (via pandoc) for academia

Many students struggle to find an adequte format for their thesis. Ironically the advent of “modern” WYSIWYG programms seems to make it harder to consistently format a text.

While learning LaTeX may be a bit too much to ask for, markdown is a very minimal language that together with pandoc affords all typesetting needs for an academic paper. While source documents written in markdown can be opened and edited on any PC (or mobile), pandoc can translate it into beautifully formatted pdf and docx (if it is absolutely necessary) files. Specifically markdown implements:

• Headings, Subheadings
• Figures and tables
• Citations and References (here in APA6 but other styles are also possible) • You will need to edit the file paper_v1.md

See the example paper.

Once pandoc and latex is installed the following command generates a pdf.

pandoc -s -S --biblio biblio.bib --csl apa.csl -N -V geometry:margin=1in paper_v1.md -o paper.pdf

All files necessary to replicate and adopt the example can be found here .

11 thoughts on “All you need is text – Markdown (via pandoc) for academia

  1. Maxim

    It sure works. Until it doesn’t. Just yesterday I have spent two hours trying to avoid a figure floating towards the end of my document. There are just no options to keep it in place unless you convert to LaTeX first and specify your wishes there. In other words, things are not entirely well-ironed in this regard, at least not yet. Hopefully in the future.

    Reply
    1. gerhi Post author

      Hi,

      the docx can be produced with:

      > pandoc -s -S –biblio biblio.bib –csl apa.csl paper_v1.md -o paper.docx

      Best Gerrit

      Reply
  2. ap53

    Thanks for the post! I am trying to get my results in docx – yes, absolutely necessary ;-(

    I can’t get the \newpage to work: pandoc consumes it, but I don’t get a new page in Word. Do you get the same issue or am I missing some setting?
    Best,
    ap53

    Reply
    1. Russell

      It appears to not be presently supported (http://stackoverflow.com/questions/15937631/rstudio-knitr-pandoc-word-how-do-i-get-a-new-page-in-my-docx). It doesn’t look like this other approach would quite get you there either (https://bitbucket.org/zuline/md2latex). I’m a little surprised the author didn’t experiment with –reference-docx=APAStyleTemplateHere.dotx. When I ran the conversion to docx the result wasn’t very pretty (with or without the template), the figure in particular became ill-tempered (although I suppose that could be fixed with another command line utility – but then we are leaving the ‘easy’ world behind). Sadly from an Sweave/knitr standpoint xtable doesn’t make tables in markdown, so it seems likely that won’t be quite right. :/

      Reply
  3. ap53

    Hello again, different question!
    I believe you use in Germany the “,” as decimal separator, as we do in Argentina. Are you able to output numbers with it? I have it set up that way in my Windows locale, but R/RStudio gives me a ‘.’.
    Thanks again!!
    ap53

    Reply
  4. Fabrice

    Hi,

    Do you know how to use pandoc to make an APA 6 style compliant manuscript? Being able to use the APA 6 document class in Latex would be really cool, and would surely seal the deal for me. Any clue on how to do this?

    Thanks.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>