I have a long backaddress and want it to be displayed correctly in the addressee box.
I have searched a lot and don't know, if there is a DIN for this too. I am wondering if noone else has ever had the problem of a long backaddress, but I haven't found anything about it.
My problem:
I have a long backaddress to display. If I use the (default) KOMA option backaddress=underlined, the backaddress runs out of the addressee box. If I use backaddress=plain it seems to work. However I would like a line between backaddress and toaddress similar to the first option.
backaddress=plain:
backaddress=underlined:
Source:
\documentclass[
foldmarks=off,
backaddress=plain, % plain/underlined (problem with long address)
%fromrule=below, % not the line I am looking for
parskip=half, % paragraph formatting
draft
]{scrlttr2}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % Inputencoding
\usepackage[T1]{fontenc} % Fontencoding: 7bit -> 8bit
\usepackage{lmodern}
\usepackage{graphicx} % for \scalebox
\usepackage{microtype} % adjust text better
\usepackage{blindtext} % blindtext for MWE
% make signature left-aligned
\makeatletter
\renewcommand*{\raggedsignature}{\raggedright}
\makeatother
% change pagenumbering "Page X" -> "-X-"
\renewcommand\pagemark{\usekomafont{pagenumber}--\ \thepage\ --}
% change pagestyle of first page % http://tex.stackexchange.com/questions/298966/pagestyle-of-koma-letter-package
\usepackage{xpatch}
\xapptocmd{\opening}{\thispagestyle{headings}}{}{}
% use a small bullet as separator in the addressee for backaddress
\setkomavar{backaddressseparator}{~{$\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}$} }
% adjust some spacings
\makeatletter
% spacing between \closing and signature
\setlength{\@tempskipa}{-1\baselineskip}%
\@addtoplength{sigbeforevskip}{\@tempskipa}
% spacing between top border and firstheader
\setlength{\@tempskipa}{\baselineskip}%
\@addtoplength{firstheadvpos}{\@tempskipa}
% MWE: increase size of backaddress field in addressee (window of envelope) to make it fit there
\setlength{\@tempskipa}{2\baselineskip}%
\@addtoplength{backaddrheight}{\@tempskipa}
% alignment of header and addressee %http://tex.stackexchange.com/questions/64690/aligning-address-with-body-of-letter-in-scrlttr2
\@setplength{toaddrhpos}{\dimexpr 1in +\oddsidemargin\relax}
\@setplength{toaddrwidth}{8cm}
\@setplength{toaddrindent}{0cm}
\@setplength{firstheadhpos}{\dimexpr 1in +\oddsidemargin\relax}
\@setplength{firstheadwidth}{\textwidth}
\makeatother
\LoadLetterOption{visualize}% loads visualize.lco to visualize boxes
\showfields{address}% show the address box
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\setkomavar{fromname}{A long, long name for backaddress}
\setkomavar{fromaddress}{And of course the address\\
which is quite long too\\
last line}
\setkomavar{signature}{Another long name for the signature}
\setkomavar{place}{Home}
\setkomavar{subject}{Very important subject for the MWE}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{letter}{%
toaddressname\\
toaddress1\\
toaddress2}
\opening{Dear xy,}
\blindtext
\vspace{2\baselineskip}
\closing{\hspace{3em}Kind regards,}
\end{letter}
\end{document}
So my idea was to edit the addressee field, which is included in the \opening macro.
The definition in scrlttr2.cls:
\newcommand{\opening}[1]{%
\@PapersizeWarning
\@gen@firsthead
\@mkboth{\scr@fromname@var}{\scr@subject@var}%
\thispagestyle{empty}\noindent
\@foldmarks\@firstheadfootfield\@addrfield\@locfield
\ifdim\useplength{subjectvpos}=\z@\else\@subjfield\fi
\@datefield
\@makelettertitle
\ifdim\useplength{subjectvpos}=\z@\if@subjafter\else\@subjfield\fi\fi
{\setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative#1\par}%
{\setlength{\@tempdima}{\baselineskip}%
\addtolength{\@tempdima}{-\parskip}%
\ifdim \@tempdima>\z@\vskip\@tempdima\fi}%
\ifdim\useplength{subjectvpos}=\z@\if@subjafter\@subjfield\fi\fi
\@afterindentfalse\@afterheading
}
For the addressee field one has to look at \@addrfield. This definition is way longer and looks complicated to me. I am not sure how to investigate further. Is it useful to go this way? I am currently "reverse engineering" using \renewcommand. Any better suggestions?
I have a feeling that the \baselineskip in the backaddress isn't reduced even though it's footnotesize. Is this correct (typographically)? How to change it?
Thank you for your help and merry christmas ;)




underlinedoption takes effect - that's why there is this line. Correct so far? I didn't know, that backaddress is displayed in this case, just thought of it as as switch. I assume this works, because it is redefined depending on the passed argument (e.g.plain)? What's the difference between these twobackaddresses? – nox Dec 25 '16 at 23:54backaddressand the KOMA-Script variable `backaddress*. See my updated answer. – esdd Dec 26 '16 at 07:08