# Cover Letter with Style - Part Three

5 min read · tagged xelatex

## Contents

This is the third part of the tutorial Cover letter with style. You can find the second part here.

It’s time to set up a custom header for our cover letter. The default one renders the sender address on the top left part of the letter, but we can change that. I usually put my name and my current job title in the header, accordingly to my big ego. In KOMA-Script there are several ways to define your own header, each one offering an increasing degree of freedom but also an increasing complication in use. Luckily enough, for our purposes, we can use the easiest.

The simplest way to change your header is by setting firsthead variable. That will set the custom header just for the first page of the document. But we’re talking about a cover letter: don’t even think to make it longer than a page. Enough said, I will modify the template now:

\ProvidesFile{standard.lco}[%
2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]

\usepackage[english]{babel}
\usepackage{fontspec}

% ==============================================
%  PERSONAL DATA
% ==============================================
\setkomavar{fromname}{Ambroos Janssen}
\setkomavar{fromphone}{+31 (0)22 7394203}
\setkomavar{fromemail}{a.janssen@gmail.com}
\setkomavar{fromfax}{+31 (0)71 5144543}
\setkomavar{fromurl}{http://www.kindoblue.nl}
\setkomavar{frombank}{Postbank 9307157}
\setkomavar{place}{Amsterdam}
\setkomavar{signature}{Ambroos Janssen}

% ==============================================
%  FORMATTING STUFF
% ==============================================

% === font settings
\defaultfontfeatures{Mapping=tex-text}
\setmainfont {Cormorant}[]
\setsansfont [Scale=MatchLowercase]{Fira Sans Book}

\setkomavar{firsthead}{      \centering         \usekomavar{fromname}\\         Software Architect and Developer}

\endinput

So, I have specified the following: the header shall be centered (line 33) and will be composed of two lines by using \\, which is the latex command to break the line. On top there will be our name. I didn’t write it directly because it is already set at line 11. So I used \usekomavar to lookup the fromname variable. The second line is the job title. You can choose to define a variable for it as well, if you plan to use the job title more than once in your letter.

Now, render the letter again, to see the result:

Well, it sucks. But we can improve things, no worries.

### Using macros

In Latex we can use macros to make code reusable. This will help also with the terseness of code that will use those macros. I will define a macro to give a name to a particular font family that will be used exclusively for the header title. We will be using Cormorant SC, which is the Small Caps version of the main font family. Also, I will define a couple of macros to represent the title and subtitle in the header. Like this:

\ProvidesFile{standard.lco}[%
2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]

.
.
.

\centering
\begin{tabular}{c}         \mytitle\\         \subtitle      \end{tabular}
}

.
.
.

At line 8 I use the \newfontfamily to define a new handle representing a font family. In case you want to use the fontspec customization capabilities, we can use them here, in one place only. After line 8 the name titlefont will represent whatever font family and its parameters we chose. At line 9 we define the macro mytitle. It will be our name, this time rendered with the font titlefont. At line 10 we define subtitle in the same manner. The last thing to do is to update the definition of our header by using those macros. The code is more clear now, I hope.

Let’s take a looks a the result:

Much better. But I’m still not quite happy. So, I will increase the font size and, more importantly, I will increase the letter spacing, just for the first line.

### Exploiting font features

In Latex you have commands to alter the font size:

normal size ->10pt11pt12pt
\tiny5pt6pt6pt
\scriptsize7pt8pt8pt
\footnotesize8pt9pt10pt
\small9pt10pt11pt
\normalsize10pt11pt12pt
\large12pt12pt14pt
\Large14pt14pt17pt
\LARGE17pt17pt20pt
\huge20pt20pt25pt
\Huge25pt25pt25pt

So for example if you use the command Large and the normal font size is 10pt, you will get the size of 14pt applied in whatever context the command is applied. So let’s proceed:

\ProvidesFile{standard.lco}[%
2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]

.
.
.

\centering
\begin{tabular}{c}
\mytitle\\[5mm]         \subtitle
\end{tabular}
}

.
.
.

At line 9 and 10 I used the command large and Huge. Since Huge is still not huge enough for the first line of the header I also changed the scale of the entire titlefont macro by using the Scale modifier.

For the titlefont I also used the command \addfontfeature to set the letterspace factor equal to 15.0. To find the right number, I just did some experiments. I also set up half centimeter of space between the lines, with the [5mm] after the \\

So, let’s render the letter again:

Very nice!

In the fourth part I will show how to setup up the footer and then we will be ready for the watermarks, logo and barcode.

Stefano software developer

...