# Some TeX Developments

Coding in the TeX world

## Writing a curriculum vitae in LaTeX: Part 4

I’ve looked over the last few days at some issues centring on writing a CV in LaTeX, first looking at the wider picture, then at creating a CV using custom macros and most recently at including a list of publications. To round things off, I’m going to create a short example: the source of my own CV cut down to a blog post. Before I do that, I’d point out that everyone’s CV is different, and while my approach makes sense for me it should be seen very much as something to pick up ideas from more than any form of template.

I’ll start as before by loading the article class and setting up some fonts. To allow a bit of flexibility, here I’ve made LuaLaTeX optional, so that the file can be processed, for example, using TeX4ht. As far as possible, the look will be the same with pdfLaTeX or LuaLaTeX (as I said earlier, I use LuaLaTeX for my CV as it makes some aspects of the real thing easier).

\documentclass[11pt]{article}

\usepackage{ifluatex}
\ifluatex
\usepackage{fontspec}
\setmainfont[Ligatures = TeX,Numbers = OldStyle]{TeX Gyre Pagella}
\setmonofont[Ligatures = TeX]{Inconsolata}
\else
\usepackage[T1]{fontenc}
\usepackage{tgpagella}
\usepackage{inconsolata}
\fi

The next phase is to load the rest of the support needed, with hyperref last as this is usually the best idea.

\usepackage{array,etaremune,geometry,fixltx2e,microtype,pifont}
\usepackage{ragged2e,titlesec,xcolor}
\usepackage{hyperref}

Setting up hyperref is easy, so that is done next.

\hypersetup
{
pdfauthor = Joseph Wright    ,
pdftitle  = Curriculum Vitae
}

Now there is some adjustment of the appearance. The page size is adjusted, and as I described in part 2 I set up a custom appearance for sections and subsections. I also miss out page numbers (which should not really be needed in a two page CV), and alter spacing a little.

\geometry
{
a4paper         ,
nofoot          ,
hmargin = 1.5cm ,
vmargin = 2cm
}

\titleformat{\section}{\Large\bfseries\sffamily}{}{0 em}
{%
\begingroup
\color{gray!30}%
\titleline{\leaders\hrule height 0.6 em\hfill\kern 0 pt\relax}%
\endgroup
\nobreak
\vspace{-1.2 em}%
\nobreak
}

\titleformat{\subsection}{\large\itshape}{}{0 em}{}

\renewcommand*\arraystretch{1.4}
\pagestyle{empty}
\frenchspacing

## Specialist macros

Now comes some custom code, first for publications as I described in part 3.

\newcommand*{\paper}[2]
{\item \href{http://dx.doi.org/#1}{\ignorespaces#2\unskip.}}
\newcommand*{\papertitle}[1]
{%
\begingroup
\ifluatex
\fi
\emph{#1}%
\endgroup
}

Next is the set up for the tabular nature of the CV. The text used here sets the width of the left-hand column, so may need to be adjusted to suite whatever is the widest thing you actually use!

\newlength{\sidewidth}
\newlength{\mainwidth}
\AtBeginDocument
{%
\settowidth{\sidewidth}{\textbf{Professional bodies}\hspace{0.75 em}}%
\setlength{\mainwidth}{\dimexpr\linewidth - \sidewidth\relax}%
}

Finally for the preamble, the macros which actually go into the body of the CV.

\newcommand*{\headline}[1]
{%
\hbox{%
\llap{\ding{72}\hspace*{0.2 em}}%
\textbf{#1}%
}%
}
\newenvironment{CVtable}
{%
\begin{tabular}
{@{}>{\bfseries}p{\sidewidth}@{}>{\RaggedRight}p{\mainwidth}@{}}%
}
{\end{tabular}}

## The document body

There is not so much you can say about the body of the CV! As described before, I start of with some general contact details.

\begin{document}

% Title block
\begin{raggedleft}
\textbf{Joseph Wright}    \\
School of Chemistry       \\
University of East Anglia \\
Norwich NR4 7TJ           \\
Tel.: 01603 592902        \\
Mobile: 0797 414 8180     \\
\href{mailto:joseph.wright@uea.ac.uk}
{\texttt{joseph.wright@uea.ac.uk}} \\
\end{raggedleft}

\begin{center}
\Huge\bfseries\sffamily
Joseph Alexander Wright
\end{center}

The first of several sections. Here, I’ve taken one which also has subsections, which work in the normal way.

\section{Employment history}

\subsection{Current position}

\begin{CVtable}
2008-- &
\headline{PDRA -- University of East Anglia} \par
Supervisor Prof.~C.~J.~Pickett \par
Studies on [Fe]- and [FeFe]-hydrogenase active sites mimics \par
Synthesis of novel ligands and model compounds \par
Mechanistic studies using stopped-flow UV and IR spectroscopies
\\
\end{CVtable}

\subsection{Previous positions}

\begin{CVtable}
2007--2008 &
\headline{Senior Demonstrator -- University of East Anglia} \par
Teaching degree level chemistry:
tutorials and laboratory classes \par
Preparation of M.~Chem.~third year practical course in
organic chemistry
\end{CVtable}

\dots

Several more sections would now follow, but I’ll leave this to the imagination.

\section{Academic history}

\dots

I find that it’s best to start a publication list on a new page, as I have quite a lot. In the UK, this list does not count as part of the general CV, so is allowed to go beyond two pages. As I said in part 3 of the series, it’s often useful to have this list as a separate file.

\newpage

\section{List of Publications}

\begin{etaremune}[start = 45] % Remember to adjust this
\paper{10.1021/ja2087536}{
\papertitle{Paramagnetic Bridging Hydrides of Relevance to Catalytic
Hydrogen Evolution at Metallosulfur Centers}, A.~Jablonskyt{\.e},
J.\,A.~Wright, S.\,A.~Fairhurst, J.\,N.\,T.~Peck, S.\,K.~Ibrahim,
V.\,S.~Oganesyan, and C.\,J.~Pickett, \emph{J.~Am. Chem. Soc.},
in press
}

\paper{10.1039/c1cc11320h}{
\papertitle{The role of CN and CO ligands in the vibrational relaxation
dynamics of model compounds of the [FeFe]-\break hydrogenase enzyme},
S.~Kaziannis, J.\,A.~Wright, M.~Candelaresi, R.~Kania, G.\,M.~Greetham,
A.\,W.~Parker, C.\,J.~Pickett and N.\,T.~Hunt
\emph{Phys. Chem. Chem. Phys.}, 2011, \textbf{13}, 10295--10305
}

\end{etaremune}

\dots

\end{document}


Written by Joseph Wright

November 8th, 2011 at 8:31 pm

Posted in General

Tagged with ,

## Writing a curriculum vitae in LaTeX: Part 3

I work in a university, so an important part of my CV is a list of my publications. In part 2, I described how I put together the bulk of my CV using some custom macros: here, I’ll focus on publications.

## BibTeX?

The obvious approach to setting up a publication list is to use a BibTeX database. I have all of my publications in one, so that does suggest itself as an easy way to go. As with the balance between pre-built styles and custom macros, I’ve decided that for a CV the task is sufficiently specialised that doing it by hand is actually easier. There are a few reasons.

Usually, you give your publications in date order, newest first. That won’t quite come out correctly if you simply order by year, so using BibTeX it’s best to \nocite the keys in the order you want. No big deal, but it does mean you can’t just dump them all in one go.

There are a couple of style differences between what I want in my CV and what I’d usually use in a publication. We chemists don’t normally include article titles in citations, but for a CV it makes sense to add these. At the same time, I like to add hyperlinks to my publications in my CV using the DOI system. These can both be added to a standard BibTeX style (indeed, my own biblatex-chem style already has a switch for titles), but of course it’s another thing to sort out.

The inclusion of article titles brings me to perhaps the biggest reason that I’m not using BibTeX for my CV. Chemistry titles tend to contain lots of awkward material, such as formulae, which are hard to line break well. So there is a bit of work to do by hand to get things looking right. If I only ever used the publication list in my CV, with one set of formatting rules, then that would be fine. However, I use it in a few ways, and so manually adjusting line breaks via BibTeX is more awkward than simply including the text directly.

## A little structure

While usually my publication list is part of my CV, I sometimes need it as a stand-alone document. So I have the list itself as a separate file, and \input it into the main CV source. So all I have to do for a stand-alone list of publications is write a short wrapper around the list (again as a separate file).

Whether you use BibTeX or not, you’ll need to do is set up a reverse-enumerated environment, so that the most recent publication has the highest number. I do that using the etaremune package, which provides a suitable environment. The package needs to know how many items to enumerate, so either two LaTeX runs or a known starting value are needed. As I work by hand, I go with the latter approach

\begin{etaremune}[start  = 45] % Update when you add a publication
...
\end{etaremune}

It’s then just a question of filling in the items. I use a couple of custom macros for this. First, to let me quickly wrap up each entire item in a hyperlink, I define

\newcommand*{\paper}[2]{%
% Standard style
\item \href{http://dx.doi.org/#1}{\ignorespaces#2\unskip.}
% Including DOI
%\item \href{http://dx.doi.org/#1}
%  {\ignorespaces#2\unskip.\\\textsc{doi}: \texttt{#1}}
}

which takes the text as #1 and the DOI as #2. As you can see from the comments, this lets me quickly decide whether I want to include the DOI in the printed output or to just use it to create a link.

The second custom macro is one for the paper title

\newcommand*{\papertitle}[1]{%
\begingroup
\emph{#1}%
\endgroup
}

There are a couple of reasons for having a macro here. The first is that lining numbers seem to work better in chemical formulae than lower case ones do: of course this is my opinion! The second reason is that it makes it easy to quickly omit the title entirely if I need a short version of the publication list.

## Putting it all together

I’ve covered a few different ideas for creating a CV in LaTeX. Each one is I hope pretty simple, and as I’ve said most people want a CV that’s in a style they have chosen. But it’s always nice to have something complete to start from. So in the final part of this short series, I’ll put the various ideas together into an example.

Written by Joseph Wright

November 7th, 2011 at 9:18 am

Posted in General

Tagged with ,

## Writing a curriculum vitae in LaTeX: Part 2

In part 1, I looked at some general ideas about writing CVs, and said that my approach is to ‘roll my own’ format based on the standard article class. Here, I want to look at the process in a bit more detail. Most of this is about using LaTeX, and so the ideas I use apply to many other cases.

I make use of quite a few packages to get the appearance as I want. Rather than list all of them at once, I’ll take about the effects I’m aiming for, and include the package names as I go.

## Setting up the appearance

Starting from the article class, the first thing to address is the overall appearance of the CV. The standard Computers Modern font is well designed, but I guess says ‘LaTeX’ in a may that many people don’t want for a CV. With the availability of XeTeX and LuaTeX, using system fonts is easy (using fontspec, of course), and that’s particularly useful if like me you have some non-Latin characters that you’d like to include in the CV but keep visually ‘matching’ everything else.  For me, LuaTeX turns out to be a better choice than XeTeX (I want fully-functional microtypography as it helps with typesetting chemical names), so my CV starts off with

% !TeX program = LuaLaTeX
\documentclass[11pt,draft]{article}

% Font set up
\usepackage{fontspec}
\setmainfont[Ligatures = TeX,Numbers = OldStyle]{TeX Gyre Pagella}
\setmonofont[Ligatures = TeX]{Inconsolata}

Here, as well as loading the fonts I like, I’ve set up to use lower case (old style) numbers as recommend by Bringhurst. I’ve also included a ‘magic’ comment to let my editor know to use LuaLaTeX. You might wonder about the draft option: I’ll come back to that later.

As I say, I want microtypography set up, so do

\usepackage[final]{microtype}

(Using the final option here will override the draft one set for the document class.)

That sets up the fonts, but what about page layout? Well, the standard here is to use the geometry package

\usepackage[a4paper,nohead,nofoot,hmargin=1.5cm,vmargin=2cm]{geometry}

I have pretty small margins, as for a CV this seems to make the most sense. I’m also not going to use a header or footer (so set \pagestyle{empty}), and so remove the space normally reserved for those.

Before looking at the content of the CV, I’ll mention hyperlinks as these come up throughout. My CV usually gets sent electronically, and I want to be able to include links for my e-mail address and publications. So I have

\usepackage[final]{hyperref}

\hypersetup
{
pdfauthor = Joseph Wright ,
pdftitle = Curriculum Vitae
}

at the end of my package-loading section. The hyperref package deals with the links, while the set up makes them blend in to the text and adds my name to the PDF information.

A very common way to start a CV is with basic contact details: what I’m going to call an ‘address block’. I do this very simply

\begin{document}

% Title block
\begin{raggedleft}
\textbf{Joseph Wright}    \\
School of Chemistry       \\
University of East Anglia \\
Norwich NR4 7TJ           \\
Tel.: 01603 592902        \\
Mobile: 0797 414 8180     \\
\href{mailto:joseph.wright@uea.ac.uk}
{\texttt{joseph.wright@uea.ac.uk}} \\
\end{raggedleft}

This therefore sits at the top of the first page, and comes out (to my mind) in a very pleasing style.

Also as part of the lead-off, it’s normal to have your name (never ‘Curriculum Vitae’), which again I do in a very straightforward way

\begin{center}
\Huge\bfseries\sffamily
Joseph Alexander Wright
\end{center}

## Sections and subsections

A CV needs several sections, for example ‘Employment history’, ‘Skills’ and so on. The standard LaTeX \section is the best choice of logical mark up for these, but the appearance is going to be wrong without adjustment. Taking some inspiration from the CurVe class, and using the abilities of titlesec and xcolor, the output can be customised to give something much more pleasing for a CV. I use

% Create some nice looking section dividers without too much fuss
\titleformat\section{\Large\bfseries\sffamily}{}{0 em}
{%
% This is put in _before_ the text so that an overlap is possible
\begingroup
\color{gray!30}%
\titleline{\leaders\hrule height 0.6 em\hfill\kern 0 pt\relax}%
\endgroup
\nobreak
\vspace{-1.2 em}%
\nobreak
}

which inserts a grey bar across the page, and places the name of the section (with no number) partially overlapping the bar.

For subsections, I go for a much lower visual impact

\titleformat{\subsection}{\large\itshape}{}{0 em}{}

which is enough to make them stand out from the body text, but keeps things flowing.

## The main body: lots of tables

The normal layout for the body of a CV is to use something based on a table, with ‘entries’ on the left and ‘information’ on the right. This can be done in lots of ways, but the approach I take is to set up a fixed column width in the preamble, then apply this to all of the CV. That requires a bit of set up

% Semi-automatically set up the table width
\newlength\sidewidth
\newlength\mainwidth
\AtBeginDocument{%
\settowidth\sidewidth{\textbf{Professional bodies}\hspace{0.75 em}}%
\setlength\mainwidth{\dimexpr\linewidth - \sidewidth\relax}%
}

Here, I’m setting two lengths to control the tables, with the only hard-coded part being the text I use to set the left-hand side width. I use the longest entry I’m going to use: in my case this is ‘Professional bodies’.

I then need the tables themselves. As they are all the same, it makes sense to set them up as a new kind of environment

\newenvironment{CVtable}
{%
\begin{tabular}
{@{}>{\bfseries}p{\sidewidth}@{}>{\RaggedRight}p{\mainwidth}@{}}%
}
{\end{tabular}}

(this uses the array package). I also \renewcommand*\arraystretch{1.4}, as this spreads the tables out a bit and I think makes things look less crowded.

The new environment is then used for each (sub)section, and contains the body of the CV, for example

\section{Employment history}

\subsection{Current position}

\begin{CVtable}
2008-- &
\headline{PDRA -- University of East Anglia} \par
Supervisor Prof.~C.~J.~Pickett \par
Studies on [Fe]- and [FeFe]-hydrogenase active sites mimics \par
Synthesis of novel ligands and model compounds \par
Mechanistic studies using stopped-flow UV and IR spectroscopies
\\
\end{CVtable}

\subsection{Previous positions}

\begin{CVtable}
2007--2008 &
\headline{Senior Demonstrator -- University of East Anglia} \par
Teaching degree level chemistry:
tutorials and laboratory classes \par
Preparation of M.~Chem.~third year practical course in
organic chemistry
\\

2005--2008 &
\headline{PDRA -- University of East Anglia} \par
Supervisor Prof.~M.~Bochmann \par
Use of zirconium phosphonates as heterogeneous catalyst supports \par
Synthesis of novel ligand systems for early transition metals
\\

2003--2004 &
\headline{PDRA -- University of Southampton} \par
Supervisor Dr A.\,A.~Danopoulos \par
Synthesis of novel N-heterocyclic carbene complexes \par
Catalytic testing on novel systems
\\
\end{CVtable}

You’ll notice the \headline macro here: it’s another formatting shortcut. It’s for making effectively subsubsections within my CV table, and is defined as

\newcommand*\headline[1]{%
\hbox{%
\llap{\ding{72}\hspace*{0.2 em}}%
\textbf{#1}%
}%
}

making use of the pifont package to provide a nice-looking star for each entry. You’ll see in the above example that I use it for things like marking up each job I’ve had in the table of employment history.

## Other refinements

As I mentioned in part 1, one of the advantages of using LaTeX is that you can store information in your CV as comments. That might be as simple as commenting-out lines that you want to miss out for a particular job, but you might also want to deal with longer optional sections. The comment package is ideal for this, as it lets you mark up sections for inclusion or exclusion in a pretty rapid way.

I mentioned earlier that I set the draft option for my CV, then override it on a package-by-package basis. The reason is that this will always include bars for overfull boxes: useful as you want to check for these.

In the academic area, a list of publications is an important part of a CV (it’s probably the most important part, actually). I’ve got a few things to say about that area, but this post is already long enough, so it will wait for the next part!

Written by Joseph Wright

November 6th, 2011 at 12:08 pm

Posted in General

Tagged with ,

## Writing a curriculum vitae in LaTeX: Part 1

Writing a curriculum vitae (what Americans would call a résumé) is something that most of us have to do when applying for jobs. LaTeX users will naturally want to do this using LaTeX. Beyond the technical detail, there’s also the question of the wider requirements for a CV: while these are not LaTeX-related, they do form an important part of the process. So here I’d like to look first at the big picture, and then at some of the LaTeX approaches available.

## What is a CV?

Before we look at writing a CV, it’s important to be clear on what its for. Broadly, a CV is a condensed and (hopefully) easy-to-read summary of your qualifications and job experience. Most people want their CV to look good, but it’s important to remember that most employers have a tick list of items to find, and the look is probably of marginal importance in most cases. Of course, LaTeX users will still want to take the time to get a great visual result. (If you are applying for a job with a heavy dependence on visual design, then appearance may be the key!)

The other thing to bear in mind is that the requirements for a CV are dependent on the country and subject area you are in. Here in the UK, the normal advice is that a CV should only be two pages long. For academic jobs (like mine), a list of publications will often make the CV longer, while for industrial positions statements about your abilities, non-work activities and so forth are common. There’s also a strong feeling against having a photograph, both here in the UK and in the US, for equal opportunities reasons. On the other hand, several other countries have very different conventions, so before you start it’s important to check on what is needed.

Each job you apply for is different, and that means each CV you send of should be targeted to that job if possible. So while the basic structure will vary slowly, you should consider what to emphasise in each application. That’s an area where LaTeX’s ability to comment out lines can be a real bonus.

## Classes

As a CV is a specialist type of document, it’s no surprise that CTAN features a number of dedicated classes. I’m seen a few questions recently about moderncv, while in the past I used CurVe. In these and other cases, the idea is to use a mix of standard mark up and specialist macros to construct the output. In most cases, there is some form of tabular-like appearance generated along with the necessary headings and so on.

There are advantages and disadvantages to using one of these classes. Most obviously, someone else provides both the mechanisms you need and (hopefully) a good example to start from. The problem tends to be that altering the layout can be a bit awkward. As I said, while CV appearance may not actually be vital, most of us want to make our CV ‘personal’, which means altering the appearance.

## Roll-your-own

The alternative to using a pre-built class is to construct your CV yourself, setting up a structure that makes sense to you. Now, there is a bit of effort needed to do this, but it does allow you to decide on exactly how things will look. For my own CV, I used to use CurVe, but in the end decided this was actually making my life more, not less, complex. So the current source is based on the standard article, using some custom macros.

Most of what I’ve done in my CV is pretty simple, but it’s always nice to have documented examples. That would probably make this post a little too long, so I’ll return to look at the detail in my next post.

Written by Joseph Wright

November 5th, 2011 at 10:40 pm

Posted in General

Tagged with ,