John Bokma

Adding Color to a LaTeX Resume

May 30, 2017

Today, after I had rewritten parts of my resume, I decided to give changing the color of the section headings a shot. I generate the PDF version of my resume via a Pandoc LaTex template. Adding support for color to the template had been on my todo list for a while and it turned out easier than I thought.

I wanted users of my template to be able to control the color of the section headings via an entry in the YAML metadata block at the start of their resume as this block is already used to control other aspects of the resume.

I decided to use the xcolor LaTeX package with the svgnames option and hence added the following near the top of the LaTeX template file:

\usepackage[svgnames]{xcolor}

See svgnames Colors from the xcolor Package for a complete list of supported colors.

As I already used the secststy package to change the font of sections changing the color was easy. Originally, I had the following code in the LaTeX template:

% Custom section fonts
\usepackage{sectsty}
\sectionfont{\rmfamily\mdseries\Large}

As the section color is optional I used Pandoc's template language to support this as follows:

% Custom section fonts
\usepackage{sectsty}

$if(section-color)$
\sectionfont{\color{$section-color$}\sffamily\bfseries\Large}
$else$
\sectionfont{\rmfamily\mdseries\Large}
$endif$

Originally I used a serifed (roman) regular font when section-color was defined. However, it didn't look right to me; too thin. So in the final version I released today on Github, if a section-color is defined the section font becomes bold sans serif. If, on the other hand, section-color is not defined sections use a serifed regular font. Also, because that's what I would expect as a user myself. If bold sans serif is desired but no color one can set section-color to black.

After examining the result of using Tomato as a section color I decided that it would be nice if I could change the color of my name on top of the resume as well. So decided to add another option: name-color and changed the following:

% Place name at left
{\huge \name}

in the LaTeX template into:

% Place name at left
$if(name-color)$
{\huge\color{$name-color$}\sffamily\bfseries \name}
$else$
{\huge \name}
$endif$

After some experimenting I settled on DarkSlateGray for the color of my name on top of the resume.

Related

home - blog - email

I am a freelance Perl programmer for hire, download my up-to-date resume (PDF).