Elements such as letterhead and address are considered part of the notepaper in scrlttr2
and scrletter
. As a rule, their size and position depend on external conditions such as the use of a window envelope. In contrast, the text area is based on typographical recommendations, as is usual with KOMA-Script, which are realized by the typearea
package. However, this means that the edge of the letter header and the address deviate from the edge of the letter text when using the default setting DIN
, for example. If no window envelopes are used and the letterhead and address can therefore be positioned freely, they can also be aligned to the left and right edges of the type area.
The easiest way is to save the following lines in an lco
file with the name aligntotextwidth.lco
:
% File `aligntotextwidth.lco`
% Copyright (c) Markus Kohm, 2025
%
% This file may be distributed under the conditions of the
% LaTeX Project Public License in the version 1.3c or later.
%
% → https://sourceforge.net/p/koma-script/wiki-de/HowTo_AlignedNotepaper
\ProvidesFile{aligntextwidth.lco}[2025-05-28 v1.0 unsupported Letter Configuration Option]
\setplength{firstheadwidth}{\textwidth}
\setplength{firstheadhpos}{-\maxdimen}
\setplength{firstfootwidth}{\textwidth}
\setplength{toaddrhpos}{\oddsidemargin+1in}
\endinput
This is then loaded after all other lco
files that change one of the four pseudo lengths:
\documentclass{scrlttr2}
\usepackage[english]{babel}
\setkomavar{fromname}{Markus Kohm}
\setkomavar{fromaddress}{Musterhausen}
\let\raggedsignature\raggedright
\LoadLetterOption{aligntotextwidth}% Load after other `lco` files.
\usepackage{blindtext}
\begin{document}
\begin{letter}{Someone\\Somewhere}
\opening{Hi,}
\blindtext
\closing{Regards}
\end{letter}
\end{document}
You can of course also insert the setting of the four pseudo lengths in the document preamble or another private lco
file.
Naturally, the reverse would also be possible, i.e. adjusting the margin and width of the text area according to the pseudo length for the header or the address. Here is an example of the pseudo length toaddrhpos
for the address:
% File `marginbytoaddrhpos.lco`
% Copyright (c) Markus Kohm, 2025
%
% This file may be distributed under the conditions of the
% LaTeX Project Public License in the version 1.3c or later.
%
% → https://sourceforge.net/p/koma-script/wiki-de/HowTo_AlignedNotepaper
\ProvidesFile{marginbytoaddrhpos.lco}[2025-05-28 v1.0 unsupported Letter Configuration Option]
\ifdim \useplength{toaddrhpos}<\z@
\setlengthtoplength[-]{\oddsidemargin}{toaddrhpos}%
\else
\setlengthtoplength{\oddsidemargin}{toaddrhpos}%
\fi
\setlength{\textwidth}{\dimeval{\paperwidth-2\oddsidemargin}}%
\addtolength{\oddsidemargin}{-1in}
\setlength{\evensidemargin}{\oddsidemargin}
\documentclass{scrlttr2}
\usepackage[english]{babel}
\setkomavar{fromname}{Markus Kohm}
\setkomavar{fromaddress}{Musterhausen}
\let\raggedsignature\raggedright
\LoadLetterOption{marginbytoaddrhpos}
\usepackage{blindtext}
\begin{document}
\begin{letter}{Someone\\Somewhere}
\opening{Hi,}
\blindtext
\closing{Regards}
\end{letter}
\end{document}
From a typographical point of view, however, this usually results in excessive line lengths in the text area. Moreover, the lco
file shown does not contain a corresponding vertical type area adjustment.