Cover Letter with Style - Part Two

Sep 29, 2013

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

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

In this second part, we will change the default fonts using fontspec. Forget importing Postscript fonts, classifying them under the NFSS (New Font Selection Scheme) and other crazy stuff: fontspec is able to load opentype fonts and select them very easily. You have just to install the fonts on your system, if not already present. And please do yourself a favour: buy an handful of professional fonts.

On Mac is trivial to install fonts. If you are using Ubuntu, you can copy the *.otf files somewhere under the /usr/share/fonts and then update the font cache with this command:

$ sudo fc-cache -fv

Last thing you will need is to take note of the exact name of the font family, to be able to select it. For that, after having installed the lcdf-typetools ubuntu package, you can do something like

otfinfo -i /usr/share/fonts/<<your font file>>.otf | grep Family

Ok, assuming you have your font installed and you know its name, you can change the letter template (remember, standard.lco) as the following:

 1 \ProvidesFile{standard.lco}[%
 2   2002/07/09 v0.9a LaTeX2e unsupported letter-class-option]
 4 \usepackage[english]{babel}
 5 \usepackage{fontspec}
 8 % ==============================================
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}{}
15 \setkomavar{fromfax}{+31 (0)71 5144543}
16 \setkomavar{fromurl}{}
17 \setkomavar{frombank}{Postbank 9307157}
18 \setkomavar{place}{Amsterdam}
19 \setkomavar{signature}{Iulius Caesar}
21 % ==============================================
23 % ==============================================
25 % === font settings
26 \defaultfontfeatures{Mapping=tex-text}
27 \setmainfont {Adobe Garamond Pro}
28 \setsansfont {Gill Sans Std}
30 %set the font size and leading
31 \renewcommand{\normalsize}{\fontsize{11}{16}\selectfont} 
34 \endinput

At line 5 I just imported the fontspec package. At line 26 I am instructing fontspec to add the mapping for TeX ligatures, like – (n-dash) and — (m-dash). At line 27 I set the main font and at line 28 I set the font to be used in case a sans serif one if needed.

Another important thing to set up, usually, is the font size and the lead. That’s the purpose of line 31. It is a plain old Latex directive, to redefine the \normalsize macro. In this way I can specify the height of the font and the space in points between the lines. The values one should use really depend on so many factors! Alas, this is not a course about typography.

Ok, time to generate our cover letter again. You might see some warnings in the log:

LaTeX Font Warning: Font shape `OML/cmm/m/it' in size <5.5> not available
(Font)              size <5> substituted on input line 25.

LaTeX Font Warning: Font shape `OMS/cmsy/m/n' in size <5.5> not available
(Font)              size <5> substituted on input line 25.

LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <5.5> not available
(Font)              size <5> substituted on input line 25.

[1] (./TSWLatexianTemp_000014.aux)

LaTeX Font Warning: Size substitutions with differences
(Font)              up to 0.5pt have occurred.

Translated, it means that the Computer Modern font is being scaled. It is used as default math font. Since we don’t plan to write math formulas in our cover letter, we can ignore the warnings. Or simply add the following line to the template:


If you need math fonts, you should avoid the workaround and use Latin Modern, which can be scaled at whatever size, or other similar fonts.

Ok, let’s try again to generate the pdf. If you used a good font, you should notice the difference. Here I’m using Adobe Garamond Pro (at the bottom)

Different fonts used

Can you see the difference? I hope so.

For more information, examples and so on, I urge you to read the fontspec documentation, to get ready for the third part of the tutorial.

That’s all folks.