John Bokma's Hacking & Hiking

# Pandoc Resume LaTeX Template

August 9, 2016

Last week, from Wednesday until Friday; and even a little in the weekend, I have been working on an up-to-date version of my resume. The last version available for download hadn't been updated since 2004. Moreover, I was never really happy with it; too many pages.

To get some inspiration and also to find a better way to write my resume I tried to find examples of Perl programmer resumes because that's what I am; a freelance Perl programmer available for hire. After some Googling I found Peter Sergeant's How to write a Developer CV/Résumé that will get you hired. Since Peter actually hires Perl developers I decided to follow his instructions, which made much more sense to me than the ones I had used to write my old resume.

Since I have some experience with LaTeX I decided to use it for writing the resume in. But now for a nice template. After some more Googling I came upon Jason Blevins' LaTeX CV Template which I decided to use as a base for my own resume.

While writing the resume in LaTeX I soon came up with the idea to create a template for Pandoc; a universal document converter. This way I could write the actual resume in a much simpler mark up language, Markdown, and have Pandoc create the LaTeX and PDF versions. However, since there was already one person waiting for my up-to-date resume I decided to focus on finishing the LaTeX version first.

In the weekend I did some reading up on Pandoc templates, especially YAML metadata blocks which allows one to set variables which can be used to pass on settings to a Pandoc template. The templating engine of Pandoc supports conditionals and for loops (with an optional separator) so there is some control from the YAML metadata block on how things will look in the output result.

Yesterday, I finally could start working on the resume LaTeX template for Pandoc. First, I used pandoc to convert the LaTeX resume to Markdown:

pandoc -o resume.md perl-programmer-john-bokma-resume.tex


This resulted in a Markdown file that required only a few but easy fixes to be directly useable as test input for Pandoc.

And today, after fixing the last issues, I pushed the template and my resume in Markdown, as an example, to my repository resume-pandoc on Github.

## Some Pandoc Template and LaTeX tips

While working on the LaTeX template I had to solve a few issues and learned a few new things. I list some of those below.

### YAML Metadata Block and Template Directives

While variables can be passed on the command line directly to pandoc a YAML metadata block at the start of a markdown document is much easier.

For example, the name that should appear on the resume can be defined as follows:

---
name: John Bokma
...


In a Pandoc template this value can be interpolated by putting the variable name between dollar signs, for example in my LaTeX template I use the following:

\def\name{$name$}


Pandoc has also support for conditional statements. The else branch can be used to set a default. For example:

\hypersetup{
urlcolor=$if(urlcolor)$$urlcolor$$else$blue$endif$,
linkcolor=$if(linkcolor)$$linkcolor$$else$magenta$endif$,
pdfauthor = {\name},
pdfkeywords = {$keywords$},
pdftitle = {\name: Curriculum Vitae},
pdfsubject = {Curriculum Vitae},
pdfpagemode = UseNone
}


### LaTeX minipages side by side

Blevins' resume uses two minipages side by side to create two columns at the top of the first place for contact details, etc. The easiest way I could think of to support this via the YAML metadata block was to create two lists left-column and right-column. Note that at this time of writing my personal resume doesn't use right-column.

left-column:
- 'Email: [contact@johnbokma.com](mailto:contact@johnbokma.com)'
- 'Homepage: [http://johnbokma.com/](http://johnbokma.com/)'
- 'Last Updated: \today'


Note that \today is a LaTex command, inserting the current date.

In the template the minipage is only added if the list exists. If this is the case all list items are added to it. Because each item has to be on a line of its own a double-backslash is used to force a line break, except for the last item.

To accomplish this I put the desired separator after the $sep$ directive. This makes the $for$ work like a join in, for example, Perl.

While developing the template I added a newline between the two minipages, probably to improve readability of the code. However, this causes the minipages to be stacked vertically.

A quick search resulted in a solution in the answers to Why does a linebreak in minipage flow this to the next page?. Don't put a newline between \end{minipage} and the next \begin{minipage}. Since Pandoc directives don't introducing spurious whitelines the following works correctly:

$if(left-column)$
\begin{minipage}[t]{0.495\textwidth}
$for(left-column)$$left-column$$sep$ \\ $endfor$
\end{minipage} % Don't use empty lines after \end and the next \begin{minipage}.
$endif$
$if(right-column)$
\begin{minipage}[t]{0.495\textwidth}
$for(right-column)$$right-column$$sep$ \\ $endfor$
\end{minipage}
$endif$


Note that at this time of writing my own resume only uses left-column.

### Anti-aliased Fonts in PDF

While doing some final testing, I discovered that if I let pandoc create the PDF file via pdflatex the fonts in the resulting PDF didn't use anti-aliasing. However, manually running pdflatex using the LaTeX version generated by pandoc as input didn't have this issue. After some online reading I found a solution; I just had to add the following line to my LaTeX template:

\usepackage{lmodern}


### Description List with Multi Line Labels

My resume uses description lists a lot. And while writing the LaTeX version of my resume, last week, I ran into the problem that long description labels just run off the page. I did find an ugly hack, using a parbox, but of course this forced the text following the description label on a new line instead of after.

Yesterday I finally read the documentation of enumitem, a package which offers control of the layout of itemize, enumerate, and description. I experimented a bit but after a while I decided to register with Stack Overflow, at last, and ask for help; enumitem: multiline label with text following label.

And soon I had an answer, thanks to both Christoph Frings, and Andrew, the latter who provided the following minimal but working example:

\documentclass{article}
\usepackage{enumitem}
\begin{document}

\setlist[description]{leftmargin=0em,style=sameline}
\begin{description}
\item [Optimization of molecular methods and statistical procedures
for forensic fingerprinting of microbial soil communities]
description of this item
\end{description}
\end{document}


This solution does exactly what I want, thanks both!

### List item on new line

In my resume I use at one point an itemize list inside a description item. And in this case I don't want the first item of the itemize list to follow the label of the description list but to have it starting on a new line.

A solution I found in an answer to Itemize item on new line when nested in a description [duplicate] mentioned adding an empty first item, i.e. \item[]. Since the enumitem package provides a before option I tried the following:

\setlist[itemize]{leftmargin=1em,label={--},before=\item[]}


Which does exactly what I want, though I am not sure if this is just a hack and if the enumitem package has a better way to solve this.

## Get it on GitHub

The LaTeX resume template, some instructions, and my resume in Markdown as an example are all available via my repository resume-pandoc on Github. Pull requests and feedback are very welcome.