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

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:

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

Now the header looks like this:

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.

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:

Sweet.

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

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.