[Tex/LaTex] nextfoot in scrlttr2

header-footerkoma-scriptluatex

I do not understand some of the features the nextfoot variable has in the scrlttr2 KOMA-script class.

\documentclass[]{scrlttr2}

\pagestyle{headings}

\usepackage{fontspec}
\setmainfont{Linux Libertine O}

\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands=true]{german}

\usepackage{lipsum}

\begin{document}

\setkomafont{pagefoot}{\normalfont}

\setkomavar{nextfoot}{\hspace*{\fill}[Name]\qquad E-Mail: \texttt{xxx@gmx.de}\qquad Mobiltelefon: +49 123 45\,67\,89\hspace*{\fill}}

\setlength{\parskip}{1em}
\setlength{\parindent}{0pt}

\begin{letter}{Familie Mustermann}

\opening{Sehr geehrte Familie Mustermann,}

\lipsum

\closing{Mit freundlichen Grüßen}

\end{letter}

\end{document}

Why do I need the line

\setkomafont{pagefoot}{\normalfont}

and

\hspace*{\fill}

to get the desired output? Why is the footer text justified and set in italics by default? And where can I find these definitions? Is there a cleaner way of doing this?

Edit: And how do I get the page number back? Is using \thepage OK?

Best Answer

Who decided that a spider has 8 legs? I don't know. But i know who is in charge of KOMA-script and scrlttr2, the author and maintainer Markus Kohm.

He decided, for whatever reason, that the footer in a letter should be slanted. The footer is implemented as a parbox, so it is justified by default.

You should not set things manually, let the program work for you. It is most likely, that you will write up more than a single letter, so storing everything in variables and later using them is a good idea. With \usekomavar* you can get the name of the variable, with the unstarred version you get the content of the variable.

Rather then setting a font, it is better to add an attribute by using the addtokomafont-mechanism. KOMA-defines pagemark, which by default does some magic, you can redefine it to show just the pagenumber, but the reader might confuse it. Please have a look at the following:

\documentclass[symbolicnames=true,parskip=half]{scrlttr2}
\pagestyle{headings}
\usepackage{showframe}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\usepackage{polyglossia}
\setdefaultlanguage[babelshorthands=true]{german}

\usepackage{lipsum}
\setkomavar{fromname}{Sascha Wolf}
\setkomavar{fromemail}{postaldude@terror.org}
\setkomavar{frommobilephone}{+49 123 45\,67\,89}
\begin{document}

\addtokomafont{pagefoot}{\normalfont}

\setkomavar{nextfoot}{\hfill Sascha Wolf\qquad%
    \usekomavar*{fromemail}\usekomavar{fromemail}\qquad%
    \usekomavar*{frommobilephone}\usekomavar{frommobilephone}\hfill\pagemark%
}
%\renewcommand{\pagemark}{{\usekomafont{pagenumber}\rlap{\thepage}}}


\begin{letter}{Familie Mustermann}
    \opening{Sehr geehrte Familie Mustermann,}
    \lipsum
    \closing{Mit freundlichen Grüßen}
\end{letter}

\end{document}

Where can you find those defaults? Either in the documentation of KOMA-script, or if you really want to know whats going on at the code level: The source file scrlttr2.cls.