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 barcode is a little bit 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:

I assume you dutifully installed XeLaTeX and KOMA-Script. Ready to follow me?

Create a .tex file and past the skeleton of the cover letter into it:

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, 9, 10 the destination address is specified. At line 15 the body of the letter. 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.

The only thing missing is the sender address. I could has 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:

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

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.