2

I want to test two header layouts based on the default one. First header without return address in the upper right corner and a centered headline. header1

In the second header the return address should start at the same level as the underlined back address with respect to the vertical space. enter image description here

I read that \firsthead is the right command to create custom headers, but I don't know where I can find a default header skeleton. So I don't know where to start getting all the vertical and horizontal spaces or margins between the objects.

\documentclass[a4paper,
    pagenumber=false,
    parskip=full,
    fontsize=11pt,
    firstfoot=false,
    fromalign=right,
    fromphone=true,
    fromemail=true,
    fromrule=false,
    foldmarks=false,
    enlargefirstpage,
]{scrlttr2}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc} 
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{marvosym}   
\usepackage{blindtext}

\newcommand{\myFirstname}{John}
\newcommand{\myFamilyname}{Doe}
\newcommand{\myStreet}{3500 West Olive Avenue}
\newcommand{\myTown}{Burbank, CA 91505-5512}


\setkomavar{date}{\today} 
\setkomavar{fromname}{\myFirstname\ \myFamilyname}
\setkomavar{signature}{\myFirstname\ \myFamilyname}
\setkomavar{fromaddress}{\myStreet\\\myTown}
\setkomavar{backaddress}{\myFirstname\ \myFamilyname, \myStreet , \myTown}
\setkomavar{place}{Burbank}
\setkomavar{fromphone}[\Mobilefone\,]{(01\,23)\,45\,67\,89\,10}
\setkomavar{fromemail}[\Letter\,]{john.doe@email.de}

\renewcommand*\familydefault{\sfdefault}



\setkomavar{subject}{Dies hier ist ein Blindtext zum Testen von Textausgaben.
}
\begin{document}
%
\begin{letter}{Richard M Winsor\\
2192 Lawman Avenue\\ 
Arlington\\
22204 Virginia
}
%
\opening{Dear Mr Winsor,}
%
\blindtext[1]
\noindent \blindtext[4]


\closing{\raggedright Yours sincerely,}
\end{letter}

\end{document}
2

The placement of your address beside the address of the addressee can be done using fromalign=location. Unfortunately in this case you cannot use variable firsthead to set a headline. But you can use either scrlayer or scrlayer-scrpage to generate the wanted page head. Here a simple solution with scrlayer-scrpage:

\documentclass[a4paper,
    pagenumber=false,
    parskip=full,
    fontsize=11pt,
    fromalign=location,
    firstfoot=false,
    fromphone=true,
    fromemail=true,
    fromrule=false,
    foldmarks=false,
    enlargefirstpage,
]{scrlttr2}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc} 
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{marvosym}   
\usepackage{blindtext}

\newcommand{\myFirstname}{John}
\newcommand{\myFamilyname}{Doe}
\newcommand{\myStreet}{3500 West Olive Avenue}
\newcommand{\myTown}{Burbank, CA 91505-5512}


\setkomavar{date}{\today} 
\setkomavar{fromname}{\myFirstname\ \myFamilyname}
\setkomavar{signature}{\myFirstname\ \myFamilyname}
\setkomavar{fromaddress}{\myStreet\\\myTown}
\setkomavar{backaddress}{\myFirstname\ \myFamilyname, \myStreet , \myTown}
\setkomavar{place}{Burbank}
\setkomavar{fromphone}[\Mobilefone\,]{(01\,23)\,45\,67\,89\,10}
\setkomavar{fromemail}[\Letter\,]{john.doe@email.de}

\renewcommand*\familydefault{\sfdefault}

\let\raggedsignature\raggedright

\usepackage{xcolor}
\usepackage{scrlayer-scrpage}
\clearmainofpairofpagestyles
\chead{\normalfont\Huge\color{red}Headline}
\RedeclarePageStyleAlias{empty}{scrheadings}


\setkomavar{subject}{Dies hier ist ein Blindtext zum Testen von Textausgaben.
}
\begin{document}
%
\begin{letter}{Richard M Winsor\\
2192 Lawman Avenue\\ 
Arlington\\
22204 Virginia
}
%
\opening{Dear Mr Winsor,}
%
\blindtext[1]
\noindent \blindtext[4]


\closing{Yours sincerely,}
\end{letter}

\end{document}

enter image description here

If you want more influence, e.g., to the position of the page head, you should have a look at the scrlayer chapter in Part II of the KOMA-Script manual.

The German KOMA-Script book shows a completely different solution in the appendix using firsthead for an extended side note. You can adapt that approach to also set the head and only some text beside the addressee.

Or you can use variable firsthead for the page head and variable location to place your address on your own:

\documentclass[a4paper,
    pagenumber=false,
    parskip=full,
    fontsize=11pt,
    firstfoot=false,
    foldmarks=false,
    enlargefirstpage,
]{scrlttr2}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc} 
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{marvosym}   
\usepackage{blindtext}

\newcommand{\myFirstname}{John}
\newcommand{\myFamilyname}{Doe}
\newcommand{\myStreet}{3500 West Olive Avenue}
\newcommand{\myTown}{Burbank, CA 91505-5512}


\setkomavar{date}{\today} 
\setkomavar{fromname}{\myFirstname\ \myFamilyname}
\setkomavar{signature}{\myFirstname\ \myFamilyname}
\setkomavar{fromaddress}{\myStreet\\\myTown}
\setkomavar{backaddress}{\myFirstname\ \myFamilyname, \myStreet , \myTown}
\setkomavar{place}{Burbank}
\setkomavar{fromphone}[\Mobilefone\,]{(01\,23)\,45\,67\,89\,10}
\setkomavar{fromemail}[\Letter\,]{john.doe@email.de}

\renewcommand*\familydefault{\sfdefault}

\let\raggedsignature\raggedright

\usepackage{xcolor}
\setkomavar{firsthead}{%
  \centering\Huge\color{red}Headline
}

\setkomavar{location}{%
  \raggedleft
  \usekomavar{fromname}\\
  \usekomavar{fromaddress}\\
  \usekomavar*{fromphone}\usekomavar{fromphone}\\
  \usekomavar*{fromemail}\usekomavar{fromemail}
}

\setkomavar{subject}{Dies hier ist ein Blindtext zum Testen von Textausgaben.
}
\begin{document}
%
\begin{letter}{Richard M Winsor\\
2192 Lawman Avenue\\ 
Arlington\\
22204 Virginia
}
%
\opening{Dear Mr Winsor,}
%
\blindtext[1]
\noindent \blindtext[4]


\closing{Yours sincerely,}
\end{letter}

\end{document}

enter image description here

If you do not want your address beside the addresse, simply use this second example without \setkomavar{location}{…}.

  • Are there controls for the width of the location field? If I use a email address like john.doe@email-america.de I got a line break in the email address. – Hölderlin Apr 4 '17 at 13:45
  • @Hölderlin: Yes. It is controlled by options and pseudo lengths. As told in my comment to the question, you can find the pseudo lengths at Part II of the KOMA-Script manual. See also the description of variable location. – Schweinebacke Apr 4 '17 at 15:42
  • Found it \@setplength{locwidth}{length } - thx :) – Hölderlin Apr 5 '17 at 0:54
3

If you add

\LoadLetterOption{visualize}
\showfields{address,location}

to your preamble you can see that the top of the address field and the top of the location field are aligned:

enter image description here

The distance from the top of the address field to the baseline of the back address is the pseudolength backaddrheight. To align the baseline of the fromname in the location field with the baseline of the back address you can use

\setkomavar{location}{
  \raggedleft
  \raisebox{0pt}[\useplength{backaddrheight}][\depth]{\usekomavar{fromname}}\\
  \usekomavar{fromaddress}\\
  \usekomavar*{fromphone}\usekomavar{fromphone}\\
  \usekomavar*{fromemail}\usekomavar{fromemail}
}

enter image description here

Without visualize and with header:

enter image description here

 \documentclass[a4paper,
    pagenumber=false,
    parskip=full,
    fontsize=11pt,
    firstfoot=false,
    fromalign=right,
    fromphone=true,
    fromemail=true,
    fromrule=false,
    foldmarks=false,
    enlargefirstpage
]{scrlttr2}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc} 
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{marvosym}
\usepackage{blindtext}
\usepackage{xcolor}

\newcommand{\myFirstname}{John}
\newcommand{\myFamilyname}{Doe}
\newcommand{\myStreet}{3500 West Olive Avenue}
\newcommand{\myTown}{Burbank, CA 91505-5512}

\setkomavar{date}{\today} 
\setkomavar{fromname}{\myFirstname\ \myFamilyname}
\setkomavar{signature}{\myFirstname\ \myFamilyname}
\setkomavar{fromaddress}{\myStreet\\\myTown}
\setkomavar{backaddress}{\myFirstname\ \myFamilyname, \myStreet , \myTown}
\setkomavar{place}{Burbank}
\setkomavar{fromphone}[\Mobilefone\,]{(01\,23)\,45\,67\,89\,10}
\setkomavar{fromemail}[\Letter\,]{john.doe@email.de}

\renewcommand*\familydefault{\sfdefault}
\setkomavar{subject}{Dies hier ist ein Blindtext zum Testen von Textausgaben.}

\setkomavar{firsthead}{\centering\Huge \textcolor{red}{HEADLINE}}
\setkomavar{location}{
  \raggedleft
  \raisebox{0pt}[\useplength{backaddrheight}][\depth]{\usekomavar{fromname}}\\
  \usekomavar{fromaddress}\\
  \usekomavar*{fromphone}\usekomavar{fromphone}\\
  \usekomavar*{fromemail}\usekomavar{fromemail}
}

% to visualize the position and the size of address and location:
%\LoadLetterOption{visualize}
%\showfields{address,location}
\begin{document}
\begin{letter}{Richard M Winsor\\
2192 Lawman Avenue\\ 
Arlington\\
22204 Virginia
}
\opening{Dear Mr Winsor,}
\blindtext[1]
\noindent \blindtext[4]
\closing{\raggedright Yours sincerely,}
\end{letter}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.