Debian Codegraph @

texmf-dist/source/latex/koma-script/scrkernel-notepaper.dtx

raw
1 % \iffalse meta-comment
2 % ======================================================================
3 % scrkernel-notepaper.dtx
4 % Copyright (c) Markus Kohm, 2006-2025
5 %
6 % This file is part of the LaTeX2e KOMA-Script bundle.
7 %
8 % This work may be distributed and/or modified under the conditions of
9 % the LaTeX Project Public License, version 1.3c of the license.
10 % The latest version of this license is in
11 % http://www.latex-project.org/lppl.txt
12 % and version 1.3c or later is part of all distributions of LaTeX
13 % version 2005/12/01 or later and of this work.
14 %
15 % This work has the LPPL maintenance status "author-maintained".
16 %
17 % The Current Maintainer and author of this work is Markus Kohm.
18 %
19 % This work consists of all files listed in MANIFEST.md.
20 % ======================================================================
21 %%% From File: $Id: scrkernel-notepaper.dtx 4220 2025-09-05 12:10:03Z kohm $
22 %<option>%%% (run: option)
23 %<body>%%% (run: body)
24 %<*dtx>
25 \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
26 \begingroup
27 \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
28 \filedate$Date: 2025-09-05 14:10:03 +0200 (Fr, 05. Sep 2025) $
29 \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
30 \filerevision$Revision: 4220 $
31 \edef\reserved@a{%
32 \noexpand\endgroup
33 \noexpand\ProvidesFile{scrkernel-notepaper.dtx}
34 [\filedate\space\filerevision\space
35 KOMA-Script source
36 (note-paper)]
37 }%
38 \reserved@a
39 \documentclass[USenglish]{koma-script-source-doc}
40 \usepackage{babel}
41 \setcounter{StandardModuleDepth}{3}
42 \begin{document}
43 \DocInput{scrkernel-notepaper.dtx}
44 \end{document}
45 %</dtx>
46 % \fi
47 %
48 % \changes{v2.95}{2006/03/16}{first version after splitting \file{scrclass.dtx}}
49 % \changes{v3.36}{2022/02/26}{\cs{@newplength} replaced by \cs{newplength}}
50 % \changes{v3.36}{2022/02/26}{\cs{@setplength} replaced by \cs{setplength}}
51 % \changes{v3.36}{2022/02/26}{\cs{@addtoplength} replaced by \cs{addtoplength}}
52 % \changes{v3.36}{2022/03/02}{switch over from \cls*{scrdoc} to
53 % \cls*{koma-script-source-doc}}
54 % \changes{v3.36}{2022/03/02}{whole implementation documentation in English}
55 % \changes{v3.40}{2023/04/17}{guide names changed}
56 %
57 % \GetFileInfo{scrkernel-notepaper.dtx}
58 % \title{Specific Code for Letters and Especially the Notepaper with
59 % \href{https://komascript.de}{\KOMAScript}}
60 % \author{\href{mailto:[email protected]}{Markus Kohm}}
61 % \date{Revision \fileversion{} of \filedate}
62 % \maketitle
63 % \begin{abstract}
64 % The notepaper is something with high interest for letters. \KOMAScript{}
65 % provides a wide range of configurations for it. \file{scrkernel-notepaper}
66 % implements these features with options, variables and pseudo lengths
67 % \end{abstract}
68 % \tableofcontents
69 %
70 % \section{User Manual}
71 %
72 % You can find the user documentation the commands implemented here in the
73 % \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the
74 % English \file{scrguide-en.pdf}.
75 %
76 % \MaybeStop{\PrintIndex}
77 %
78 %
79 % \section{Implementation of the Notepaper of Letters}
80 %
81 % This code is only valid for letters with \cls*{scrlttr2} or
82 % \pkg*{scrletter}.
83 %
84 % \begin{macrocode}
85 %<*letter>
86 % \end{macrocode}
87 %
88 %
89 % \subsection{Options of the letter head}
90 %
91 % There are several options for the letter head.
92 %
93 % \begin{option}{firsthead}
94 % \changes{v2.97e}{2007/11/22}{added}
95 % \begin{macro}{\@firstheadfalse,\@firstheadtrue,\if@firsthead}
96 % \changes{v2.8q}{2002/01/25}{added}
97 % Optionally the whole letter head can be switched off (default is on).
98 % \begin{macrocode}
99 %<*option>
100 \KOMA@ifkey{firsthead}{@firsthead}
101 \KOMAExecuteOptions{firsthead=true}
102 % \end{macrocode}
103 % \end{macro}
104 % \end{option}
105 %
106 % \begin{option}{fromalign}
107 % \changes{v2.8q}{2002/01/25}{added}
108 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
109 % \changes{v3.17}{2015/03/16}{using internal value storage}
110 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
111 % option storage commands}
112 % \begin{macro}{\@alignfrom}
113 % \changes{v2.8q}{2002/01/25}{added}
114 % \changes{v2.97e}{2007/11/13}{new values added}
115 % The option provides several values for placing the sender of the letter. The
116 % decision is saved as numerical value of the macro.
117 % \begin{center}
118 % \begin{tabular}{lrl}
119 % \opt{fromalign} & \cs{@alignfrom} & placement\\\hline
120 % \opt{=left} & 0 & left in the head\\
121 % \opt{=center} & 1 & centered in the head\\
122 % \opt{=right} & 2 & right in the head\\
123 % \opt{=locationleft} & 3 & left in the location field\\
124 % \opt{=locationright} & 4 & right in the location field\\
125 % \opt{=false} & 10000 & \emph{don't touch} \\
126 % \end{tabular}
127 % \end{center}
128 % Initial setting is \emph{don't touch}, which means not to change the content
129 % of variable \var{firsthead} of \var{location}.
130 % \begin{macrocode}
131 \newcommand*{\@alignfrom}{0}
132 \KOMA@key{fromalign}{%
133 \KOMA@set@ncmdkey{fromalign}{@alignfrom}{%
134 {left}{0},%
135 {center}{1},{centered}{1},{middle}{1},%
136 {right}{2},%
137 {locationleft}{3},{leftlocation}{3},%
138 {locationright}{4},{rightlocation}{4},{location}{4},%
139 {no}{10000},{false}{10000},{off}{10000}%
140 }{#1}%
141 \ifx\FamilyKeyState\FamilyKeyStateProcessed
142 \KOMA@kav@xreplacevalue{%
143 %<class> \KOMAClassFileName
144 %<package> scrletter.\scr@pkgextension
145 }{fromalign}{#1}%
146 \ifcase\@alignfrom\or\or\or\@firstheadfalse\or\@firstheadfalse\fi
147 \fi
148 }
149 \KOMA@kav@add{%
150 %<class> \KOMAClassFileName
151 %<package> scrletter.\scr@pkgextension
152 }{fromalign}{left}
153 % \end{macrocode}
154 % \end{macro}
155 % \end{option}
156 %
157 % \begin{option}{fromrule}
158 % \changes{v2.8q}{2002/01/25}{added}
159 % \changes{v3.17}{2015/03/16}{using internal value storage}
160 % \begin{macro}{\@rulefrom}
161 % \changes{v2.8q}{2002/01/25}{added}
162 % Should there be a horizontal rule inside the sender of the automatic
163 % generated letter head of option \opt{fromalign}?
164 % \begin{center}
165 % \begin{tabular}{lrl}
166 % \opt{fromrule} & \cs{@rulefrom} & rule placement \\\hline
167 % \opt{=false} & 0 & nowhere \\
168 % \opt{=aftername} & 1 & below the senders name \\
169 % \opt{=below} & 2 & below the senders address \\
170 % \end{tabular}
171 % \end{center}
172 % Initial setting is nowhere.
173 % \begin{macrocode}
174 \KOMA@ncmdkey{fromrule}[below]{@rulefrom}{%
175 {false}{0},{no}{0},{off}{0},{aftername}{1},%
176 {below}{2},{afteraddress}{2},{true}{2},{yes}{2},{on}{2}%
177 }
178 \KOMA@kav@add{%
179 %<class> \KOMAClassFileName
180 %<package> scrletter.\scr@pkgextension
181 }{fromrule}{false}
182 % \end{macrocode}
183 % \end{macro}
184 % \end{option}
185 %
186 % \begin{option}{fromphone}
187 % \changes{v2.8q}{2002/01/25}{added}
188 % \begin{macro}{\@phonefalse,\@phonetrue,\if@phone}
189 % \changes{v2.8q}{2002/01/25}{added}
190 % Show the sender's telephone number in the letter head automatically
191 % generated by option \opt{fromalign}?
192 % \begin{macrocode}
193 \KOMA@ifkey{fromphone}{@phone}
194 % \end{macrocode}
195 % \end{macro}
196 % \end{option}
197 %
198 % \begin{option}{frommobilephone}
199 % \changes{v3.12}{2013/05/29}{added}
200 % \begin{macro}{\@mobilephonefalse,\@mobilephonetrue,\if@mobilephone}
201 % \changes{v3.12}{2013/05/29}{added}
202 % Show the sender's mobile telephone number in the letter head automatically
203 % generated by option \opt{fromalign}?
204 % \begin{macrocode}
205 \KOMA@ifkey{frommobilephone}{@mobilephone}
206 % \end{macrocode}
207 % \end{macro}
208 % \end{option}
209 %
210 % \begin{option}{fromfax}
211 % \changes{v2.8q}{2002/01/25}{added}
212 % \begin{macro}{\@faxfalse,\@faxtrue,\if@fax}
213 % \changes{v2.8q}{2002/01/25}{added}
214 % Show the sender's telefax number in the letter head automatically generated
215 % by option \opt{fromalign}?
216 % \begin{macrocode}
217 \KOMA@ifkey{fromfax}{@fax}
218 % \end{macrocode}
219 % \end{macro}
220 % \end{option}
221 %
222 % \begin{option}{fromemail}
223 % \changes{v2.8q}{2002/01/25}{added}
224 % \begin{macro}{\@emailfalse,\@emailtrue,\if@email}
225 % \changes{v2.8q}{2002/01/25}{added}
226 % Show the sender's email address in the letter head automatically generated
227 % by option \opt{fromalign}?
228 % \begin{macrocode}
229 \KOMA@ifkey{fromemail}{@email}
230 % \end{macrocode}
231 % \end{macro}
232 % \end{option}
233 %
234 % \begin{option}{fromurl}
235 % \changes{v2.8q}{2002/01/25}{added}
236 % \begin{macro}{\@wwwfalse,\@wwwtrue,\if@www}
237 % \changes{v2.8q}{2002/01/25}{added}
238 % Show a sender's url (e.g. of the homepage) in the letter head automatically
239 % generated by option \opt{fromalign}?
240 % \begin{macrocode}
241 \KOMA@ifkey{fromurl}{@www}
242 % \end{macrocode}
243 % \end{macro}
244 % \end{option}
245 %
246 % \begin{option}{fromlogo}
247 % \changes{v2.8q}{2002/01/25}{added}
248 % \begin{macro}{\@logofalse,\@logotrue,\if@logo}
249 % \changes{v2.8q}{2002/01/25}{added}
250 % Show a sender's logo in the letter head automatically generated by option
251 % \opt{fromalign} (placement also depends on \opt{fromalign})?
252 % \begin{macrocode}
253 \KOMA@ifkey{fromlogo}{@logo}
254 %</option>
255 % \end{macrocode}
256 % \end{macro}
257 % \end{option}
258 %
259 %
260 % \subsection{Options for the addressee and the location field}
261 %
262 % \begin{option}{addrfield}
263 % \changes{v2.8q}{2001/10/09}{added}
264 % \changes{v3.03}{2009/03/04}{new values added}
265 % \changes{v3.17}{2015/03/16}{using internal value storage}
266 % \begin{macro}{\@afieldmode}
267 % \changes{v3.03}{2009/03/04}{added}
268 % There are several settings for the address field---not only to switch it on
269 % and off:
270 % \begin{center}
271 % \begin{tabular}{lrl}
272 % \opt{addrfield} & \cs{@afieldmode} & meaning \\\hline
273 % false & 0 & don't show the address
274 % field\\
275 % true & 1 & show address field
276 % centered\\
277 % PP & 2 & address field with
278 % pospaid\\
279 % backgroundimage & 3 & address field with
280 % background image\\
281 % image & 4 & address field by image\\
282 % topaligned & 5 & show address field top
283 % aligned\\
284 % \end{tabular}
285 % \end{center}
286 % \begin{macrocode}
287 %<*option>
288 \newcommand*{\@afieldmode}{\@ne}
289 \KOMA@ncmdkey{addrfield}[true]{@afieldmode}{%
290 {false}{0},{off}{0},{no}{0},%
291 {true}{1},{on}{1},{yes}{1},%
292 {PP}{2},{pp}{2},%
293 {PPexplicite}{2},{PPExplicite}{2},%
294 {ppexplicite}{2},{ppExplicite}{2},%
295 {backgroundimage}{3},%
296 {PPbackgroundimage}{3},{PPBackgroundImage}{3},{PPBackGroundImage}{3},%
297 {ppbackgroundimage}{3},{ppBackgroundImage}{3},{ppBackGroundImage}{3},%
298 {image}{4},{Image}{4},%
299 {PPimage}{4},{PPImage}{4},%
300 {ppimage}{4},{ppImage}{4},%
301 {topaligned}{5},{alignedtop}{5}%
302 }
303 \KOMA@kav@add{%
304 %<class> \KOMAClassFileName
305 %<package> scrletter.\scr@pkgextension
306 }{addrfield}{true}
307 % \end{macrocode}
308 % \begin{macro}{\@afieldfalse,\@afieldtrue,\if@afield}
309 % \changes{v3.03}{2009/03/04}{replaced by \cs{@afieldmode}}
310 % \changes{v3.36}{2022/03/02}{removed}
311 % \end{macro}
312 % \end{macro}
313 % \end{option}
314 %
315 % \begin{option}{priority}
316 % \changes{v3.03}{2009/03/04}{added}
317 % \changes{v3.17}{2015/03/16}{using internal value storage}
318 % \changes{v3.36}{2022/03/02}{value \opt{\quotechar=manual} fixed}
319 % \begin{macro}{\ltr@priority}
320 % \changes{v3.03}{2009/03/04}{added}
321 % The international postage convention allows two priorities for
322 % letters. Together with no (or manually given) priority we have three of
323 % them:
324 % \begin{center}
325 % \begin{tabular}{lrl}
326 % \opt{priority} & \cs{ltr@priority} & meaning \\\hline
327 % false & 0 & use variable \var{specialmail}\\
328 % B & 1 & set \var{specialmail} to
329 % B-Economy\\
330 % A & 2 & set \var{specialmail} to
331 % A-Priority\\
332 % \end{tabular}
333 % \end{center}
334 % \begin{macrocode}
335 \KOMA@ncmdkey{priority}[A]{ltr@priority}{%
336 {no}{0},{off}{0},{false}{0},{manual}{0},%
337 {B}{1},{b}{1},%
338 {economy}{1},{Economy}{1},{ECONOMY}{1},%
339 {B-ECONOMY}{1},{B-Economy}{1},{b-economy}{1},%
340 {A}{2},{a}{2},%
341 {priority}{2},{Priority}{2},{PRIORITY}{2},%
342 {A-PRIORITY}{2},{A-Priority}{2},{a-priority}{2}%
343 }%
344 \KOMA@kav@add{%
345 %<class> \KOMAClassFileName
346 %<package> scrletter.\scr@pkgextension
347 }{priority}{false}
348 % \end{macrocode}
349 % \end{macro}
350 % \end{option}
351 %
352 % \begin{option}{backaddress}
353 % \changes{v2.8q}{2002/01/22}{added}
354 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
355 % \changes{v3.17}{3015/03/16}{using internal value storage}
356 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
357 % option storage commands}
358 % \begin{macro}{\@baddrfalse,\@baddrtrue,\if@baddr}
359 % \begin{macro}{\backaddr@format}
360 % \changes{v2.96}{2006/07/31}{added}
361 % The address field of the addressee can also contain a small sender's address
362 % also known as return address.
363 % \begin{center}
364 % \begin{tabular}{llll}
365 % \opt{backaddress} & \cs{if@baddr} & \cs{backaddr@format} & meaning \\\hline
366 % \opt{=false} & \cs{iffalse} & unchanged & don't show a
367 % return
368 % address\\
369 % \opt{=true} & \cs{iftrue} & unchanged & show the
370 % return address\\
371 % \opt{=underlined} & \cs{iftrue} & \cs{underline} & show
372 % underlined
373 % return
374 % address\\
375 % \opt{=plain} & \cs{iftrue} & \cs{@firstofone} & show the
376 % return
377 % address
378 % unchanged\\
379 % \end{tabular}
380 % \end{center}
381 % Initial setting is to show a underlined return address.
382 % \begin{macrocode}
383 \newcommand{\backaddr@format}[1]{}
384 \let\backaddr@format\underline
385 \newif\if@baddr\@baddrtrue
386 \KOMA@key{backaddress}[true]{%
387 \begingroup
388 \KOMA@set@ncmdkey{backaddress}{@tempa}{%
389 {false}{0},{off}{0},{no}{0},%
390 {true}{1},{on}{1},{yes}{1},%
391 {underlined}{2},%
392 {plain}{3}%
393 }{#1}%
394 \ifx\FamilyKeyState\FamilyKeyStateProcessed
395 \aftergroup\FamilyKeyStateProcessed
396 \ifcase\@tempa
397 \endgroup
398 \@baddrfalse
399 \or
400 \endgroup
401 \@baddrtrue
402 \or
403 \endgroup
404 \@baddrtrue
405 \let\backaddr@format\underline
406 \or
407 \endgroup
408 \@baddrtrue
409 \let\backaddr@format\@firstofone
410 \else
411 \endgroup
412 \fi
413 \if@baddr
414 \ifx\backaddr@format\underline
415 \KOMA@kav@replacevalue{%
416 %<class> \KOMAClassFileName
417 %<package> scrletter.\scr@pkgextension
418 }{backaddress}{underlined}%
419 \else
420 \ifx\backaddr@format\@firstofone
421 \KOMA@kav@replacevalue{%
422 %<class> \KOMAClassFileName
423 %<package> scrletter.\scr@pkgextension
424 }{backaddress}{plain}%
425 \else
426 \KOMA@kav@replacevalue{%
427 %<class> \KOMAClassFileName
428 %<package> scrletter.\scr@pkgextension
429 }{backaddress}{true}%
430 \fi
431 \fi
432 \else
433 \KOMA@kav@replacevalue{%
434 %<class> \KOMAClassFileName
435 %<package> scrletter.\scr@pkgextension
436 }{backaddress}{false}%
437 \fi
438 \else
439 \endgroup
440 \FamilyKeyStateUnknownValue
441 \fi
442 }
443 % \end{macrocode}
444 % \end{macro}^^A \backaddr@format
445 % \end{macro}^^A \if@baddr
446 % \end{option}^^A backaddress
447 %
448 % \begin{option}{locfield}
449 % \changes{v2.8q}{2001/10/09}{added}
450 % \changes{v2.97c}{2007/03/30}{inverted meaning fixed}
451 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
452 % \changes{v3.17}{2015/03/16}{using internal value storage}
453 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
454 % option storage commands}
455 % \changes{v3.42}{2024/06/07}{missing \cs{FamilyKeyStateProcessed} after end
456 % of group added}
457 % \begin{macro}{\@biglocfalse,\@bigloctrue,\if@bigloc}
458 % We allow two different automatic settings for the location field right
459 % beside the addressee's address field:
460 % \begin{center}
461 % \begin{tabular}{lll}
462 % \opt{locfield} & \cs{if@bigloc} & meaning \\\hline
463 % \opt{=wide} & \cs{iftrue} & set \plen{locwidth} to 2/3 of
464 % available space\\
465 % \opt{=narrow} & \cs{iffalse} & set \plen{locwidth} to 1/2 of
466 % available space\\
467 % \end{tabular}
468 % \end{center}
469 % Initial setting is \opt{locfield=narrow}.
470 % \begin{macrocode}
471 \newif\if@bigloc
472 \KOMA@key{locfield}[wide]{%
473 \begingroup
474 \KOMA@set@ncmdkey{locfield}{@tempa}{{wide}{0},{narrow}{1}}{#1}%
475 \ifx\FamilyKeyState\FamilyKeyStateProcessed
476 \aftergroup\FamilyKeyStateProcessed
477 \ifcase\@tempa
478 \endgroup
479 \@bigloctrue
480 \KOMA@kav@replacevalue{%
481 %<class> \KOMAClassFileName
482 %<package> scrletter.\scr@pkgextension
483 }{locfield}{wide}%
484 \else
485 \endgroup
486 \@biglocfalse
487 \KOMA@kav@replacevalue{%
488 %<class> \KOMAClassFileName
489 %<package> scrletter.\scr@pkgextension
490 }{locfield}{narrow}%
491 \fi
492 \else
493 \endgroup
494 \FamilyKeyStateUnknownValue
495 \fi
496 }
497 \KOMA@kav@add{%
498 %<class> \KOMAClassFileName
499 %<package> scrletter.\scr@pkgextension
500 }{locfield}{narrow}
501 % \end{macrocode}
502 % \begin{option}{wlocfield,slocfield}
503 % \changes{v3.01a}{2008/11/20}{deprecated}
504 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
505 % \begin{macrocode}
506 %<*!v4>
507 \KOMA@DeclareDeprecatedOption{wlocfield}{locfield=wide}
508 \KOMA@DeclareDeprecatedOption{slocfield}{locfield=narrow}
509 %</!v4>
510 %</option>
511 % \end{macrocode}
512 % \end{option}^^A wlocfield,slocfield
513 % \end{macro}^^A \if@bigloc
514 % \end{option}^^A locfield
515 %
516 %
517 % \subsection{Options of the fold marks}
518 %
519 % \KOMAScript{} provides a large number of horizontal and vertical fold marks.
520
521 % \begin{option}{foldmarks}
522 % \changes{v2.8q}{2001/09/10}{added}
523 % \changes{v3.00}{2008/06/06}{locally re-definition of \cs{FamilyUnkownKeyVal}
524 % instead of \cs{KOMA@unkown@keyval}}
525 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
526 % \changes{v3.17}{2015/03/16}{using internal value storage}
527 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
528 % option storage commands}
529 % \begin{macro}{\@foldfalse,\@foldtrue,\if@fold}
530 % \begin{macro}{\@usefolds}
531 % \changes{v2.97e}{2007/11/08}{added}
532 % Fold marks can be generally switched on and off and it can be selected,
533 % which fold marks should be shown, if fold marks has been activated:
534 % \begin{center}
535 % \begin{tabular}{llll}
536 % \opt{foldmarks} & \cs{if@fold} & \cs{@usefolds} & meaning\\\hline
537 % \opt{=true} & \cs{iftrue} & \emph{no change} & switch on fold
538 % marks\\
539 % \opt{=false} & \cs{iffalse} & \emph{no change} & switch off fold
540 % marks\\
541 % \opt{=\dots T\dots} & \emph{no change} & \texttt{T} \emph{added} & top
542 % fold mark
543 % enabled\\
544 % \opt{=\dots M\dots} & \emph{no change} & \texttt{M} \emph{added} & middle
545 % fold mark
546 % enabled\\
547 % \opt{=\dots B\dots} & \emph{no change} & \texttt{B} \emph{added} & bottom
548 % fold mark
549 % enabled\\
550 % \opt{=\dots P\dots} & \emph{no change} & \texttt{P} \emph{added} & hole
551 % punch fold mark
552 % enabled\\
553 % \opt{=\dots H\dots} & \emph{no change} & \texttt{TMBP} \emph{added} & all
554 % horizontal fold
555 % marks enabled\\
556 % \opt{=\dots L\dots} & \emph{no change} & \texttt{L} \emph{added} & left
557 % fold mark
558 % enabled\\
559 % \opt{=\dots V\dots} & \emph{no change} & \texttt{L} \emph{added} & all
560 % vertical fold
561 % marks enabled\\
562 % \opt{=\dots t\dots} & \emph{no change} & \texttt{T} \emph{removed} & top
563 % fold mark
564 % disabled\\
565 % \opt{=\dots m\dots} & \emph{no change} & \texttt{M} \emph{removed} & middle
566 % fold mark
567 % disabled\\
568 % \opt{=\dots b\dots} & \emph{no change} & \texttt{B} \emph{removed} & bottom
569 % fold mark
570 % disabled\\
571 % \opt{=\dots p\dots} & \emph{no change} & \texttt{P} \emph{removed} & hole
572 % punch fold mark
573 % disabled\\
574 % \opt{=\dots h\dots} & \emph{no change} & \texttt{TMBP} \emph{removed} & all
575 % horizontal fold
576 % marks disabled\\
577 % \opt{=\dots l\dots} & \emph{no change} & \texttt{L} \emph{removed} & left
578 % fold mark
579 % disabled\\
580 % \opt{=\dots v\dots} & \emph{no change} & \texttt{L} \emph{removed} & all
581 % vertical fold
582 % marks disabled\\
583 % \end{tabular}
584 % \end{center}
585 % Enabling or disabling a fold mark does not enable printing of fold
586 % marks. the enabled fold marks are only printed, if fold marks are switched
587 % on. The initial state is to switch on the top, middle, bottom, punch hole
588 % and left fold mark (in other words: all fold marks).
589 % \begin{macrocode}
590 %<*option>
591 \newif\if@fold\@foldtrue
592 \newcommand*{\@usefolds}{TMBPL}
593 \KOMA@key{foldmarks}[true]{%
594 \begingroup
595 \KOMA@set@ifkey\@empty{@fold}{#1}%
596 \ifx\FamilyKeyState\FamilyKeyStateProcessed
597 \if@fold\aftergroup\@foldtrue\else\aftergroup\@foldfalse\fi
598 \aftergroup\FamilyKeyStateProcessed
599 \else
600 \aftergroup\FamilyKeyStateProcessed
601 \def\sc@nf@ldch@rs##1{%
602 \ifx ##1\@nil\else
603 \if ##1T\g@addto@macro\@usefolds{##1}\else
604 \if ##1M\g@addto@macro\@usefolds{##1}\else
605 \if ##1B\g@addto@macro\@usefolds{##1}\else
606 \if ##1P\g@addto@macro\@usefolds{##1}\else
607 \if ##1L\g@addto@macro\@usefolds{##1}\else
608 \if ##1V\g@addto@macro\@usefolds{L}\else
609 \if ##1H\g@addto@macro\@usefolds{TMBP}\else
610 \if ##1t\scr@removechar\@usefolds{T}\else
611 \if ##1m\scr@removechar\@usefolds{M}\else
612 \if ##1b\scr@removechar\@usefolds{B}\else
613 \if ##1p\scr@removechar\@usefolds{P}\else
614 \if ##1l\scr@removechar\@usefolds{L}\else
615 \if ##1v%
616 \scr@removechar\@usefolds{L}%
617 \else
618 \if ##1h%
619 \scr@removechar\@usefolds{T}%
620 \scr@removechar\@usefolds{M}%
621 \scr@removechar\@usefolds{B}%
622 \else
623 \aftergroup\FamilyKeyStateUnknownValue
624 \fi
625 \fi
626 \fi
627 \fi
628 \fi
629 \fi
630 \fi
631 \fi
632 \fi
633 \fi
634 \fi
635 \fi
636 \fi
637 \fi
638 \expandafter\sc@nf@ldch@rs
639 \fi
640 }%
641 \expandafter\sc@nf@ldch@rs#1\@nil
642 \fi
643 \endgroup
644 \ifx\FamilyKeyState\FamilyKeyStateProcessed
645 \KOMA@kav@xreplacevalue{%
646 %<class> \KOMAClassFileName
647 %<package> scrletter.\scr@pkgextension
648 }{foldmarks}{\@usefolds}%
649 \KOMA@kav@xadd{%
650 %<class> \KOMAClassFileName
651 %<package> scrletter.\scr@pkgextension
652 }{foldmarks}{\if@fold true\else false\fi}%
653 \fi
654 }
655 \KOMA@kav@xadd{%
656 %<class> \KOMAClassFileName
657 %<package> scrletter.\scr@pkgextension
658 }{foldmarks}{\@usefolds}%
659 \KOMA@kav@add{%
660 %<class> \KOMAClassFileName
661 %<package> scrletter.\scr@pkgextension
662 }{foldmarks}{true}%
663 % \end{macrocode}
664 % \begin{macro}{\scr@removechar}
665 % \changes{v2.97e}{2007/11/08}{added}
666 % Used to remove one char from a character list macro like \cs{@usefolds}.
667 % \begin{macrocode}
668 \newcommand*{\scr@removechar}[2]{%
669 \def\in@@##1#2##2##3\in@@{%
670 \ifx\in@##2\else
671 \def\in@@####1#2\in@{\gdef#1{##1####1}}%
672 \in@@##2##3%
673 \fi}%
674 \expandafter\in@@#1#2\in@\in@@
675 }
676 %</option>
677 % \end{macrocode}
678 % \end{macro}^^A \scr@removechar
679 % \end{macro}^^A \@usefolds
680 % \end{macro}^^A \if@fold
681 % \end{option}^^A foldmarks
682 %
683 %
684 % \subsection{Options of the reference line}
685 %
686 % \begin{option}{refline}
687 % \changes{v2.8n}{2001/09/08}{added}
688 % \changes{v2.96a}{2006/12/07}{alternated meaning fixed}
689 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
690 % \changes{v3.17}{2015/03/16}{using internal value storage}
691 % \changes{v3.09}{2011/03/07}{values \opt{\quotechar=dateleft},
692 % \opt{\quotechar=dateright}, \opt{\quotechar=nodate} added}
693 % \changes{v3.27}{2019/05/03}{new value \opt{\quotechar=false} added}
694 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
695 % option storage commands}
696 % \begin{macro}{\@refwidefalse,\@refwidetrue,\if@refwide}
697 % \changes{v2.8n}{2001/09/08}{added}
698 % \begin{macro}{\@datepos}
699 % \changes{v3.09}{2011/03/07}{added}
700 % \begin{macro}{\@reflinefalse,\@reflinetrue,\if@refline}
701 % \changes{v3.27}{2019/05/03}{added}
702 % The reference line support two predefined widths, switching off and
703 % three different positions for the date:
704 % \begin{center}
705 % \begin{tabular}{lllrl}
706 % \opt{refline} & \cs{if@refwide} & \cs{if@refline} & \cs{@datepos} &
707 % meaning\\\hline
708 % \opt{false} & \emph{unchanged}& \cs{iffalse} & \emph{unchanged} &
709 % deactivate reference line\\
710 % \opt{=wide} & \cs{iftrue} & \cs{iftrue} & \emph{unchanged} &
711 % print wide reference line\\
712 % \opt{=narrow} & \cs{iffalse} & \cs{iftrue} & \emph{unchanged} &
713 % print narrow reference line\\
714 % \opt{=nodate}& \emph{unchanged} & \emph{unchanged} & 1 & don't print
715 % date in reference line\\
716 % \opt{=dateright}& \emph{unchanged} & \emph{unchanged} & 1 & add date
717 % rightmost to reference line\\
718 % \opt{=dateleft} & \emph{unchanged} & \emph{unchanged} & 2 & add date
719 % leftmost to reference line\\
720 % \end{tabular}
721 % \end{center}
722 % \begin{macrocode}
723 %<*option>
724 \newif\if@refwide
725 %<package>\newif\if@refline\@reflinetrue
726 \newcommand*{\@datepos}{1}
727 \KOMA@key{refline}[wide]{%
728 \begingroup
729 \KOMA@set@ncmdkey{refline}{@tempa}{{wide}{0},{narrow}{1},%
730 {dateleft}{2},{leftdate}{2},%
731 {dateright}{3},{rightdate}{3},%
732 {nodate}{4}%
733 %<package> ,{no}{5},{off}{5},{false}{5}%
734 }{#1}%
735 \ifx\FamilyKeyState\FamilyKeyStateProcessed
736 \aftergroup\FamilyKeyStateProcessed
737 \ifcase\@tempa% wide
738 \endgroup
739 \@refwidetrue
740 %<*package>
741 \@reflinetrue
742 \KOMA@kav@remove{scrletter.\scr@pkgextension}{refline}{false}%
743 %</package>
744 \KOMA@kav@remove{%
745 %<class> \KOMAClassFileName
746 %<package> scrletter.\scr@pkgextension
747 }{refline}{wide}%
748 \KOMA@kav@remove{%
749 %<class> \KOMAClassFileName
750 %<package> scrletter.\scr@pkgextension
751 }{refline}{narrow}%
752 \KOMA@kav@add{%
753 %<class> \KOMAClassFileName
754 %<package> scrletter.\scr@pkgextension
755 }{refline}{wide}%
756 \or% narrow
757 \endgroup
758 \@refwidefalse
759 %<*package>
760 \@reflinetrue
761 \KOMA@kav@remove{scrletter.\scr@pkgextension}{refline}{false}%
762 %</package>
763 \KOMA@kav@remove{%
764 %<class> \KOMAClassFileName
765 %<package> scrletter.\scr@pkgextension
766 }{refline}{wide}%
767 \KOMA@kav@remove{%
768 %<class> \KOMAClassFileName
769 %<package> scrletter.\scr@pkgextension
770 }{refline}{narrow}%
771 \KOMA@kav@add{%
772 %<class> \KOMAClassFileName
773 %<package> scrletter.\scr@pkgextension
774 }{refline}{narrow}%
775 \or% dateleft
776 \endgroup
777 \def\@datepos{2}%
778 \KOMA@kav@remove{%
779 %<class> \KOMAClassFileName
780 %<package> scrletter.\scr@pkgextension
781 }{refline}{dateleft}%
782 \KOMA@kav@remove{%
783 %<class> \KOMAClassFileName
784 %<package> scrletter.\scr@pkgextension
785 }{refline}{dateright}%
786 \KOMA@kav@remove{%
787 %<class> \KOMAClassFileName
788 %<package> scrletter.\scr@pkgextension
789 }{refline}{nodate}%
790 \KOMA@kav@add{%
791 %<class> \KOMAClassFileName
792 %<package> scrletter.\scr@pkgextension
793 }{refline}{dateleft}%
794 \or% dateright
795 \endgroup
796 \def\@datepos{1}%
797 \KOMA@kav@remove{%
798 %<class> \KOMAClassFileName
799 %<package> scrletter.\scr@pkgextension
800 }{refline}{dateleft}%
801 \KOMA@kav@remove{%
802 %<class> \KOMAClassFileName
803 %<package> scrletter.\scr@pkgextension
804 }{refline}{dateright}%
805 \KOMA@kav@remove{%
806 %<class> \KOMAClassFileName
807 %<package> scrletter.\scr@pkgextension
808 }{refline}{nodate}%
809 \KOMA@kav@add{%
810 %<class> \KOMAClassFileName
811 %<package> scrletter.\scr@pkgextension
812 }{refline}{dateright}%
813 \or% nodate
814 \endgroup
815 \def\@datepos{0}%
816 \KOMA@kav@remove{%
817 %<class> \KOMAClassFileName
818 %<package> scrletter.\scr@pkgextension
819 }{refline}{dateleft}%
820 \KOMA@kav@remove{%
821 %<class> \KOMAClassFileName
822 %<package> scrletter.\scr@pkgextension
823 }{refline}{dateright}%
824 \KOMA@kav@remove{%
825 %<class> \KOMAClassFileName
826 %<package> scrletter.\scr@pkgextension
827 }{refline}{nodate}%
828 \KOMA@kav@add{%
829 %<class> \KOMAClassFileName
830 %<package> scrletter.\scr@pkgextension
831 }{refline}{nodate}%
832 %<*package>
833 \or% false
834 \endgroup
835 \@reflinefalse
836 \KOMA@kav@remove{scrletter.\scr@pkgextension}{refline}{wide}%
837 \KOMA@kav@remove{scrletter.\scr@pkgextension}{reline}{narrow}%
838 \KOMA@kav@add{scrletter.\scr@pkgextension}{refline}{false}%
839 %</package>
840 \fi
841 \else
842 \endgroup
843 \FamilyKeyStateUnknownValue
844 \fi
845 }
846 \KOMA@kav@add{%
847 %<class> \KOMAClassFileName
848 %<package> scrletter.\scr@pkgextension
849 }{refline}{dateright}%
850 \KOMA@kav@add{%
851 %<class> \KOMAClassFileName
852 %<package> scrletter.\scr@pkgextension
853 }{refline}{narrow}%
854 %</option>
855 % \end{macrocode}
856 % \end{macro}^^A \@reflinefalse,\@reflinetrue,\if@refline
857 % \end{macro}^^A \@datepos
858 % \end{macro}^^A \@refwidefalse,\@refwidetrue,\if@refwide
859 % \end{option}^^A refline
860 %
861 %
862 % \subsection{Options of the subject}
863 %
864 % \begin{option}{subject}
865 % \changes{v2.8q}{2001/10/09}{added}
866 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
867 % \changes{v3.17}{2015/03/16}{using internal value storage}
868 % \begin{macro}{\@subjtrue,\@subjfalse,\if@subj}
869 % \begin{macro}{\@subjaftertrue,\@subjafterfalse,\if@subjafter}
870 % \begin{macro}{\subject@format}
871 % \changes{v2.97c}{2007/07/06}{added}
872 % \begin{command}{\raggedsubject}
873 % \changes{v2.97c}{2007/07/06}{added}
874 % The subject can be printed with or without title before or after the
875 % opening. Different alignments and formats are also supported:
876 % \begin{center}
877 % \begin{tabular}{lllll}
878 % \opt{subject} & \cs{if@subj} & \cs{if@subjafter} & \cs{subject@format} &
879 % \cs{raggedsubject}\\\hline
880 % \opt{=titled} & \cs{iftrue} & \emph{unchanged} & \emph{unchanged} &
881 % \emph{unchanged}\\
882 % \opt{=untitled} & \cs{iffalse} & \emph{unchanged} & \emph{unchanged} &
883 % \emph{unchanged}\\
884 % \opt{=afteropening} & \emph{unchanged} & \cs{iftrue} & \emph{unchanged} &
885 % \emph{unchanged}\\
886 % \opt{=beforeopening} & \emph{unchanged} & \cs{iffalse} & \emph{unchanged} &
887 % \emph{unchanged}\\
888 % \opt{=underlined} & \emph{unchanged} & \emph{unchanged} & \cs{underline}
889 % & \emph{unchanged}\\
890 % \opt{=left} & \emph{unchanged} & \emph{unchanged} & \emph{unchanged} &
891 % \cs{raggedright} \\
892 % \opt{=right} & \emph{unchanged} & \emph{unchanged} & \emph{unchanged} &
893 % \cs{raggedleft} \\
894 % \opt{=centered} & \emph{unchanged} & \emph{unchanged} & \emph{unchanged} &
895 % \cs{centering} \\
896 % \end{tabular}
897 % \end{center}
898 % \begin{macrocode}
899 %<*option>
900 \newcommand{\subject@format}[1]{#1}
901 \newcommand*{\raggedsubject}{}
902 \newif\if@subj
903 \newif\if@subjafter
904 \KOMA@key{subject}{%
905 \begingroup
906 \KOMA@set@ncmdkey{subject}{@tempa}{%
907 {titled}{0},%
908 {untitled}{1},%
909 {afteropening}{2},%
910 {beforeopening}{3},%
911 {underlined}{4},%
912 {left}{5},%
913 {right}{6},%
914 {centered}{7}%
915 }{#1}%
916 \ifx\FamilyKeyState\FamilyKeyStateProcessed
917 \aftergroup\FamilyKeyStateProcessed
918 \ifcase\@tempa
919 \aftergroup\@subjtrue
920 \or
921 \aftergroup\@subjfalse
922 \or
923 \aftergroup\@subjaftertrue
924 \or
925 \aftergroup\@subjafterfalse
926 \or
927 \aftergroup\let\aftergroup\subject@format\aftergroup\underline
928 \or
929 \aftergroup\let\aftergroup\raggedsubject\aftergroup\raggedright
930 \or
931 \aftergroup\let\aftergroup\raggedsubject\aftergroup\raggedleft
932 \or
933 \aftergroup\let\aftergroup\raggedsubject\aftergroup\centering
934 \fi
935 \else
936 \aftergroup\FamilyKeyStateUnknownValue
937 \fi
938 \endgroup
939 \ifx\FamilyKeyState\FamilyKeyStateProcessed
940 \KOMA@kav@xreplacevalue{%
941 %<class> \KOMAClassFileName
942 %<package> scrletter.\scr@pkgextension
943 }{subject}{\if@subj titled\else untitled\fi}%
944 \KOMA@kav@xadd{%
945 %<class> \KOMAClassFileName
946 %<package> scrletter.\scr@pkgextension
947 }{subject}{\if@subjafter after\else before\fi opening}%
948 \ifx\subject@format\underline
949 \KOMA@kav@add{%
950 %<class> \KOMAClassFileName
951 %<package> scrletter.\scr@pkgextension
952 }{subject}{underlined}%
953 \fi
954 \ifx\raggedsubject\raggedright
955 \KOMA@kav@add{%
956 %<class> \KOMAClassFileName
957 %<package> scrletter.\scr@pkgextension
958 }{subject}{left}%
959 \else
960 \ifx\raggedsubject\raggedleft
961 \KOMA@kav@add{%
962 %<class> \KOMAClassFileName
963 %<package> scrletter.\scr@pkgextension
964 }{subject}{right}%
965 \else
966 \ifx\raggedsubject\centering
967 \KOMA@kav@add{%
968 %<class> \KOMAClassFileName
969 %<package> scrletter.\scr@pkgextension
970 }{subject}{centered}%
971 \fi
972 \fi
973 \fi
974 \fi
975 }
976 \KOMA@kav@add{%
977 %<class> \KOMAClassFileName
978 %<package> scrletter.\scr@pkgextension
979 }{subject}{untitled}%
980 \KOMA@kav@add{%
981 %<class> \KOMAClassFileName
982 %<package> scrletter.\scr@pkgextension
983 }{subject}{beforeopening}%
984 %</option>
985 % \end{macrocode}
986 % \end{command}^^A \raggedsubject
987 % \end{macro}^^A \subject@format
988 % \end{macro}^^A \@subjaftertrue,\@subjafterfalse,\if@subjafter
989 % \end{macro}^^A \@subjtrue,\@subjfalse,\if@subj
990 % \end{option}^^A subject
991 %
992 %
993 % \subsection{Options of the typing area}
994 %
995 % \begin{option}{enlargefirstpage}
996 % \changes{v2.8o}{2001/09/18}{added}
997 % \begin{macro}{\@enlargefpfalse,\@enlargefptrue,\if@enlargefp}
998 % \changes{v2.8o}{2001/09/18}{added}
999 % \begin{option}{shrinkfirstpage}
1000 % \changes{v3.48}{2025/09/05}{added}
1001 % \begin{macro}{\@shrinkfpfalse,\@shrinkfptrue,\if@shrinkp}
1002 % Usually the text at the notepaper is placed regarding the general typing
1003 % area. But if the position of the foot of the note paper is to high, with
1004 % option \opt{shrinkfirstpage} the text area is automatically
1005 % shorten. Option \opt{firstpageenlarge} also provides the opposite: enlarge
1006 % the text area of the first page, if the foot of the note paper is placed
1007 % very low.
1008 % \begin{macrocode}
1009 %<*option>
1010 \KOMA@ifkey{enlargefirstpage}{@enlargefp}
1011 \KOMA@ifkey{shrinkfirstpage}{@shrinkfp}
1012 \@shrinkfptrue
1013 %</option>
1014 % \end{macrocode}
1015 % \end{macro}^^A \if@shrinkfp
1016 % \end{option}^^A shrinkfirstpage
1017 % \end{macro}^^A \if@enlargefp
1018 % \end{option}^^A enlargefirstpage
1019 %
1020 %
1021 % \subsection{Options of the letter footer}
1022 %
1023 % \begin{option}{firstfoot}
1024 % \changes{v2.97e}{2007/11/22}{added}
1025 % \begin{macro}{\@firstfootfalse,\@firstfoottrue,\if@firstfoot}
1026 % \changes{v2.8q}{2002/01/25}{added}
1027 % Allow to switch of the footer of the note paper.
1028 % \begin{macrocode}
1029 %<*option>
1030 \KOMA@ifkey{firstfoot}{@firstfoot}\@firstfoottrue
1031 %</option>
1032 % \end{macrocode}
1033 % \end{macro}
1034 % \end{option}
1035 %
1036 %
1037 % \subsection{Options of the head of succeeding pages}
1038 %
1039 % \begin{option}{pagenumber}
1040 % \changes{v2.8q}{2002/01/31}{added}
1041 % \changes{v3.12}{2013/03/05}{using \cs{FamilyKeyState}}
1042 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
1043 % option storage commands}
1044 % \begin{macro}{\@pageat}
1045 % \changes{v2.8q}{2002/01/31}{added}
1046 % This is irrelevant for the notepaper but selects the position of the page
1047 % number on succeeding pages using page style \pstyle{headings},
1048 % \pstyle{myheadings} or \pstyle{plain} resp. \pstyle{letter} or
1049 % \pstyle{plain.letter}.
1050 % \begin{center}
1051 % \begin{tabular}{lrl}
1052 % \opt{pagenumber} & \cs{@pageat} & meaning\\\hline
1053 % \opt{=false} & -1 & no page number\\
1054 % \opt{=topleft} & 0 & in the left of the page head\\
1055 % \opt{=topmiddle} & 1 & centered in the page head\\
1056 % \opt{=topright} & 2 & in the right of the page head\\
1057 % \opt{=botleft} & 3 & in the left of the page foot\\
1058 % \opt{=botmiddle} & 4 & centered in the page foot\\
1059 % \opt{=botright} & 5 & in the right of the page foot\\
1060 % \end{tabular}
1061 % \end{center}
1062 % \begin{macrocode}
1063 %<*option>
1064 \newcommand*{\@pageat}{4}
1065 \KOMA@key{pagenumber}{%
1066 \begingroup
1067 \KOMA@set@ncmdkey{pagenumber}{@tempa}{%
1068 {no}{-1},{off}{-1},{false}{-1},%
1069 {topleft}{0},{headleft}{0},%
1070 {topmiddle}{1},{topcenter}{1},{topcentered}{1},%
1071 {headmiddle}{1},{headcenter}{1},{headcentered}{1},%
1072 {topright}{2},{headright}{2},%
1073 {botleft}{3},{footleft}{3},%
1074 {botmiddle}{4},{botcenter}{4},{botcentered}{4},%
1075 {footmiddle}{4},{footcenter}{4},{footcentered}{4},%
1076 {botright}{5},{footright}{5},%
1077 {top}{10},{head}{10},{bot}{11},{foot}{11},%
1078 {left}{20},{middle}{21},{center}{21},{centered}{21},{right}{22}%
1079 }{#1}%
1080 \ifx\FamilyKeyState\FamilyKeyStateProcessed
1081 \aftergroup\FamilyKeyStateProcessed
1082 \ifnum\@tempa<10
1083 \edef\@tempa{\endgroup\edef\noexpand\@pageat{\@tempa}}%
1084 \else
1085 \ifnum\@tempa<20
1086 \@tempcnta\@pageat\relax
1087 \ifnum\@tempcnta>2
1088 \advance\@tempcnta by -3
1089 \fi
1090 \ifnum\@tempa=11
1091 \advance\@tempcnta by 3
1092 \fi
1093 \edef\@tempa{\endgroup\edef\noexpand\@pageat{\the\@tempcnta}}%
1094 \else
1095 \ifnum\@pageat>2
1096 \edef\@pageat{3}%
1097 \else
1098 \edef\@pageat{0}%
1099 \fi
1100 \@tempcnta\@tempa
1101 \advance\@tempcnta by -20
1102 \advance\@tempcnta by\@pageat
1103 \edef\@tempa{\endgroup\edef\noexpand\@pageat{\the\@tempcnta}}%
1104 \fi
1105 \fi
1106 \else
1107 \def\@tempa{\endgroup\FamilyKeyStateUnknownValue}%
1108 \fi
1109 \@tempa
1110 \KOMA@kav@xreplacevalue{%
1111 %<class> \KOMAClassFileName
1112 %<package> scrletter.\scr@pkgextension
1113 }{pagenumber}{%
1114 \ifcase \@pageat
1115 topleft%
1116 \or
1117 topmiddle%
1118 \or
1119 topright%
1120 \or
1121 botleft%
1122 \or
1123 botmiddle%
1124 \or
1125 botright%
1126 \else
1127 false%
1128 \fi
1129 }%
1130 }
1131 \KOMA@kav@add{%
1132 %<class> \KOMAClassFileName
1133 %<package> scrletter.\scr@pkgextension
1134 }{pagenumber}{botmiddle}
1135 %</option>
1136 % \end{macrocode}
1137 % \end{macro}
1138 % \end{option}
1139 %
1140 %
1141 % \subsection{Commands and macros of the letter head}
1142 %
1143 % \begin{variable}{firsthead}
1144 % \changes{v2.8q}{2002/01/28}{\cs{@alignfrom} set to 10000}
1145 % \changes{v3.08}{2010/10/28}{added}
1146 % \changes{v3.13b}{2014/10/04}{\emph{hook} for \file{DINmtext.lco} added}
1147 % \changes{v3.27}{2019/04/02}{\emph{hook} removed}
1148 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
1149 % \cs{Ifkomavarempty}}
1150 % The head of the notepaper is not set by the page style but variable
1151 % \var{firsthead} inside \cs{opening}.
1152 % \begin{description}
1153 % \item[ToDo:] Change this at least for \pkg*{scrletter} to make the letter
1154 % head independent from \cs{opening}. With this \opt{fromalign} could
1155 % immediately re-define \var{firsthead} and also \cs{@gen@fisthead}
1156 % could become superfluously.
1157 % \end{description}
1158 % \begin{macrocode}
1159 %<*body>
1160 \newkomavar{firsthead}
1161 \setkomavar{firsthead}{%
1162 \parbox[b]{\useplength{firstheadwidth}}%
1163 {\centering\usekomafont{fromaddress}{%
1164 \Ifkomavarempty{fromname}{}{%
1165 {\usekomafont{fromname}%
1166 {\ignorespaces\usekomavar{fromname}}\\[-8pt]}
1167 {\usekomafont{fromrule}{\rule{\useplength{firstheadwidth}}{.4pt}}}\\
1168 }%
1169 \Ifkomavarempty{fromaddress}{}{%
1170 \ignorespaces\usekomavar{fromaddress}%
1171 }%
1172 }%
1173 }%
1174 }
1175 % \end{macrocode}
1176 % \end{variable}
1177 % \begin{macro}{\scr@firsthead@postsetvar}
1178 % \changes{v3.08}{2010/10/28}{added}
1179 % \changes{v3.17}{2015/03/16}{internal setting of {fromalign\quotechar=false}}
1180 % \changes{v3.39}{2022/11/11}{initial dot in member argument of
1181 % \cs{KOMAExecuteOptions} removed}
1182 % After setting the variable \opt{fromalign} has to be set to manual
1183 % alignment. But this must not be done for the initialization.
1184 % \begin{macrocode}
1185 \newcommand*{\scr@firsthead@postsetvar}{%
1186 \KOMAExecuteOptions[%
1187 %<class> \KOMAClassFileName
1188 %<package> scrletter.\scr@pkgextension
1189 ]{fromalign=no}%
1190 }
1191 % \end{macrocode}
1192 % \end{macro}^^A \scr@firsthead@postsetvar
1193 % \begin{macro}{\@gen@firsthead}
1194 % \changes{v2.8q}{2002/01/28}{added}
1195 % \changes{v2.97c}{2007/05/08}{configurable thickness of the line}
1196 % \changes{v2.97c}{2007/05/08}{configurable font/color of the line}
1197 % \changes{v3.06a}{2010/07/29}{using font element \fnt{fromrule}}
1198 % \changes{v3.08}{2010/10/28}{the notepaper head is a variable}
1199 % \changes{v3.12}{2013/05/29}{using variable \var{frommobilephone}}
1200 % \begin{macrocode}
1201 \newcommand*{\@gen@firsthead}{%
1202 % \end{macrocode}
1203 % Re-defines the page head of the notepaper, if this has been activated by
1204 % option \opt{fromalign}.
1205 % \begin{macrocode}
1206 \ifcase\@alignfrom
1207 % \end{macrocode}
1208 % This is \cs{@alignfrom}=0 context, which means a left aligned sender's
1209 % address. This is done using a \cs{parbox} over the while text width.
1210 % \begin{macrocode}
1211 \setkomavar{firsthead}{%
1212 \parbox[b]{\textwidth}{\raggedright
1213 % \end{macrocode}
1214 % The name with the font element \fnt{fromname}.
1215 % \begin{macrocode}
1216 {\usekomafont{fromname}\strut\ignorespaces
1217 \usekomavar{fromname}%
1218 % \end{macrocode}
1219 % If \cs{@rulefrom}=1, a horizontal rule has to follow. The length is either
1220 % \plen{fromrulewidth} or, if \plen{fromrulewidth} is 0, it is
1221 % automatically calculated. Here we avoid a rule into the logo.
1222 % \begin{macrocode}
1223 {%
1224 \ifnum\@rulefrom=1\\[-.5\baselineskip]%
1225 \usekomafont{fromrule}{%
1226 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
1227 \ifdim\@tempdima=\z@
1228 \setlength{\@tempdima}{\textwidth}%
1229 \if@logo
1230 \settowidth{\@tempdimb}{\usekomavar{fromlogo}}%
1231 \addtolength{\@tempdima}{-\@tempdimb}%
1232 \fi
1233 \fi
1234 \expandafter\rule\expandafter{\the\@tempdima}{%
1235 \useplength{fromrulethickness}}}%
1236 \fi
1237 }%
1238 \\
1239 }%
1240 % \end{macrocode}
1241 % Next the senders' address with all optional fields, depending on the
1242 % corresponding switches. Once again we need a group because of the font
1243 % element \fnt{fromaddress} to be used.
1244 % \begin{macrocode}
1245 {\usekomafont{fromaddress}\strut\ignorespaces
1246 \usekomavar{fromaddress}%
1247 \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
1248 \if@mobilephone
1249 \\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}%
1250 \fi%
1251 \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
1252 \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
1253 \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
1254 % \end{macrocode}
1255 % If \cs{@rulefrom}=2, the horizontal rule has to be placed here. Once again
1256 % the length can be calculated automatically for \plen{fromrulewidth}=0.
1257 % \begin{macrocode}
1258 \ifnum\@rulefrom=2\\[-.5\baselineskip]%
1259 \usekomafont{fromrule}{%
1260 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
1261 \ifdim\@tempdima=\z@
1262 \setlength{\@tempdima}{\textwidth}%
1263 \fi
1264 \expandafter\rule\expandafter{\the\@tempdima}{%
1265 \useplength{fromrulethickness}}}%
1266 \fi
1267 \\
1268 }%
1269 }%
1270 % \end{macrocode}
1271 % This was the \cs{parbox}, but maybe we have to place the logo.
1272 % \begin{macrocode}
1273 \if@logo
1274 \llap{\usekomavar{fromlogo}}%
1275 \fi
1276 }%
1277 \renewcommand*{\@alignfrom}{0}%
1278 \or
1279 % \end{macrocode}
1280 % This is \cs{@alignfrom}=1 context, which means centered sender's
1281 % address. Here the logo needs special treatment: It is placed in the location
1282 % field.
1283 % \begin{macrocode}
1284 \setkomavar{firsthead}{%
1285 \parbox[b]{\textwidth}{\centering
1286 {\usekomafont{fromname}\strut\ignorespaces
1287 \usekomavar{fromname}%
1288 {%
1289 \ifnum\@rulefrom=1\\[-.5\baselineskip]%
1290 \usekomafont{fromrule}{%
1291 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
1292 \ifdim\@tempdima=\z@
1293 \setlength{\@tempdima}{\textwidth}%
1294 \fi
1295 \expandafter\rule\expandafter{\the\@tempdima}{%
1296 \useplength{fromrulethickness}}}%
1297 \fi
1298 }%
1299 \\
1300 }%
1301 {\usekomafont{fromaddress}\strut\ignorespaces
1302 \usekomavar{fromaddress}%
1303 \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
1304 \if@mobilephone
1305 \\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}%
1306 \fi%
1307 \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
1308 \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
1309 \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
1310 \ifnum\@rulefrom=2\\[-.5\baselineskip]%
1311 \usekomafont{fromrule}{%
1312 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
1313 \ifdim\@tempdima=\z@
1314 \setlength{\@tempdima}{\textwidth}%
1315 \fi
1316 \expandafter\rule\expandafter{\the\@tempdima}{%
1317 \useplength{fromrulethickness}}}%
1318 \fi
1319 \\
1320 }%
1321 }%
1322 }%
1323 \renewcommand*{\@alignfrom}{1}%
1324 \or
1325 % \end{macrocode}
1326 % This is \cs{@alignfrom}=2 context, which means right aligned sender's
1327 % address. This is almost the same as left aligned.
1328 % \begin{macrocode}
1329 \setkomavar{firsthead}{%
1330 \if@logo
1331 \rlap{\usekomavar{fromlogo}}%
1332 \fi
1333 \parbox[b]{\textwidth}{\raggedleft
1334 {\usekomafont{fromname}\strut\ignorespaces
1335 \usekomavar{fromname}%
1336 {%
1337 \ifnum\@rulefrom=1\\[-.5\baselineskip]%
1338 \usekomafont{fromrule}{%
1339 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
1340 \ifdim\@tempdima=\z@
1341 \setlength{\@tempdima}{\textwidth}%
1342 \if@logo
1343 \settowidth{\@tempdimb}{\usekomavar{fromlogo}}%
1344 \addtolength{\@tempdima}{-\@tempdimb}%
1345 \fi
1346 \fi
1347 \expandafter\rule\expandafter{\the\@tempdima}{%
1348 \useplength{fromrulethickness}}}%
1349 \fi
1350 }%
1351 \\
1352 }%
1353 {\usekomafont{fromaddress}\strut\ignorespaces
1354 \usekomavar{fromaddress}%
1355 \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
1356 \if@mobilephone
1357 \\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}%
1358 \fi%
1359 \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
1360 \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
1361 \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
1362 \ifnum\@rulefrom=2\\[-.5\baselineskip]%
1363 \usekomafont{fromrule}{%
1364 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
1365 \ifdim\@tempdima=\z@
1366 \setlength{\@tempdima}{\textwidth}%
1367 \fi
1368 \expandafter\rule\expandafter{\the\@tempdima}{%
1369 \useplength{fromrulethickness}}}%
1370 \fi
1371 \\
1372 }%
1373 }%
1374 }%
1375 \renewcommand*{\@alignfrom}{2}%
1376 % \end{macrocode}
1377 % All other values of \cs{@alignfrom} do not change anything.
1378 % \begin{macrocode}
1379 \fi
1380 }
1381 % \end{macrocode}
1382 % \end{macro}^^A \@gen@firsthead
1383 %
1384 % \begin{command}{\firsthead}
1385 % \changes{v3.08}{2010/10/28}{deprecated}
1386 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
1387 % \begin{macro}{\@firsthead}
1388 % \changes{v3.08}{2010/10/28}{deprecated}
1389 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
1390 % \begin{macrocode}
1391 %<*class&!v4>
1392 \newcommand*{\@firsthead}{%
1393 \ClassWarning{scrlttr2}{%
1394 Deprecated usage of \string\@firsthead.\MessageBreak
1395 \string\usekomavar{firsthead} should be used\MessageBreak
1396 instead of \string\@firsthead
1397 }%
1398 \usekomavar{firsthead}%
1399 }
1400 \newcommand{\firsthead}{%
1401 \ClassWarning{scrlttr2}{%
1402 Deprecated usage of \string\firsthead.\MessageBreak
1403 You should use \string\setkomavar{firsthead}\MessageBreak
1404 instead of \string\firsthead
1405 }
1406 \setkomavar{firsthead}%
1407 }
1408 %</class&!v4>
1409 %</body>
1410 % \end{macrocode}
1411 % \end{macro}
1412 % \end{command}
1413 %
1414 % \subsection{Fonts of the notepaper}
1415 %
1416 % \begin{fontelement}{foldmark}
1417 % \changes{v2.97c}{2007/05/08}{added}
1418 % The font or indeed the color of the fold marks.
1419 % \begin{macrocode}
1420 %<*body>
1421 \newkomafont{foldmark}{}
1422 % \end{macrocode}
1423 % \end{fontelement}
1424 %
1425 % \begin{fontelement}{fromname}
1426 % \changes{v2.95}{2006/03/23}{using \cs{newkomafont}}
1427 % The font of the sender's name in the letter head.
1428 % \begin{macrocode}
1429 \newkomafont{fromname}{}
1430 % \end{macrocode}
1431 % \end{fontelement}
1432 %
1433 % \begin{fontelement}{fromaddress}
1434 % \changes{v2.95}{2006/03/23}{using \cs{newkomafont}}
1435 % The font of the sender's address in the letter head.
1436 % \begin{macrocode}
1437 \newkomafont{fromaddress}{}
1438 % \end{macrocode}
1439 % \end{fontelement}
1440 %
1441 % \begin{fontelement}{fromrule}
1442 % \changes{v2.97c}{2007/05/08}{added}
1443 % The font or indeed the color of the horizontal rule above or below the
1444 % sender's address.
1445 % \begin{macrocode}
1446 \newkomafont{fromrule}{}
1447 % \end{macrocode}
1448 % \end{fontelement}
1449 %
1450 % \begin{fontelement}{backaddress}
1451 % \changes{v2.95}{2006/03/23}{using \cs{newkomafont}}
1452 % \changes{v3.21}{2016/05/19}{support of option
1453 % \opt{egregdoesnotlikesansseriftitles}}
1454 % \changes{v3.39}{2023/04/04}{using \cs{maybesffamily}}
1455 % The font of the return address.
1456 % \begin{macrocode}
1457 \newkomafont{backaddress}{\maybesffamily}
1458 % \end{macrocode}
1459 % \end{fontelement}
1460 %
1461 % \begin{fontelement}{specialmail}
1462 % \changes{v2.97c}{2007/07/06}{added}
1463 % The font of the special sending note.
1464 % \begin{macrocode}
1465 \newkomafont{specialmail}{}
1466 % \end{macrocode}
1467 % \end{fontelement}
1468 %
1469 % \begin{fontelement}{priority}
1470 % \changes{v3.03}{2009/03/04}{added}
1471 % The font of the priority note of priority A or B. Here we don't use any lead
1472 % and sans-serif is a must, so \opt{sfdefaults} is ignored.
1473 % \begin{macrocode}
1474 \newkomafont{priority}{\fontsize{10pt}{10pt}\sffamily\bfseries}
1475 % \end{macrocode}
1476 % \end{fontelement}
1477 %
1478 % \begin{fontelement}{prioritykey}
1479 % \changes{v3.03}{2009/03/04}{added}
1480 % The font of the letter of priority A or B. It is used after
1481 % \fnt{priority}. Generally this should be 9\,mm, but this would need a free
1482 % scalable font. With 24.88\,pt we are only 0.25\,mm to low. This should not
1483 % be a problem and does also work with Computer Modern. Once again we do not
1484 % use any lead.
1485 % \begin{macrocode}
1486 \newkomafont{prioritykey}{\fontsize{24.88pt}{24.88pt}\selectfont}
1487 % \end{macrocode}
1488 % \end{fontelement}
1489 %
1490 % \begin{fontelement}{PPlogo}
1491 % \changes{v3.03}{2009/03/04}{added}
1492 % The font of the ``\texttt{P.P.}'' logo, with \opt{addrfield=PP}. Once again
1493 % sans-serif is a must, so option \opt{sfdefaults} is ignored.
1494 % \begin{macrocode}
1495 \newkomafont{PPlogo}{\sffamily\bfseries}
1496 % \end{macrocode}
1497 % \end{fontelement}
1498 %
1499 % \begin{fontelement}{PPdata}
1500 % \changes{v3.03}{2009/03/04}{added}
1501 % The font to be used inside the PP head. Once again sans-serif is a must, so
1502 % option \opt{sfdefaults} is ignored.
1503 % \begin{macrocode}
1504 \newkomafont{PPdata}{\sffamily}
1505 % \end{macrocode}
1506 % \end{fontelement}
1507 %
1508 % \begin{fontelement}{addressee}
1509 % \changes{v2.97c}{2007/07/06}{added}
1510 % The font to be used for the whole addressee.
1511 % \begin{macrocode}
1512 \newkomafont{addressee}{}
1513 % \end{macrocode}
1514 % \end{fontelement}
1515 %
1516 % \begin{fontelement}{toname}
1517 % \changes{v2.97c}{2007/07/06}{added}
1518 % The font used only for the name of the addressee in difference to
1519 % \fnt{addressee}.
1520 % \begin{macrocode}
1521 \newkomafont{toname}{}
1522 % \end{macrocode}
1523 % \end{fontelement}
1524 %
1525 % \begin{fontelement}{toaddress}
1526 % \changes{v2.97c}{2007/07/06}{added}
1527 % The font used only for the address of the addressee in difference to
1528 % \fnt{addressee}.
1529 % \begin{macrocode}
1530 \newkomafont{toaddress}{}
1531 % \end{macrocode}
1532 % \end{fontelement}
1533 %
1534 % \begin{fontelement}{refname}
1535 % \changes{v2.97c}{2007/05/14}{added}
1536 % \changes{v3.21}{2016/05/19}{support of \opt{egregdoesnotlikesansseriftitles}}
1537 % \changes{v3.39}{2023/04/04}{usage of \cs{maybesffamily}}
1538 % The font for the field names of the reference line.
1539 % \begin{macrocode}
1540 \newkomafont{refname}{\maybesffamily\scriptsize}
1541 % \end{macrocode}
1542 % \end{fontelement}
1543 %
1544 % \begin{fontelement}{refvalue}
1545 % \changes{v2.97c}{2007/05/14}{added}
1546 % \changes{v2.97d}{2007/10/09}{initial value changed}
1547 % \changes{v3.39}{2022/10/25}{using \cs{scr@v@is@eq}}
1548 % The font of the field values of the reference line.
1549 % Support for option \opt{sfdefaults} is not needed on
1550 % compatibility mode, because the option did not exist in version 2.97.
1551 % \begin{macrocode}
1552 %<*class&!v4>
1553 \expandafter\ifnum\scr@v@is@eq{2.97}%
1554 \newkomafont{refvalue}{\sffamily\scriptsize}
1555 \else
1556 %</class&!v4>
1557 \newkomafont{refvalue}{}
1558 %<class>\fi
1559 % \end{macrocode}
1560 % \end{fontelement}
1561 %
1562 % \begin{fontelement}{placeanddate}
1563 % \changes{v3.12}{2013/07/31}{added}
1564 % The font is used for place and date, if not real reference line but only
1565 % place and date are used.
1566 % \begin{macrocode}
1567 \newkomafont{placeanddate}{}
1568 % \end{macrocode}
1569 % \end{fontelement}
1570 %
1571 % \begin{fontelement}{lettertitle}
1572 % \changes{v3.17}{2015/02/21}{replacement of \fnt{letter}}
1573 % \changes{v3.21}{2016/05/19}{support of \opt{egregdoesnotlikesansseriftitles}}
1574 % \changes{v3.39}{2023/04/04}{usage of \cs{maybesffamily}}
1575 % The font of the title of the letter.
1576 % \begin{macrocode}
1577 \newkomafont{lettertitle}{\normalcolor\maybesffamily\bfseries}
1578 % \end{macrocode}
1579 % \begin{fontelement}{title}
1580 % \changes{v2.95}{2006/03/23}{using \cs{newkomafont}}
1581 % \changes{v3.17}{2015/02/21}{only an alias}
1582 % \changes{v3.17a}{2015/04/26}{alias fixed}
1583 % \begin{macrocode}
1584 %<package>\scr@ifundefinedorrelax{scr@fnt@title}{%
1585 \aliaskomafont{title}{lettertitle}%
1586 %<package>}{}
1587 % \end{macrocode}
1588 % \end{fontelement}
1589 % \end{fontelement}
1590 %
1591 % \begin{fontelement}{lettersubject}
1592 % \changes{v3.17}{2015/02/21}{replacement of \texttt{subject}}
1593 % \changes{v3.17a}{2015/04/26}{alias fixed}
1594 % The font of the subject of the letter.
1595 % \begin{macrocode}
1596 \newkomafont{lettersubject}{\normalfont\bfseries}
1597 % \end{macrocode}
1598 % \begin{fontelement}{subject}
1599 % \changes{v2.95}{2006/03/23}{using \cs{newkomafont}}
1600 % \changes{v3.17}{2015/02/21}{only an alias}
1601 % \begin{macrocode}
1602 %<package>\scr@ifundefinedorrelax{scr@fnt@subject}{%
1603 \aliaskomafont{subject}{lettersubject}%
1604 %<package>}{}
1605 %</body>
1606 % \end{macrocode}
1607 % \end{fontelement}
1608 % \end{fontelement}
1609 %
1610 % \subsection{Pseudo lengths of the notepaper}
1611 %
1612 % \begin{pseudolength}{foldmarkhpos}
1613 % \changes{v2.8q}{2001/10/06}{added}
1614 % Distance of the horizontal fold marks to the left edge of the paper.
1615 % \begin{macrocode}
1616 %<*body>
1617 \newplength{foldmarkhpos}
1618 % \end{macrocode}
1619 % \end{pseudolength}
1620 % \begin{pseudolength}{foldmarkvpos}
1621 % \changes{v2.97e}{2007/11/10}{added}
1622 % Distance of the vertical fold marks to the top edge of the paper.
1623 % \begin{macrocode}
1624 \newplength{foldmarkvpos}
1625 % \end{macrocode}
1626 % \end{pseudolength}
1627 % \begin{pseudolength}{tfoldmarkvpos}
1628 % \changes{v2.8q}{2001/10/06}{added}
1629 % Distance of the top of the horizontal fold marks to the top edge of the
1630 % paper.
1631 % \begin{macrocode}
1632 \newplength{tfoldmarkvpos}
1633 % \end{macrocode}
1634 % \end{pseudolength}
1635 % \begin{pseudolength}{mfoldmarkvpos}
1636 % \changes{v2.97e}{2007/11/08}{added}
1637 % Distance of the middle horizontal fold mark (which is not the bunch
1638 % hole fold mark) to the top edge of the paper.
1639 % \begin{macrocode}
1640 \newplength{mfoldmarkvpos}
1641 % \end{macrocode}
1642 % \end{pseudolength}
1643 % \begin{pseudolength}{bfoldmarkvpos}
1644 % \changes{v2.8q}{2001/10/06}{added}
1645 % Distance of the lower horizontal fold mark to the top edge of the paper.
1646 % \begin{macrocode}
1647 \newplength{bfoldmarkvpos}
1648 % \end{macrocode}
1649 % \end{pseudolength}
1650 % \begin{pseudolength}{lfoldmarkhpos}
1651 % \changes{v2.97e}{2007/11/10}{added}
1652 % Distance of the left (and only) vertical fold mark to the left edge of the
1653 % paper.
1654 % \begin{macrocode}
1655 \newplength{lfoldmarkhpos}
1656 % \end{macrocode}
1657 % \end{pseudolength}
1658 % \begin{pseudolength}{pfoldmarklength,hfoldmarklength,mfoldmarklength,
1659 % bfoldmarklength,lfoldmarklength}
1660 % \changes{v2.97e}{2001/11/10}{added}
1661 % The lengths of all fold marks.
1662 % \begin{macrocode}
1663 \newplength{pfoldmarklength}
1664 \newplength{tfoldmarklength}
1665 \newplength{mfoldmarklength}
1666 \newplength{bfoldmarklength}
1667 \newplength{lfoldmarklength}
1668 % \end{macrocode}
1669 % \end{pseudolength}
1670 % \begin{pseudolength}{foldmarkthickness}
1671 % \changes{v2.97c}{2007/05/08}{added}
1672 % One length for the thickness/weight of all fold marks.
1673 % \begin{macrocode}
1674 \newplength{foldmarkthickness}
1675 \setplength{foldmarkthickness}{.2pt}
1676 % \end{macrocode}
1677 % \end{pseudolength}
1678 % \begin{pseudolength}{toaddrvpos}
1679 % \changes{v2.8q}{2001/10/06}{added}
1680 % Distance of the address field of the addressee from the top edge of the
1681 % paper.
1682 % \begin{macrocode}
1683 \newplength{toaddrvpos}
1684 % \end{macrocode}
1685 % \end{pseudolength}
1686 % \begin{pseudolength}{backaddrheight}
1687 % \changes{v2.8q}{2001/10/06}{added}
1688 % Height reserved for the return address inside the address field of the
1689 % addressee.
1690 % \begin{macrocode}
1691 \newplength{backaddrheight}
1692 % \end{macrocode}
1693 % \end{pseudolength}
1694 % \begin{pseudolength}{toaddrhpos}
1695 % \changes{v2.8q}{2001/10/06}{added}
1696 % If positive the distance of the left of the address field of the addressee
1697 % to the left edge of the paper. Otherwise the (negative) distance of the
1698 % addressee from the right of the address field of the addressee to the right
1699 % edge of the paper.
1700 % \begin{macrocode}
1701 \newplength{toaddrhpos}
1702 % \end{macrocode}
1703 % \end{pseudolength}
1704 % \begin{pseudolength}{specialmailindent}
1705 % \changes{v2.8q}{2002/03/25}{added}
1706 % Distance of the special sending note from the left edge of the address field
1707 % of the addressee.
1708 % \begin{macrocode}
1709 \newplength{specialmailindent}
1710 % \end{macrocode}
1711 % \end{pseudolength}
1712 % \begin{pseudolength}{specialmailrightindent}
1713 % \changes{v2.8q}{2002/03/25}{added}
1714 % Distance of the special sending not from the right edge of the address field
1715 % of the addressee.
1716 % \begin{macrocode}
1717 \newplength{specialmailrightindent}
1718 % \end{macrocode}
1719 % \end{pseudolength}
1720 % \begin{pseudolength}{toaddrindent}
1721 % \changes{v2.8q}{2001/10/06}{added}
1722 % Distance of the name and address of the addressee from the left edge of the
1723 % address field of the addressee. With \opt{addrfield=PP} 0 is interpreted as
1724 % 8\,mm, because of the international norm. Additionally the value is also
1725 % used for the distance on the right side. In all other modes 0 is really 0.
1726 % \begin{macrocode}
1727 \newplength{toaddrindent}
1728 % \end{macrocode}
1729 % \end{pseudolength}
1730 % \begin{pseudolength}{PPheadheight}
1731 % \changes{v3.03}{2009/03/04}{added}
1732 % The height of the PP head with \opt{addrfield=PP},
1733 % \opt{addrfield=backgroundimage} or \opt{addrfield=image}. 0 means 20.74\,pt
1734 % here.
1735 % \begin{macrocode}
1736 \newplength{PPheadheight}
1737 % \end{macrocode}
1738 % \end{pseudolength}
1739 % \begin{pseudolength}{PPheadwidth}
1740 % \changes{v3.03}{2009/03/04}{added}
1741 % The width of the PP head with \opt{addrfield=PP}. 0 means 42\,mm here.
1742 % \begin{macrocode}
1743 \newplength{PPheadwidth}
1744 % \end{macrocode}
1745 % \end{pseudolength}
1746 % \begin{pseudolength}{PPdatamatrixvskip}
1747 % \changes{v3.03}{2009/03/04}{added}
1748 % Distance between the PP head and the data matrix with \opt{addrfield=PP}. 0
1749 % means 9\,mm.
1750 % \begin{macrocode}
1751 \newplength{PPdatamatrixvskip}
1752 % \end{macrocode}
1753 % \end{pseudolength}
1754 % \begin{pseudolength}{toaddrwidth}
1755 % \changes{v2.8q}{2001/10/06}{added}
1756 % Width of the address field of the addressee.
1757 % \begin{macrocode}
1758 \newplength{toaddrwidth}
1759 % \end{macrocode}
1760 % \end{pseudolength}
1761 % \begin{pseudolength}{toaddrheight}
1762 % \changes{v2.8q}{2001/10/06}{added}
1763 % \changes{v3.03b}{2009/06/25}{implemented like documented}
1764 % Height of the address field inclusive return address.
1765 % \begin{macrocode}
1766 \newplength{toaddrheight}
1767 % \end{macrocode}
1768 % \end{pseudolength}
1769 % \begin{pseudolength}{locvpos}
1770 % \changes{v2.97e}{2007/11/07}{added}
1771 % Distance of the location field from the top edge of the paper.
1772 % \begin{macrocode}
1773 \newplength{locvpos}
1774 % \end{macrocode}
1775 % \end{pseudolength}
1776 % \begin{pseudolength}{locwidth}
1777 % \changes{v2.8q}{2001/10/06}{added}
1778 % Width of the location field.
1779 % \begin{macrocode}
1780 \newplength{locwidth}
1781 % \end{macrocode}
1782 % \end{pseudolength}
1783 % \begin{pseudolength}{lochpos}
1784 % \changes{v2.97e}{2007/11/07}{added}
1785 % For positive values, the distance of the left of the location field to the
1786 % left edge of the paper. For negative values the (negative) distance of the
1787 % right of the location field to the right edge of the paper.
1788 % \begin{macrocode}
1789 \newplength{lochpos}
1790 % \end{macrocode}
1791 % \end{pseudolength}
1792 % \begin{pseudolength}{locheight}
1793 % \changes{v2.97e}{2007/11/07}{added}
1794 % The height of the location field.
1795 % \begin{macrocode}
1796 \newplength{locheight}
1797 % \end{macrocode}
1798 % \end{pseudolength}
1799 % \begin{pseudolength}{refvpos}
1800 % \changes{v2.8q}{2001/10/06}{added}
1801 % The distance of the reference line from the top edge of the paper.
1802 % \begin{macrocode}
1803 \newplength{refvpos}
1804 % \end{macrocode}
1805 % \end{pseudolength}
1806 % \begin{pseudolength}{refheight}
1807 % \changes{v3.27}{2019/05/03}{added}
1808 % The height of the reference line, if it is used.
1809 % \begin{macrocode}
1810 %<*package&willbe>
1811 \newplength{refheight}
1812 %</package&willbe>
1813 % \end{macrocode}
1814 % \end{pseudolength}
1815 % \begin{pseudolength}{refwidth}
1816 % \changes{v2.8q}{2001/10/06}{added}
1817 % The width of the reference line.
1818 % \begin{macrocode}
1819 \newplength{refwidth}
1820 % \end{macrocode}
1821 % \end{pseudolength}
1822 % \begin{pseudolength}{refhpos}
1823 % \changes{v2.9l}{2003/01/28}{added}
1824 % The horizontal position of the reference line.
1825 % \begin{macrocode}
1826 \newplength{refhpos}
1827 % \end{macrocode}
1828 % \end{pseudolength}
1829 % \begin{pseudolength}{refaftervskip}
1830 % \changes{v2.8q}{2001/10/09}{added}
1831 % The vertical distance below the reference line.
1832 % \begin{macrocode}
1833 \newplength{refaftervskip}
1834 % \end{macrocode}
1835 % \end{pseudolength}
1836 % \begin{pseudolength}{sigbeforevskip}
1837 % \changes{v2.8q}{2001/10/09}{added}
1838 % The vertical distance between the closing text and the signature text, to be
1839 % used for the hand-written signature.
1840 % \begin{macrocode}
1841 \newplength{sigbeforevskip}
1842 % \end{macrocode}
1843 % \end{pseudolength}
1844 % \begin{pseudolength}{sigindent}
1845 % \changes{v2.8q}{2001/10/06}{added}
1846 % Horizontal indent of the closing text and the signature.
1847 % \begin{macrocode}
1848 \newplength{sigindent}
1849 % \end{macrocode}
1850 % \end{pseudolength}
1851 % \begin{pseudolength}{firstfootvpos}
1852 % \changes{v2.8q}{2001/10/06}{added}
1853 % Distance of the letter footer (on the notepaper only) to the top edge of the
1854 % paper.
1855 % \begin{macrocode}
1856 \newplength{firstfootvpos}
1857 % \end{macrocode}
1858 % \end{pseudolength}
1859 % \begin{pseudolength}{firstfootwidth}
1860 % \changes{v2.8q}{2001/10/06}{added}
1861 % Width of the letter footer (on the notepaper only).
1862 % \begin{macrocode}
1863 \newplength{firstfootwidth}
1864 % \end{macrocode}
1865 % \end{pseudolength}
1866 % \begin{pseudolength}{firstfoothpos}
1867 % \changes{v3.05}{2009/11/09}{added}
1868 % Distance of the letter footer (on the notepaper only) to the left edge of
1869 % the paper. Note: See the \cs{opening} code for information about special
1870 % value \cs{maxdimen}.
1871 % \begin{macrocode}
1872 \newplength{firstfoothpos}
1873 \setplength{firstfoothpos}{\maxdimen}
1874 % \end{macrocode}
1875 % \end{pseudolength}
1876 % \begin{pseudolength}{firstheadvspos}
1877 % \changes{v2.8q}{2001/10/06}{added}
1878 % Distance of the letter head (on the notepaper only) to the top edge of the
1879 % paper.
1880 % \begin{macrocode}
1881 \newplength{firstheadvpos}
1882 % \end{macrocode}
1883 % \end{pseudolength}
1884 % \begin{pseudolength}{firstheadwidth}
1885 % \changes{v2.8q}{2001/10/06}{added}
1886 % Width of the letter head (on the notepaper only).
1887 % \begin{macrocode}
1888 \newplength{firstheadwidth}
1889 % \end{macrocode}
1890 % \end{pseudolength}
1891 % \begin{pseudolength}{firstheadhpos}
1892 % \changes{v3.05}{2009/11/09}{added}
1893 % Distance of the letter head (on the notepaper only) to the left edge of
1894 % the paper. Note: See the \cs{opening} code for information about special
1895 % value \cs{maxdimen}.
1896 % \begin{macrocode}
1897 \newplength{firstheadhpos}
1898 \setplength{firstheadhpos}{\maxdimen}
1899 % \end{macrocode}
1900 % \end{pseudolength}
1901 % \begin{pseudolength}{fromrulewidth}
1902 % \changes{v2.8q}{2002/01/28}{added}
1903 % The length of the optional horizontal rule above or below the address of the
1904 % sender. Value 0 means automatically calculated length.
1905 % \begin{macrocode}
1906 \newplength{fromrulewidth}
1907 \setplength{fromrulewidth}{0pt}
1908 % \end{macrocode}
1909 % \end{pseudolength}
1910 % \begin{pseudolength}{fromrulethickness}
1911 % \changes{v2.97c}{2007/05/08}{added}
1912 % The thickness/weight of the optional horizontal rule above or below the
1913 % address of the sender.
1914 % \begin{macrocode}
1915 \newplength{fromrulethickness}
1916 \setplength{fromrulethickness}{.4pt}
1917 %</body>
1918 % \end{macrocode}
1919 % \end{pseudolength}
1920 %
1921 %
1922 % \subsection{The footer of the notepaper}
1923 %
1924 % \begin{variable}{firstfoot}
1925 % \changes{v3.08}{2010/10/28}{added}
1926 % Initially the value of the letter footer of the notepaper is empty. The user
1927 % manual shows, how to use it.
1928 % \begin{macrocode}
1929 %<*body>
1930 \newkomavar{firstfoot}
1931 % \end{macrocode}
1932 % \begin{command}{\firstfoot}
1933 % \changes{v3.08}{2010/10/28}{deprecated}
1934 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
1935 % \begin{macro}{\@firstfoot}
1936 % \changes{v3.08}{2010/10/28}{deprecated}
1937 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
1938 % \begin{macrocode}
1939 %<*class&!v4>
1940 \newcommand*{\@firstfoot}{%
1941 \ClassWarning{scrlttr2}{%
1942 Deprecated usage of \string\@firstfoot.\MessageBreak
1943 \string\usekomavar{firstfoot} should be used\MessageBreak
1944 instead of \string\@firstfoot
1945 }%
1946 \usekomavar{firstfoot}%
1947 }
1948 \newcommand{\firstfoot}{%
1949 \ClassWarning{scrlttr2}{%
1950 Deprecated usage of \string\firstfoot.\MessageBreak
1951 You should use \string\setkomavar{firstfoot}\MessageBreak
1952 instead of \string\firstfoot
1953 }
1954 \setkomavar{firstfoot}%
1955 }
1956 %</class&!v4>
1957 %</body>
1958 % \end{macrocode}
1959 % \end{macro}^^A \@firstfoot
1960 % \end{command}^^A \firstfoot
1961 % \end{variable}^^A firstfoot
1962 %
1963 %
1964 % \subsection{Output of the notepaper}
1965 %
1966 % \begin{description}
1967 % \item[Note:] There have been plans to move output of the notepaper to the
1968 % page style with \pkg*{scrletter}. You can find some experimental code for
1969 % this already here with tag \texttt{willbe}. But the plans have been
1970 % dropped, because there was not enough man power to design and implement it
1971 % all and to keep \KOMAScript{} compatible with \LaTeX{} at the same time.
1972 % \end{description}
1973 %
1974 % \begin{macro}{\scr@notepaper@printallelements}
1975 % \changes{v3.27}{2019/04/16}{added}
1976 % This is used by page style \pstyle{notepaper} (see
1977 % \file{scrkernel-pagestyle.dtx}) to print all elements.
1978 % \begin{macro}{\scr@notepaper@printelementsoflist}
1979 % \changes{v3.27}{2019/04/16}{added}
1980 % And this is used to print a given list of elements.
1981 % \begin{macro}{\scr@notepaper@printelement}
1982 % \changes{v3.27}{2019/04/16}{added}
1983 % Last but not least this prints one given element.
1984 % \begin{macrocode}
1985 %<*package&body&willbe>
1986 \newcommand*{\scr@notepaper@printallelements}{%
1987 \scr@notepaper@printelementsoflist\scr@notepaper@elements
1988 }
1989 \newcommand*{\scr@notepaper@printelementsoflist}[1]{%
1990 \expandafter\scr@ForEachTrimmedListElement\expandafter{#1}{%
1991 \scr@notepaper@printelement
1992 }%
1993 }
1994 \newcommand*{\scr@notepaper@printelement}[1]{%
1995 \@ifundefined{scr@notepaper@element@#1}{%
1996 \PackageWarning{scrletter}{%
1997 Unknown note paper element `#1'\MessageBreak
1998 will be ignored%
1999 }%
2000 }{%
2001 \@nameuse{scr@notepaper@element@#1}%
2002 }%
2003 }
2004 % \end{macrocode}
2005 % \end{macro}^^A \scr@notepaper@printelement
2006 % \end{macro}^^A \scr@notepaper@printelementsoflist
2007 % \end{macro}^^A \scr@notepaper@printallelements
2008 %
2009 % \begin{macro}{\scr@foldmarks@printallelements}
2010 % \changes{v3.27}{2019/04/16}{new (internal)}
2011 % This is used by the page style \pstyle{notepaper} to print all fold marks.
2012 % \begin{macrocode}
2013 \newcommand*{\scr@foldmarks@printallelements}{%
2014 \if@fold
2015 \ifdim \useplength{pfoldmarklength}=\z@
2016 \setplength{pfoldmarklength}{4mm}%
2017 \fi
2018 \ifdim \useplength{tfoldmarklength}=\z@
2019 \setplength{tfoldmarklength}{2mm}%
2020 \fi
2021 \ifdim \useplength{mfoldmarklength}=\z@
2022 \setplength{mfoldmarklength}{2mm}%
2023 \fi
2024 \ifdim \useplength{bfoldmarklength}=\z@
2025 \setplength{bfoldmarklength}{2mm}%
2026 \fi
2027 \ifdim \useplength{lfoldmarklength}=\z@
2028 \setplength{lfoldmarklength}{4mm}%
2029 \fi
2030 \@hfoldmark{P}%
2031 \@hfoldmark{T}%
2032 \@hfoldmark{M}%
2033 \@hfoldmark{B}%
2034 \@vfoldmark{L}%
2035 \fi
2036 }
2037 % \end{macrocode}
2038 % \end{macro}
2039 %
2040 % \begin{macro}{\scr@notepaper@elements}
2041 % \changes{v3.27}{2019/03/22}{added}
2042 % This is a comma-separated list of elements (aka blocks) to be printed on the
2043 % notepaper. It is used by the page style layer \texttt{notepaper} to set all
2044 % elements (see \file{scrkernel-pagestyle.dtx}). There are exactly four
2045 % defaults (but you can add more):
2046 % \begin{macrocode}
2047 \newcommand*{\scr@notepaper@elements}{%
2048 firsthead,addressee,location,firstfoot,refline%
2049 }
2050 % \end{macrocode}
2051 % \begin{macro}{\scr@notepaper@element@firsthead}
2052 % \changes{v3.27}{2019/03/22}{added}
2053 % How to print the notepaper element \texttt{firsthead}:
2054 % \begin{macrocode}
2055 \newcommand*{\scr@notepaper@element@firsthead}{%
2056 \if@firsthead
2057 % \end{macrocode}
2058 % The calculation of the real horizontal position could be done as part of the
2059 % layer contents or while selection of the layer or while initialization of
2060 % the layer. The in-contents code is used, so the layer can be used with
2061 % different page styles. The position depends on \plen{firstheadhpos} this
2062 % way:
2063 % \begin{itemize}
2064 % \item If \plen{firstheadhpos} is positive but less than the paper width,
2065 % \plen{firstheadhpos} is the distance if the head from the left edge.
2066 % \item If \plen{firstheadhpos} is negative but the absolute value is less
2067 % then the paper width, the absolute value of \plen{firstheadhpos} is the
2068 % distance from the right edge.
2069 % \item If \plen{firstheadhpos} is greater than the paper width, the head
2070 % will be centered.
2071 % \item If \plen{firstheadhpos} is less than the negative paper width, the
2072 % head will be left aligned to the text area.
2073 % \end{itemize}
2074 % \begin{macrocode}
2075 \ifdim\useplength{firstheadhpos}<\paperwidth
2076 \ifdim \useplength{firstheadhpos}>-\paperwidth
2077 \ifdim \useplength{firstheadhpos}<\z@
2078 \setlength{\@tempdima}{\dimexpr
2079 \paperwidth + \useplength{firstheadhpos}
2080 - \useplength{firstheadwidth}
2081 \relax}%
2082 \else
2083 \setlength{\@tempdima}{\useplength{firstheadhpos}}%
2084 \fi
2085 \else
2086 \setlength{\@tempdima}{\dimexpr\oddsidemargin + 1in\relax}%
2087 \fi
2088 \else
2089 \setlength{\@tempdima}{\dimexpr
2090 (\paperwidth-\useplength{firstheadwidth})/2
2091 \relax}%
2092 \fi
2093 \put@notepaper@element
2094 (\@tempdima,\useplength{firstheadvpos})%
2095 (\useplength{firstheadwidth},%
2096 \useplength{toaddrvpos}-\useplength{firstheadvpos})%
2097 {Element `firsthead'}{\usekomavar{firsthead}}\relax
2098 \fi
2099 }
2100 % \end{macrocode}
2101 % \end{macro}^^A \scr@notepaper@element@firsthead
2102 % \begin{macro}{\scr@notepaper@element@firstfoot}
2103 % \changes{v3.27}{2019/03/22}{added}
2104 % Element \texttt{firstfoot} is very similar to \texttt{firsthead}. The
2105 % differences are using of pseudo lengths for the foot instead the head and
2106 % the calculation of the available height.
2107 % \begin{macrocode}
2108 \newcommand*{\scr@notepaper@element@firstfoot}{%
2109 \if@firstfoot
2110 \ifdim\useplength{firstfoothpos}<\paperwidth
2111 \ifdim \useplength{firstfoothpos}>-\paperwidth
2112 \ifdim \useplength{firstfoothpos}<\z@
2113 \setlength{\@tempdima}{\dimexpr
2114 \paperwidth + \useplength{firstfoothpos}
2115 - \useplength{firstfootwidth}%
2116 \relax}%
2117 \else
2118 \setlength{\@tempdima}{\useplength{firstfoothpos}}%
2119 \fi
2120 \else
2121 \setlength{\@tempdima}{\dimexpr\oddsidemargin + 1in\relax}%
2122 \fi
2123 \else
2124 \setlength{\@tempdima}{\dimexpr
2125 (\paperwidth-\useplength{firstfootwidth})/2
2126 \relax}%
2127 \fi
2128 \put@notepaper@element
2129 (\@tempdima,\useplength{firstfootvpos})%
2130 (\useplength{firstfootwidth},
2131 \paperheight-\useplength{firstfootvpos})%
2132 {Element `firstfoot'}{\usekomavar{firstfoot}}\relax
2133 \fi
2134 }
2135 % \end{macrocode}
2136 % \end{macro}^^A \scr@notepaper@element@firstfoot
2137 % \begin{macro}{\scr@notepaper@element@addressee}
2138 % \changes{v3.27}{2019/03/22}{added}
2139 % Element \texttt{addressee} is very complex and therefore split into several
2140 % different sub-elements.
2141 % \begin{macrocode}
2142 \newcommand*{\scr@notepaper@element@addressee}{%
2143 \setlengthtoplength{\@tempdima}{toaddrhpos}%
2144 \ifdim \@tempdima<\z@
2145 \addtolength{\@tempdima}{%
2146 \dimexpr \paperwidth-\useplength{toaddrwidth}\relax
2147 }%
2148 \fi
2149 \put@notepaper@element(\@tempdima,\useplength{toaddrvpos})%
2150 (\useplength{toaddrwidth},\useplength{toaddrheight})%
2151 {address field}{%
2152 \setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative
2153 \ifcase \@afieldmode\relax
2154 \or
2155 \scr@notepaper@subelement@addressee@default
2156 \or
2157 \scr@notepaper@subelement@addressee@PP
2158 \or
2159 \scr@notepaper@subelement@addressee@PPbackgroundimage
2160 \or
2161 \scr@notepaper@subelement@addressee@image
2162 \else
2163 \scr@notepaper@subelement@addressee@default
2164 \fi
2165 }\relax
2166 }
2167 % \end{macrocode}
2168 % \begin{macro}{\scr@notepaper@subelement@addressee@default}
2169 % \changes{v3.27}{2019/03/22}{added}
2170 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by \cs{Ifkomavarempty}}
2171 % \changes{v3.30}{2020/03/27}{re-definition of line break moved}
2172 % The field with the recipience address. This should be used only on the first
2173 % page of a letter.
2174 % \begin{macrocode}
2175 \newcommand*{\scr@notepaper@subelement@addressee@default}{%
2176 \setbox\@tempboxa\vbox {%
2177 \hsize=\useplength{toaddrwidth}\linewidth=\hsize
2178 \color@begingroup
2179 \if@baddr
2180 \Ifkomavarempty{backaddress}{}{%
2181 \backaddr@format{\scriptsize
2182 {%
2183 \def\\{\usekomavar{backaddressseparator}\@ogobble}%
2184 \usekomafont{backaddress}%
2185 {\usekomavar{backaddress}}%
2186 }%
2187 }%
2188 }%
2189 \fi
2190 \color@endgroup
2191 }%
2192 \ifdim \dimexpr\ht\@tempboxa+\dp\@tempboxa>\useplength{backaddrheight}\relax
2193 \PackageWarning{scrletter}{Element `backaddress' to high.\MessageBreak
2194 The content of `backaddress' could exceed\MessageBreak
2195 the address field%
2196 }%
2197 \fi
2198 \vbox to \useplength{backaddrheight}{\vss\usebox\@tempboxa}%
2199 \ifcase \ltr@priority
2200 \or
2201 \setkomavar{specialmail}{%
2202 {\usekomafont{priority}{%
2203 {\usekomafont{prioritykey}{B}}%
2204 -ECONOMY}}%
2205 }%
2206 \or
2207 \setkomavar{specialmail}{%
2208 {\usekomafont{priority}{%
2209 {\usekomafont{prioritykey}{A}}%
2210 -PRIORITY}}%
2211 }%
2212 \fi
2213 \Ifkomavarempty{specialmail}{%
2214 \@tempdima=\z@
2215 }{%
2216 \setbox\@tempboxa\vbox{\hsize\useplength{toaddrwidth}%
2217 \color@begingroup
2218 \noindent\hspace*{\useplength{specialmailindent}}%
2219 \specialmail@format{%
2220 \usekomafont{specialmail}\usekomavar{specialmail}}%
2221 \hspace*{\useplength{specialmailrightindent}}%
2222 \color@endgroup
2223 }%
2224 \copy\@tempboxa
2225 \@tempdima=\dimexpr\ht\@tempboxa+\dp\@tempboxa\relax
2226 }%
2227 \setbox\@tempboxa\vbox{%
2228 \hsize\dimexpr \useplength{toaddrwidth}-2\useplength{toaddrindent}\relax
2229 \color@begingroup
2230 \raggedright
2231 \usekomafont{addressee}{%
2232 %<*package>
2233 \usekomavar{addressee}\par%
2234 %</package>
2235 %<class> {\usekomafont{toname}{\usekomavar{toname}\\}}%
2236 %<class> {\usekomafont{toaddress}{\usekomavar{toaddress}\par}}%
2237 }%
2238 \color@endgroup
2239 }%
2240 \ifnum\@afieldmode=\@ne
2241 % \end{macrocode}
2242 % In opposite to the class, the package rounds the distance to lines.
2243 % \begin{macrocode}
2244 \vskip \dimexpr ((\useplength{toaddrheight}-\useplength{backaddrheight}
2245 -\@tempdima -\ht\@tempboxa -\dp\@tempboxa
2246 -\ht\strutbox)/(2*\baselineskip))
2247 *\baselineskip\relax
2248 \fi
2249 \hskip\useplength{toaddrindent}%
2250 \usebox\@tempboxa
2251 }
2252 % \end{macrocode}
2253 % \end{macro}^^A \scr@notepaper@subelement@addressee@default
2254 % \begin{macro}{\scr@notepaper@subelement@addressee@PP}
2255 % \changes{v3.27}{2019/03/22}{added}
2256 % \begin{macrocode}
2257 \newcommand*{\scr@notepaper@subelement@addressee@PP}{%
2258 \ifdim \useplength{toaddrindent}=\z@
2259 \setplength{toaddrindent}{8mm}%
2260 \fi
2261 \ifdim \useplength{PPheadheight}=\z@
2262 \setplength{PPheadheight}{20.74pt}%
2263 \fi
2264 \ifdim \useplength{PPheadwidth}=\z@
2265 \setplength{PPheadwidth}{42mm}%
2266 \fi
2267 \ifdim \useplength{PPdatamatrixvskip}=\z@
2268 \setplength{PPdatamatrixvskip}{3mm}%
2269 \fi
2270 \vskip 2pt\relax
2271 \hskip \useplength{toaddrindent}\relax
2272 \fbox{%
2273 \vbox to \dimexpr \useplength{PPheadheight}-2\fboxsep\relax{%
2274 \setlength{\parindent}{0pt}%
2275 \hsize \dimexpr \useplength{PPheadwidth}-2\fboxsep\relax
2276 \sbox\@tempboxa{%
2277 {\fontsize{20.74pt}{20.74pt}\selectfont
2278 \usekomafont{PPlogo}{P.P.}}\hskip 2mm%
2279 }%
2280 \dp\@tempboxa\z@
2281 \setlength{\@tempdima}{\hsize}%
2282 \addtolength{\@tempdima}{-\wd\@tempboxa}%
2283 \hbox{\box\@tempboxa
2284 \vbox to \dimexpr
2285 \useplength{PPheadheight}-2\fboxsep\relax{%
2286 \vss\hsize\@tempdima
2287 \raggedright
2288 \fontsize{8pt}{9pt}\selectfont\usekomafont{PPdata}%
2289 \usekomavar*{fromzipcode}\usekomavar{zipcodeseparator}%
2290 \usekomavar{fromzipcode}\scr@endstrut\\
2291 \usekomavar{place}\scr@endstrut
2292 \hfill
2293 }%
2294 }%
2295 \vss
2296 }%
2297 }%
2298 \hskip 1mm
2299 \mbox{%
2300 \vbox to \useplength{PPheadheight}{%
2301 \addtolengthplength[-]{\hsize}{PPheadwidth}%
2302 \addtolength{\hsize}{-1mm}%
2303 \addtolengthplength[-2]{\hsize}{toaddrindent}%
2304 \setlength{\parindent}{0pt}%
2305 \fontsize{8pt}{9pt}\selectfont\usekomafont{PPdata}%
2306 \hfill\usekomavar{PPcode}
2307 \vss
2308 \ifcase \ltr@priority
2309 \or
2310 \usekomafont{priority}{%
2311 {\usekomafont{prioritykey}{B}}%
2312 -ECONOMY\hss\vskip-\dp\strutbox
2313 }%
2314 \or
2315 \usekomafont{priority}{%
2316 {\usekomafont{prioritykey}{A}}%
2317 -PRIORITY\hss\vskip-\dp\strutbox
2318 }%
2319 \fi
2320 \vss
2321 }%
2322 }%
2323 \vskip 1mm
2324 \vskip-\ht\strutbox
2325 \noindent\hskip\useplength{toaddrindent}%
2326 \hrulefill%
2327 \hskip\useplength{toaddrindent}%
2328 \vbox to\z@{\hsize\z@
2329 \vskip \useplength{PPdatamatrixvskip}\relax
2330 \llap{\usekomavar{PPdatamatrix}\hskip\useplength{toaddrindent}}%
2331 \vss
2332 }%
2333 \vskip 3mm
2334 \noindent\hskip\useplength{toaddrindent}%
2335 \setlength{\@tempdima}{\useplength{toaddrwidth}}%
2336 \addtolengthplength[-2]{\@tempdima}{toaddrindent}%
2337 \vbox{\hsize\@tempdima
2338 \Ifkomavarempty{PPdatamatrix}{}{%
2339 \addtolength{\hsize}{-2mm}%
2340 \settowidth\@tempdima{\usekomavar{PPdatamatrix}}%
2341 \addtolength{\hsize}{-\@tempdima}%
2342 }%
2343 \raggedright
2344 \usekomafont{addressee}{%
2345 %<*package>
2346 \usekomavar{addressee}\par%
2347 %</package>
2348 %<class> {\usekomafont{toname}{\usekomavar{toname}\\}}%
2349 %<class> {\usekomafont{toaddress}{\usekomavar{toaddress}\par}}%
2350 }%
2351 }%
2352 }
2353 % \end{macrocode}
2354 % \end{macro}^^A \scr@notepaper@subelement@addressee@PP
2355 % \begin{macro}{\scr@notepaper@subelement@addressee@PPimage}
2356 % \changes{v3.27}{2019/03/22}{added}
2357 % The PP image.
2358 % \begin{description}
2359 % \item[ToDo:] Needs to be tested!
2360 % \end{description}
2361 % \begin{macrocode}
2362 \newcommand*{\scr@notepaper@subelement@addressee@PPimage}{%
2363 \ifdim \useplength{toaddrindent}=\z@
2364 \setplength{toaddrindent}{8mm}%
2365 \fi
2366 \vskip 1mm
2367 \noindent\expandafter\hskip\useplength{toaddrindent}%
2368 \vbox to \useplength{PPheadheight}{%
2369 \addtolengthplength[-2]{\hsize}{toaddrindent}%
2370 \setlength{\parindent}{0pt}%
2371 \usekomavar{addresseeimage}%
2372 \vss
2373 }%
2374 }
2375 % \end{macrocode}
2376 % \end{macro}^^A \scr@notepaper@subelement@addressee@PPimage
2377 % \begin{macro}{\scr@notepaper@subelement@addressee@backgroundimage}
2378 % \changes{v3.27}{2019/03/22}{added}
2379 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
2380 % \cs{Ifkomavarempty}}
2381 % \begin{description}
2382 % \item[ToDo:] Needs to be tested!
2383 % \end{description}
2384 % \begin{macrocode}
2385 \newcommand*{\scr@notepaper@subelement@addressee@backgroundimage}{%
2386 \vskip 1mm
2387 \noindent\expandafter\hskip\useplength{toaddrindent}%
2388 \vbox to \useplength{PPheadheight}{%
2389 \addtolengthplength[-2]{\hsize}{toaddrindent}%
2390 \setlength{\parindent}{0pt}%
2391 \usekomavar{addresseeimage}%
2392 \vss
2393 }%
2394 \vskip 1mm
2395 \vskip\dp\strutbox
2396 \vfil%
2397 \noindent\hskip\useplength{toaddrindent}%
2398 \setlength{\@tempdima}{\useplength{toaddrwidth}}%
2399 \addtolengthplength[-2]{\@tempdima}{toaddrindent}%
2400 \vbox{\hsize\@tempdima
2401 \Ifkomavarempty{PPdatamatrix}{}{%
2402 \addtolength{\hsize}{-2mm}%
2403 \settowidth\@tempdima{\usekomavar{PPdatamatrix}}%
2404 \addtolength{\hsize}{-\@tempdima}%
2405 }%
2406 \raggedright
2407 \usekomafont{addressee}{%
2408 %<*package>
2409 \usekomavar{addressee}\par%
2410 %</package>
2411 %<class> {\usekomafont{toname}{\usekomavar{toname}\\}}%
2412 %<class> {\usekomafont{toaddress}{\usekomavar{toaddress}\par}}%
2413 }%
2414 }%
2415 }
2416 % \end{macrocode}
2417 % \end{macro}^^A \scr@notepaper@subelement@addressee@backgroundimage
2418 % \end{macro}^^A \scr@notepaper@element@addressee
2419 % \begin{macro}{\scr@notepaper@element@location}
2420 % \changes{v3.27}{2019/03/22}{added}
2421 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
2422 % \cs{Ifkomavarempty}}
2423 % The \texttt{location} element depends on several options.
2424 % \begin{macrocode}
2425 \newcommand*{\scr@notepaper@element@location}{%
2426 % \end{macrocode}
2427 % Depending on the alignment of the sender's address, the location field must
2428 % not be empty.
2429 % \begin{macrocode}
2430 \ifcase\@alignfrom
2431 \or
2432 \if@logo
2433 \Ifkomavarempty{location}{\setkomavar{location}{\null}}{}%
2434 \fi
2435 \or
2436 \or
2437 \Ifkomavarempty{location}{\setkomavar{location}{\null}}{}%
2438 \or
2439 \Ifkomavarempty{location}{\setkomavar{location}{\null}}{}%
2440 \fi
2441 % \end{macrocode}
2442 % Everything else only, if the field is not empty.
2443 % \begin{macrocode}
2444 \Ifkomavarempty{location}{}{%
2445 % \end{macrocode}
2446 % Calculation of height and vertical position.
2447 % \begin{macrocode}
2448 \ifdim \useplength{locheight}=\z@%
2449 \setplength{locheight}{\useplength{toaddrheight}}%
2450 \fi
2451 \ifdim \useplength{locvpos}=\z@%
2452 \setplength{locvpos}{\useplength{toaddrvpos}}%
2453 \fi
2454 % \end{macrocode}
2455 % Calculation of width and horizontal position.
2456 % \begin{macrocode}
2457 \ifdim \useplength{locwidth}=\z@%
2458 \setplength{locwidth}{\paperwidth}%
2459 \ifdim \useplength{toaddrhpos}>\z@
2460 \addtoplength[-2]{locwidth}{\useplength{toaddrhpos}}%
2461 \else
2462 \addtoplength[2]{locwidth}{\useplength{toaddrhpos}}%
2463 \fi
2464 \addtoplength[-1]{locwidth}{\useplength{toaddrwidth}}%
2465 \if@bigloc
2466 \setplength[.66667]{locwidth}{\useplength{locwidth}}%
2467 \else
2468 \setplength[.5]{locwidth}{\useplength{locwidth}}%
2469 \fi
2470 \fi
2471 \ifdim \useplength{lochpos}=\z@%
2472 \setplength{lochpos}{\useplength{toaddrhpos}}%
2473 \fi
2474 \ifdim \useplength{lochpos}<\z@
2475 \setlength{\@tempdima}{-\useplength{lochpos}}%
2476 \else
2477 \setlength{\@tempdima}{\dimexpr
2478 \paperwidth-\useplength{lochpos}-\useplength{locwidth}
2479 \relax}%
2480 \fi
2481 \put@notepaper@element(\@tempdima,\useplength{locvpos})%
2482 (\useplength{locwidth},\useplength{locheight})%
2483 {Element `location'}%
2484 {%
2485 % \end{macrocode}
2486 % Depending on the alignment of the sender's address, output of the logo and
2487 % maybe also the address.
2488 % \begin{macrocode}
2489 \ifcase\@alignfrom
2490 \or
2491 \if@logo
2492 \Ifkomavarempty{fromlogo}{\null}{%
2493 {\raggedleft\noindent\usekomavar{fromlogo}\\
2494 \vskip\parskip}\noindent}%
2495 \fi
2496 \or
2497 \or
2498 \if@logo
2499 \Ifkomavarempty{fromlogo}{}{%
2500 \raggedleft\usekomavar{fromlogo}\par}%
2501 \fi
2502 \raggedright
2503 {\usekomafont{fromname}\strut\ignorespaces
2504 \usekomavar{fromname}%
2505 {%
2506 \ifnum\@rulefrom=1\\[-.5\baselineskip]%
2507 \usekomafont{fromrule}{%
2508 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
2509 \ifdim\@tempdima=\z@
2510 \setlength{\@tempdima}{\useplength{locwidth}}%
2511 \fi
2512 \expandafter\rule\expandafter{\the\@tempdima}{%
2513 \useplength{fromrulethickness}}%
2514 }%
2515 \fi
2516 }%
2517 \\
2518 }%
2519 {\usekomafont{fromaddress}\strut\ignorespaces
2520 \usekomavar{fromaddress}%
2521 \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
2522 \if@mobilephone
2523 \\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}%
2524 \fi%
2525 \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
2526 \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
2527 \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
2528 \ifnum\@rulefrom=2\\[-.5\baselineskip]%
2529 \usekomafont{fromrule}{%
2530 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
2531 \ifdim\@tempdima=\z@
2532 \setlength{\@tempdima}{\useplength{locwidth}}%
2533 \fi
2534 \expandafter\rule\expandafter{\the\@tempdima}{%
2535 \useplength{fromrulethickness}}}%
2536 \fi
2537 \\
2538 }%
2539 \or
2540 \raggedleft
2541 \if@logo
2542 \Ifkomavarempty{fromlogo}{}{\usekomavar{fromlogo}\par}%
2543 \fi
2544 {\usekomafont{fromname}\strut\ignorespaces
2545 \usekomavar{fromname}%
2546 {%
2547 \ifnum\@rulefrom=1\\[-.5\baselineskip]%
2548 \usekomafont{fromrule}{%
2549 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
2550 \ifdim\@tempdima=\z@
2551 \setlength{\@tempdima}{\useplength{locwidth}}%
2552 \fi
2553 \expandafter\rule\expandafter{\the\@tempdima}{%
2554 \useplength{fromrulethickness}}%
2555 }%
2556 \fi
2557 }%
2558 \\
2559 }%
2560 {\usekomafont{fromaddress}\strut\ignorespaces
2561 \usekomavar{fromaddress}%
2562 \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
2563 \if@mobilephone%
2564 \\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}%
2565 \fi%
2566 \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
2567 \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
2568 \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
2569 \ifnum\@rulefrom=2\\[-.5\baselineskip]%
2570 \usekomafont{fromrule}{%
2571 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
2572 \ifdim\@tempdima=\z@
2573 \setlength{\@tempdima}{\useplength{locwidth}}%
2574 \fi
2575 \expandafter\rule\expandafter{\the\@tempdima}{%
2576 \useplength{fromrulethickness}}}%
2577 \fi
2578 \\
2579 }%
2580 % \end{macrocode}
2581 % Last but not least the location information.
2582 % \begin{macrocode}
2583 \fi
2584 \usekomavar{location}%
2585 }\relax
2586 }%
2587 }
2588 % \end{macrocode}
2589 % \end{macro}^^A \scr@notepaper@element@location
2590 % \begin{macro}{\scr@notepaper@element@refline}
2591 % \changes{v3.27}{2019/05/03}{added}
2592 % This notepaper element replaces the \cs{@datefield} of
2593 % \cls*{scrlttr2}. In opposite to \cls*{scrlttr2} this element has a
2594 % dedicated height \texttt{reflineheight}.
2595 % \begin{description}
2596 % \item[ToDo:] Needs to be tested.
2597 % \end{description}
2598 % \begin{macrocode}
2599 \newcommand*{\scr@notepaper@element@refline}{%
2600 % \end{macrocode}
2601 % First of all test, whether or not their has to be set anything.
2602 % \begin{macrocode}
2603 \@tempswafalse
2604 \if@refline
2605 \let\do@set@reffield\@test@reffield
2606 %<trace> \let\@tempa\@empty
2607 \@set@reffields
2608 % \end{macrocode}
2609 % Maybe we have to add the date:
2610 % \begin{macrocode}
2611 \ifcase \@datepos
2612 \or
2613 \if@tempswa\addtoreffields{date}\fi
2614 \expandafter\let\csname if@refline\expandafter\endcsname
2615 \csname if@tempswa\endcsname
2616 \@test@reffield{date}%
2617 \or
2618 \if@tempswa
2619 \edef\expandafter\@set@reffields{%
2620 \unexpanded{\do@set@reffield{date}}%
2621 \unexpanded\expandafter{\@set@reffields}%
2622 }%
2623 \fi
2624 \expandafter\let\csname if@refline\expandafter\endcsname
2625 \csname if@tempswa\endcsname
2626 \@test@reffield{date}%
2627 \fi
2628 \fi
2629 \if@tempswa
2630 % \end{macrocode}
2631 % We have to print something, so let's calculate the position and height.
2632 % \begin{macrocode}
2633 \ifdim\useplength{refwidth}=\z@
2634 %<trace> \typeout{TRACE: refwidth by option}%
2635 \if@refwide
2636 %<trace> \typeout{TRACE: refline=wide}%
2637 \ifdim \useplength{toaddrhpos}>\z@
2638 \setplength{refhpos}{\useplength{toaddrhpos}}%
2639 \else
2640 \setplength[-]{refhpos}{\useplength{toaddrhpos}}%
2641 \fi
2642 \setplength{refwidth}{\paperwidth -2\useplength{refhpos}}%
2643 \else
2644 %<trace> \typeout{TRACE: refline=narrow}%
2645 \setplength{refwidth}{\textwidth}%
2646 \setplength{refhpos}{\oddsidemargin+1in}%
2647 \fi
2648 \else
2649 %<trace> \typeout{TRACE: refwidth by pseudo-length}%
2650 \ifdim\useplength{refhpos}=\z@
2651 \setlength{\@tempdima}{\dimexpr
2652 \textwidth-\useplength{refwidth}
2653 \relax}%
2654 \setlength{\@tempdimb}{\dimexpr \oddsidemarin+1in\relax}%
2655 \setlength{\@tempdimc}{\dimexpr \paperwidth-\textwidth\relax}%
2656 \divide\@tempdimb by 32768\relax
2657 \divide\@tempdimc by 32768\relax
2658 \ifdim\@tempdimc=\z@\else
2659 \multiply\@tempdima by\@tempdimb
2660 \divide\@tempdima by\@tempdimc
2661 \fi
2662 \setplength{refhpos}{\@tempdima}%
2663 \fi
2664 \fi
2665 %<*trace>
2666 \typeout{TRACE: Reference line with \@tempa^^J
2667 \space\space\space\space\space\space
2668 at refhpos=\the\useplength{refhpos},^^J
2669 \space\space\space\space\space\space\space\space\space
2670 refvpos=\the\useplength{refvpos},^^J
2671 \space\space\space\space\space\space\space\space\space
2672 refwidth=\the\useplength{refwidth},^^J
2673 \space\space\space\space\space\space\space\space\space
2674 refheight=\the\useplength{refheight}}%
2675 %</trace>
2676 \put@notepaper@element
2677 (\useplength{refhpos},\useplength{refvpos})%
2678 (\useplength{refwidth},\useplength{refheight})%
2679 {Element `refline'}%
2680 {%
2681 % \end{macrocode}
2682 % Last but not least print it.
2683 % \begin{macrocode}
2684 \if@refline
2685 % \end{macrocode}
2686 % Print a reference line.
2687 % \begin{macrocode}
2688 \let\do@set@reffield\@set@reffield\@tempswafalse\@set@reffields
2689 \else
2690 % \end{macrocode}
2691 % Print only place and date.
2692 % \begin{macrocode}
2693 \ifnum \@datepos=1 \hspace*{\fill}\fi
2694 {%
2695 \usekomafont{placeanddate}{%
2696 \Ifkomavarempty{place}{}{%
2697 \usekomavar{place}\usekomavar{placeseparator}%
2698 }%
2699 \usekomavar{date}%
2700 }%
2701 }%
2702 \fi
2703 }%
2704 \fi
2705 }
2706 % \end{macrocode}
2707 % \end{macro}^^A \scr@notepaper@element@refline
2708 % \end{macro}^^A \scr@notepaper@elements
2709 % \begin{macro}{\put@notepager@element}
2710 % \changes{v3.27}{2019/03/22}{added}
2711 % \begin{macro}{\put@@notepager@@element}
2712 % \changes{v3.27}{2019/05/03}{added}
2713 % A helper macro to output one element at a specific
2714 % position. \texttt{(\#1,\#2)} is the position, \texttt{(\#3,\#4)} the allowed
2715 % width and height, \texttt{\#5} is the name of the element (used for warning
2716 % messages only), \texttt{\#6} is the element content. The content is first
2717 % put into a temporary box of type \texttt{vtop}. Optional code can be
2718 % executed immediately before testing the total height of this box
2719 % \cs{@tempboxa} and before using it.
2720 % \begin{macrocode}
2721 \newcommand{\put@notepaper@element}{}
2722 \long\def\put@notepaper@element(#1,#2)(#3,#4)#5#6{%
2723 \kernel@ifnextchar [%]
2724 {\put@@notepaper@@element({#1},{#2})({#3},{#4}){#5}{#6}}%
2725 {\put@@notepaper@@element({#1},{#2})({#3},{#4}){#5}{#6}[]}%
2726 }
2727 \newcommand{\put@@notepaper@@element}{}
2728 \long\def\put@@notepaper@@element(#1,#2)(#3,#4)#5#6[#7]{%
2729 \put(\LenToUnit{\dimexpr #1\relax},\LenToUnit{-\dimexpr #2\relax}){%
2730 \setbox\@tempboxa \vtop{%
2731 \color@begingroup
2732 \vskip \z@
2733 \hsize=\dimexpr #3\relax
2734 \linewidth=\hsize
2735 \columnwidth=\linewidth
2736 \textwidth=\columnwidth
2737 \parfillskip=\z@ \@plus 1fil\relax
2738 #6
2739 \color@endgroup
2740 }%
2741 #7%
2742 \ifdim \dimexpr\ht\@tempboxa+\dp\@tempboxa\relax > \dimexpr #4\relax
2743 \PackageWarning{scrletter}{#5
2744 \the\dimexpr \ht\@tempboxa+\dp\@tempboxa-(#4)\relax\space
2745 to high.\MessageBreak
2746 The content could collide with other page contents\MessageBreak
2747 or break the page edges. You should reduce the\MessageBreak
2748 size before usage%
2749 }%
2750 \fi
2751 \usebox\@tempboxa
2752 }%
2753 }
2754 %</package&body&willbe>
2755 % \end{macrocode}
2756 % \end{macro}^^A \put@@notepaper@@element
2757 % \end{macro}^^A \put@notepaper@element
2758 %
2759 % \begin{macro}{\move@topt}
2760 % \changes{v2.8n}{2001/09/07}{added}
2761 % We will need a helper to place an element relative to the top paper
2762 % edge. So we have to move from the start of the text area to the start of an
2763 % absolute position on the paper. This does only work, if the current position
2764 % is the start of the text area!
2765 % \begin{macrocode}
2766 %<*body>
2767 \newcommand*{\move@topt}{%
2768 \null\vskip -1in\vskip -\topmargin%
2769 \vskip -\headheight\vskip -\headsep%
2770 \vskip -\topskip%
2771 \ignorespaces%
2772 }
2773 % \end{macrocode}
2774 % \begin{macro}{\move@frompt}
2775 % \changes{v2.8n}{2001/09/07}{added}
2776 % And also we need to move back from the absolute paper position to the start
2777 % of the text area. This does only work, if the absolute paper position is
2778 % unchanged.
2779 % \begin{macrocode}
2780 \newcommand*{\move@frompt}{%
2781 \vskip 1in\vskip \topmargin%
2782 \vskip \headheight\vskip \headsep%
2783 \vskip \topskip%
2784 \vskip -\baselineskip%
2785 \ignorespaces%
2786 }
2787 % \end{macrocode}
2788 % \end{macro}
2789 % \end{macro}
2790 %
2791 % \begin{macro}{\move@topl,\move@frompl}
2792 % \changes{v2.8n}{2001/09/07}{added}
2793 % We need the same for the horizontal position.
2794 % \begin{macrocode}
2795 \newcommand*{\move@topl}{%
2796 \null\hskip -1in%
2797 \ifodd\value{page}\hskip -\oddsidemargin\else\hskip -\evensidemargin\fi
2798 \ignorespaces%
2799 }
2800 \newcommand*{\move@frompl}{%
2801 \hskip 1in%
2802 \ifodd\value{page}\hskip \oddsidemargin\else\hskip \evensidemargin\fi%
2803 \ignorespaces%
2804 }
2805 % \end{macrocode}
2806 % \end{macro}
2807 %
2808 %
2809 % \begin{macro}{\vb@t@z}
2810 % \changes{v2.8n}{2001/09/07}{added}
2811 % \changes{v2.95}{2006/03/23}{using \cs{setparsizes}}
2812 % \changes{v2.97e}{2007/11/20}{\cs{long}}
2813 % This is similar to \cs{smash}.
2814 % \begin{description}
2815 % \item[ToDo:] Should we use \cs{smash} inside the definition?
2816 % \end{description}
2817 % \begin{macrocode}
2818 \newcommand{\vb@t@z}[1]{{%
2819 \setbox\z@\vbox to\z@{\color@begingroup #1\color@endgroup\vss}%
2820 \setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative
2821 \setlength{\baselineskip}{\z@}%
2822 \setlength{\@tempdima}{\ht0}\addtolength{\@tempdima}{\dp0}%
2823 \box\z@\vskip-\@tempdima%
2824 }%
2825 }
2826 % \end{macrocode}
2827 % \end{macro}
2828 %
2829 % \begin{macro}{\@foldmarks}
2830 % \changes{v2.97e}{2007/11/08}{using \plen{mfoldmarkvpos}}
2831 % \begin{macro}{\@hfoldmark}
2832 % \changes{v2.97e}{2007/11/08}{added}
2833 % \begin{macro}{\@foldmark}
2834 % \changes{v2.8n}{2001/09/07}{added}
2835 % \changes{v2.95}{2006/06/06}{\cs{vskip} moved into \cs{vb@t@z}}
2836 % \changes{v2.97c}{2007/05/08}{using \plen{foldmarkthickness}}
2837 % \changes{v2.97c}{2007/05/08}{using \fnt{foldmark}}
2838 % \changes{v3.27}{2019/03/29}{different versions for package and class}
2839 % Used to place all activated fold marks, either a horizontal one or a
2840 % vertical one.
2841 % \begin{description}
2842 % \item[ToDo:] The plans explained in the into of this section would have
2843 % consequences here too.
2844 % \end{description}
2845 % For the still used version the parameters oft a horizontal fold mark are the
2846 % vertical distance from the top edge an the length. The parameters of a
2847 % vertical fold mark are the horizontal distance from the left edge and the
2848 % length.
2849 % \begin{macrocode}
2850 %<*class|!willbe>
2851 \newcommand*{\@foldmark}[2]{%
2852 \vb@t@z{\setlength{\@tempdima}{#1}%
2853 \addtolengthplength[-.5]{\@tempdima}{foldmarkthickness}%
2854 \vskip \@tempdima
2855 \rlap{\move@topl\hskip\useplength{foldmarkhpos}%
2856 \usekomafont{foldmark}{%
2857 \rule{#2}{\useplength{foldmarkthickness}}}}}%
2858 \ignorespaces
2859 }
2860 %</class|!willbe>
2861 % \end{macrocode}
2862 % The planned package version uses \cs{put} to set the marks. It has a
2863 % position, a direction and a length, so it can handle the horizontal and the
2864 % vertical foldmarks.
2865 % \begin{macrocode}
2866 %<*package&willbe>
2867 \newcommand*{\@foldmark}{}
2868 \def\@foldmark(#1,#2)(#3,#4)#5{%
2869 \put(\LenToUnit{#1},-\LenToUnit{#2}){%
2870 \linethickness{\useplength{foldmarkthickness}}%
2871 \line(#3,-#4){\LenToUnit{#5}}%
2872 }%
2873 }
2874 %</package&willbe>
2875 \newcommand*{\@hfoldmark}[1]{%
2876 \begingroup
2877 \@expandtwoargs\in@{#1}{\@usefolds}%
2878 \ifin@
2879 \lowercase{%
2880 \edef\@tempa{%
2881 %<*class|!willbe>
2882 \noexpand\ifdim \noexpand\useplength{#1foldmarkvpos}=\noexpand\z@
2883 \noexpand\else
2884 \noexpand\@foldmark{%
2885 \noexpand\useplength{#1foldmarkvpos}%
2886 }{%
2887 \noexpand\useplength{#1foldmarklength}%
2888 }%
2889 \noexpand\fi
2890 %</class|!willbe>
2891 % \end{macrocode}
2892 % \changes{v3.27}{2019/03/29}{different handling of the package version}
2893 % The planned package version of \cs{@foldmark} has a new direction argument,
2894 % because it handles horizontal and vertical foldmarks. And if there is not a
2895 % pseudo-length for the vertical possition of the horizontal fold-mark the
2896 % possition is half of the paper height. This is for the ``P''-mark.
2897 % \begin{macrocode}
2898 %<*package&willbe>
2899 \Ifplength{#1foldmarkvpos}{%
2900 \ifdim \useplength{#1foldmarkvpos}=\z@\else
2901 \noexpand\@foldmark(\noexpand\useplength{foldmarkhpos},%
2902 \noexpand\useplength{#1foldmarkvpos})%
2903 (1,0)%
2904 {%
2905 \noexpand\useplength{#1foldmarklength}%
2906 }%
2907 \fi
2908 }{%
2909 \noexpand\@foldmark(\noexpand\useplength{foldmarkhpos},%
2910 .5\noexpand\paperheight)%
2911 (1,0)%
2912 {%
2913 \noexpand\useplength{#1foldmarklength}%
2914 }%
2915 }%
2916 %</package&willbe>
2917 }%
2918 }%
2919 \@tempa
2920 \fi
2921 \endgroup
2922 }
2923 % \end{macrocode}
2924 % \begin{macro}{\@vfoldmark}
2925 % \changes{v2.97e}{2007/11/10}{added}
2926 % The rule is printed completely above the baseline, so the length has to
2927 % be added to the vertical movement.
2928 % \begin{macrocode}
2929 \newcommand*{\@vfoldmark}[1]{%
2930 \begingroup
2931 \ifdim \useplength{lfoldmarkhpos}=\z@\else
2932 \@expandtwoargs\in@{#1}{\@usefolds}%
2933 \ifin@
2934 % \end{macrocode}
2935 % \changes{v3.27}{2019/03/29}{package version uses \cs{@foldmark}}
2936 % The currently used version does still work using \cs{rule}.
2937 % \begin{macrocode}
2938 %<*class|willbe>
2939 \vb@t@z{%
2940 \ifdim \useplength{foldmarkvpos}<\z@
2941 \nobreak\vskip \paperheight\nobreak
2942 \fi
2943 \vskip \useplength{foldmarkvpos}%
2944 \vskip \useplength{foldmarkthickness}%
2945 \rlap{\move@topl
2946 \setlength{\@tempdima}{\useplength{lfoldmarkhpos}}%
2947 \addtolengthplength[-.5]{\@tempdima}{foldmarkthickness}%
2948 \hskip\@tempdima
2949 \usekomafont{foldmark}{%
2950 \rule{\useplength{foldmarkthickness}}%
2951 {\useplength{lfoldmarklength}}%
2952 }%
2953 }%
2954 }%
2955 \ignorespaces
2956 %</class|willbe>
2957 % \end{macrocode}
2958 % But the planned package version uses \cs{@foldmark}.
2959 % \begin{macrocode}
2960 %<*package&willbe>
2961 \@foldmark(\useplength{lfoldmarkhpos},\useplength{foldmarkvpos})%
2962 (0,1)%
2963 {\useplength{lfoldmarklength}}%
2964 %</package&willbe>
2965 \fi
2966 \fi
2967 \endgroup
2968 }
2969 % \end{macrocode}
2970 % The main foldmark command is only needed by the current version.
2971 % \begin{macrocode}
2972 %<*class|!willbe>
2973 \newcommand*{\@foldmarks}{%
2974 \if@fold%
2975 %<trace> \typeout{Foldmarks: yes}%
2976 \move@topt
2977 \ifdim \useplength{pfoldmarklength}=\z@
2978 \setplength{pfoldmarklength}{4mm}%
2979 \fi
2980 \ifdim \useplength{tfoldmarklength}=\z@
2981 \setplength{tfoldmarklength}{2mm}%
2982 \fi
2983 \ifdim \useplength{mfoldmarklength}=\z@
2984 \setplength{mfoldmarklength}{2mm}%
2985 \fi
2986 \ifdim \useplength{bfoldmarklength}=\z@
2987 \setplength{bfoldmarklength}{2mm}%
2988 \fi
2989 \ifdim \useplength{lfoldmarklength}=\z@
2990 \setplength{lfoldmarklength}{4mm}%
2991 \fi
2992 \begingroup
2993 \@expandtwoargs\in@{P}{\@usefolds}%
2994 \ifin@
2995 \@foldmark{.5\paperheight}{\useplength{pfoldmarklength}}%
2996 \fi
2997 \endgroup
2998 \@hfoldmark{T}%
2999 \@hfoldmark{M}%
3000 \@hfoldmark{B}%
3001 \@vfoldmark{L}%
3002 \move@frompt
3003 %<trace> \else \typeout{Foldmarks: no}%
3004 \fi%
3005 }
3006 %</class|!willbe>
3007 % \end{macrocode}
3008 % \end{macro}
3009 % \end{macro}
3010 % \end{macro}
3011 % \end{macro}
3012 %
3013 % \begin{macro}{\@savevbox}
3014 % \changes{v2.8n}{2001/09/07}{added}
3015 % \changes{v2.8q}{2001/10/30}{optional argument added}
3016 % \begin{macro}{\@savevbox@warningfalse,\@savevbox@warningtrue,\if@savevbox@warning}
3017 % \changes{v2.8q}{2001/10/30}{added}
3018 % A vertically overfull box while \cs{opening} is hard to find. So we use
3019 % \begin{quote}
3020 % \cs{@savevbox}\oarg{print code}\marg{nominal height}\marg{content}%
3021 % \marg{element name}\marg{height name}\marg{change code}
3022 % \end{quote}
3023 % to measure each of these boxes and report a warning with more information.
3024 % \begin{description}
3025 % \item[Note:] The \meta{print code} is not used to measure the box, but to
3026 % print it.
3027 % \item[Note:] The \meta{content} is used twice: first to measure the box and
3028 % second to print it. Currently no special treatment is implemented to avoid
3029 % problems using commands like \cs{label}, \cs{stepcounter} etc. inside
3030 % \meta{content}.
3031 % \end{description}
3032 % \begin{macrocode}
3033 \newif\if@savevbox@warning\@savevbox@warningtrue
3034 \newcommand{\@savevbox}[6][]{%
3035 \begingroup%
3036 \vbox to #2{#1#3}%
3037 \if@savevbox@warning\@savevbox@warningfalse%
3038 \setbox\z@\vbox{\color@begingroup #3\color@endgroup}%
3039 \setlength{\@tempdima}{#2}%
3040 \setlength{\@tempdimb}{\ht0}\addtolength{\@tempdimb}{\dp0}%
3041 \ifdim \@tempdimb>\@tempdima%
3042 \addtolength{\@tempdimb}{-\@tempdima}%
3043 %<class> \ClassWarning{scrlttr2}{%
3044 %<package> \PackageWarning{scrletter}{%
3045 #4 is \the\@tempdimb\space too high.\MessageBreak
3046 You have to change `\string#5'\MessageBreak
3047 or you have to define a smaller\MessageBreak
3048 #4 using \string#6.\MessageBreak
3049 Because of this too high #4\MessageBreak
3050 you've got an overfull \string\vbox\space message%
3051 }%
3052 \fi%
3053 \fi%
3054 \endgroup%
3055 }
3056 % \end{macrocode}
3057 % \end{macro}
3058 % \end{macro}
3059 %
3060 % \begin{macro}{\@firstheadfootfield}
3061 % \changes{v2.8n}{2001/09/08}{added}
3062 % \changes{v2.8q}{2001/10/30}{\cs{parfillskip} locally set to 0}
3063 % \changes{v2.8q}{2001/10/30}{use a box for the foot}
3064 % \changes{v2.9l}{2003/01/23}{improved positioning}
3065 % \changes{v2.97e}{2007/11/22}{support for options \opt{firsthead} and
3066 % \opt{firstfoot}}
3067 % \changes{v3.05}{2009/11/09}{using pseudo length \plen{firstheadhpos}}
3068 % \changes{v3.05}{2009/11/09}{using pseudo length \plen{firstfoothpos}}
3069 % The letter head of the notepaper.
3070 % \begin{description}
3071 % \item[ToDo:] \changes{v3.27}{2019/03/22}{planned code enlarges page} The
3072 % planned code of \pkg*{scrlayer} does not print the page head or foot
3073 % here. It only enlarges or shrinks the first page.
3074 % \end{description}
3075 % \begin{macrocode}
3076 \newcommand*{\@firstheadfootfield}{%
3077 %<*class|!willbe>
3078 \if@firsthead
3079 %<trace> \typeout{Head of first page}%
3080 \move@topt\vskip\useplength{firstheadvpos}%
3081 \vb@t@z{%
3082 \rlap{\move@topl
3083 % \end{macrocode}
3084 % \begin{itemize}
3085 % \item If \plen{firstheadhpos} is positiv and less than the paper width, it
3086 % is the distance of the left paper edge to the left edge of the letter
3087 % head.
3088 % \item If \plen{firstheadhpos} is negative and the absolute value is less
3089 % than the paper width, the absolute value is the distance of the right
3090 % paper edge to the right edge of the letter head.
3091 % \item If \plen{firstheadhpos} is larger than the paper width, the letter
3092 % head will be centered.
3093 % \item If \plen{firstheadhpos} is negative an the absolute value is larger
3094 % than the paper width, the letter head will be left aligned to the text area.
3095 % \end{itemize}
3096 % \begin{macrocode}
3097 \ifdim\useplength{firstheadhpos}<\paperwidth
3098 \ifdim \useplength{firstheadhpos}>-\paperwidth
3099 \ifdim \useplength{firstheadhpos}<\z@
3100 \setlength\@tempskipa{\paperwidth}%
3101 \addtolengthplength{\@tempskipa}{firstheadhpos}%
3102 \addtolengthplength[-]{\@tempskipa}{firstheadwidth}%
3103 \else
3104 \setlength{\@tempskipa}{\useplength{firstheadhpos}}%
3105 \fi
3106 \else
3107 \setlength\@tempskipa{\oddsidemargin}%
3108 \addtolength\@tempskipa{1in}%
3109 \fi
3110 \else
3111 \setlength\@tempskipa{.5\paperwidth}%
3112 \addtolengthplength[-.5]{\@tempskipa}{firstheadwidth}%
3113 \fi
3114 \hskip\@tempskipa
3115 \vbox{\hsize\useplength{firstheadwidth}%
3116 \setlength{\@tempskipa}{\useplength{toaddrvpos}}%
3117 \addtolengthplength[-1]{\@tempskipa}{firstheadvpos}%
3118 \addtolength{\@tempskipa}{-\baselineskip}%
3119 % \end{macrocode}
3120 % Locally set \len{textwidth} to the width of the letter head (similar to
3121 % using a \env{minipage}. Also reset \len{parfillskip} to avoid overfull
3122 % \cs{hbox} messages because of filled text width.
3123 % \begin{macrocode}
3124 \setlength{\textwidth}{\useplength{firstheadwidth}}%
3125 \setlength{\parfillskip}{\z@ \@plus 1fil}%
3126 \@savevbox{\@tempskipa}{\noindent\usekomavar{firsthead}%
3127 \vskip \z@ \@plus .00001fil}%
3128 {head of first page}{firstheadvpos}{\setkomavar}%
3129 }%
3130 }%
3131 }%
3132 \vskip-\useplength{firstheadvpos}\move@frompt
3133 \else
3134 %<trace> \typeout{No head at first page}%
3135 \fi
3136 \move@topt
3137 \if@firstfoot
3138 %<trace> \typeout{Foot of first page}%
3139 \vb@t@z{%
3140 \rlap{\move@topl
3141 % \end{macrocode}
3142 % \begin{itemize}
3143 % \item If \plen{firstfoothpos} is positiv and less than the paper width, it
3144 % is the distance of the left paper edge to the left edge of the letter
3145 % footer.
3146 % \item If \plen{firstfoothpos} is negative and the absolute value is less
3147 % than the paper width, the absolute value is the distance of the right
3148 % paper edge to the right edge of the letter footer.
3149 % \item If \plen{firstfoothpos} is larger than the paper width, the letter
3150 % footer will be centered.
3151 % \item If \plen{firstfoothpos} is negative an the absolute value is larger
3152 % than the paper width, the letter footer will be left aligned to the text
3153 % area.
3154 % \end{itemize}
3155 % \begin{macrocode}
3156 \ifdim\useplength{firstfoothpos}<\paperwidth
3157 \ifdim \useplength{firstfoothpos}>-\paperwidth
3158 \ifdim \useplength{firstfoothpos}<\z@
3159 \setlength\@tempskipa{\paperwidth}%
3160 \addtolengthplength{\@tempskipa}{firstfoothpos}%
3161 \addtolengthplength[-]{\@tempskipa}{firstfootwidth}%
3162 \else
3163 \setlength{\@tempskipa}{\useplength{firstfoothpos}}%
3164 \fi
3165 \else
3166 \setlength\@tempskipa{\oddsidemargin}%
3167 \addtolength\@tempskipa{1in}%
3168 \fi
3169 \else
3170 \setlength\@tempskipa{.5\paperwidth}%
3171 \addtolengthplength[-.5]{\@tempskipa}{firstfootwidth}%
3172 \fi
3173 \hskip\@tempskipa
3174 \vbox{\hsize\useplength{firstfootwidth}%
3175 \vskip\useplength{firstfootvpos}%
3176 \setlength{\textwidth}{\useplength{firstfootwidth}}%
3177 \setlength{\parfillskip}{\z@ \@plus 1fil}%
3178 \vbox{\hsize\useplength{firstfootwidth}\noindent
3179 \usekomavar{firstfoot}}%
3180 }%
3181 }%
3182 }%
3183 %<trace> \else \typeout{No foot at first page}%
3184 \fi
3185 \move@frompt%
3186 %</class|!willbe>
3187 {%
3188 \setlength{\@tempdima}{1in}\addtolength{\@tempdima}{\topmargin}%
3189 \addtolength{\@tempdima}{\headheight}%
3190 \addtolength{\@tempdima}{\headsep}%
3191 \addtolength{\@tempdima}{\textheight}%
3192 \addtolength{\@tempdima}{\footskip}%
3193 \if@firstfoot
3194 \addtolengthplength[-1]{\@tempdima}{firstfootvpos}%
3195 \else
3196 \addtolength{\@tempdima}{-\paperheight}%
3197 \fi
3198 % \end{macrocode}
3199 % \changes{v3.48}{2025/09/05}{fix distance}
3200 % From \KOMAScript{} 3.48 we add some tolerance and also take the height of
3201 % the first footer line into account. Note, the footer of the first page does
3202 % not use any font element, so we can use \cs{ht}\cs{strutbox} here.
3203 % \begin{macrocode}
3204 %<trace> \typeout{TRACE enlargement \dimeval{-\@tempdima}}%
3205 %<class&!v4> \expandafter\ifnum\scr@v@is@ge{3.48}%
3206 \addtolength{\@tempdima}{-\ht\strutbox}%
3207 \ifdim \@tempdima > -\maxdepth
3208 \ifdim \@tempdima < \maxdepth
3209 \@shrinkfpfalse\@enlargefpfalse
3210 \fi
3211 \fi
3212 %<class&!v4> \fi
3213 \ifdim\@tempdima>\z@\if@shrinkfp\enlargethispage{-\@tempdima}\fi%
3214 \else\if@enlargefp\enlargethispage{-\@tempdima}\fi\fi
3215 }%
3216 }
3217 % \end{macrocode}
3218 % \end{macro}
3219 %
3220 % \begin{macro}{\@addrfield}
3221 % \changes{v2.8q}{2002/04/01}{\cs{parfillskip} locally changed}
3222 % \changes{v2.8q}{2002/06/03}{special treatment of addressee right aligend}
3223 % \changes{v2.9o}{2003/02/20}{\cs{noindent} added to \var{specialmail}}
3224 % \changes{v2.96}{2006/07/31}{using \cs{backaddr@format}}
3225 % \changes{v3.03}{2009/03/04}{support for priority}
3226 % \changes{v3.03}{2009/03/04}{new \opt{addrfield} values \opt{\quotechar=PP},
3227 % \opt{\quotechar=backgroundimage}, \opt{\quotechar=addresseeimage}}
3228 % \changes{v3.03b}{2009/06/30}{typo fix of ``addressee''}
3229 % \changes{v3.06a}{2010/07/29}{setting paragraph parameters}
3230 % \changes{v3.17}{2015/04/17}{\cs{setbox} replaced by \cs{sbox}}
3231 % \changes{v3.22}{2016/12/21}{braces fixed}
3232 % \changes{v3.22}{2016/12/21}{\cs{endgraf} added}
3233 % \changes{v3.25}{2017/11/15}{using \cs{scr@endstrut} instead of
3234 % \cs{unskip}\cs{strut}}
3235 % \changes{v3.27}{2019/03/27}{potentially only for \cls*{scrlttr2}}
3236 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
3237 % \cs{Ifkomavarempty}}
3238 % \changes{v3.30}{2020/03/27}{re-definition of line break moved}
3239 % The address field of the addressee inclusive return address and special mail
3240 % text.
3241 % \begin{description}
3242 % \item[ToDo:] The plans explained in the into of this section would have
3243 % consequences here too.
3244 % \end{description}
3245 % \begin{macrocode}
3246 %<*class|!willbe>
3247 \newcommand*{\@addrfield}{%
3248 \ifcase \ifnum\@afieldmode=5 \@ne\else\@afieldmode\fi\relax
3249 %<trace> \typeout{Address: No}%
3250 \or
3251 \begingroup%
3252 \if@baddr
3253 \Ifkomavarempty{backaddress}{%
3254 \let\@tempa\@empty\let\@tempb\@empty
3255 }{%
3256 \def\@tempa{backaddress}\def\@tempb{,\space}%
3257 }%
3258 \else
3259 \let\@tempa\@empty\let\@tempb\@empty
3260 \fi
3261 \ifcase \ltr@priority
3262 \Ifkomavarempty{specialmail}{}{%
3263 \edef\@tempa{\@tempa\@tempb specialmail}\def\@tempb{,\space}%
3264 }%
3265 \or
3266 \edef\@tempa{\@tempa\@tempb B-Economy}\def\@tempb{,\space}%
3267 \or
3268 \edef\@tempa{\@tempa\@tempb A-Priority}\def\@tempb{,\space}%
3269 \fi
3270 %<trace> \typeout{Address (\@tempa\@tempb addressee)}%
3271 \endgroup%
3272 \move@topt\vskip\useplength{toaddrvpos}%
3273 \vb@t@z{{\setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative
3274 \rlap{\move@topl
3275 \setlengthtoplength{\@tempskipa}{toaddrhpos}%
3276 \ifdim \@tempskipa<\z@
3277 \addtolength{\@tempskipa}{\paperwidth}%
3278 \addtolengthplength[-]{\@tempskipa}{toaddrwidth}%
3279 \fi
3280 \hskip\@tempskipa
3281 \@savevbox{\useplength{toaddrheight}}{\hsize\useplength{toaddrwidth}%
3282 \@savevbox[\vss]{\useplength{backaddrheight}}{%
3283 \hsize\useplength{toaddrwidth}%
3284 \if@baddr
3285 \Ifkomavarempty{backaddress}{}{{%
3286 \noindent%
3287 \backaddr@format{\scriptsize
3288 {%
3289 \def\\{\usekomavar{backaddressseparator}\@ogobble}%
3290 \usekomafont{backaddress}%
3291 {\usekomavar{backaddress}}%
3292 }}}}%
3293 \fi
3294 }{backaddress}{backaddrheight}{\setkomavar}%
3295 \ifcase \ltr@priority
3296 \or
3297 \setkomavar{specialmail}{%
3298 {\usekomafont{priority}{%
3299 {\usekomafont{prioritykey}{B}}%
3300 -ECONOMY}}%
3301 }%
3302 \or
3303 \setkomavar{specialmail}{%
3304 {\usekomafont{priority}{%
3305 {\usekomafont{prioritykey}{A}}%
3306 -PRIORITY}}%
3307 }%
3308 \fi
3309 \Ifkomavarempty{specialmail}{}{%
3310 \vbox{\hsize\useplength{toaddrwidth}%
3311 \noindent\hspace*{\useplength{specialmailindent}}%
3312 \specialmail@format{%
3313 \usekomafont{specialmail}\usekomavar{specialmail}}%
3314 \hspace*{\useplength{specialmailrightindent}}}%
3315 }%
3316 \ifnum\@afieldmode=\@ne\vfil\fi%
3317 \noindent\hskip\useplength{toaddrindent}%
3318 \setlength{\@tempdima}{\useplength{toaddrwidth}}%
3319 \addtolengthplength[-2]{\@tempdima}{toaddrindent}%
3320 \vbox{\hsize\@tempdima\raggedright
3321 \usekomafont{addressee}{%
3322 {\usekomafont{toname}{\usekomavar{toname}\\}}%
3323 {\usekomafont{toaddress}{\usekomavar{toaddress}\endgraf}}}}%
3324 \vfil\null\vskip-\baselineskip}%
3325 {address field}{toaddrheight}%
3326 {\begin{letter} or you\MessageBreak
3327 have to define a smaller special purpose using\MessageBreak
3328 \string\specialmail}%
3329 }}}%
3330 \vskip-\useplength{toaddrvpos}\move@frompt
3331 \else
3332 \begingroup%
3333 % \end{macrocode}
3334 % With \opt{addrfield=PP}, \opt{addrfield=backgroundimage} or
3335 % \opt{addrfield=image} there are neither a return address nor a special mail
3336 % text, but a priority.
3337 % \begin{macrocode}
3338 \if@baddr
3339 \let\@tempa\@empty\let\@tempb\@empty
3340 \ifcase \@afieldmode\relax\or\or
3341 \def\@tempa{PP-mode}\def\@tempb{,\space}%
3342 \or
3343 \def\@tempa{backgroundimage-mode}\def\@tempb{,\space}%
3344 \or
3345 \def\@tempa{image-mode}\def\@tempb{,\space}%
3346 \fi
3347 \Ifkomavarempty{backaddress}{}{%
3348 \edef\@tempa{\@tempa\@tempb backaddress ignored}\def\@tempb{,\space}%
3349 }%
3350 \else
3351 \let\@tempa\@empty\let\@tempb\@empty
3352 \fi
3353 \ifcase \ltr@priority
3354 \Ifkomavarempty{specialmail}{}{%
3355 \edef\@tempa{\@tempa\@tempb specialmail ignored}\def\@tempb{,\space}%
3356 }%
3357 \or
3358 \edef\@tempa{\@tempa\@tempb B-Economy}\def\@tempb{,\space}%
3359 \or
3360 \edef\@tempa{\@tempa\@tempb A-Priority}\def\@tempb{,\space}%
3361 \fi
3362 %<trace> \typeout{Address (\@tempa\@tempb addressee)}%
3363 \endgroup%
3364 \move@topt\vskip\useplength{toaddrvpos}%
3365 \vb@t@z{{%
3366 \setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative
3367 \ifdim \useplength{toaddrindent}=\z@
3368 \setplength{toaddrindent}{8mm}%
3369 \fi
3370 \ifdim \useplength{PPheadheight}=\z@
3371 \setplength{PPheadheight}{20.74pt}%
3372 \fi
3373 \ifdim \useplength{PPheadwidth}=\z@
3374 \setplength{PPheadwidth}{42mm}%
3375 \fi
3376 \ifdim \useplength{PPdatamatrixvskip}=\z@
3377 \setplength{PPdatamatrixvskip}{9mm}%
3378 \fi
3379 \rlap{\move@topl
3380 \setlengthtoplength{\@tempskipa}{toaddrhpos}%
3381 \ifdim \@tempskipa<\z@
3382 \addtolength{\@tempskipa}{\paperwidth}%
3383 \addtolengthplength[-]{\@tempskipa}{toaddrwidth}%
3384 \fi
3385 \hskip\@tempskipa
3386 \@savevbox{\useplength{toaddrheight}}{\hsize\useplength{toaddrwidth}%
3387 \ifnum\@afieldmode=\tw@
3388 % \end{macrocode}
3389 % \opt{addrfield=PP}:
3390 % \begin{macrocode}
3391 \vskip 2pt\relax
3392 \hskip \useplength{toaddrindent}\relax
3393 \fbox{%
3394 \vbox to \dimexpr \useplength{PPheadheight}-2\fboxsep\relax{%
3395 \setlength{\parindent}{0pt}%
3396 \hsize \dimexpr \useplength{PPheadwidth}-2\fboxsep\relax
3397 \sbox\@tempboxa{%
3398 {\fontsize{20.74pt}{20.74pt}\selectfont
3399 \usekomafont{PPlogo}{P.P.}}\hskip 2mm%
3400 }%
3401 \dp\@tempboxa\z@
3402 \setlength{\@tempdima}{\hsize}%
3403 \addtolength{\@tempdima}{-\wd\@tempboxa}%
3404 \hbox{\box\@tempboxa
3405 \vbox to \dimexpr
3406 \useplength{PPheadheight}-2\fboxsep\relax{%
3407 \vss\hsize\@tempdima
3408 \raggedright
3409 \fontsize{8pt}{9pt}\selectfont\usekomafont{PPdata}%
3410 \usekomavar*{fromzipcode}\usekomavar{zipcodeseparator}%
3411 \usekomavar{fromzipcode}\scr@endstrut\\
3412 \usekomavar{place}\scr@endstrut
3413 \hfill
3414 }%
3415 }%
3416 \vss
3417 }%
3418 }%
3419 \hskip 1mm
3420 \mbox{%
3421 \vbox to \useplength{PPheadheight}{%
3422 \addtolengthplength[-]{\hsize}{PPheadwidth}%
3423 \addtolength{\hsize}{-1mm}%
3424 \addtolengthplength[-2]{\hsize}{toaddrindent}%
3425 \setlength{\parindent}{0pt}%
3426 \fontsize{8pt}{9pt}\selectfont\usekomafont{PPdata}%
3427 \hfill\usekomavar{PPcode}
3428 \vss
3429 \ifcase \ltr@priority
3430 \or
3431 \usekomafont{priority}{%
3432 {\usekomafont{prioritykey}{B}}%
3433 -ECONOMY\hss\vskip-\dp\strutbox
3434 }%
3435 \or
3436 \usekomafont{priority}{%
3437 {\usekomafont{prioritykey}{A}}%
3438 -PRIORITY\hss\vskip-\dp\strutbox
3439 }%
3440 \fi
3441 \vss
3442 }%
3443 }%
3444 \vskip 1mm
3445 \vskip-\ht\strutbox
3446 \noindent\hskip\useplength{toaddrindent}%
3447 \hrulefill%
3448 \hskip\useplength{toaddrindent}%
3449 \vbox to\z@{\hsize\z@
3450 \vskip \useplength{PPdatamatrixvskip}\relax
3451 \llap{\usekomavar{PPdatamatrix}\hskip\useplength{toaddrindent}}%
3452 \vss
3453 }%
3454 \else
3455 % \end{macrocode}
3456 % \opt{addrfield=backgroundimage} or \opt{addrfield=image}:
3457 % \begin{macrocode}
3458 \vskip 1mm
3459 \noindent\expandafter\hskip\useplength{toaddrindent}%
3460 \vbox to \useplength{PPheadheight}{%
3461 \addtolengthplength[-2]{\hsize}{toaddrindent}%
3462 \setlength{\parindent}{0pt}%
3463 \usekomavar{addresseeimage}%
3464 \vss
3465 }%
3466 \vskip 1mm
3467 \vskip\dp\strutbox
3468 \fi
3469 \ifnum \@afieldmode=4 \else
3470 \vfil%
3471 \noindent\hskip\useplength{toaddrindent}%
3472 \setlength{\@tempdima}{\useplength{toaddrwidth}}%
3473 \addtolengthplength[-2]{\@tempdima}{toaddrindent}%
3474 \vbox{\hsize\@tempdima
3475 \Ifkomavarempty{PPdatamatrix}{}{%
3476 \addtolength{\hsize}{-2mm}%
3477 \settowidth\@tempdima{\usekomavar{PPdatamatrix}}%
3478 \addtolength{\hsize}{-\@tempdima}%
3479 }%
3480 \raggedright
3481 \usekomafont{addressee}{%
3482 {\usekomafont{toname}{\usekomavar{toname}\\}}%
3483 {\usekomafont{toaddress}{\usekomavar{toaddress}\endgraf}}}}%
3484 \fi
3485 \vss\null}%
3486 {address field}{toaddrheight}%
3487 {\string\begin{letter}}%
3488 }}}%
3489 \vskip-\useplength{toaddrvpos}\move@frompt
3490 \fi
3491 }
3492 %</class|!willbe>
3493 % \end{macrocode}
3494 % \begin{macro}{\specialmail@format}
3495 % \changes{v2.97c}{2007/07/06}{added}
3496 % Formatting the special mail note.
3497 % \begin{macrocode}
3498 \newcommand*{\specialmail@format}[1]{}
3499 \let\specialmail@format\underline
3500 % \end{macrocode}
3501 % \end{macro}
3502 %
3503 % \begin{macro}{\@ogobble}
3504 % \changes{v2.8q}{2002/01/22}{added}
3505 % Something like \cs{gobble} but to gobble an optional argument.
3506 % \begin{macrocode}
3507 \newcommand*{\@ogobble}[1][]{}
3508 % \end{macrocode}
3509 % \end{macro}
3510 % \end{macro}
3511 %
3512 % \begin{macro}{\@locfield}
3513 % \changes{v2.8o}{2001/09/17}{\cs{noindent} added}
3514 % \changes{v2.8q}{2002/02/07}{\cs{noindent} after the logo}
3515 % \changes{v2.8q}{2002/07/23}{width calculation moved to this}
3516 % \changes{v2.8q}{2002/06/03}{special treatment of right aligned addressee}
3517 % \changes{v3.12}{2013/05/29}{using variable \var{frommobilephone}}
3518 % \changes{v3.27}{2019/03/27}{potentially only at \cls*{scrlttr2}}
3519 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
3520 % \cs{Ifkomavarempty}}
3521 % The location field to be placed independent of having an address field.
3522 % \begin{description}
3523 % \item[ToDo:] The plans explained in the into of this section would have
3524 % consequences here too.
3525 % \end{description}
3526 % \begin{macrocode}
3527 %<*class|!willbe>
3528 \newcommand*{\@locfield}{%
3529 \ifdim \useplength{locwidth}=\z@%
3530 \setplength{locwidth}{\paperwidth}%
3531 \ifdim \useplength{toaddrhpos}>\z@
3532 \addtoplength[-2]{locwidth}{\useplength{toaddrhpos}}%
3533 \else
3534 \addtoplength[2]{locwidth}{\useplength{toaddrhpos}}%
3535 \fi
3536 \addtoplength[-1]{locwidth}{\useplength{toaddrwidth}}%
3537 \if@bigloc%
3538 \setplength[.66667]{locwidth}{\useplength{locwidth}}%
3539 \else%
3540 \setplength[.5]{locwidth}{\useplength{locwidth}}%
3541 \fi%
3542 \fi%
3543 % \end{macrocode}
3544 % \changes{v2.97e}{2007/11/13}{support for sender in location}
3545 % \changes{v2.98b}{2008/01/30}{always print location if used}
3546 % Depending of \opt{fromalign} we have to take care to print the location by
3547 % adding a dummy content.
3548 % \begin{macrocode}
3549 \ifcase\@alignfrom
3550 \or
3551 \if@logo
3552 \Ifkomavarempty{location}{\setkomavar{location}{\null}}{}%
3553 \fi
3554 \or
3555 \or
3556 \Ifkomavarempty{location}{\setkomavar{location}{\null}}{}%
3557 \or
3558 \Ifkomavarempty{location}{\setkomavar{location}{\null}}{}%
3559 \fi
3560 % \end{macrocode}
3561 % Report if the location is empty or calculate the position and width.
3562 % \begin{macrocode}
3563 \Ifkomavarempty{location}{%
3564 %<trace> \typeout{Location field: empty}%
3565 }{%
3566 %<trace> \typeout{Location field: yes}%
3567 \ifdim \useplength{lochpos}=\z@%
3568 \setplength{lochpos}{\useplength{toaddrhpos}}%
3569 \fi
3570 \ifdim \useplength{locvpos}=\z@%
3571 \setplength{locvpos}{\useplength{toaddrvpos}}%
3572 \fi
3573 \ifdim \useplength{locheight}=\z@%
3574 \setplength{locheight}{\useplength{toaddrheight}}%
3575 \fi
3576 \move@topt\vskip\useplength{locvpos}%
3577 \vb@t@z{\noindent\makebox[0pt][l]{%
3578 \move@topl
3579 \setlengthtoplength[-]{\@tempskipa}{lochpos}%
3580 \ifdim \@tempskipa<\z@
3581 \addtolength{\@tempskipa}{\paperwidth}%
3582 \else
3583 \addtolengthplength{\@tempskipa}{locwidth}%
3584 \fi
3585 \hskip\@tempskipa
3586 \makebox[0pt][r]{%
3587 \@savevbox{\useplength{locheight}}{%
3588 \noindent\hsize\useplength{locwidth}%
3589 % \end{macrocode}
3590 % For some values of \opt{fromalign} we also have to place the sender's
3591 % address or logo.
3592 % \begin{macrocode}
3593 \ifcase\@alignfrom
3594 \or
3595 \if@logo
3596 \Ifkomavarempty{fromlogo}{\null}{%
3597 {\raggedleft\noindent\usekomavar{fromlogo}\\
3598 \vskip\parskip}\noindent}%
3599 \fi
3600 \or
3601 \or
3602 \if@logo
3603 \Ifkomavarempty{fromlogo}{}{%
3604 \raggedleft\usekomavar{fromlogo}\par}%
3605 \fi
3606 \raggedright
3607 {\usekomafont{fromname}\strut\ignorespaces
3608 \usekomavar{fromname}%
3609 {%
3610 \ifnum\@rulefrom=1\\[-.5\baselineskip]%
3611 \usekomafont{fromrule}{%
3612 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
3613 \ifdim\@tempdima=\z@
3614 \setlength{\@tempdima}{\useplength{locwidth}}%
3615 \fi
3616 \expandafter\rule\expandafter{\the\@tempdima}{%
3617 \useplength{fromrulethickness}}%
3618 }%
3619 \fi
3620 }%
3621 \\
3622 }%
3623 {\usekomafont{fromaddress}\strut\ignorespaces
3624 \usekomavar{fromaddress}%
3625 \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
3626 \if@mobilephone
3627 \\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}%
3628 \fi%
3629 \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
3630 \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
3631 \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
3632 \ifnum\@rulefrom=2\\[-.5\baselineskip]%
3633 \usekomafont{fromrule}{%
3634 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
3635 \ifdim\@tempdima=\z@
3636 \setlength{\@tempdima}{\useplength{locwidth}}%
3637 \fi
3638 \expandafter\rule\expandafter{\the\@tempdima}{%
3639 \useplength{fromrulethickness}}}%
3640 \fi
3641 \\
3642 }%
3643 \or
3644 \raggedleft
3645 \if@logo
3646 \Ifkomavarempty{fromlogo}{}{\usekomavar{fromlogo}\par}%
3647 \fi
3648 {\usekomafont{fromname}\strut\ignorespaces
3649 \usekomavar{fromname}%
3650 {%
3651 \ifnum\@rulefrom=1\\[-.5\baselineskip]%
3652 \usekomafont{fromrule}{%
3653 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
3654 \ifdim\@tempdima=\z@
3655 \setlength{\@tempdima}{\useplength{locwidth}}%
3656 \fi
3657 \expandafter\rule\expandafter{\the\@tempdima}{%
3658 \useplength{fromrulethickness}}%
3659 }%
3660 \fi
3661 }%
3662 \\
3663 }%
3664 {\usekomafont{fromaddress}\strut\ignorespaces
3665 \usekomavar{fromaddress}%
3666 \if@phone\\\usekomavar*{fromphone}\usekomavar{fromphone}\fi%
3667 \if@mobilephone%
3668 \\\usekomavar*{frommobilephone}\usekomavar{frommobilephone}%
3669 \fi%
3670 \if@fax\\\usekomavar*{fromfax}\usekomavar{fromfax}\fi%
3671 \if@email\\\usekomavar*{fromemail}\usekomavar{fromemail}\fi%
3672 \if@www\\\usekomavar*{fromurl}\usekomavar{fromurl}\fi%
3673 \ifnum\@rulefrom=2\\[-.5\baselineskip]%
3674 \usekomafont{fromrule}{%
3675 \setlength{\@tempdima}{\useplength{fromrulewidth}}%
3676 \ifdim\@tempdima=\z@
3677 \setlength{\@tempdima}{\useplength{locwidth}}%
3678 \fi
3679 \expandafter\rule\expandafter{\the\@tempdima}{%
3680 \useplength{fromrulethickness}}}%
3681 \fi
3682 \\
3683 }%
3684 % \end{macrocode}
3685 % Last but not least the content of the location.
3686 % \begin{macrocode}
3687 \fi
3688 \usekomavar{location}%
3689 \vskip \z@ \@plus .00001fil}%
3690 {location field}{locheight}{\setkomavar}%
3691 }}%
3692 }%
3693 \vskip-\useplength{locvpos}\move@frompt
3694 }%
3695 }
3696 %</class|!willbe>
3697 % \end{macrocode}
3698 % \end{macro}
3699 %
3700 % \begin{macro}{\@datefield}
3701 % \changes{v2.8q}{2002/01/14}{setting \cs{if@tempwa}}
3702 % \changes{v2.97c}{2007/05/14}{using font elements \fnt{refname} and
3703 % \fnt{refvalue}}
3704 % Print either a reference line or place and date only.
3705 % \begin{macro}{\do@set@reffield}
3706 % \changes{v3.09}{2011/03/06}{added}
3707 % The macro will be defined later depending on testing of usage or
3708 % printing. So we just allocate/reserve it here.
3709 % \begin{macrocode}
3710 \newcommand*{\do@set@reffield}{}
3711 % \end{macrocode}
3712 % \begin{macro}{\@set@reffield}
3713 % \changes{v3.17}{2015/04/17}{\cs{setbox} replaced by \cs{sbox}}
3714 % Used to print a single field in the reference line. The argument is the name
3715 % of field.
3716 % \begin{macrocode}
3717 \newcommand*{\@set@reffield}[1]{%
3718 \Ifkomavarempty{#1}{}{%
3719 \settowidth{\@tempdima}{\strut\usekomafont{refvalue}\usekomavar{#1}}%
3720 \sbox\z@{\strut\usekomafont{refname}\usekomavar*{#1}}%
3721 \ifdim \@tempdima<\wd0\setlength{\@tempdima}{\wd0}\fi
3722 \if@tempswa\enskip\hfill\fi
3723 \parbox[t]{\@tempdima}{\noindent\raggedright
3724 \strut\box\z@\\\usekomafont{refvalue}\strut\usekomavar{#1}}%
3725 \@tempswatrue
3726 }%
3727 }
3728 % \end{macrocode}
3729 % \end{macro}
3730 % \begin{macro}{\@test@reffield}
3731 % \changes{v3.09}{2011/03/06}{added}
3732 % Used to test, if a field is not empty and sets \cs{if@tempswa} corresponding
3733 % to the result. All not empty fields are added to a comma+space separated
3734 % list in \cs{@tempa}.
3735 % \begin{macrocode}
3736 \newcommand*{\@test@reffield}[1]{%
3737 \Ifkomavarempty{#1}{}{%
3738 %<trace> \if@tempswa\l@addto@macro\@tempa{, }\fi
3739 %<trace> \l@addto@macro\@tempa{#1}%
3740 \@tempswatrue
3741 }%
3742 }
3743 % \end{macrocode}
3744 % \end{macro}
3745 % \begin{macro}{\@set@reffields}
3746 % \changes{v2.8q}{2002/01/14}{added}
3747 % The internal storage of all \cs{do@set@reffield} calls to be used for the
3748 % reference line.
3749 % \begin{macrocode}
3750 \newcommand*{\@set@reffields}{}%
3751 % \end{macrocode}
3752 % \end{macro}
3753 % \begin{command}{\addtoreffields}
3754 % \changes{v3.09}{2011/03/06}{using \cs{do@set@reffield}}
3755 % Adds a new \cs{do@set@reffield} to \cs{@set@reffields} for the field given
3756 % by the argument.
3757 % \begin{macrocode}
3758 \newcommand*{\addtoreffields}[1]{%
3759 \l@addto@macro{\@set@reffields}{\do@set@reffield{#1}}%
3760 }
3761 % \end{macrocode}
3762 % \end{command}
3763 %
3764 % \begin{command}{\removereffields}
3765 % \changes{v2.8q}{2002/01/14}{added}
3766 % Remove all fields from \cs{@set@reffields}.
3767 % \begin{macrocode}
3768 \newcommand*{\removereffields}{%
3769 \renewcommand*{\@set@reffields}{}%
3770 }
3771 % \end{macrocode}
3772 % \end{command}
3773 %
3774 % \begin{command}{\defaultreffields}
3775 % \changes{v2.8q}{2002/01/14}{added}
3776 % (Re)Set the default of \cs{@set@reffields}.
3777 % \begin{macrocode}
3778 \newcommand*{\defaultreffields}{%
3779 \removereffields
3780 \addtoreffields{yourref}%
3781 \addtoreffields{yourmail}%
3782 \addtoreffields{myref}%
3783 \addtoreffields{customer}%
3784 \addtoreffields{invoice}%
3785 }
3786 % \end{macrocode}
3787 % This is used for initial state:
3788 % \begin{macrocode}
3789 \defaultreffields
3790 % \end{macrocode}
3791 % \end{command}
3792 %
3793 % \changes{v2.3e}{1996/05/31}{distance between place and date added}
3794 % \changes{v2.8o}{2001/09/18}{added an additional verticale distance for
3795 % \file{KOMAold.lco} only}
3796 % \changes{v2.8q}{2001/11/13}{\cs{rlap} added}
3797 % \changes{v2.8q}{2001/11/13}{\cs{@parskipfalse}\cs{@parskip@indent}}
3798 % \changes{v2.8q}{2002/01/14}{empty test moved to \cs{@set@reffield}}
3799 % \changes{v2.9l}{2003/01/28}{calculation of \plen{refwidth} fixed}
3800 % \changes{v2.9l}{2003/01/28}{calculation of \plen{refhpos} added}
3801 % \changes{v2.95}{2006/03/23}{using \cs{setparsizes}}
3802 % \changes{v2.97c}{2007/05/14}{using several new font elements}
3803 % \changes{v3.09}{2011/03/06}{initialization of \cs{do@set@reffield}}
3804 % \changes{v3.12}{2013/07/31}{using font element \fnt{placeanddate}}
3805 % \changes{v3.17}{2015/04/17}{\cs{setbox} replaced by \cs{sbox}}
3806 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
3807 % \cs{Ifkomavarempty}}
3808 % \begin{macrocode}
3809 \newcommand*{\@datefield}{%
3810 {%
3811 \setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative
3812 \ifdim\useplength{refwidth}=\z@
3813 \if@refwide
3814 \setplength{refwidth}{\paperwidth}%
3815 \ifdim \useplength{toaddrhpos}>\z@
3816 \setplength{refhpos}{\useplength{toaddrhpos}}%
3817 \else
3818 \setplength[-]{refhpos}{\useplength{toaddrhpos}}%
3819 \fi
3820 \addtoplength[-2]{refwidth}{\useplength{refhpos}}%
3821 \else
3822 \setplength{refwidth}{\textwidth}%
3823 \setplength{refhpos}{\oddsidemargin}%
3824 \addtoplength{refhpos}{1in}%
3825 \fi
3826 \else
3827 \ifdim\useplength{refhpos}=\z@
3828 \begingroup
3829 % \end{macrocode}
3830 % How much smaller is the reference line than the text width.
3831 % \begin{macrocode}
3832 \setlength\@tempdima{\textwidth}%
3833 \addtolengthplength[-]{\@tempdima}{refwidth}%
3834 % \end{macrocode}
3835 % Now we calculate the left margin.
3836 % \begin{macrocode}
3837 \setlength\@tempdimb{\oddsidemargin}%
3838 \addtolength\@tempdimb{1in}%
3839 % \end{macrocode}
3840 % And the left and right margin together.
3841 % \begin{macrocode}
3842 \setlength{\@tempdimc}{\paperwidth}%
3843 \addtolength{\@tempdimc}{-\textwidth}%
3844 % \end{macrocode}
3845 % Now we can calculate the left margin of the reference line without changing
3846 % the relation of the margins (with some tolerance).
3847 % \begin{macrocode}
3848 \divide\@tempdimb by 32768\relax
3849 \divide\@tempdimc by 32768\relax
3850 \ifdim\@tempdimc=\z@\else
3851 \multiply\@tempdima by\@tempdimb
3852 \divide\@tempdima by\@tempdimc
3853 \fi
3854 \edef\@tempa{\noexpand\endgroup
3855 \noexpand\setplength{refhpos}{\the\@tempdima}}%
3856 \@tempa
3857 \fi\fi
3858 \@tempswafalse
3859 \move@topt\vskip\useplength{refvpos}%
3860 % \end{macrocode}
3861 % Have we to print something?
3862 % \begin{macrocode}
3863 \@tempswafalse
3864 \let\do@set@reffield\@test@reffield
3865 %<trace> \let\@tempa\@empty
3866 \@set@reffields
3867 \ifcase \@datepos\else\@test@reffield{date}\fi
3868 \if@tempswa
3869 %<trace> \typeout{Reference line(s) with: \@tempa}%
3870 \@tempswafalse
3871 % \end{macrocode}
3872 % If so, do so.
3873 % \begin{macrocode}
3874 \rlap{\noindent\move@topl\hskip\useplength{refhpos}%
3875 \vbox{\hsize\useplength{refwidth}%
3876 \noindent
3877 \ifnum \@datepos=2
3878 \@set@reffields
3879 \if@tempswa
3880 \@tempswafalse
3881 \@set@reffield{date}%
3882 \fi
3883 \fi
3884 \let\do@set@reffield\@set@reffield
3885 \@set@reffields%
3886 \if@tempswa
3887 \ifnum \@datepos=1 \@set@reffield{date}\fi%
3888 % \end{macrocode}
3889 % From version~2.97c also test, of the font of the reference line is too big.
3890 % \changes{v3.46}{2025/07/28}{\cs{strutbox} replaced by \cs{strut}}
3891 % \begin{macrocode}
3892 \sbox\z@{\usekomafont{refname}\strut}%
3893 \ifdim\ht\z@>\ht\strutbox
3894 %<class> \ClassWarningNoLine{scrlttr2}{%
3895 %<package> \PackageWarningNoLine{scrletter}{%
3896 Font element `refname' should not be larger than
3897 \string\normalsize!}%
3898 \fi
3899 \sbox\z@{\usekomafont{refvalue}\strut}%
3900 \ifdim\ht\z@>\ht\strutbox
3901 %<class> \ClassWarningNoLine{scrlttr2}{%
3902 %<package> \PackageWarningNoLine{scrletter}{%
3903 Font element `refvalue' should not be larger than
3904 \string\normalsize!}%
3905 \fi
3906 \else
3907 % \end{macrocode}
3908 % If we do not have to print any field, we are printing the place and date.
3909 % \begin{macrocode}
3910 \ifcase \@datepos\else
3911 \ifnum \@datepos=1 \enskip\hfill\fi
3912 {\usekomafont{placeanddate}{\Ifkomavarempty{place}{}{%
3913 \usekomavar{place}\usekomavar{placeseparator}}%
3914 \usekomavar{date}}}%
3915 \fi
3916 \fi
3917 }%
3918 }%
3919 %<trace> \else\typeout{No reference line.}%
3920 \fi
3921 \vskip\useplength{refaftervskip}%
3922 }%
3923 }
3924 % \end{macrocode}
3925 % \end{macro}
3926 % \end{macro}
3927 %
3928 % \begin{macro}{\@maketitle,\@makelettertitle}
3929 % \changes{v2.3b}{1996/01/14}{using \cs{sectfont}}
3930 % \changes{v2.8p}{2001/09/22}{using \cs{titlefont} instead of \cs{sectfont}}
3931 % \changes{v2.8q}{2001/11/13}{\cs{@parskipfalse}\cs{@parskip@indent}}
3932 % \changes{v2.9t}{2004/09/16}{\cs{par} with size and font of the title}
3933 % \changes{v2.95}{2006/03/22}{using \cs{usekomafont}}
3934 % \changes{v3.13}{2014/06/26}{\cs{@maketitle} renamed to \cs{@makelettertitle}}
3935 % \changes{v3.15}{2015/02/21}{\fnt{title} replaced by \fnt{lettertitle}}
3936 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
3937 % \cs{Ifkomavarempty}}
3938 % \changes{v3.36}{2022/03/04}{use of variable \var{title} removed}
3939 % \changes{v3.37}{2022/06/20}{wrongly removed \var{title} added again}
3940 % \KOMAScript{} provides a letter title. This is different from a document
3941 % title.
3942 % \begin{macrocode}
3943 \newcommand*{\@makelettertitle}{%
3944 \Ifkomavarempty{title}{%
3945 %<trace> \typeout{Title: no}%
3946 }{%
3947 %<trace> \typeout{Title: yes}%
3948 {\setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative
3949 \centering\LARGE\usekomafont{lettertitle}\usekomavar{title}\par}%
3950 \vskip\baselineskip%
3951 }%
3952 }
3953 % \end{macrocode}
3954 % \end{macro}
3955 % \begin{macro}{\@subjfield}
3956 % \changes{v2.8q}{2001/10/19}{\cs{centerline} replaced by \cs{centering}}
3957 % \changes{v2.8q}{2001/11/13}{\cs{@parskipfalse}\cs{@parskip@indent}}
3958 % \changes{v2.8q}{2002/01/31}{hanging}
3959 % \changes{v2.95}{2006/03/23}{using cs{setparsizes}}
3960 % \changes{v3.01}{2008/11/03}{using \plen{subjectbeforevskip} and
3961 % \plen{subjectaftervskip}}
3962 % \changes{v3.15}{2015/02/21}{\fnt{subject} replaced by \fnt{lettersubject}}
3963 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
3964 % \cs{Ifkomavarempty}}
3965 % The subject of the letter.
3966 % \begin{macrocode}
3967 \newcommand*{\@subjfield}{{%
3968 \setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative
3969 \Ifkomavarempty{subject}{%
3970 %<trace> \typeout{Subject: no}%
3971 }{%
3972 \ifx\raggedsubject\@empty
3973 \ifdim\useplength{subjectvpos}=\z@
3974 \if@subjafter%
3975 %<trace> \typeout{Subject: after opening}%
3976 \let\raggedsubject\centering%
3977 \else
3978 %<trace> \typeout{Subject: before opening}%
3979 \def\raggedsubject{\noindent\@hangfrom}%
3980 \fi
3981 \else
3982 %<trace> \typeout{Subject: at absolute vertical position}%
3983 \def\raggedsubject{\noindent\@hangfrom}%
3984 \fi
3985 \fi
3986 \ifdim\useplength{subjectvpos}=\z@
3987 \vskip\useplength{subjectbeforevskip}%
3988 \begingroup
3989 \else
3990 \move@topt\vskip\useplength{subjectvpos}%
3991 \expandafter\vb@t@z\expandafter{%
3992 \fi
3993 \usekomafont{lettersubject}%
3994 \raggedsubject{\if@subj \subject@format{\strut\ignorespaces
3995 \usekomavar*{subject}}\fi}%
3996 \subject@format{\strut\ignorespaces\usekomavar{subject}}\par
3997 \ifdim\useplength{subjectvpos}=\z@
3998 \endgroup
3999 \vskip\useplength{subjectaftervskip}%
4000 \else
4001 }%
4002 \vskip-\useplength{subjectvpos}\move@frompt
4003 \fi
4004 }%
4005 }%
4006 }
4007 % \end{macrocode}
4008 % \begin{pseudolength}{subjectvpos}
4009 % \changes{v3.01}{2008/11/03}{added}
4010 % If \plen{subjectpos} is not 0 it is the absolute vertical position of the
4011 % subject. With 0 it is placed relative to the title, the reference line or
4012 % the opening. This is the initial value.
4013 % \begin{macrocode}
4014 \newplength{subjectvpos}
4015 \setplength{subjectvpos}{0pt}
4016 % \end{macrocode}
4017 % \end{pseudolength}
4018 % \begin{pseudolength}{subjectaftervskip}
4019 % \changes{v3.01}{2008/11/03}{added}
4020 % The vertical distance after the subject is initialized with
4021 % 2\len{baselineskip}.
4022 % \begin{macrocode}
4023 \newplength{subjectaftervskip}
4024 \setplength{subjectaftervskip}{2\baselineskip}
4025 % \end{macrocode}
4026 % \end{pseudolength}
4027 % \begin{pseudolength}{subjectbeforevskip}
4028 % \changes{v3.01}{2008/11/03}{added}
4029 % The vertical distance before the subject, if not an absolute position is
4030 % used. Initial value is \len{baselineskip}.
4031 % \begin{macrocode}
4032 \newplength{subjectbeforevskip}
4033 \setplength{subjectbeforevskip}{0pt}
4034 %</body>
4035 % \end{macrocode}
4036 % \end{pseudolength}
4037 % \end{macro}^^A \@subjfield
4038 %
4039 %
4040 % \subsection{Head of the succeeding pages}
4041 %
4042 % The succeeding pages use another kind of note paper without all these large
4043 % elements for the sender, addressee etc. And there isn't an element like
4044 % \cs{opening}. So the page style is used.
4045 %
4046 % \begin{variable}{nexthead}
4047 % \changes{v3.08}{2010/10/28}{added}
4048 % This is the variable used for the page head of the page style.
4049 % The initial content depends mostly on \cs{@pageat} but also uses
4050 % \cs{leftmark} and \cs{rightmark} set by \cs{opening}.
4051 % \begin{macrocode}
4052 %<*body>
4053 \newkomavar{nexthead}
4054 \setkomavar{nexthead}{%
4055 \rlap{\parbox[c]{\textwidth}{\raggedright\strut
4056 \ifnum\@pageat=0\pagemark\else\leftmark\fi\strut}}%
4057 \parbox[c]{\textwidth}{%
4058 \centering\strut
4059 \ifcase\@pageat
4060 \rightmark
4061 \or
4062 \pagemark
4063 \or
4064 \rightmark
4065 \fi\strut}%
4066 \llap{\parbox[c]{\textwidth}{\raggedleft\strut
4067 \ifcase\@pageat
4068 \leftmark
4069 \or
4070 \rightmark
4071 \or
4072 \pagemark
4073 \else
4074 \rightmark
4075 \fi\strut}}%
4076 }%
4077 % \end{macrocode}
4078 % \end{variable}
4079 % \begin{command}{\nexthead}
4080 % \changes{v3.08}{2010/10/28}{deprecated}
4081 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
4082 % \begin{macro}{\@nexthead}
4083 % \changes{v3.08}{2010/10/28}{deprecated}
4084 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
4085 % \begin{macrocode}
4086 %<*class&!v4>
4087 \newcommand{\nexthead}{%
4088 \ClassWarning{scrlttr2}{%
4089 Deprecated usage of \string\nexthead.\MessageBreak
4090 You should use \string\setkomavar{nexthead}\MessageBreak
4091 instead of \string\nexthead
4092 }
4093 \setkomavar{nexthead}%
4094 }
4095 \newcommand*{\@nexthead}{%
4096 \ClassWarning{scrlttr2}{%
4097 Deprecated usage of \string\@nexthead.\MessageBreak
4098 \string\usekomavar{nexthead} should be used\MessageBreak
4099 instead of \string\@nexthead
4100 }%
4101 \usekomavar{nexthead}%
4102 }
4103 %</class&!v4>
4104 %</body>
4105 % \end{macrocode}
4106 % \end{macro}^^A \@nexthead
4107 % \end{command}^^A \nexthead
4108 %
4109 %
4110 % \subsection{Footer of the succeeding pages}
4111 %
4112 % \begin{variable}{nextfoot}
4113 % \changes{v3.08}{2010/10/28}{added}
4114 % This is the variable used for the page footer of the page style.
4115 % The initial content depends mostly on \cs{@pageat}
4116 % \begin{macrocode}
4117 %<*body>
4118 \newkomavar{nextfoot}
4119 \setkomavar{nextfoot}{%
4120 \ifnum\@pageat>2
4121 \parbox[c]{\textwidth}{%
4122 \ifcase\@pageat\or\or\or\raggedright\or\centering\or\raggedleft\fi
4123 \strut\pagemark%
4124 }%
4125 \fi
4126 }
4127 % \end{macrocode}
4128 % \end{variable}
4129 % \begin{command}{\nextfoot}
4130 % \changes{v3.08}{2010/10/28}{deprecated}
4131 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
4132 % \begin{macro}{\@nextfoot}
4133 % \changes{v3.08}{2010/10/28}{deprecated}
4134 % \changes{v3.99}{2022/11/16}{removed from \KOMAScript~4}
4135 % \begin{macrocode}
4136 %<*class&!v4>
4137 \newcommand{\nextfoot}{%
4138 \ClassWarning{scrlttr2}{%
4139 Deprecated usage of \string\nextfoot.\MessageBreak
4140 You should use \string\setkomavar{nextfoot}\MessageBreak
4141 instead of \string\nextfoot
4142 }
4143 \setkomavar{nextfoot}%
4144 }
4145 \newcommand*{\@nextfoot}{%
4146 \ClassWarning{scrlttr2}{%
4147 Deprecated usage of \string\@nextfoot.\MessageBreak
4148 \string\usekomavar{nextfoot} should be used\MessageBreak
4149 instead of \string\@nextfoot
4150 }%
4151 \usekomavar{nextfoot}%
4152 }
4153 %</class&!v4>
4154 %</body>
4155 % \end{macrocode}
4156 % \end{macro}^^A \@nextfoot
4157 % \end{command}^^A \nextfoot
4158 %
4159 %
4160 % \subsection{The \env{letter} environment}
4161 %
4162 % \begin{environment}{letter}
4163 % \changes{v2.8q}{2002/01/16}{optional argument added}
4164 % \changes{v2.8q}{2002/01/16}{reset counter \cnt{footnote}}
4165 % \changes{v2.9d}{2002/08/12}{fixed reset of counter \cnt{footnote}}
4166 % \changes{v3.17}{2015/03/20}{replacement for \cs{pagemark}}
4167 % \changes{v3.19}{2015/07/15}{using \cs{letterpagestyle}}
4168 % \changes{v3.19}{2015/07/15}{referenceable numbering of letters}
4169 % \changes{v3.27}{2019/03/05}{no support for two-columned letters}
4170 % The is the environment used to define one or even several letters in one
4171 % document. It has an optional argument to set additional \KOMAScript{}
4172 % options and a mandatory argument with the addressee.
4173 % \begin{macrocode}
4174 %<*body>
4175 \newenvironment{letter}[2][]{%
4176 % \end{macrocode}
4177 % If we are in two column mode, we have to switch back to one column for the
4178 % letter. \cs{ifletter@restonecol} as indicator, it at the end we have to
4179 % switch back to two column mode.
4180 % \begin{macrocode}
4181 \if@twocolumn
4182 %<class> \ClassWarning{\KOMAClassName}{%
4183 %<package> \PackageWarning{scrletter}{%
4184 twocolumn mode not supported.\MessageBreak
4185 If you really want a twocolumned letter, you should\MessageBreak
4186 use package `multicol' and add a `multicols'\MessageBreak
4187 environment inside your letter.\MessageBreak
4188 Switching back to oneside%
4189 }%
4190 \letter@restonecoltrue
4191 \expandafter\onecolumn
4192 \else
4193 \letter@restonecolfalse
4194 \fi
4195 % \end{macrocode}
4196 % Then we start a new odd page and change the page style. Afterwards all
4197 % relevant counters (currently \cnt{page} and \cnt{footnote}) are reset and
4198 % the \cnt{letter} counter is increased referenceable.
4199 % \changes{v3.19}{2015/07/15}{using \cs{cleardoubleoddemptypage}}
4200 % \changes{v3.27}{2019/03/05}{using \cs{raggedbottom}}
4201 % \begin{macrocode}
4202 \cleardoubleoddemptypage
4203 \raggedbottom
4204 \scr@ifundefinedorrelax{letterpagestyle}{}{%
4205 \ifx\letterpagestyle\@empty\else
4206 \pagestyle{\letterpagestyle}%
4207 \fi
4208 }%
4209 %<package> \let\pagemark\letterpagemark
4210 \refstepcounter{letter}%
4211 \let\thisletter\@currentlabel
4212 \setcounter{page}{\@ne}%
4213 \setcounter{footnote}{0}%
4214 \interlinepenalty=200\@processto{#2}%
4215 % \end{macrocode}
4216 % Then it's time for the options.
4217 % \begin{macrocode}
4218 \KOMAoptions{#1}%
4219 % \end{macrocode}
4220 % \changes{v3.27}{2019/03/31}{first-page head generation moved}
4221 % There are plans to generate the page head already here instead of waiting
4222 % till \cs{opening}. But currently this is not used.
4223 % \begin{macrocode}
4224 %<package&willbe> \@gen@firsthead
4225 % \end{macrocode}
4226 % \changes{v3.27}{2019/03/22}{plans to set the page style}
4227 % There are plans to use page style \pstyle{notepaper} for the first page
4228 % before executing the begin hook.
4229 % \begin{macrocode}
4230 %<package&willbe> \thispagestyle{notepaper}%
4231 % \end{macrocode}
4232 % There are also plans to calculate the height of the reference line here.
4233 % \begin{macrocode}
4234 %<*package&willbe>
4235 \ifdim\useplength{refheight}>\z@
4236 \else
4237 \begingroup
4238 \newkomavar[\strut]{@internal@testvar@}%
4239 \setkomavar{@internal@testvar@}{\strut}%
4240 \setplengthtototalheight{refheight}{\@set@reffield{@internal@testvar@}}%
4241 \edef\reserved@a{\noexpand\endgroup
4242 \noexpand\setplength{refheight}{\useplength{refheight}}%
4243 }%
4244 \reserved@a
4245 \fi
4246 %</package&willbe>
4247 % \end{macrocode}
4248 % Before executing the hook. The hook can be used, e.g., to reset additional
4249 % counters.
4250 % \begin{macrocode}
4251 \@beginletterhook
4252 %<package&willbe>\initial@letter@vskip
4253 }{%
4254 % \end{macrocode}
4255 % At the end, stop the letter.
4256 % \begin{macrocode}
4257 \stopletter
4258 % \end{macrocode}
4259 % \changes{v3.19}{2015/07/15}{label at the end added}
4260 % Set a label for the current letter to provide referencing the last
4261 % page. Then do the final page beak and reset the column mode.
4262 % \begin{macrocode}
4263 \let\@currentlabel\thisletter
4264 \label{\thisletter.lastpage}%
4265 \@@par\pagebreak\@@par%
4266 \ifletter@restonecol\twocolumn\fi
4267 % \end{macrocode}
4268 % \changes{v3.27}{2019/03/31}{cleanup running head}
4269 % Plan: The package also cleans up the running head after the end of the
4270 % letter.
4271 % \begin{macrocode}
4272 %<package&willbe> \@mkdouble\@empty
4273 }
4274 % \end{macrocode}
4275 % \begin{macro}{\initial@letter@vskip}
4276 % \changes{v3.27}{2019/05/03}{added}
4277 % Go to the start position of the letter. Usually to jump below the reference
4278 % line inside the \texttt{letter} environment.
4279 % \begin{macrocode}
4280 %<*package&willbe>
4281 \newcommand*{\initial@letter@vskip}{%
4282 \move@topt
4283 \vskip \dimexpr \useplength{refvpos}
4284 \if@refline +\useplength{refheight}\fi
4285 +\useplength{refaftervskip}\relax
4286 }
4287 %</package&willbe>
4288 % \end{macrocode}
4289 % \end{macro}^^A \inital@letter@vskip
4290 % \begin{macro}{\letter@restonecolfalse,\letter@restonecoltrue,
4291 % \ifletter@restonecol}
4292 % \changes{v3.27}{2019/03/05}{added}
4293 % Used above to save and restore the column mode.
4294 % \begin{macrocode}
4295 \newif\ifletter@restonecol
4296 % \end{macrocode}
4297 % \end{macro}
4298 % \begin{command}{\thisletter}
4299 % \changes{v3.19}{2015/07/15}{added}
4300 % The base value of the current letter label. This can be used to, e.g.,
4301 % reference the \texttt{\cs{thisletter}.lastpage} label. It is initialized to
4302 % a unknown value, as long as we are outside any \env{letter} environment.
4303 % \begin{macrocode}
4304 \newcommand*{\thisletter}{outside.letter.undefined}
4305 % \end{macrocode}
4306 % \end{command}^^A \thisletter
4307 % \begin{command}{\letterlastpage}
4308 % \changes{v3.19}{2015/07/15}{add}
4309 % Reference to the page of the \texttt{\cs{thisletter}.lastpage} label.
4310 % \begin{macrocode}
4311 \newcommand*{\letterlastpage}{\pageref{\thisletter.lastpage}}
4312 % \end{macrocode}^^A \letterlastpage
4313 % \end{command}
4314 % \begin{command}{\stopletter}
4315 % This is a kind of end of letter hook. But \cs{AtEndLetter} should be used to
4316 % add code.
4317 % \begin{macrocode}
4318 \newcommand*{\stopletter}{}
4319 % \end{macrocode}
4320 % \end{command}^^A \stopletter
4321 % \begin{macro}{\@processto}
4322 % \changes{v2.9r}{2004/06/16}{supports empty addressee}
4323 % \changes{v3.27}{2019/03/24}{extended setting of variables}
4324 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
4325 % \cs{Ifkomavarempty}}
4326 % The addressee argument of \env{letter} has to be split into the name and the
4327 % address.
4328 % \begin{description}
4329 % \item[Note:] The specification clearly says, that optional arguments to |\\|
4330 % are not supported. So we do not adapt that change of \LaTeX{} 2021/10/01.
4331 % \item[Note:] Here we also have plans to change things.
4332 % \end{description}
4333 % \begin{macrocode}
4334 \newcommand{\@processto}[1]{%
4335 % \end{macrocode}
4336 % If \cs{@processto} argument (\texttt{letter} mandatory argument) is empty:
4337 % \begin{macrocode}
4338 \IfArgIsEmpty{#1}{%
4339 % \end{macrocode}
4340 % try to build it from \texttt{toname} and \texttt{toaddress}.
4341 % \begin{macrocode}
4342 %<*package&willbe>
4343 \Ifkomavarempty{toname}{%
4344 \Ifkomavarempty{tofamilyname}{}{%
4345 \Ifkomavarempty{togivenname}{%
4346 \usekomavar[\setkomavar{toname}]{tofamilyname}%
4347 }{%
4348 % Fixme: The \cs{protected@edef}s are critical!
4349 \usekomavar[\protected@edef\reserved@a]{togivenname}%
4350 \usekomavar[\protected@edef\reserved@b]{tofamilyname}%
4351 \edef\reserved@a{%
4352 \noexpand\setkomavar{toname}{%
4353 \unexpanded\expandafter{\reserved@a}\ %
4354 \unexpanded\expandafter{\reserved@b}}%
4355 }\reserved@a
4356 }%
4357 }%
4358 }{}%
4359 \Ifkomavarempty{toaddress}{%
4360 % Fixme: The \cs{protected@edef}s are critical!
4361 \usekomavar[\protected@edef\reserved@a]{toname}%
4362 \protected@edef\reserved@a{%
4363 \noexpand\usekomafont{toname}{\reserved@a}%
4364 }\reserved@a
4365 }{%
4366 \Ifkomavarempty{toname}{%
4367 % Fixme: The \cs{protected@edef}s are critical!
4368 \usekomavar[\protected@edef\reserved@a]{toaddress}%
4369 \protected@edef\reserved@a{%
4370 \noexpand\usekomafont{toaddress}{\reserved@a}%
4371 }\reserved@a
4372 }{%
4373 % Fixme: The \cs{protected@edef}s are critical!
4374 \usekomavar[\protected@edef\scr@local@toname]{toname}%
4375 \usekomavar[\protected@edef\reserved@b]{toaddress}%
4376 \protected@edef\reserved@a{%
4377 \noexpand\setkomavar{addressee}{%
4378 {\noexpand\usekomafont{toname}{\scr@local@toname}}\\
4379 \noexpand\usekomafont{toaddress}{\reserved@b}%
4380 }%
4381 }\reserved@a
4382 }%
4383 }%
4384 %</package&willbe>
4385 }{%
4386 % \end{macrocode}
4387 % Split into part before first \cmd\\ and it:
4388 % \begin{macrocode}
4389 \expandafter\@xproc#1\\\@nil
4390 \ifx\reserved@b\@empty\else\expandafter\@xproc#1\@nil\fi
4391 % \end{macrocode}
4392 % Plan: Set variable \var{addressee}:
4393 % \begin{macrocode}
4394 %<*package&willbe>
4395 % Fixme: The \cs{protected@edef}s are critical!
4396 \protected@edef\reserved@c{%
4397 \noexpand\setkomavar{addressee}{%
4398 {\noexpand\usekomafont{toname}{\reserved@a}}%
4399 \ifx\reserved@b\@empty\else
4400 \\\noexpand\usekomafont{toaddress}{\reserved@b}%
4401 \fi
4402 }%
4403 }%
4404 % \end{macrocode}
4405 % If \var{toname} is empty, set it:
4406 % \begin{macrocode}
4407 \Ifkomavarempty{toname}{%
4408 % Fixme: The \cs{protected@edef}s are critical!
4409 \protected@edef\reserved@a{%
4410 \noexpand\reserved@c{\noexpand\setkomavar{toname}{\reserved@a}}}%
4411 }{\let\reserved@a\reserved@c}%
4412 % \end{macrocode}
4413 % If \var{toaddress} is empty, set it:
4414 % \begin{macrocode}
4415 \Ifkomavarempty{toaddress}{%
4416 % Fixme: The \cs{protected@edef}s are critical!
4417 \protected@edef\reserved@b{\noexpand\reserved@a
4418 \noexpand\setkomavar{toaddress}{\reserved@b}}%
4419 \reserved@b
4420 }{\reserved@a}%
4421 %</package&willbe>
4422 % \end{macrocode}
4423 % For now simply set \var{toname} and \var{toaddress}:
4424 % \changes{v3.27}{2019/10/28}{don't expand the contents of \cs{reserved@a} and
4425 % \cs{reserved@b}}
4426 % \begin{macrocode}
4427 %<*class|!willbe>
4428 \edef\reserved@a{%
4429 \noexpand\setkomavar{toname}{\unexpanded\expandafter{\reserved@a}}%
4430 \noexpand\setkomavar{toaddress}{\unexpanded\expandafter{\reserved@b}}%
4431 }\reserved@a
4432 %</class|!willbe>
4433 }%
4434 }
4435 % \end{macrocode}
4436 % \begin{macro}{\@xproc}
4437 % Macro to split two elements with |\\| separator.
4438 % \begin{macrocode}
4439 \newcommand*{\@xproc}{}
4440 \long\def\@xproc#1\\#2\@nil{%
4441 % \end{macrocode}
4442 % \changes{v3.27}{2019/03/24}{do not directly set variables but
4443 % \cs{reserved@a} and \cs{reserved@b}}
4444 % \begin{macrocode}
4445 \def\reserved@a{#1}\def\reserved@b{#2}%
4446 }
4447 % \end{macrocode}
4448 % \end{macro}^^A \@xproc
4449 % \end{macro}^^A \@processto
4450 % \begin{command}{\flushbottom}
4451 % \changes{v2.97c}{2007/05/17}{added}
4452 % The \cs{stopletter} hook is used to make the last page similar to using
4453 % \cs{raggedbottom}.
4454 % \begin{description}
4455 % \item[Note:] It is correct to have this change globally, because it can be
4456 % used outside a letter, but should be valid for letters in this case too.
4457 % \end{description}
4458 % \begin{macrocode}
4459 \g@addto@macro\flushbottom{%
4460 \AtEndLetter{\vskip \z@\@plus.0001fil\relax}%
4461 }
4462 % \end{macrocode}
4463 % \end{command}^^A \flushbottom
4464 % \begin{counter}{letter}
4465 % \changes{v3.19}{2015/07/15}{added}
4466 % The counter used to number the letters and make them reference-able.
4467 % \begin{macrocode}
4468 \newcounter{letter}
4469 % \end{macrocode}
4470 % \end{counter}
4471 % \end{environment}^^A letter
4472 %
4473 %
4474 % \begin{command}{\letterpagestyle}
4475 % \changes{v3.19}{2015/07/15}{added}
4476 % Similar to \cs{tilepagestyle}, \cs{indexpagestyle} etc. we have a
4477 % \cs{letterpagestyle} for the page style of the letter environment. The
4478 % initial value of the class and the package are different. For the class we
4479 % use an empty value, which means not change, because it already uses an
4480 % adapted page style. But the package does not change the usual page styles of
4481 % the classes, and therefore has a new default \pstyle{plain.letter} for
4482 % letters.
4483 % \begin{macrocode}
4484 \newcommand*{\letterpagestyle}{%
4485 %<package> plain.letter%
4486 }
4487 % \end{macrocode}
4488 % \end{command}
4489 %
4490 %
4491 % \begin{command}{\AtBeginLetter}
4492 % \changes{v2.8n}{2001/09/08}{added}
4493 % \begin{macro}{\@beginletterhook}
4494 % \changes{v2.8n}{2001/09/08}{added}
4495 % This is the hook at the beginning of a letter. Initially it is empty.
4496 % \begin{macrocode}
4497 \newcommand{\AtBeginLetter}{\g@addto@macro\@beginletterhook}
4498 \newcommand{\@beginletterhook}{}
4499 % \end{macrocode}
4500 % \end{macro}
4501 % \end{command}
4502 %
4503 % \begin{command}{\AtEndLetter}
4504 % \changes{v2.95}{2006/03/22}{added}
4505 % At the end currently a user command \cs{stopletter} is used to represent the
4506 % hook. An internal macro would be better but incompatible.
4507 % \begin{macrocode}
4508 \newcommand{\AtEndLetter}{\g@addto@macro\stopletter}
4509 % \end{macrocode}
4510 % \end{command}
4511 %
4512 % \begin{command}{\stopbreaks}
4513 % \begin{command}{\startbreaks}
4514 % \changes{v3.33}{2021/03/05}{\cs{relax} added}
4515 % \begin{macro}{\@nobreakvspace}
4516 % \changes{v3.20}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
4517 % \changes{v3.33}{2021/03/05}{robust definition}
4518 % \begin{macro}{\@nobreakvspacex}
4519 % \begin{macro}{\@nobreakcr}
4520 % \changes{v3.20}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
4521 % \changes{v3.33}{2021/03/05}{simplified}
4522 % Inside letters we have a slightly different page break. This should improve
4523 % placement of letter texts (but I doubt, that it really does).
4524 % \begin{macrocode}
4525 \newcommand*{\stopbreaks}{\interlinepenalty \@M
4526 \def\par{\@@par\nobreak}\let\\=\@nobreakcr
4527 \let\vspace\@nobreakvspace}
4528 \DeclareRobustCommand*{\@nobreakvspace}{%
4529 \kernel@ifstar{\@nobreakvspacex}{\@nobreakvspacex}}
4530 \newcommand*{\@nobreakvspacex}[1]{\ifvmode\nobreak\vskip #1\relax\else
4531 \@bsphack\vadjust{\nobreak\vskip #1}\@esphack\fi}
4532 \newcommand*{\@nobreakcr}{\kernel@ifstar{\@normalcr*}{\@normalcr*}}
4533 \newcommand*{\startbreaks}{\let\\=\@normalcr
4534 \interlinepenalty 200\def\par{\@@par\penalty 200\relax}}
4535 % \end{macrocode}
4536 % \end{macro}
4537 % \end{macro}
4538 % \end{macro}
4539 % \end{command}
4540 % \end{command}
4541 %
4542 % \begin{command}{\opening}
4543 % \changes{v2.8n}{2001/09/08}{re-implemented}
4544 % \changes{v2.8q}{2001/11/13}{\cs{@parskipfalse}\cs{@parskip@indent}}
4545 % \changes{v2.8q}{2002/03/25}{\cs{@PapersizeWarning}}
4546 % \changes{v2.95}{2003/03/23}{using \cs{setparsizes}}
4547 % \changes{v3.27}{2019/03/27}{only \cls*{scrlttr2} uses \cs{@addrfield},
4548 % \cs{@locfield} and \cs{@foldmarks}}
4549 % \changes{v3.27}{2019/03/27}{only \cls*{scrlttr2} sets pagestyle}
4550 % \changes{v3.27}{2019/03/31}{only \cls*{scrlttr2} generates the first-page
4551 % head here}
4552 % \begin{description}
4553 % \item[ToDO:] There are plans to not generate the notepaper head, foot and
4554 % several other elements here but in \env{letter}.
4555 % \end{description}
4556 % \begin{macrocode}
4557 \newcommand{\opening}[1]{%
4558 \@PapersizeWarning
4559 %<class|!willbe> \@gen@firsthead
4560 \@mkboth{\scr@fromname@var}{\scr@subject@var}%
4561 %<class|!willbe> \thispagestyle{empty}%
4562 \noindent
4563 %<class|!willbe> \@foldmarks\@firstheadfootfield
4564 %<class|!willbe> \@addrfield\@locfield
4565 \ifdim\useplength{subjectvpos}=\z@\else\@subjfield\fi
4566 %<class|!willbe> \@datefield
4567 \@makelettertitle
4568 \ifdim\useplength{subjectvpos}=\z@\if@subjafter\else\@subjfield\fi\fi
4569 {\setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative#1\par}%
4570 {\setlength{\@tempdima}{\baselineskip}%
4571 \addtolength{\@tempdima}{-\parskip}%
4572 \ifdim \@tempdima>\z@\vskip\@tempdima\fi}%
4573 \ifdim\useplength{subjectvpos}=\z@\if@subjafter\@subjfield\fi\fi
4574 \@afterindentfalse\@afterheading
4575 }
4576 % \end{macrocode}
4577 % \end{command}
4578 %
4579 %
4580 % \begin{command}{\closing}
4581 % \changes{v2.2b}{1995/02/16}{\cs{fromsig} used directly}
4582 % \changes{v2.3b}{1996/01/14}{distance between closing text and signature
4583 % increased}
4584 % \changes{v2.5d}{2000/06/10}{distance between closing text and signature
4585 % variable}
4586 % \changes{v2.8q}{2001/11/13}{\cs{@parskipfalse}\cs{@parskip@indent}}
4587 % \changes{v2.8q}{2002/02/05}{not \cs{long}}
4588 % \changes{v2.8q}{2002/02/05}{supports \texttt{\cmd{\\}[\dots]}}
4589 % \changes{v2.9r}{2004/01/28}{length limited to \cs{hsize}}
4590 % \changes{v2.9r}{2004/01/28}{support for empty closing text}
4591 % \changes{v2.95}{2003/03/23}{using \cs{setparsizes}}
4592 % \changes{v3.17}{2015/02/19}{re-implemented to be more mistake tolerant}
4593 % \changes{v3.17}{2015/02/20}{\cs{}\cs{} replaced by \cs{tabularnewline}}
4594 % \changes{v3.17}{2015/02/20}{several \cs{strut} added}
4595 % \changes{v3.20}{2015/10/08}{line break after the closing text only in
4596 % horizontal mode}
4597 % \changes{v3.25}{2017/11/15}{\cs{unskip}\cs{strut} replaced by
4598 % \cs{scr@endstrut}}
4599 % \changes{v3.37}{2022/06/09}{spurious space removed}
4600 % \changes{v3.44}{2025/05/28}{support for multiple signatures added}
4601 % \changes{v3.45}{2025/06/04}{issue with \pkg{array} not expanding the column
4602 % definition fixed}
4603 % \changes{v3.45}{2025/06/04}{test adapted for \pkg{ragged2e}}
4604 % Sets not only the closing text, that is given as argument, but also the
4605 % signature.
4606 % \begin{macro}{\presig@skip}
4607 % \changes{v2.5d}{2000/06/10}{added}
4608 % \changes{v2.8q}{2001/10/09}{replaced by \plen{sigbeforevskip}}
4609 % \end{macro}
4610 % \begin{command}{\setpresigskip}
4611 % \changes{v2.5d}{2000/06/10}{added}
4612 % \changes{v2.8q}{2001/10/09}{using \plen{asigbeforesvskip}}
4613 % \changes{v2.8q}{2001/10/09}{only for \file{KOMAold.lco}}
4614 % \begin{description}
4615 % \item[ToDo:] This has to be moved to
4616 % \file{scrkernel-letterclassoptions.dtx}!
4617 % \end{description}
4618 % \begin{macrocode}
4619 %</body>
4620 %</letter>
4621 %<lco&KOMAold&body>\def\setpresigskip{\setplength{sigbeforevskip}}
4622 %<*letter>
4623 %<*body>
4624 % \end{macrocode}
4625 % \end{command}^^A \setpresigskip
4626 % \begin{macro}{\@@xtrimtempa,\@xtrimtempa,\@tempdimaismaxwidthof}
4627 % \changes{v2.8q}{2002/02/05}{added}
4628 % \changes{v3.17}{2014/02/19}{removed}
4629 % \end{macro}^^A \@@xtrimtempa,\@xtrimtempa,\@tempdimaismaxwidthof
4630 % \begin{macrocode}
4631 \ExplSyntaxOn
4632 \newcommand*{\closing}[1]{%
4633 {%
4634 \ifx\sigalign\@empty
4635 \tl_if_in:nVTF { \raggedright\LaTeXraggedright } \raggedsignature
4636 { \tl_set:Nn \sigalign l }
4637 {
4638 \tl_if_in:nVTF { \raggedleft\LaTeXraggedleft } \raggedsignature
4639 { \tl_set:Nn \sigalign r }
4640 {
4641 \tl_if_in:nVTF { \centering\LaTeXcentering } \raggedsignature
4642 { \tl_set:Nn \sigalign c }
4643 {
4644 \tl_if_eq:NNTF \raggedsignature \raggedright
4645 { \tl_set:Nn \sigalign l }
4646 {
4647 \tl_if_eq:NNTF \raggedsignature \raggedleft
4648 { \tl_set:Nn \sigalign r }
4649 {
4650 \tl_if_eq:NNTF \raggedsignature \centering
4651 { \tl_set:Nn \sigalign c }
4652 {
4653 \tl_if_eq:NNTF \raggedsignature \LaTeXraggedright
4654 { \tl_set:Nn \sigalign l }
4655 {
4656 \tl_if_eq:NNTF \raggedsignature \LaTeXraggedleft
4657 { \tl_set:Nn \sigalign r }
4658 {
4659 \tl_if_eq:NNTF \raggedsignature \LaTeXcentering
4660 { \tl_set:Nn \sigalign c }
4661 {
4662 %<class> \ClassWarning{scrlttr2}{
4663 %<package> \PackageWarning{scrletter}{
4664 unexpected~definition~of~
4665 \string\raggedsignature.
4666 \MessageBreak
4667 Using~\string\sigalign=l
4668 }
4669 \tl_set:Nn \sigalign l
4670 }
4671 }
4672 }
4673 }
4674 }
4675 }
4676 }
4677 }
4678 }
4679 \fi
4680 \cs_set:Npn \and
4681 {
4682 \end{tabular}\sigspace
4683 \rule[-\dp\strutbox]
4684 {0pt}{\dimeval{\baselineskip+\useplength{sigbeforevskip}}}
4685 \exp_last_unbraced:Ne\begin{{tabular}[t]{@{}\sigalign @{}}}%\end
4686 }%
4687 \setparsizes{\z@}{\z@}{\z@ plus 1fil}\par@updaterelative
4688 \par\nobreak\vskip\baselineskip
4689 \dim_set:Nn \l_tmpa_dim {\linewidth-\useplength{sigindent}}
4690 \sbox \l_tmpa_box { #1 }
4691 \sbox \l_tmpb_box
4692 {
4693 \exp_last_unbraced:Ne\begin{{tabular}[t]{@{}\sigalign @{}}}
4694 \usekomavar{signature}\ifhmode \scr@endstrut\fi
4695 \end{tabular}
4696 }
4697 \dim_compare:nNnT { \l_tmpa_dim } > { \box_wd:N \l_tmpa_box }
4698 {
4699 \dim_compare:nNnT { \l_tmpa_dim } > { \box_wd:N \l_tmpb_box }
4700 {
4701 \dim_compare:nNnTF
4702 { \box_wd:N \l_tmpa_box } > { \box_wd:N \l_tmpb_box }
4703 { \dim_set:Nn \l_tmpa_dim { \box_wd:N \l_tmpa_box } }
4704 { \dim_set:Nn \l_tmpa_dim { \box_wd:N \l_tmpb_box } }
4705 }
4706 }
4707 \hskip\useplength{sigindent}
4708 \parbox[t]{\l_tmpa_dim}{
4709 \raggedsignature
4710 \ignorespaces #1\par
4711 \rule[-\dp\strutbox]
4712 {0pt}{\dimeval{\baselineskip+\useplength{sigbeforevskip}}}
4713 \exp_last_unbraced:Ne\begin{{tabular}[t]{@{}\sigalign @{}}}
4714 \usekomavar{signature}%
4715 \end{tabular}
4716 }
4717 }
4718 \par\nobreak\vskip\baselineskip
4719 }
4720 \ExplSyntaxOff
4721 % \end{macrocode}
4722 % \begin{command}{\sigalign,\sigspace}
4723 % \changes{v3.44}{2025/05/28}{added}
4724 % These are relevant for multiple signatures. \cs{sigalign} is the alignment
4725 % character for the tabular. By default it is empty, which means it is
4726 % defined by \cs{raggedsignature}. But users are allowed to explicitly set
4727 % it to ``l'', ``r'' or ``c''. \cs{sigspace} is the space added between the
4728 % tabulars/signatures. The default is 1 quad.
4729 % \begin{macrocode}
4730 \newcommand*{\sigalign}{}
4731 \newcommand*{\sigspace}{\quad}
4732 % \end{macrocode}
4733 % \end{command}
4734 % \end{command}
4735 %
4736 % \begin{command}{\ps}
4737 % \changes{v2.8n}{2001/09/08}{re-implemented}
4738 % Switch to printing of \emph{postscriptum}.
4739 % \begin{macrocode}
4740 \newcommand\ps{\par%
4741 \ifdim\parskip=\z@
4742 \vskip\baselineskip
4743 \fi\startbreaks\noindent\ignorespaces
4744 }
4745 % \end{macrocode}
4746 % \end{command}
4747 %
4748 % \begin{command}{\cc}
4749 % \changes{v2.6}{2001/01/03}{\cs{def} replaced by \cs{newcommand*}}
4750 % \changes{v2.8n}{2001/09/08}{re-implemented}
4751 % \changes{v2.9o}{2003/04/22}{\len{parfillskip} changed}
4752 % \changes{v2.9q}{2004/04/26}{\len{parfillskip} changed to \texttt{1em plus
4753 % 1fil}}
4754 % \changes{v2.9r}{2004/05/25}{\len{parfillskip} changed to \texttt{\cs{z@} plus
4755 % 1fil}}
4756 % \changes{v3.22}{2016/12/15}{missing star at \cs{ifkomavaremptry*} added}
4757 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
4758 % \cs{Ifkomavarempty}}
4759 % Switch to the printing of the \emph{copy circulated}.
4760 % \begin{macrocode}
4761 \newcommand*{\cc}[1]{\par%
4762 \ifdim\parskip=\z@%
4763 \vskip\baselineskip%
4764 \fi\noindent%
4765 \begingroup
4766 \parbox[t]{\textwidth}{%
4767 \Ifkomavarempty*{ccseparator}{}{%
4768 \@hangfrom{%
4769 \strut\usekomavar*{ccseparator}\usekomavar{ccseparator}}%
4770 }%
4771 \ignorespaces #1\strut}%
4772 \setlength{\parfillskip}{\z@ \@plus 1fil}\par
4773 \endgroup
4774 }
4775 % \end{macrocode}
4776 % \end{command}
4777 %
4778 % \begin{command}{\encl}
4779 % \changes{v2.4a}{1997/06/06}{don't print a colon for empty enclosure}
4780 % \changes{v2.6}{2001/01/03}{\cs{def} replaced by \cs{newcommand*}}
4781 % \changes{v2.8n}{2001/09/08}{re-implemented}
4782 % \changes{v2.8q}{2002/01/31}{missing \% added}
4783 % \changes{v2.9o}{2003/04/22}{\cs{parfillskip} changed}
4784 % \changes{v2.9q}{2004/04/26}{\cs{parfillskip} changed to \texttt{1em plus
4785 % 1fil}}
4786 % \changes{v2.9r}{2004/05/25}{\cs{parfillskip} changed to \texttt{\cs{z@} plus
4787 % 1fil}}
4788 % The enclosures are given as argument of \cs{encl}. They are printed hanging,
4789 % if the output name of \var{enclseparator} is not empty.
4790 % \begin{macrocode}
4791 \newcommand*{\encl}[1]{\par%
4792 \ifdim\parskip=\z@%
4793 \vskip\baselineskip%
4794 \fi\noindent%
4795 \begingroup
4796 \parbox[t]{\textwidth}{%
4797 \Ifkomavarempty*{enclseparator}{}{%
4798 \@hangfrom{%
4799 \strut\usekomavar*{enclseparator}\usekomavar{enclseparator}}%
4800 }%
4801 \ignorespaces #1\strut}%
4802 \setlength{\parfillskip}{\z@ \@plus 1fil}\par
4803 \endgroup
4804 }
4805 %</body>
4806 % \end{macrocode}
4807 % \end{command}
4808 %
4809 %
4810 % \subsection{Letter specific variables}
4811 %
4812 % \begin{variable}{place,location,specialmail,title,fromlogo}
4813 % \changes{v2.8q}{2002/01/28}{added}
4814 % \begin{variable}{fromzipcode,PPcode,PPdatamatrix}
4815 % \changes{v3.03}{2009/03/04}{added}
4816 % \begin{variable}{addresseeimage}
4817 % \changes{v3.03}{2009/03/04}{added}
4818 % \changes{v3.03b}{2009/06/30}{typofix}
4819 % \begin{variable}{signature}
4820 % \changes{v2.8q}{2002/01/16}{added}
4821 % \begin{variable}{backaddress}
4822 % \changes{v2.8q}{2002/01/16}{added}
4823 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} durch \cs{Ifkomavarempty}
4824 % ersetzt}
4825 % There are several variables without output name. For most of them the user
4826 % has to define a value, if it should be used in the notepaper. Only
4827 % \var{backaddress} and \var{signature} have a default, that depends on the
4828 % values of other variables. Unfortunately these defaults are not expandable,
4829 % because of the not expandable \cs{usekomavar}.
4830 % \begin{description}
4831 % \item[ToDo:] We should define a expandable \cs{usekomavar} alternative
4832 % without optional star and optional argument.
4833 % \end{description}
4834 % \begin{macrocode}
4835 %<*body>
4836 \newkomavar{place}
4837 \newkomavar{location}
4838 \newkomavar{specialmail}
4839 \newkomavar{title}
4840 \newkomavar{fromlogo}
4841 \newkomavar{fromzipcode}
4842 \newkomavar{PPcode}
4843 \newkomavar{PPdatamatrix}
4844 \newkomavar{addresseeimage}
4845 \newkomavar{signature}
4846 \setkomavar{signature}{\usekomavar{fromname}}
4847 \newkomavar{backaddress}
4848 \setkomavar{backaddress}{%
4849 \Ifkomavarempty{fromname}{}{%
4850 \strut\ignorespaces\usekomavar{fromname}%
4851 \Ifkomavarempty{fromaddress}{}{\\}}%
4852 \Ifkomavarempty{fromaddress}{}{%
4853 \strut\ignorespaces\usekomavar{fromaddress}}%
4854 }
4855 %</body>
4856 % \end{macrocode}
4857 % \end{variable}^^A backaddress
4858 % \end{variable}^^A signature
4859 % \end{variable}^^A addresseeimage
4860 % \end{variable}^^A fromzipcode,PPcode,PPdatamatrix
4861 % \end{variable}^^A place,location,specialmail,title,fromlogo
4862 %
4863 % \begin{option}{symbolicnames}
4864 % \changes{v3.12}{2013/05/13}{added}
4865 % \changes{v3.17}{2015/03/16}{using internal value storage}
4866 % \changes{v3.27}{2019/03/21}{new values \opt{\quotechar=fontawesome} and
4867 % \opt{\quotechar=marvosym} added}
4868 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
4869 % \changes{v3.39}{2022/11/11}{initial dot removed from member argument of
4870 % option storage commands}
4871 % \begin{macro}{\@scrsymbolsfalse,\@scrsymbolstrue,\if@scrsymbols}
4872 % For some of the variable the print name can be a symbol instead of a name.
4873 % \begin{macrocode}
4874 %<*option>
4875 \newif\if@scrsymbols
4876 \KOMA@key{symbolicnames}[true]{%
4877 \KOMA@set@ifkey{symbolicnames}{@scrsymbols}{#1}%
4878 \ifx\FamilyKeyState\FamilyKeyStateProcessed
4879 \def\scr@symbols@font{marvosym}%
4880 \else
4881 \KOMA@set@ncmdkey{symbolicnames}{reserved@a}{%
4882 {marvosym}{0},%
4883 {fontawesome}{1},{awesome}{1},%
4884 }{#1}%
4885 \ifx \FamilyKeyState\FamilyKeyStateProcessed
4886 \@scrsymbolstrue
4887 \ifcase \number\reserved@a
4888 \def\scr@symbols@font{marvosym}%
4889 \else
4890 \def\scr@symbols@font{fontawesome}%
4891 \fi
4892 \fi
4893 \fi
4894 \ifx \FamilyKeyState\FamilyKeyStateProcessed
4895 \KOMA@kav@xreplacevalue{%
4896 %<class> \KOMAClassFileName
4897 %<package> scrletter.\scr@pkgextension
4898 }{symbolicnames}{#1}%
4899 \if@scrsymbols
4900 \Ifstr{\scr@symbols@font}{marvosym}{%
4901 \def\scr@symbol@phone{\Telefon}%
4902 \def\scr@symbol@fax{\FAX}%
4903 \def\scr@symbol@email{\Email}%
4904 \def\scr@symbol@mobilephone{\Mobilefone}%
4905 \let\scr@symbol@www\@empty
4906 }{%
4907 \def\scr@symbol@phone{\faPhone}%
4908 \def\scr@symbol@fax{\faFax}%
4909 \def\scr@symbol@email{\faEnvelopeO}%
4910 \def\scr@symbol@mobilephone{\faMobilePhone}%
4911 \def\scr@symbol@www{\faGlobe}%
4912 }%
4913 \if@atdocument
4914 \begingroup
4915 \@tempswafalse
4916 \expandafter\ifdefined\scr@symbol@phone\else\@tempswatrue\fi
4917 \expandafter\ifdefined\scr@symbol@fax\else\@tempswatrue\fi
4918 \expandafter\ifdefined\scr@symbol@email\else\@tempswatrue\fi
4919 \expandafter\ifdefined\scr@symbol@mobilephone\else\@tempswatrue\fi
4920 \expandafter\ifdefined\scr@symbol@www\else\@tempswatrue\fi
4921 \if@tempswa
4922 \aftergroup\@scrsymbolsfalse
4923 %<class> \ClassWarning{\KOMAClassName}{%
4924 %<package> \PackageWarning{scrletter}{%
4925 Option `symbolicnames=#1'
4926 ignorred.\MessageBreak
4927 You've tried to set option `symbolicnames'\MessageBreak
4928 after \string\begin{document}, but without\MessageBreak
4929 loading package `\scr@symbols@font' before.\MessageBreak
4930 You should either switch on option\MessageBreak
4931 `symbolicnames' before \string\begin{document}\MessageBreak
4932 or load package `\scr@letter@symbols@font' in the
4933 document\MessageBreak
4934 preamble to avoid this warning%
4935 }%
4936 \fi
4937 \endgroup
4938 \else
4939 % \end{macrocode}
4940 % \changes{v3.20}{2016/04/01}{need only extension for kind of loading delay}
4941 % \changes{v3.20}{2016/04/01}{loading delay only if needed and available}
4942 % In the document preamble we can load \pkg{macrosym} or \pkg{fontawesome},
4943 % but not while the options not has been processed. So in this case we have to
4944 % delay it using \cs{AtEndOfClass} resp. \cs{AtEndOfPackage}. With an unknown
4945 % extension we use \cs{AtBeginDocument}.
4946 % \begin{macrocode}
4947 \ifx\@fileswith@pti@ns\@badrequireerror
4948 \Ifstr{\@currext}{\@clsextension}{%
4949 \expandafter\AtEndOfClass
4950 }{%
4951 \Ifstr{\@currext}{\@pkgextension}{%
4952 \expandafter\AtEndOfPackage
4953 }{%
4954 \expandafter\AtBeginDocument
4955 }%
4956 }%
4957 \else
4958 \expandafter\@firstofone
4959 \fi
4960 {\RequirePackage{\scr@symbols@font}}%
4961 \fi
4962 \fi
4963 \fi
4964 }
4965 \KOMA@kav@add{%
4966 %<class> \KOMAClassFileName
4967 %<package> scrletter.\scr@pkgextension
4968 }{symbolicnames}{false}%
4969 % \end{macrocode}
4970 % \begin{macro}{\scr@symbols@font}
4971 % \changes{v3.27}{2019/03/21}{added}
4972 % The name of the font packages used for the symbols if symbols instead of
4973 % names are activated.
4974 % \begin{macro}{\scr@symbol@phone}
4975 % \changes{v3.27}{2019/03/21}{added}
4976 % The phone symbole.
4977 % \begin{macro}{\scr@symbol@fax}
4978 % \changes{v3.27}{2019/03/21}{added}
4979 % The fax symbole.
4980 % \begin{macro}{\scr@symbol@email}
4981 % \changes{v3.27}{2019/03/21}{added}
4982 % The e-mail symbol.
4983 % \begin{macro}{\scr@symbol@mobilephone}
4984 % \changes{v3.27}{2019/03/21}{added}
4985 % The mobile-phone symbol.
4986 % \begin{macro}{\scr@symbol@www}
4987 % \changes{v3.27}{2019/03/21}{added}
4988 % The world-wide-web symbol.
4989 % \begin{macrocode}
4990 \newcommand*{\scr@symbols@font}{}
4991 \newcommand*{\scr@symbol@phone}{\undefined}
4992 \newcommand*{\scr@symbol@fax}{\undefined}
4993 \newcommand*{\scr@symbol@email}{\undefined}
4994 \newcommand*{\scr@symbol@mobilephone}{\undefined}
4995 \newcommand*{\scr@symbol@www}{\undefined}
4996 %</option>
4997 % \end{macrocode}
4998 % \end{macro}^^A \scr@symbol@www
4999 % \end{macro}^^A \scr@symbol@mobilephone
5000 % \end{macro}^^A \scr@symbol@email
5001 % \end{macro}^^A \scr@symbol@fax
5002 % \end{macro}^^A \scr@symbol@phone
5003 % \end{macro}^^A \scr@symbols@font
5004 % \end{macro}^^A \if@scrsymbols
5005 % \end{option}^^A symbolicnames
5006 %
5007 % \begin{variable}{backaddressseparator,ccseparator,enclseparator,
5008 % placeseparator,subjectseparator}
5009 % \changes{v2.8q}{2002/01/22}{added}
5010 % \begin{variable}{emailseparator,faxseparator,mobilephoneseparator,
5011 % phoneseparator,urlseparator}
5012 % \changes{v2.8q}{2002/03/25}{added}
5013 % \changes{v3.12}{2013/05/29}{support for option \opt{symbolicnames}}
5014 % \changes{v3.27}{2019/03/21}{indirect saving of symbols}
5015 % \changes{v3.42}{2023/08/25}{defaults changed to fix
5016 % \href{https://sourceforge.net/p/koma-script/tickets/56/}{issue \#56}}
5017 % \begin{variable}{zipcodeseparator}
5018 % \changes{v3.03}{2009/03/04}{added}
5019 % We also have variables with (predefined) output names and predefined
5020 % values. These are the separator variables.
5021 % \begin{macrocode}
5022 %<*body>
5023 \newkomavar[\usekomavar{place}]{placeseparator}
5024 \setkomavar{placeseparator}{,\nobreakspace}
5025 \newkomavar[\subjectname]{subjectseparator}
5026 \setkomavar{subjectseparator}{: }
5027 \newkomavar[\ccname]{ccseparator}
5028 \setkomavar{ccseparator}{: }
5029 \newkomavar[\enclname]{enclseparator}
5030 \setkomavar{enclseparator}{: }
5031 \newkomavar{backaddressseparator}
5032 \setkomavar{backaddressseparator}{,\nobreakspace}
5033 \newkomavar[\if@scrsymbols\scr@symbol@phone\else\phonename\fi]{phoneseparator}
5034 \setkomavar{phoneseparator}{%
5035 \Ifkomavarxempty*{phoneseparator}{}{\if@scrsymbols\else:\fi\nobreakspace}%
5036 }
5037 \newkomavar[%
5038 \if@scrsymbols\scr@symbol@mobilephone\else\mobilephonename\fi
5039 ]{mobilephoneseparator}
5040 \setkomavar{mobilephoneseparator}{\usekomavar{phoneseparator}}
5041 \newkomavar[\if@scrsymbols\scr@symbol@fax\else\faxname\fi]{faxseparator}
5042 \setkomavar{faxseparator}{%
5043 \Ifkomavarxempty*{faxseparator}{}{\if@scrsymbols\else:\fi\nobreakspace}%
5044 }
5045 \newkomavar[\if@scrsymbols\scr@symbol@email\else\emailname\fi]{emailseparator}
5046 \setkomavar{emailseparator}{%
5047 \Ifkomavarxempty*{emailseparator}{}{\if@scrsymbols\else:\fi\nobreakspace}%
5048 }
5049 \newkomavar[\if@scrsymbols\scr@symbol@www\else\wwwname\fi]{urlseparator}
5050 \setkomavar{urlseparator}{%
5051 \Ifkomavarxempty*{urlseparator}{}{\if@scrsymbols\else:\fi\nobreakspace}%
5052 }
5053 \newkomavar{zipcodeseparator}
5054 \setkomavar{zipcodeseparator}{\,--\,}
5055 % \end{macrocode}
5056 % \end{variable}^^A zipcodeseparator
5057 % \end{variable}^^A emailseparator … urlseparator
5058 % \end{variable}^^A backaddressseparator .. subjectseparator
5059 %
5060 % \begin{variable}{addressee}
5061 % \changes{v3.27}{2019/03/24}{new variable}
5062 % The package needs a variable for the addressee (used for the address field).
5063 % \begin{variable}{togivenname}
5064 % \changes{v3.27}{2019/03/24}{new variable}
5065 % \begin{variable}{tofamilyname}
5066 % \changes{v3.27}{2019/03/24}{new variable}
5067 % The package allows to build \texttt{toname} by \texttt{togivenname} and
5068 % \texttt{tofamilyname}.
5069 % \begin{macrocode}
5070 %<*package&willbe>
5071 \newkomavar{addressee}
5072 \newkomavar{togivenname}
5073 \newkomavar{tofamilyname}
5074 %</package&willbe>
5075 % \end{macrocode}
5076 % \end{variable}^^A tofamilyname
5077 % \end{variable}^^A togivenname
5078 % \end{variable}^^A addressee
5079 %
5080 % \begin{variable}{fromname,fromaddress,fromemail,fromurl,frombank,
5081 % toname,toaddress,
5082 % fromphone,fromfax,
5083 % yourmail,yourref,
5084 % myref,customer,invoice,subject,date}
5085 % \changes{v2.8q}{2002/01/16}{added}
5086 % \begin{variable}{frommobilephone}
5087 % \changes{v3.12}{2013/05/29}{added}
5088 % \begin{command}{\date}
5089 % \changes{v3.17}{2015/03/05}{deprecated}
5090 % \begin{macro}{\scr@saved@date}
5091 % \changes{v3.17}{2015/03/05}{added}
5092 % Several variables with output name but without default value. Somehow
5093 % special is \var{subject}, because the output name also contains the
5094 % separator. To change the name only but not the separator change the output
5095 % name of \var{subjectseparator}. \var{toaddress} and \var{fromaddress} are
5096 % also special. Their output names are the values of \var{toname}
5097 % resp. \var{fromname}. But this is not used initially. The initial value of
5098 % \var{date} is \cs{@date}. So \cs{date} can still be used to change it, but
5099 % this is not recommended.
5100 % \begin{macrocode}
5101 \newkomavar[\headfromname]{fromname}
5102 \newkomavar[\usekomavar{fromname}]{fromaddress}
5103 \newkomavar[\headtoname]{toname}
5104 \newkomavar[\usekomavar{toname}]{toaddress}
5105 \newkomavar[\usekomavar*{phoneseparator}%
5106 \usekomavar{phoneseparator}]{fromphone}
5107 \newkomavar[\usekomavar*{mobilephoneseparator}%
5108 \usekomavar{mobilephoneseparator}]{frommobilephone}
5109 \newkomavar[\usekomavar*{faxseparator}%
5110 \usekomavar{faxseparator}]{fromfax}
5111 \newkomavar[\usekomavar*{emailseparator}%
5112 \usekomavar{emailseparator}]{fromemail}
5113 \newkomavar[\usekomavar*{urlseparator}%
5114 \usekomavar{urlseparator}]{fromurl}
5115 \newkomavar[\bankname]{frombank}
5116 \newkomavar[\yourrefname]{yourref}
5117 \newkomavar[\yourmailname]{yourmail}
5118 \newkomavar[\myrefname]{myref}
5119 \newkomavar[\customername]{customer}
5120 \newkomavar[\invoicename]{invoice}
5121 \newkomavar[\usekomavar*{subjectseparator}%
5122 \usekomavar{subjectseparator}]{subject}
5123 \newkomavar[\datename]{date}
5124 \setkomavar{date}{\@date}
5125 \newcommand*{\scr@saved@date}{}
5126 \let\scr@saved@date\date
5127 \renewcommand*{\date}[1]{%
5128 %<class> \ClassWarning{\KOMAClassName}{%
5129 %<package> \PackageWarning{scrletter}{%
5130 \string\date\space changes the internal \string\LaTeX\space date
5131 only.\MessageBreak
5132 You should note that this changes the default\MessageBreak
5133 value of variable `date' only as long as nobody\MessageBreak
5134 uses `\string\setkomavar` to change the content of\MessageBreak
5135 variable `date'.\MessageBreak
5136 Therefore, usage of `\string\setkomavar' is recommended\MessageBreak
5137 to change the letter's date%
5138 }%
5139 \scr@saved@date{#1}%
5140 }
5141 %</body>
5142 % \end{macrocode}
5143 % \end{macro}^^A \scr@saved@date
5144 % \end{command}^^A \date
5145 % \end{variable}^^A frommobilephone
5146 % \end{variable}^^A fromname … date
5147 %
5148 %
5149 % \begin{macrocode}
5150 %</letter>
5151 % \end{macrocode}
5152 %
5153 %
5154 % \Finale
5155 % \PrintChanges
5156 %
5157 \endinput
5158 % Local Variables:
5159 % mode: doctex
5160 % ispell-local-dictionary: "en_US"
5161 % eval: (flyspell-mode 1)
5162 % TeX-master: t
5163 % TeX-engine: luatex-dev
5164 % eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
5165 % End: