0

Lately I just found the scrlttr2 class for my letters, as it has the SN option that gets all I need, in less than 5-10 seconds. But if I would like to use it to make my CV cover letter, I need one particular option, to be able to draw a color background for my heading.

The thing is I played with the pirates engineer template (https://www.overleaf.com/latex/templates/pirate-engineer-template/sqfvydxkztqj), getting a decent CV, and I would like to find a way to keep the letter as profesional as it is, with my little personal touch.

So how can I draw the same kind of colored stripe with white colored text using the from * macros/variable already present?

I tried adding TikZ packages and drawing some tabular or parbox, but it just shift my letter on the second page, while the first gets a shifted (by firstheadvpos and firstheadhpos) colorfilled rectangle, seemingly at the place of the heading, maybe going over the right margin (as I used minimum width=\paperwidth in the TikZ setup).

MWE:

%\LoadLetterOption{SN} %% Lettere in stile svizzero
\usepackage{mwe}
\usepackage{geometry}

\usepackage[italian]{babel}
\usepackage{hyperref}

\usepackage{xcolor}
\definecolor{Green4}{HTML}{059108}

\usepackage{calc}

%% advanced drawing
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{smartdiagram}
\usepackage{float}
\usepackage{array}
\usetikzlibrary{decorations.text}
\usetikzlibrary{fadings}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.misc,positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{backgrounds} 
\usetikzlibrary{shadings}
\usetikzlibrary{calendar} 
\usetikzlibrary{er}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes} 
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{decorations}
\usetikzlibrary{topaths}

\renewcommand{\familydefault}{\sfdefault}

\date{\today}

\KOMAoptions{
    paper=a4,
    fromemail=true,
    foldmarks=true,
    fromphone=true,
    firsthead=true,
%   backaddress=false,
}

%% Opzioni personali
\setkomavar{fromname}{First LAST}
\setkomavar{fromaddress}{my Street\\ZIP myCity}
\setkomavar{fromemail}[]{\href{mailto:[email protected]}{[email protected]}}
\setkomavar{fromphone}[]{+41 (0)7x abc de fg}
\setkomavar{place}{myLivingRoom}
\setkomavar{signature}{f. LAST}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%
%%%%    Oggetto della missiva
%%%%
\setkomavar{subject}{Job something}
%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    \firsthead{
        \tikz{%
            \node[rectangle, fill=Green4, anchor=north, minimum width=\paperwidth, minimum height=3.5cm](header) at (current page.north){};%
            \node[draw=none, align=left](name) at (header) {%
                {\color{white}\usekomavar{fromname}\\ \usekomavar{fromaddress}}% 
                    };%
            \node[draw=none, align=right](contacts) at (header) {\color{red}\usekomavar{fromphone}\\ \usekomavar{fromemail}};% 
        }\vspace{-7mm}%
    }
    
\begin{document}
    % If you want headings on subsequent pages,
    % remove the ``%'' on the next line:
    % \pagestyle{headings}
    

    \begin{letter}{\textbf{COmpany Hiring}\\companyStreet\\ZipCode Town}
        
        \opening{Dear Madam, Dear Sir,}
        
        
        
        \closing{Best Regards,}
        
        %enclosure listing
        \vfill
        \encl{CV}
        
    \end{letter}
\end{document}

Output: enter image description here Desired output: enter image description here

3
  • It would be really useful, if you'd show a minimal working example with the code you've tried. However, see \setkomavar{firsthead}{…} about setting the header of the first page and \usekomavar{fromname} etc. about using variables. See also the detailed examples for corporate identities with letters in the KOMA-Script wiki for examples on using pseudo lengths and variables.
    – cabohah
    Feb 1 at 17:25
  • I downloaded the KOMA full guide (2 days ago), but the English version does lack some explanations, e.g. the full explanation scheme on the dimensions of the various letter parts. I'll try this sourceforge.net/p/koma-script/wiki-en/HowTo_LetterLayer solution as it appears to be quite my kind of desired output. Thanks for the useful links @cabohah
    – Fr3d
    Feb 2 at 9:36
  • You can find the description of all pseudo lengths in Table 4.2. A schematic description can be found in Figure 4.1. There are also links to the full descriptions in chapter 4. For the variable see Table 4.1 and also the description of all the variables in chapter 4. For example variable firsthead can be found in section “4.10.2. Letterhead”, currently page 202f. But in your example you are not using variable firshead but command \firsthead. This command is not described in the manual because it is deprecated. Using it results in a corresponding warning message.
    – cabohah
    Feb 2 at 9:46

1 Answer 1

1

You have to add options remember picture and overlay for the \tikz command (or the tikzpicture environment) and you have to use anchors for the nodes.

\documentclass{scrlttr2}
%\LoadLetterOption{SN} %% Lettere in stile svizzero

\usepackage[T1]{fontenc}% <- added
\usepackage{tikz}% loads package xcolor
\usepackage{hyperref}

\definecolor{Green4}{HTML}{059108}

\renewcommand{\familydefault}{\sfdefault}

\setkomavar{date}{\today}% <- changed!

\KOMAoptions{
    %paper=a4,% default
    fromemail=true,
    foldmarks=true,
    fromphone=true,
    firsthead=true,
%   backaddress=false,
}

%% Opzioni personali
\setkomavar{fromname}{First LAST}
\setkomavar{fromaddress}{my Street\\ZIP myCity}
\setkomavar{fromemail}[]{\href{mailto:[email protected]}{[email protected]}}
\setkomavar{fromphone}[]{+41 (0)7x abc de fg}
\setkomavar{place}{myLivingRoom}
\setkomavar{signature}{f. LAST}

\setkomavar{subject}{Job something}

\setkomavar{firsthead}{% <- changed!
  \tikz[remember picture,overlay,inner sep=1em,text=white]{
    \node[outer sep=0pt,fill=Green4, anchor=north, minimum width=\paperwidth, minimum height=3.5cm]
      (header) at (current page.north) {};%
    \node[anchor=north west,align=left](name) at (header.north west) 
      {\usekomavar{fromname}\\ \usekomavar{fromaddress}};%
    \node[anchor=north east,align=left](contacts) at (header.north east)
      {\usekomavar{fromphone}\\ \usekomavar{fromemail}};% 
  }%
}

\begin{document}
\begin{letter}{\textbf{COmpany Hiring}\\companyStreet\\ZipCode Town}
  \opening{Dear Madam, Dear Sir,}
  \closing{Best Regards,}
  \vfill
  \encl{CV}
\end{letter}
\end{document}

enter image description here

Note, that I have used \setkomavar{date}{...} and \setkomavar{firsthead}{...}.

1
  • And I've tried those but, with "proper" scrlttr2 names; turned out all I needed was to call the picture option even if I hadn't any, the some dimension grinding and done. Didn't know tikz already loads xcolor. I thought it was still necessary to specify the paper dimensions.
    – Fr3d
    Feb 2 at 15:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .