I had written a summary of some class down using markdown, which went nice enough during the class as well as after it. However when it came down to studying from it, the experience was less pleasant. Most online tools do not seem to produce something that really looks like I would want it to and getting it into a pretty pdf document that I could potentially print was an entire other problem too.

In comes pandoc. In its simplest invocation, it allowed me to convert the markdown document into a pdf file that looked like it had been produced by writing LaTeX.

pandoc -s input.md -o output.pdf

The solution did not end there, I also wanted to output things in two columns as well as using a proper title and adding myself as the author. For these, I overwrite some of the variables in the default LaTeX template that pandoc uses as an intermediate step in creating my pdf. (pandoc goes markdown → latex → pdf, as far as I can tell) This can be achieved using the --variable argument.

pandoc --variable author="Whoever Wrote It" \
       --variable title="Some Title" \
       --variable classoption=twocolumn \
       --variable papersize=a4paper \
       -s input.md \
       -o output.pdf

author and title are available for just about all of the pandoc output formats I believe. The two bottom variables are specific for LaTeX. I use papersize since the default seemed to be US letter on my system (and who wants that). classoption is something you can use to add various extra options in the documentclass line of LaTeX. I make use of it to ensure my output document has a body in two columns. To see which other variables can be overwritten, you can issue pandoc -D latex which will show you the complete template used.

While this shows how easy it is to create a pretty pdf document using a markdown file you wrote, do not think for one second this is all pandoc can do. There is a multitude of input and output formats it can handle, but for that you will have to look at the documentation yourself.