Minimalia.

Cover Letter with Style - Part Three


Cover Letter with Style - Part Three

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

The header

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 giant ego. In KOMA-Script, there are several ways to define your header, each offering an increasing degree of freedom and a rising 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{fromaddress}{Van Eeghenlaan 69\\1691qt Amsterdam\\Nederland}
\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}
\linespread{1.1}
\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 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 if you plan to use the job title more than once in your letter.

Now, render the letter to see the result: First header changed

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

Using macros

In Latex, we can use macros to make code reusable. It will also help with the conciseness of code that will use those macros. I will define a macro to give a name to a particular font family 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]
 
.
.
.

\newfontfamily\titlefont{Cormorant SC}
\newcommand\mytitle{\titlefont\usekomavar{fromname}}
\newcommand\subtitle{\titlefont{Software architect and Developer}}

\setkomavar{firsthead}{
   \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: First header changed again

Much better. But I’m still not entirely 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]
 
.
.
.

\newfontfamily\titlefont{Cormorant SC}[Scale=1.7]
\newcommand\mytitle{\titlefont\Huge\addfontfeature{LetterSpace=20.0}\usekomavar{fromname}}
\newcommand\subtitle{\titlefont\large{Software architect and Developer}}

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

.
.
.

At lines 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 entire titlefont scale by using the Scale modifier.

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

So, let’s render the letter again: First header final

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.