minimalia blog

Cover Letter with Style - Part Four

4 min read · tagged latex, tutorial, xelatex

Contents

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

After the header, I will take care of the footer. To change the default I will change the firstfoot variable. Basically it works like firsthead, so I have nothing special to add. I will update the template with:

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

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

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


% ==============================================
%  FORMATTING STUFF 
% ==============================================

% === font settings
\defaultfontfeatures{Mapping=tex-text}
\linespread{1.1}
\setmainfont {Cormorant}[]
\setsansfont [Scale=MatchLowercase]{Fira Sans Book}

\newfontfamily\titlefont{Cormorant SC}[Scale=1.7]
\newcommand\mytitle{\titlefont\Huge\addfontfeature{LetterSpace=20.0}\usekomavar{fromname}}
\newcommand\subtitle{\titlefont\large{Software architect and Developer}}

\setkomavar{firsthead}{
   \centering
      \begin{tabular}{c}
         \mytitle\\[5mm]
         \subtitle
      \end{tabular}
}
\setkomavar{firstfoot}{   \centering     \usekomavar{fromaddress}}

\endinput

At line 42 I’ve declared my new footer. I wanted the material in the footer to be centered (line 43) and I’ve read the content of the variable fromaddress.

The result is the following:

There’s a problem with the way I declared the fromaddress: to have KOMA-Script rendering my address on three lines, I used the break line command (\\) but now I would like a one-liner address in the footer. I could declare yet another variable, this time avoiding putting the line breaks, but I don’t like unneeded duplications.

Redefining a latex command

Instead, I will use \renewcommand, to change the meaning of \\ within the context of the footer’s first line. \renewcommand takes the command to be redefined as first parameter; as second parameter you declare the new material to use instead. Take a look at line 10 below

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

\setkomavar{firstfoot}{
   \centering
   {\renewcommand{\\}{\ {\large\textperiodcentered}\ }      \usekomavar{fromaddress}
   }}

.
.
.

\endinput

I redefined the meaning of the \\, specifying it has to be replaced by a dot and not with a line break. Mind the use of the enclosing curly brackets to limit the redefinition of \\ to the address line.

For someone new to Latex sometimes it is difficult to unwrap the details, so I will try to clarify with the following picture:

So the curly brackets depicted within the black boxes are there to specify a scope to limit the effects of the instruction contained within. The instruction itself is highlighted in blue. What it does, again, is to redefine the meaning on \\. In this case the \\ will be replaced by a big dot (\Large\textperiodcentered) with spaces before and after (highlighted in the red box). The spaces have to be literal, in the sense Latex has to be instructed to output a space no matter what. You can escape the space with \ to reach that goal.

Now the footer looks like this:

You see, the line breaks in the address were replaced by dots. We have our address on one line now.

We will now render all the footer in small caps and we will use some letterspacing. The change is on line 9 below:

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

\setkomavar{firstfoot}{
   \addfontfeature{LetterSpace=20.0}\scshape\centering   {\renewcommand{\\}{\ {\Large\textperiodcentered}\ }
      \usekomavar{fromaddress}
   }
}

.
.
.

\endinput

The rendered document will look like this:

Marvosym package

It’s time to take care of the second line. For the email and the phone contacts I will use a couple of symbols from the marvosym package. The template becomes:

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

\usepackage[english]{babel}
\usepackage{fontspec}
\usepackage{marvosym}.
.
.

\setkomavar{firstfoot}{
   \addfontfeature{LetterSpace=20.0}\scshape\centering
   {\renewcommand{\\}{\ {\Large\textperiodcentered}\ }
      \usekomavar{fromaddress}
   }\\
   {\Large\Letter} \usekomavar{fromemail} \ {\Large\Telefon} \usekomavar{fromphone}}

.
.
.
\endinput

At line 6 I included the marvosym package; the rest is happening at line 16: I used the enlarged version of the symbols \Letter and \Telefon from the package. I also used an escaped space \ to keep the email address separated from the telephone number.

And this is the final result:

I think it is already quite good but in the next part we will use a logo as a watermark in the background.


Stefano software developer

...
powered by @gatsby