% \iffalse meta-comment
% ======================================================================
% scrkernel-letterclassoptions.dtx
% Copyright (c) Markus Kohm, 2006-2023
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in MANIFEST.md.
% ======================================================================
%%% From File: $Id: scrkernel-letterclassoptions.dtx 4032 2023-04-17 09:45:11Z kohm $
%
% \end{macrocode}
%
%
% \subsection{Makros für Letter-Class-Options}
%
% \begin{command}{\LoadLetterOption}
% \changes{v2.8q}{2001/10/08}{added}
% \changes{v3.14}{2014/10/04}{ignoring white spaced}
% \changes{v3.26}{2018/08/29}{\cs{KV@@sp@def} replaced by \cs{scr@sp@def}}
% Command
% \begin{quote}
% \cs{LoadLetterOption}\marg{letter configuration option}
% \end{quote}
% loads \file{\meta{letter configuration option}.lco}. The \cs{catcode} of
% ``|@|'' is changed to letter for loading the file. But because \file{lco}
% files can load other \file{lco} files using \cs{LoadLetterOption} this has
% to be reset only for the outer \cs{LoadLetterOption}.
% \begin{description}
% \item[ToDo:] can't we do this more simply just using either some
% \cs{expandafter} magic or an internal stack?
% \end{description}
% \begin{macrocode}
%<*body>
\newcommand*{\LoadLetterOption}[1]{%
\@ifundefined{@restore@catcode@level}%
{\let\@restore@catcode@level=\z@}{}%
\ifnum\@restore@catcode@level =\z@
\ifnum\catcode`\@=11
\let\@restore@catcode\relax
\else
\@tempcnta=\catcode`\@
\edef\@restore@catcode{%
\noexpand\catcode`\noexpand\@=\the\@tempcnta}%
\makeatletter
\fi
\fi
\@tempcnta=\@restore@catcode@level\relax
\advance\@tempcnta by \@ne\relax
\edef\@restore@catcode@level{\the\@tempcnta}%
\scr@sp@def\reserved@a{#1}%
\edef\reserved@a{%
\noexpand\edef\noexpand\scr@currentlco{\reserved@a}%
% \end{macrocode}
% \changes{v3.99}{2022/10/25}{local definition of \cs{scr@compatibility}}
% For compatibility of old \file{lco} files with \KOMAScript~4 we locally
% define \cs{scr@compatibility} to the highest possible number.
% \begin{macrocode}
%<*v4>
\ifdefined\scr@compatibility\else
\noexpand\edef\noexpand\scr@compatibility{\the\maxdimen}%
\fi
%
\noexpand\InputIfFileExists{\reserved@a.lco}{%
% \noexpand\ClassInfo{scrlttr2}%
% \noexpand\PackageInfo{scrletter}%
{Letter-Class-Option `#1' loaded}%
}{%
% \noexpand\ClassError{scrlttr2}%
% \noexpand\PackageError{scrletter}%
{%
Letter-Class-Option file `#1.lco' not found%
}{%
You've told me to load the Letter-Class-Option `#1'. So I have
to load\noexpand\MessageBreak
the file `#1.lco'. But the file isn't available.}%
}%
%<*v4>
\ifdefined\scr@compatibility
\noexpand\def\noexpand\scr@compatibility{\scr@compatibility}%
\else
\unexpanded{\let\scr@compatibility\undefined}%
\fi
%
\scr@ifundefinedorrelax{scr@currentlco}{%
\unexpanded{\let\scr@currentlco\relax}%
}{%
\noexpand\def\noexpand\scr@currentlco{\scr@currentlco}%
}%
}%
% \end{macrocode}
% \changes{v3.18}{2015/06/03}{manage \cs{RequirePackage} and \cs{usepackage}
% inside \texttt{lco}-files after \cs{begin\{document\}}}
% \changes{v3.28}{2019/11/24}{\cs{usepackage} typo fixed}
% \begin{description}
% \item[ToDo:] I don't think, that the following really works. So maybe it
% should simple be removed to get the usual error message using
% \cs{RequirePackage} or \cs{usepackage} inside a document.
% \end{description}
% \begin{macrocode}
\if@atdocument
\edef\reserved@a{%
\unexpanded\expandafter{\reserved@a}%
\ifx\RequirePackage\@notprerr
\unexpanded{\let\RequirePackage\@notprerr}%
\else
\noexpand\def\noexpand\RequirePackage{%
\unexpanded\expandafter{\RequirePackage}%
}%
\fi
\ifx\usepackage\@notprerr
\unexpanded{\let\usepackage\@notprerr}%
\else
\noexpand\def\noexpand\usepackage{%
\unexpanded\expandafter{\usepackage}%
}%
\fi
}%
\let\RequirePackage\lco@RequirePackage
\let\usepackage\lco@RequirePackage
\expandafter\reserved@a
\else \expandafter\reserved@a
\fi
\@tempcnta=\@restore@catcode@level\relax
\advance\@tempcnta by \m@ne\relax
\edef\@restore@catcode@level{\the\@tempcnta}%
\ifnum\@tempcnta =\z@
\@restore@catcode
\fi
}
% \end{macrocode}
% \begin{macro}{\lco@RequirePackage}
% \changes{v3.18}{2015/06/03}{added}
% \changes{v3.26}{2018/08/29}{\cs{KV@@sp@def} replaced by
% \cs{scr@trim@spaces}}
% \begin{description}
% \item[ToDo:] See the note above.
% \end{description}
% \begin{macrocode}
\newcommand*{\lco@RequirePackage}[2][]{%
\begingroup
\@for\reserved@a:=#2\do{%
\scr@trim@spaces\reserved@a
\scr@ifundefinedorrelax{ver@\reserved@a.\scr@pkgextension}{%
% \ClassError{\KOMAClassName}{%
% \PackageError{scrletter}{%
lco-file `\scr@currentlco' can be used only in preamble%
}{%
The lco-file `\scr@currentlco' uses \string\RequirePackage\space or
\string\usepackage\space to load\MessageBreak
package `\reserved@a'. This means you have to either load
`\reserved@a'\MessageBreak
or lco-file `\scr@currentlco' in the document preamble.
}%
}{}%
}%
\endgroup
\scr@gobbleopt
}
% \end{macrocode}
% \end{macro}^^A \lco@RequirePackage
% \end{command}^^A \LoadLetterOption
%
% \begin{command}{\LoadLetterOptions}
% \changes{v3.14}{2014/10/04}{added}
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}
% \changes{v3.26}{2018/08/29}{special treatment of space entries not needed
% any more}
% Similar to \cs{LoadLetterOption} but with \meta{list of letter configuration
% options} instead of a single \meta{letter configuration option}.
% \begin{macrocode}
\newcommand*{\LoadLetterOptions}[1]{%
\begingroup
\def\reserved@a{\endgroup}%
\@for\reserved@b:=#1\do{%
\scr@trim@spaces\reserved@b
\ifx\reserved@b\@empty\else
\edef\reserved@a{\expandafter\unexpanded\expandafter{\reserved@a
\LoadLetterOption}{\reserved@b}\relax}%
\fi
}%
\reserved@a
}
% \end{macrocode}
% \end{command}^^A \LoadLetterOptions
%
% \begin{command}{\LetterOptionNeedsPapersize}
% \changes{v2.8q}{2001/10/17}{added}
% With
% \begin{quote}
% \cs{LetterOptionNeedsPapersize}\marg{letter configuration
% option}\marg{paper size}
% \end{quote}
% inside a \meta{letter configuration option} file we can define a \meta{paper
% size} to be used. This does not change the paper size, but adds a test to
% \cs{opening}, that warns if another paper size is used.
% \begin{macro}{\@PapersizeWarning}
% \changes{v2.8q}{2002/03/25}{added}
% \changes{v3.12}{2013/11/05}{differences of +/- 1\,mm are tolerated}
% \changes{v3.23}{2017/02/22}{using \cs{PaperNameToSize}}
% \begin{macro}{\@@PapersizeWarning,\LOPNP@size,\LOPNP@option}
% \changes{v2.8q}{2002/03/25}{added}
% \begin{macrocode}
\newcommand*{\LOPNP@option}{}
\newcommand*{\LOPNP@size}{}
\newcommand*{\@PapersizeWarning}{%
\begingroup%
\edef\@tempc{\noexpand\@tempswafalse
\noexpand\ifdim\paperwidth<\the\dimexpr\paperwidth-.1mm\relax
\relax
\noexpand\else
\noexpand\ifdim\paperwidth>\the\dimexpr\paperwidth+.1mm\relax
\relax
\noexpand\else
\noexpand\ifdim\paperheight<\the\dimexpr\paperheight-.1mm\relax
\relax
\noexpand\else
\noexpand\ifdim\paperheight>\the\dimexpr\paperheight+.1mm\relax
\relax
\noexpand\else
\noexpand\@tempswatrue
\noexpand\fi
\noexpand\fi
\noexpand\fi
\noexpand\fi
\noexpand\@@PapersizeWarning
}%
\def\@tempb{letter}\ifx\LOPNP@size\@tempb%
\setlength{\paperheight}{11in}\setlength{\paperwidth}{8.5in}%
\else\def\@tempb{legal}\ifx\LOPNP@size\@tempb%
\setlength{\paperheight}{14in}\setlength{\paperwidth}{8.5in}%
\else\def\@tempb{executive}\ifx\LOPNP@size\@tempb%
\setlength{\paperheight}{10.5in}\setlength{\paperwidth}{7.25in}%
\else%
\PaperNameToSize[letter]{\LOPNP@size}%
\fi
\fi
\fi
\@tempc
\endgroup%
}
%\AfterPackage*{typearea}{%
\ProvideUnknownPaperSizeError{letter}{%
% \ClassError{scrlttr2}{%
% \PackageError{scrletter}{%
papersize `\LOPNP@size' undefined}{%
You've told me to check for paper size
`\LOPNP@size'\MessageBreak
at letter option file `\LOPNP@option.lco',\MessageBreak
but this paper size is not supported.\MessageBreak
See the KOMA-Script manual for informations about known
paper sizes.}%
}
%}
\newcommand*{\@@PapersizeWarning}{%
\if@tempswa\else%
% \ClassWarningNoLine{scrlttr2}%
% \PackageWarningNoLine{scrletter}%
{%
Letter option file `\LOPNP@option.lco'\MessageBreak
needs paper size `\LOPNP@size'.\MessageBreak
Current paper size is not `\LOPNP@size'!\MessageBreak
\scr@ifundefinedorrelax{KOMAClassName}{%
You should load package `typearea' either\MessageBreak
with option `paper=\LOPNP@size,paper=portrait' or
additionally\MessageBreak
}{%
You should add `paper=\LOPNP@size,paper=portrait' at the\MessageBreak
option list of `\string\documentclass' or\MessageBreak
}%
add `\string\KOMAoptions{paper=\LOPNP@size,paper=portrait}'\MessageBreak
before starting this letter!\MessageBreak
Maybe you know what you are doing,\MessageBreak
so I do not change this myself%
}%
\fi
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macrocode}
\newcommand*{\LetterOptionNeedsPapersize}[2]{%
\edef\LOPNP@size{#2}\edef\LOPNP@option{#1}%
}
%
% \end{macrocode}
% \end{command}
%
% \begin{macrocode}
%(class|package)&letter>
% \end{macrocode}
%
% \section{Implementation of the Letter Configuration Option Files}
%
% Most of the predefined letter configuration option files define a letter
% layout, e.g, depending on a norm. The main thing in this case is to setup
% pseudo-lengths. Sometimes additionally macros or commands are (re-)defined.
%
% \begin{macrocode}
%<*lco>
% \end{macrocode}
%
% \subsection{The file header}
%
% The head has to identify the file:
% \changes{v3.04}{2009/04/21}{\file{NF.lco} by Jean-Marie Pacquet added}
% \changes{v3.04}{2009/06/26}{\file{USletter2w.lco} with contribution of
% Engelbert Buxbaum and Richard Ar\`es}
% \changes{v3.04}{2009/06/29}{\file{UScommercial9DW-lco} for paper formats
% letter or legal and envelopes with format no.\,9 with two windows}
% \changes{v3.04}{2009/06/30}{\file{UScommercial9} for paper formats
% letter or legal and envelopes with format commercial No.\,9 with one
% window based on \url{http://www.envelopesuperstore.com/}}
% \changes{v3.04}{2009/06/26}{long existing \file{visualize.lco} added}
% \changes{v3.17}{2015/02/17}{\file{DIN5008A.lco} and \file{DIN5008B.lco} added}
% \begin{macrocode}
%<*head>
\ProvidesFile{%
% visualize%
% DIN%
%<5008> 5008%
% A%
% B%
% DINmtext%
% SN%
% SNold%
% SNleft%
% KOMAold%
% NF%
% USletter2w
% UScommercial9
% UScommercial9DW
.lco}[\KOMAScriptVersion\space letter-class-option]
% \end{macrocode}
%
% Some of the \file{LCO} files need others:
% \begin{macrocode}
%<*5008>
\LoadLetterOption{%
% DINmtext%
% DIN%
}
%5008>
% \end{macrocode}
%
% \begin{command}{\LCOWarningNoLine,\LCOWarning}
% \changes{v2.95}{2006/03/24}{added}
% These are similar to \cs{PackageWarningNoLine} and \cs{PackageWarning} but
% for \file{lco} files.
% \begin{macrocode}
%<*!5008>
\providecommand*\LCOWarningNoLine[2]{%
\LCOWarning{#1}{#2\@gobble}%
}
\providecommand*\LCOWarning[2]{%
\GenericWarning{%
(#1)\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces
}{%
Letter configuration option #1 Warning: #2%
}%
}
%!5008>
%
% \end{macrocode}
% \end{command}
%
%
% \subsection{Main part of layout option files}
%
% The dimensions of some of the options has been researched by others:
% \begin{center}
% \begin{tabular}{ll}
% \texttt{lco} file & source \\\hline\\[-1.6ex]
% DIN & me \\
% DINmtext & me \\
% DIN5008A & me \\
% DIN5008B & me \\
% KOMAold & me \\
% SNleft & Roger Luethi \\
% SN & Roger Luethi \\
% NF & Jean-Marie Pacquet \\
% USletter2w & Engelbert Buxbaum \\
% UScommercial9 & me \\
% UScommercial9DW & me \\
% \end{tabular}
% \end{center}
%
% Test for the correct class or package:
% \begin{macrocode}
%<*body&!visualize>
%<*!5008>
\@ifundefined{scr@fromname@var}{%
\LCOWarningNoLine{%
% DIN%
% DINmtext%
% SN%
% SNold%
% SNleft%
% KOMAold%
% NF%
% USletter2w%
% UScommercial9%
% UScommercial9DW%
}{%
This letter configuration option file was made only\MessageBreak
to be used with KOMA-Script letter class\MessageBreak
`scrlttr2' or letter package `scrletter'.\MessageBreak
Use with other classes and without that package\MessageBreak
can result in a lot of errors%
}%
}{}
% \end{macrocode}
%
% Make sure, the correct paper size has been used:
% \begin{macrocode}
\LetterOptionNeedsPapersize{%
% DIN%
% DINmtext%
% SN%
% SNold%
% SNleft%
% KOMAold%
% NF%
% USletter2w%
% UScommercial9%
% UScommercial9DW%
%<*DIN|DINmoretext|SN|SNold|SwissLeft|KOMAold|NF>
}{a4}
%
%<*USletter2w|UScommercial9|UScommercial9DW>
}{letter}
%
% \end{macrocode}
%
% And now the dimensions and variables:
% \begin{variable}{fromzipcode}
% \changes{v3.03}{2009/03/04}{change of output name added}
% \begin{macrocode}
%\setkomavar*{fromzipcode}{%
% D}
% CH}
% F}
% US}
% \end{macrocode}
% \end{variable}
% \begin{pseudolength}{foldmarkhpos,tfoldmarkvpos,mfoldmarkvpos,bfoldmarkvpos,
% lforlmarkhpos}
% \changes{v2.97e}{2007/11/20}{several new fold marks to setup}
% \begin{macrocode}
\setplength{foldmarkhpos}{3.5mm}
\setplength{tfoldmarkvpos}{%
% 105mm}
% 87mm}
% 103.5mm}
% 99mm}
% 3.75in}
\setplength{mfoldmarkvpos}{\z@}
\setplength{bfoldmarkvpos}{%
% 210mm}
% 192mm}
% 202.5mm}
% 198mm}
% 7.4in}
% 7.375in}
\setplength{lfoldmarkhpos}{\z@}
% \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{toaddrvpos,toaddrhpos,toaddrwidth,toaddrheight,
% backaddrheight,specialmainindent,specialmailrightindent}
% \changes{v3.03}{2009/06/25}{the documentation says, the back-address is part
% of the address field}
% \begin{macrocode}
\setplength{toaddrvpos}{%
% 45mm}
% 27mm}
% 35.5mm}
% 49mm}
% 35mm}
% 1.8in}
% 2.1875in}
\setplength{toaddrhpos}{%
% 20mm}
% -8mm}
% 1in}
%\addtoplength{toaddrhpos}{\oddsidemargin}
% -10mm}
% .73in}
% 0.6875in}
% .5625in}
\setplength{toaddrwidth}{%
% 85mm}
% 90mm}
% 100mm}
% 70mm}
% 3.11in}
% 4.5in}
% 3.625in}
\setplength{toaddrheight}{%
% 45mm}
% 1.17in}
% 1.125in}
%!5008>
\setplength{toaddrindent}{%
% \z@}
%<5008> 5mm}
% 10mm}
%<*!5008>
\setplength{backaddrheight}{%
% 5mm}
% \z@}
%\KOMAoptions{backaddress=false}
\setplength{specialmailindent}{\fill}
\setplength{specialmailrightindent}{1em}
%!5008>
%<*5008>
\setplength{specialmailindent}{\useplength{toaddrindent}}
\setplength{specialmailrightindent}{\z@}
%5008>
% \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{locvpos,locwidth,lochpos}
% \begin{macrocode}
%<*5008>
\setplength{locvpos}{%
\dimexpr\useplength{toaddrvpos}+\useplength{backaddrheight}}
%5008>
\setplength{locwidth}{%
% \z@}
%<5008> 75mm}
%<5008>\setplength{lochpos}{10mm}
%<*!5008>
% \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{firstheadvpos,firstheadhpos,firstheadwidth}
% \begin{macrocode}
\setplength{firstheadvpos}{%
% 8mm}
% 6mm}
% 15mm}
% .36in}
% .4375in}
%!5008>
%<*5008>
\setplength{firstheadhpos}{%
\dimexpr \useplength{toaddrhpos}+\useplength{toaddrindent}}
%5008>
\setplength{firstheadwidth}{%
% \textwidth}
% 170mm}
%<*DIN|DINmoretext|SN|SwissLeft|UScommercial9>
\paperwidth}
\ifdim \useplength{toaddrhpos}>\z@
\addtoplength[-2]{firstheadwidth}{\useplength{toaddrhpos}}
\else
\addtoplength[2]{firstheadwidth}{\useplength{toaddrhpos}}
\fi
%
%<5008> \dimexpr 125mm-\useplength{firstheadhpos}}
%<*USletter2w>
\paperwidth}
\addtoplength[-]{firstheadwidth}{.68in}
%
%<*UScommercial9DW>
\paperwidth}
\addtoplength[-]{firstheadwidth}{.25in}
%
% \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{firstfootwidth,firstfootvpos}
% \changes{v2.9u}{2005/03/05}{optional the footer is placed 16\,mm above the
% lower paper edge}
% \begin{macrocode}
%\setplength{firstfootwidth}{\useplength{firstheadwidth}}
%<*5008>
\setplength{firstfoothpos}{%
\dimexpr\useplength{toaddrhpos}+\useplength{toaddrindent}}%
\setplength{firstfootwidth}{%
\dimexpr \paperwidth-\useplength{toaddrhpos}-\useplength{firstfoothpos}}%
%5008>
%\setplength{firstfootvpos}{\paperheight}
%\addtoplength{firstfootvpos}{-2cm}
%\setplength{firstfootvpos}{\paperheight}
%\addtoplength{firstfootvpos}{-16mm}
%\scr@ifundefinedorrelax{scr@v@is@le}{}{%
% \expandafter\ifnum \scr@v@is@le{2.9t}\relax\else
% \setplength{firstfootvpos}{1in}%
% \addtoplength{firstfootvpos}{\topmargin}%
% \addtoplength{firstfootvpos}{\headheight}%
% \addtoplength{firstfootvpos}{\headsep}%
% \addtoplength{firstfootvpos}{\textheight}%
% \addtoplength{firstfootvpos}{\footskip}%
% \fi
%}%
%\setplength{firstfootvpos}{266.679mm}
% \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{refvpos,refaftervskip,refwidth}
% \begin{macrocode}
%\setplength{refvpos}{%
% 98.5mm}
% 80.5mm}
%<5008&A> 79.4mm}
% 89mm}
% 89.5mm}
% \useplength{tfoldmarkvpos}}
% 3.1in}
% 3.4375in}
\setplength{refaftervskip}{%
% \baselineskip}
% 2\baselineskip}
%<5008> 8.46mm}
%<*!5008>
% \end{macrocode}
% The width of the reference line is somehow special, because setting of
% option \opt{refline=wide} or \opt{refline=narrow} should be possible after
% loading a \file{lco} file. So we use the initial special value 0 and
% calculate it inside \cs{opening} if it is still 0.
% \begin{macrocode}
\setplength{refwidth}{0pt}
% \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{sigindent,sigbeforevskip}
% \begin{macrocode}
\setplength{sigindent}{0mm}
\setplength{sigbeforevskip}{2\baselineskip}
%\let\raggedsignature=\centering
%\let\raggedsignature=\raggedright
% \end{macrocode}
% \end{pseudolength}
% \begin{macro}{\scr@default@firsthead@fromaddress@hook}
% \changes{v3.13b}{2014/04/02}{added}
% \changes{v3.27}{2019/04/02}{removed}
% \end{macro}
%
% \begin{command}{\yourref,\yourmail,\myref,\customer,\invoice,\defaultfields,
% \toname,\toaddress,\branch,\signature,\fromsig,\name,
% \fromname,\location,\fromlocation,\backaddress,
% \frombackaddress,\telephone,\telephonenum,\specialmail,
% \title,\subject,\place,\fromplace,\ccnameseparator,
% \enclnameseparator,\foldmarkson,\foldmarksoff,\addrfieldon,
% \addrfieldoff,\subjecton,\subjectoff,\subjectafteron,
% \subjectafteroff}
% \begin{macro}{\@title,\@subject}
% \begin{variable}{refitemi,refitemii,refitemiii,branch}
% We have also to do the compatibility commands and variables for
% \file{KOMAold.lco}.
% \begin{macrocode}
%<*KOMAold>
\def\yourref{\setkomavar{yourref}}
\def\yourmail{\setkomavar{yourmail}}
\def\myref{\setkomavar{myref}}
\def\customer{\setkomavar{customer}}
\def\invoice{\setkomavar{invoice}}
\@ifundefined{scr@refitemi@var}{\newkomavar{refitemi}}{}
\def\refitemi{\setkomavar{refitemi}}
\def\refitemnamei{\setkomavar*{refitemi}}
\@ifundefined{scr@refitemii@var}{\newkomavar{refitemii}}{}
\def\refitemii{\setkomavar{refitemii}}
\def\refitemnameii{\setkomavar*{refitemii}}
\@ifundefined{scr@refitemiii@var}{\newkomavar{refitemiii}}{}
\def\refitemiii{\setkomavar{refitemiii}}
\def\refitemnameiii{\setkomavar*{refitemiii}}
\l@addto@macro{\defaultreffields}{%
\addtoreffields{refitemi}%
\addtoreffields{refitemii}%
\addtoreffields{refitemiii}%
}
\addtoreffields{refitemi}%
\addtoreffields{refitemii}%
\addtoreffields{refitemiii}%
\def\toname{\usekomavar{toname}}
\def\toaddress{\usekomavar{toaddress}}
\@ifundefined{scr@branch@var}{\newkomavar{branch}}{}
\def\branch{\setkomavar{branch}}
\def\frombranch{\usekomavar{branch}}
\def\signature{\setkomavar{signature}}
\def\fromsig{\usekomavar{signature}}
\def\name{\setkomavar{fromname}}
\def\fromname{\usekomavar{fromname}}
\def\address{\setkomavar{fromaddress}}
\def\fromaddress{\usekomavar{fromaddress}}
\def\location{\setkomavar{location}}
\def\fromlocation{\usekomavar{location}}
\def\backaddress{\setkomavar{backaddress}}
% \end{macrocode}
% \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
% \cs{Ifkomavarempty}}
% Note: This is dangerous if someone uses a new \KOMAScript{} but copies the
% wrong code.
% \begin{macrocode}
\def\@tempa{%
\Ifkomavarempty{fromname}{}{%
\strut\ignorespaces\usekomavar{fromname}%
\Ifkomavarempty{fromaddress}{}{\\}}%
\Ifkomavarempty{fromaddress}{}{%
\strut\ignorespaces\usekomavar{fromaddress}}%
}
\ifx\@tempa\scr@backaddress@var%
\setkomavar{backaddress}{}
\else
\def\@tempa{%
\ifkomavarempty{fromname}{}{%
\strut\ignorespaces\usekomavar{fromname}%
\ifkomavarempty{fromaddress}{}{\\}}%
\ifkomavarempty{fromaddress}{}{%
\strut\ignorespaces\usekomavar{fromaddress}}%
}
\ifx\@tempa\scr@backaddress@var%
\setkomavar{backaddress}{}
\fi
\fi
\def\frombackaddress{\usekomavar{backaddress}}
\def\telephone{\setkomavar{fromphone}}
\def\telephonenum{\usekomavar{fromphone}}
\def\specialmail{\setkomavar{specialmail}}
\def\@specialmail{\usekomavar{specialmail}}
\def\title{\setkomavar{title}}
\def\@title{\usekomavar{title}}
\def\subject{\setkomavar{subject}}
\def\@subject{\usekomavar{subject}}
\def\place{\setkomavar{place}}
\def\fromplace{\usekomavar{place}}
\let\ccnameseparator=\scr@ccseparator@var
\setkomavar{ccseparator}{\ccnameseparator}
\let\enclnameseparator=\scr@enclseparator@var
\setkomavar{enclseparator}{\enclnameseparator}
\setkomafont{fromname}{\scshape}
\def\foldmarkson{\@ObsoleteCommand{\foldmarkson}{foldmarks=on}}
\def\foldmarksoff{\@ObsoleteCommand{\foldmarksoff}{foldmarks=off}}
\def\addrfieldon{\@ObsoleteCommand{\addrfieldon}{addrfield=on}}
\def\addrfieldoff{\@ObsoleteCommand{\addrfieldoff}{addrfield=off}}
\def\subjecton{\@ObsoleteCommand{\subjecton}{subject=titled}}
\def\subjectoff{\@ObsoleteCommand{\subjectoff}{subject=untitled}}
\def\subjectafteron{%
\@ObsoleteCommand{\subjectafteron}{subject=afteropening}}
\def\subjectafteroff{%
\@ObsoleteCommand{\subjectafteroff}{subject=beforeopening}}
%
% \end{macrocode}
% \end{variable}
% \end{macro}
% \end{command}
%
%
% \begin{pseudolength}{specialmailheight}
% \begin{macro}{\@PapersizeWarning}
% For \file{DIN5008a.lco} and \file{DIN5008b.lco} we need additional settings:
% \changes{v3.30}{2020/02/25}{white spaces and end of warning removed}
% \begin{macrocode}
%!5008>
%<*5008>
\newplength{specialmailheight}
\setplength{specialmailheight}{12.7mm}
\areaset[5mm]{165mm}{233mm}
\KOMAoptions{%
fromalign=locationleft,
addrfield=topaligned,
refline=narrow,
parskip=full
}
\l@addto@macro\@PapersizeWarning{%
\begingroup
\@tempswafalse
\ifdim\oddsidemargin<\dimexpr 25mm-1in-1pt\relax\@tempswatrue\else
\ifdim\oddsidemargin>\dimexpr 25mm-1in+1pt\relax\@tempswatrue\fi\fi
\ifdim\textwidth<\dimexpr \paperwidth-45mm-1pt\relax\@tempswatrue\else
\ifdim\textwidth>\dimexpr \paperwidth-45mm+1pt\relax\@tempswatrue\fi\fi
\if@tempswa
\LCOWarning{DIN5008%
% A%
% B%
}{%
DIN5008 orders exact margins and text\MessageBreak
width. Without following these values,\MessageBreak
your document does not conform DIN5008.\MessageBreak
You should use, e.g.,\MessageBreak
\space\string\areaset[5mm]{%
\the\dimexpr \paperwidth-45mm\relax}{%
\the\dimexpr 1.414\dimexpr \paperwidth-45mm\relax\relax}\MessageBreak
to follow the norm%
}%
\fi
\ifdim \dimexpr\parskip\relax=\dimexpr\baselineskip\relax\else
\LCOWarning{DIN5008%
% A%
% B%
}{%
DIN5008 orders paragraph separation by\MessageBreak
exactly one line. Without this, your\MessageBreak
document does not conform DIN5008.\MessageBreak
You shoud use, e.g.,\MessageBreak
\space\string\KOMAoption{parskip}{full}\MessageBreak
to follow the norm%
}%
\fi
\endgroup
}
% \end{macrocode}
% \end{macro}
% \end{pseudolength}
% \begin{macro}{\backaddr@format}
% \changes{v3.25}{2017/11/15}{using \cs{scr@endstrut} instead of
% \cs{unskip}\cs{strut}}
% Multi line back address without underline.
% \begin{macrocode}
\renewcommand{\backaddr@format}[1]{\hspace*{\useplength{toaddrindent}}%
\parbox[t][\useplength{backaddrheight}][t]%
{\dimexpr\useplength{toaddrwidth}-\useplength{toaddrindent}}%
{\strut\ignorespaces #1\ifhmode\scr@endstrut\fi}%
}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\specialmail@format}
% \changes{v3.25}{2017/11/15}{using \cs{scr@endstrut} instead of
% \cs{unskip}\cs{strut}}
% Multi line special sending.
% \begin{macrocode}
\renewcommand{\specialmail@format}[1]{%
\parbox[t][\useplength{specialmailheight}][t]%
{\dimexpr\useplength{toaddrwidth}
-\useplength{specialmailindent}
-\useplength{specialmailrightindent}}%
{\strut\ignorespaces #1\ifhmode\scr@endstrut\fi}%
}
% \end{macrocode}
% \end{macro}
% \begin{fontelement}{specialmail,backaddress,addressee,fromname,fromaddress,refvalue}
% Some font settings.
% \begin{macrocode}
\setkomafont{specialmail}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\setkomafont{backaddress}{\sffamily\fontsize{8pt}{10pt}\selectfont}
\setkomafont{addressee}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\setkomafont{fromname}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\setkomafont{fromaddress}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\setkomafont{refvalue}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\let\raggedsignature\raggedright
%5008>
%