Floating Octothorpe

LaTex CV with CentOS

A little while ago I when through updating my CV. After a bit of digging, I decided to use a LaTex template by Roald Ruiter. This post goes over the steps I when through to compile the template on CentOS 7.

Installing required packages

The first thing to do is install git and unzip. These packages are required to clone the LaTex template, and to unpack packages from CTAN:

yum install -y git unzip

The XeTeX typesetting engine is also available from the CentOS repositories, and can be installed with yum:

yum install -y texlive-collection-xetex texlive-parskip texlive-zapfding

Once the required packages are installed, the CV Template can be cloned from GitHub:

git clone https://github.com/Roald87/xelatex-cv-roald.git
cd xelatex-cv-roald

In addition to the template, 3 files need to be grabbed from the fontawesome CTAN package. This can be done with the following commands:

curl -L -O http://mirrors.ctan.org/fonts/fontawesome.zip
unzip fontawesome.zip
cp fontawesome/tex/fontawesome.sty .
cp fontawesome/tex/fontawesomesymbols-generic.tex .
cp fontawesome/tex/fontawesomesymbols-xeluatex.tex .

Compiling the template

In theory it should now be possible to compile the template with the xelatex command. Unfortunately this produces the following error:

$ xelatex cv-roald-example.tex
...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! fontspec error: "font-not-found"
!
! The font "SourceSansPro" cannot be found.
!
! See the fontspec documentation for further information.
!
! For immediate help type H <return>.
!...............................................

l.63 \setmainfont{SourceSansPro}
                                [
?

This error occurs because CentOS 7 uses version 2.3 of fontspec. However as of version 2.4 the syntax was changed from:

\setmainfont[features]{font}

to:

\setmainfont{font}[features]

To get around this the font section incv-roald.cls can be updated to look something like the following:

% --------------------------------- %
%              FONTS
% --------------------------------- %
\setmainfont[
    Path = Fonts/,
    Extension = .otf ,
    UprightFont = *-Light,
    ItalicFont = *-LightIt,
    BoldFont = *-Semibold,
]{SourceSansPro}

\newfontfamily\titlefont[
    Path = Fonts/,
    Extension = .ttf,
    UprightFont = *-ExtraLight,
    BoldFont = *-SemiBold,
]{AdventPro}

After doing this the template should compile successfully:

$ xelatex cv-roald-example.tex
$ !!

Note: the first time xelatex runs it will create an auxiliary file (cv-roald-example.aux), with position information. xelatex then needs to be run a second time to position the header correctly.

Adding hyperlinks

By default the links in the generated PDF cannot be clicked. This can be fixed using the hyperref package. First update cv-roald.cls to load the package:

\RequirePackage{hyperref} % Needed for links

By default links will have a blue border, this can be avoided by setting the hidelinks option in cv-roald.cls:

\hypersetup{
  hidelinks=true
}

Links can then be added to cv-roald-example.tex. For example:

\href{mailto:[email protected]}{[email protected]}

Once the document has been updated, don't forget to re-run xelatex. If everything goes well, the PDF should now contain hyperlinks:

Screenshot of a PDF with embeded hyperlinks

GitHub fork

A fork of the original CV template with the changes described in this post is available on GitHub.