minimalia blog

Cover Letter with Style - Part One

4 min read · tagged latex, tutorial, xelatex

Contents

Introduction

I decided to start a new tutorial, this time illustrating a way to obtain a stylish cover letter with XeLaTeX, which enables the easy use of OpenType fonts (through the fontspec package) and supports for Unicode text (no need of escape extended characters anymore). Also, KOMA-Script will be used.

The cover letter is the first thing they will read; possibly its form is as much important as its content. Even if you don’t agree, a fancy letter doesn’t do any harm, doesn’t it? For example, what about a letter like this:

Strong header, contact data in the footer, logo as watermark. Even a barcode to pimp the destination address! Ok, the watermark and the barcode are a little too nerdy, but it will give me the chance to show how easy is to use PSTricks from inside XeLaTex.

In this tutorial I will also show how to separate the content from the style, so you can swap the latter really easily, to obtain something completely different, like this for example:

First draft

I assume you dutifully installed XeLaTeX and KOMA-Script. Now create a .tex file and write a skeleton of the cover letter like this:

\documentclass[letterpaper,pagesize,UScommercial9]{scrlttr2}

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

\begin{document}

\begin{letter}{%
       Damage Inc. --- HR Dept.\\
       Paulus Potterstraat 134\\
       1753KJ Amsterdam
}
\setkomavar{subject}{Cover Letter}
\opening{Dear Recruiter,}

\lipsum[2]

\closing{Regards}


\end{letter}
\end{document}

At line 1 you are instructing XeLaTeX to load the letter class from KOMA-Script (by using scrlttr2) and specifing which paper size to use (letterpaper in this case). The option pagesize forces the page size of the resulting pdf file to follow accordingly. Without this option, headaches will ensue: you will see the main matter (the text) to be forced into the specified page size but the page itself not be changed at all. By default KOMA-Script uses the DIN standards (which also mandate the paper size to be A4) For US, you can use the option UScommercial9.

Even if not stated explicitly, KOMA-Script needs the package babel to be included, and so we do at line 3. At lines 8 we start the letter; at line 9 , 10, 11 the destination address is specified. At line 16 the body of the letter, in this case one paragraph from lorem ipsum. The other parts should be trivial to understand . Basically this is a template for any kind of letter you will write. Nothing difficult indeed. If you process this with XeLaTeX, you will obtain:

Effortlessly we obtained a nice formatted letter. KOMA-Script have even added three little dashes on the left border: they are guides to fold the letter with precision.

Separating content from style

The only thing missing is the sender address. I could have added the KOMA instructions to set the sender address directly into the tex file, but there’s a better method. The letter document class defined by KOMA-Script support the loading of a setting/style file. In this file, with extension .lco, you can store things like your data (used to compose the sender address) or other latex instructions. In this way the .tex will contain just the letter text and nothing else. This is handy for two reason:

  1. you don’t have to type your contact data for each letter you write;
  2. you may have more .lco files that you can use to change the look & feel altogether.

So, create a file and call it standard.lco. Stick your data in it, like this:

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

\usepackage[english]{babel}

% ==============================================
%  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}

\endinput

Change accordingly your .tex file (containing the text of the letter) to instruct KOMA-Script to load the standard.lco file:

\documentclass[standard,letterpaper,pagesize,UScommercial9]{scrlttr2}
\usepackage{lipsum}

\begin{document}

\begin{letter}{%
       Damage Inc. --- HR Dept.\\%
       Paulus Potterstraat 134\\%
       1753KJ Amsterdam
}
\setkomavar{subject}{Cover Letter}
\opening{Dear Recruiter,}

\lipsum[2]

\closing{Regards}


\end{letter}
\end{document}

I’ve changed the first line, adding the standard option. This will load the standard.lco, in which I also moved the instruction to load the babel package. Urge yourself to run XeLaTeX to see the results:

The sender address now appears where it is supposed to be. If you are using the default DIN standard (leave out UScommercial9 and replace letterpaper with a4paper) you will get also the one-liner version of the sender address, meant to pop up from the transparent window of the envelope - if any - together with the destination address.

Well, that’s all for the first part. There’s still lot to explain so please proceed to the second part.


Stefano software developer

...
powered by @gatsby