Cover Letter with Style - Part Three

Oct 13, 2013

A tutorial illustrating a way to obtain stylish cover letters with XeLaTeX

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

It’s time to setup a custom header for our cover letter. The default one render the sender address on the top left part of the letter. Boooring. 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 offers 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

 1 \ProvidesFile{standard.lco}[%
 2   2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]
 3  
 4 \usepackage[english]{babel}
 5 \usepackage{fontspec}
 6 
 7  
 8 % ==============================================
 9 %  PERSONAL DATA
10 % ==============================================
11 \setkomavar{fromname}{Iulius Caesar}
12 \setkomavar{fromaddress}{Van Eeghenlaan 69\\1691qt Amsterdam\\Nederland}
13 \setkomavar{fromphone}{+31 (0)22 7394203}
14 \setkomavar{fromemail}{iulius@gmail.com}
15 \setkomavar{fromfax}{+31 (0)71 5144543}
16 \setkomavar{fromurl}{http://www.kindoblue.nl}
17 \setkomavar{frombank}{Postbank 9307157}
18 \setkomavar{place}{Amsterdam}
19 \setkomavar{signature}{Iulius Caesar}
20  
21 % ==============================================
22 %  FORMATTING STUFF
23 % ==============================================
24  
25 % === font settings
26 \defaultfontfeatures{Mapping=tex-text}
27 \setmainfont {Adobe Garamond Pro}
28 \setsansfont {Gill Sans Std}
29 
30 %set the font size and leading
31 \renewcommand{\normalsize}{\fontsize{11}{16}\selectfont} 
32 
33 \setkomavar{firsthead}{
34       \centering
35          \usekomavar{fromname}\\
36          Programmer and Architect at Initech
37 }
38 
39  
40 \endinput

So, I have specified the following: the header shall be centered and will be comprised of two lines (the \\ is the latex command to break the line). The first line will be our name. I didn’t write it directly because it is already set at line 11. Instead, I used \usekomavar to lookup the fromname variable. Here, I am adhering to the D-FRY principle: don’t fucking repeat yourself. The second line is the job title. You can choose to define a variable 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:

First header changed

Well, it sucks. I will increase the font size, and use the small caps version.

 1 \ProvidesFile{standard.lco}[%
 2   2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]
 3  
 4 .
 5 .
 6 .
 7 
 8 \setkomavar{firsthead}{
 9       \centering
10          \fontsize{36}{36}\selectfont\scshape \usekomavar{fromname}\\
11          \fontsize{21}{21}\selectfont\scshape Programmer and Architect at Initech
12 }
13 
14 .
15 .
16 .

Now the header looks like this:

First header changed again

Much better. But I’m still not quite happy. So, I will increase the letter spacing, just for the first line. I will change the so called “feature” LetterSpace.

 1 \ProvidesFile{standard.lco}[%
 2   2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]
 3  
 4 .
 5 .
 6 .
 7 
 8 \setkomavar{firsthead}{
 9       \centering
10          {\addfontfeature{LetterSpace=15.0}\fontsize{36}{36}\selectfont\scshape \usekomavar{fromname}}\\[5mm]
11          \fontsize{21}{21}\selectfont\scshape Programmer and Architect at Initech
12 }
13 
14 .
15 .
16 .

I used the command \addfontfeature to set the letter space factor equal to 15.0. To find the right number, I just did some experiments. Mind the use of a pair of {} to enclose the entire first line. In this way the change of letter spacing is local to the first line only. I also set up half centimeter of space between the lines, with the [5mm] after the \\

So, render again the letter:

First header final

Sweet.

Now, if you want, you can refactor the latex code and use macros, like this:

 1 \ProvidesFile{standard.lco}[%
 2   2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]
 3  
 4 .
 5 .
 6 .
 7 
 8 
 9 
10 % === header settings
11 \newcommand\myname{%
12    {\addfontfeature{LetterSpace=15.0}\fontsize{36}{36}\selectfont\scshape \usekomavar{fromname}}
13 }
14 
15 \newcommand\mytitle{%
16    \fontsize{21}{21}\selectfont\scshape Programmer and Architect at Initech
17 }
18 
19 \setkomavar{firsthead}{
20    \centering
21          \myname\\[5mm]
22          \mytitle
23 }
24 
25 
26 .
27 .
28 .

What I did is to create two macros, which in turn were used to define the header. Mind that “%” after the opening bracket of the macros (line 11 and 15): its purpose is to avoid a carriage return to be part of the copied text when Latex expands the macros. Details, details, details…

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.