DEV Community

Robin Winslow
Robin Winslow

Posted on • Originally published at robinwinslow.uk

How to build and customise ModernCV on Ubuntu 23.04

Originally published on my blog.

ModernCV is a customisable LaTeX CV template for creating your résumé.

ModernCV and Cover Letter Template

You can edit it directly and for free on Overleaf, but the version on there is not as customisable as the full source code. So here I'm going to write down how to download, build and customise the original source code on Ubuntu, as I do it.

Prerequisites

First, install LaTeX on Ubuntu:

sudo apt update
sudo apt install -y latexmk texlive-latex-extra texlive-fonts-extra git
Enter fullscreen mode Exit fullscreen mode

The pages we're installing are:

  • LatexMK: A smart compiler for LaTeX documents. It wraps and makes use of pdflatex. It's better than using pdflatex yourself because it will manage any recompiltions and further steps automatically.
  • texlive-latex-extra: This contains the etoolbox package, which is needed for most things including ModernCV.
  • texlive-fonts-extra: This contains fontawesome5, used by ModernCV.
  • Git: You need this to clone ModernCV, if you don't have it.

Build the template ModernCV

Now clone the ModernCV project and build the template CV to check it's working:

git clone https://github.com/moderncv/moderncv  # Get the code
cv moderncv  # Enter the project
latexmk -pdf ./template.tex  # Build the template
Enter fullscreen mode Exit fullscreen mode

If it succeeded, you should see something like this at the bottom of the output:

Output written on template.pdf (6 pages, 351459 bytes).
Transcript written on template.log.
Latexmk: Getting log file 'template.log'
Latexmk: Examining 'template.fls'
Latexmk: Examining 'template.log'
Latexmk: Found input bbl file 'template.bbl'
Latexmk: Log file says output to 'template.pdf'
Latexmk: Found bibliography file(s):
  ./publications.bib
Latexmk: All targets () are up-to-date
Enter fullscreen mode Exit fullscreen mode

And if you open up template.pdf you should now see an example CV for "John Doe".

If you get errors in compiling the PDF, firstly try running it again, or try deleting the directory, cloning it again, and then running if again. If that fails, try copying any error messages into Google to see if you can discover if you can fix the error by installing more texlive packages. It's possible installing textlive-full may help.

Customise the CV

To customise the CV for your own purposes, you should first copy template.tex to make your own .tex file for your CV, and then open that file and start editing it.

cp template.tex yourname.tex  # Make a copy
code yourname.tex  # I like to use VSCode for editing, but you do you
Enter fullscreen mode Exit fullscreen mode

The file has liberal comments to explain to you how to make changes to it. You may want to change the settings at the top of the file for the font size, font style, margins, colour etc.

\documentclass[11pt,a4paper,sans]{moderncv}        % possible options include font size ('10pt', '11pt' and '12pt'), paper size ('a4paper', 'letterpaper', 'a5paper', 'legalpaper', 'executivepaper' and 'landscape') and font family ('sans' and 'roman')

% moderncv themes
\moderncvstyle{classic}                            % style options are 'casual' (default), 'classic', 'banking', 'oldstyle' and 'fancy'
\moderncvcolor{blue}                               % color options 'black', 'blue' (default), 'burgundy', 'green', 'grey', 'orange', 'purple' and 'red'
%\renewcommand{\familydefault}{\sfdefault}         % to set the default font; use '\sfdefault' for the default sans serif font, '\rmdefault' for the default roman one, or any tex font name
%\nopagenumbers{}                                  % uncomment to suppress automatic page numbering for CVs longer than one page

% adjust the page margins
\usepackage[scale=0.75]{geometry}
\setlength{\footskip}{149.60005pt}                 % depending on the amount of information in the footer, you need to change this value. comment this line out and set it to the size given in the warning
%\setlength{\hintscolumnwidth}{3cm}                % if you want to change the width of the column with the dates
%\setlength{\makecvheadnamewidth}{10cm}            % for the 'classic' style, if you want to force the width allocated to your name and avoid line breaks. be careful though, the length is normally calculated to avoid any overlap with your personal info; use this at your own typographical risks...
Enter fullscreen mode Exit fullscreen mode

Then the first thing you should probably do after that is go down to where it says "John Doe" and change it to your name:

\name{John}{Doe}
Enter fullscreen mode Exit fullscreen mode

Once you've made a couple of changes, try building and opening your CV:

latexmk -pdf ./robinwinslowmorris.tex
xdg-open robinwinslowmorris.pdf
Enter fullscreen mode Exit fullscreen mode

I'm not going to explain all of how to edit the .tex file, as it's mostly explained inline. You can also learn more about LaTeX format on Overleaf or on freecodecamp.org.

Top comments (0)