28 June 2020

Write Your CV in LateX, Like a Nerd

I write my CV in LateX. I could say that this is because LateX is a professional typesetter and I want my CV to look great. I could say that I don’t want to mess around with layout when Word / Pages decides to throw my header away. These are true, but they are not why I use LateX. I use LateX because I am a nerd. I love the fact that I have taken a boring thing like writing a CV and turned it into a coding problem.

Unfortunately since leaving University, where I fell in love with LaTex, my reasons for using it have fallen to just my CV. Keeping an active installation of MikTex on my little MacBook just so every few years I could update my CV seemed a bit overkill. Luckily I found Overleaf (which I heartily recommend) which allowed me to keep my CV in LaTeX, without having to worry about installing and running it.

This has never sat well with me. It’s not that it doesn’t do what I want - it does - and it does it so well that my not very technical Wife uses it for her CV and wouldn’t even think of changing that.

No, it felt like cheating. It didn’t feel nerdy and really I wanted it to be.

Recently I’ve been bringing the development environment for a number of projects under docker and while I was moving the source for my CV so that it was versioned by git and backed up into Github, I wondered if I could do the same here. It turns out this is pretty easy and someone has already done it!

Thanks to blang I had a git repo with by LaTeX source and a simple build script to produce PDFs for my CVs. I have one copy of my CV for more manager type roles and one for more developer type roles. So this build script processes each of them in turn.

#!/bin/sh

IMAGE=blang/latex:ubuntu
COMMAND=pdflatex

for FILE in *.latex; do
  docker run \
    --rm \
    -i \
    --user="$(id -u):$(id -g)" \
    --net=none \
    -v `pwd`:/data \
    $IMAGE \
    $COMMAND $FILE
done

Bonus, I can now use Github Actions to run this on push and save the produced CVs as artifacts. The multiple CVs are stored in a single zip archive by using the glob pattern supported by the upload artifact action.

name: Build

on: [push, pull_request]

jobs:
  make:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Build CVs
      run: ./build.sh
    - name: Upload CVs
      uses: actions/upload-artifact@v2
      with:
        name: CVs
        path: "**/*.pdf"