Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 % ======================================================================
3 % scrkernel-letterclassoptions.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-letterclassoptions.dtx 4197 2025-08-15 09:13:30Z kohm $
22 %<option>%%% (run: option)
23 %<head>%%% (run: head)
24 %<body>%%% (run: body)
25 %<*dtx>
26 \ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
27 \begingroup
28 \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
29 \filedate$Date: 2025-08-15 11:13:30 +0200 (Fr, 15. Aug 2025) $
30 \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
31 \filerevision$Revision: 4197 $
32 \endgroup
33 \ProvidesFile{scrkernel-letterclassoptions.dtx}
34 [\filedate\space \filerevision\space
35 KOMA-Script source (letter configuration options)]
36 \documentclass[USenglish]{koma-script-source-doc}
37 \usepackage{babel}
38 \setcounter{StandardModuleDepth}{2}
39 \begin{document}
40 \DocInput{scrkernel-letterclassoptions.dtx}
41 \end{document}
42 %</dtx>
43 % \fi
44 %
45 % \changes{v2.95}{2006/03/22}{new by splitting \file{scrclass.dtx}}
46 % \changes{v3.36}{2022/02/26}{switch over from \cls*{scrdoc} to
47 % \cls*{koma-script-source-doc}}
48 % \changes{v3.36}{2022/02/26}{\cs{@setplength} replaced by \cs{setplength}}
49 % \changes{v3.36}{2022/02/26}{\cs{@addtoplength} replaced by \cs{addtoplength}}
50 % \changes{v3.36}{2022/02/26}{\cs{@newplength} replaced by \cs{newplength}}
51 % \changes{v3.36}{2022/02/26}{whole implementation documentation in English}
52 % \changes{v3.40}{2023/04/17}{guide names changed}
53 %
54 %
55 % \GetFileInfo{scrkernel-letterclassoptions.dtx}
56 % \title{Handling and Implementation of Letter Configuration Options of
57 % \href{https://komascript.de}{\KOMAScript} Letter Class and Package}
58 % \author{\href{mailto:[email protected]}{Markus Kohm}}
59 % \date{Revision \fileversion{} of \filedate}
60 % \maketitle
61 % \begin{abstract}
62 % The \KOMAScript{} letter class \cls*{scrlttt2} and the \KOMAScript{}
63 % letter package \pkg*{scrletter} has something special: the letter
64 % configuration option files formerly known as letter class option
65 % files. These are used to setup either layouts or user configurations. Both
66 % the implementation of these files and the handling of them can be found in
67 % \file{scrkernel-letterclassoptions.dtx}.
68 % \end{abstract}
69 % \tableofcontents
70 %
71 % \section{User Manual}
72 %
73 % You can find the user documentation the commands and files implemented here
74 % in the \KOMAScript{} manual, either the German \file{scrguide-de.pdf} or the
75 % English \file{scrguide-en.pdf}.
76 %
77 % \MaybeStop{\PrintIndex}
78 %
79 % \section{Implementation of the Handling of Letter Configuration Options}
80 %
81 % We need this feature only with letter classes and packages.
82 %
83 % \begin{macrocode}
84 %<*(class|package)&letter>
85 % \end{macrocode}
86 %
87 %
88 % \subsection{Options for the letter configuration option files}
89 %
90 % \begin{macro}{\lco@test}
91 % \changes{v2.95}{2006/03/22}{added}
92 % \changes{v2.97c}{2007/09/12}{modified for new option handling}
93 % \changes{v3.36}{2022/02/26}{deprecated}
94 % The \KOMAScript{} letter class \cls*{scrlttr2} allows to load a letter
95 % configuration option file by classic class options to \cs{documentclass},
96 % \cs{LoadClass} or \cs{PassOptionsToClass}. This is done inside via the
97 % general \cs{DeclareOption*}, that is used for several other deprecated (and
98 % some standard) options too. \cs{lco@test} simply tests, if
99 % \file{\CurrentOption.lco} does exist and in this case load it a the end of
100 % the class. Note: The \KOMAScript{} letter package \pkg*{scrletter} does not
101 % support loading of letter configuration option files via global or package
102 % option. Moreover, from \KOMAScript{} v3.36 loading via class option is also
103 % deprecated for \cls*{scrlttr2}.
104 % \begin{macrocode}
105 %<*class&option>
106 \newcommand*{\lco@test}{%
107 \IfFileExists{\CurrentOption.lco}{%
108 \ClassWarningNoLine{\KOMAClassName}{%
109 loading of LCO via class option
110 `\CurrentOption'.\MessageBreak
111 Note: Loading a LCO via class option is deprecated.\MessageBreak
112 \space\space\space\space\space\space
113 You should use
114 `\string\LoadLetterOption\string{\CurrentOption\string}'\MessageBreak
115 instead%
116 }%
117 \expandafter\AtEndOfClass\expandafter{%
118 \expandafter\LoadLetterOption\expandafter{\CurrentOption}%
119 }%
120 \expandafter\def\expandafter\scr@pti@nerr@r\expandafter{%
121 \expandafter\def\expandafter\scr@pti@nerr@r\expandafter{%
122 \scr@pti@nerr@r
123 }%
124 }%
125 }{}%
126 }
127 %</class&option>
128 % \end{macrocode}
129 % \end{macro}
130 %
131 % \file{DIN.lco} is the default and therefore loaded first at the end of the
132 % class or package.
133 % \begin{macrocode}
134 %<*option>
135 %<class>\AtEndOfClass
136 %<package>\AtEndOfPackage
137 {\LoadLetterOption{DIN}}
138 %</option>
139 % \end{macrocode}
140 %
141 %
142 % \subsection{Makros für Letter-Class-Options}
143 %
144 % \begin{command}{\LoadLetterOption}
145 % \changes{v2.8q}{2001/10/08}{added}
146 % \changes{v3.14}{2014/10/04}{ignoring white spaced}
147 % \changes{v3.26}{2018/08/29}{\cs{KV@@sp@def} replaced by \cs{scr@sp@def}}
148 % Command
149 % \begin{quote}
150 % \cs{LoadLetterOption}\marg{letter configuration option}
151 % \end{quote}
152 % loads \file{\meta{letter configuration option}.lco}. The \cs{catcode} of
153 % ``|@|'' is changed to letter for loading the file. But because \file{lco}
154 % files can load other \file{lco} files using \cs{LoadLetterOption} this has
155 % to be reset only for the outer \cs{LoadLetterOption}.
156 % \begin{description}
157 % \item[ToDo:] can't we do this more simply just using either some
158 % \cs{expandafter} magic or an internal stack?
159 % \end{description}
160 % \begin{macrocode}
161 %<*body>
162 \newcommand*{\LoadLetterOption}[1]{%
163 \@ifundefined{@restore@catcode@level}%
164 {\let\@restore@catcode@level=\z@}{}%
165 \ifnum\@restore@catcode@level =\z@
166 \ifnum\catcode`\@=11
167 \let\@restore@catcode\relax
168 \else
169 \@tempcnta=\catcode`\@
170 \edef\@restore@catcode{%
171 \noexpand\catcode`\noexpand\@=\the\@tempcnta}%
172 \makeatletter
173 \fi
174 \fi
175 \@tempcnta=\@restore@catcode@level\relax
176 \advance\@tempcnta by \@ne\relax
177 \edef\@restore@catcode@level{\the\@tempcnta}%
178 \scr@sp@def\reserved@a{#1}%
179 \edef\reserved@a{%
180 \noexpand\edef\noexpand\scr@currentlco{\reserved@a}%
181 % \end{macrocode}
182 % \changes{v3.99}{2022/10/25}{local definition of \cs{scr@compatibility}}
183 % For compatibility of old \file{lco} files with \KOMAScript~4 we locally
184 % define \cs{scr@compatibility} to the highest possible number.
185 % \begin{macrocode}
186 %<*v4>
187 \ifdefined\scr@compatibility\else
188 \noexpand\edef\noexpand\scr@compatibility{\the\maxdimen}%
189 \fi
190 %</v4>
191 \noexpand\InputIfFileExists{\[email protected]}{%
192 %<class> \noexpand\ClassInfo{scrlttr2}%
193 %<package> \noexpand\PackageInfo{scrletter}%
194 {Letter-Class-Option `#1' loaded}%
195 }{%
196 %<class> \noexpand\ClassError{scrlttr2}%
197 %<package> \noexpand\PackageError{scrletter}%
198 {%
199 Letter-Class-Option file `#1.lco' not found%
200 }{%
201 You've told me to load the Letter-Class-Option `#1'. So I have
202 to load\noexpand\MessageBreak
203 the file `#1.lco'. But the file isn't available.}%
204 }%
205 %<*v4>
206 \ifdefined\scr@compatibility
207 \noexpand\def\noexpand\scr@compatibility{\scr@compatibility}%
208 \else
209 \unexpanded{\let\scr@compatibility\undefined}%
210 \fi
211 %</v4>
212 \scr@ifundefinedorrelax{scr@currentlco}{%
213 \unexpanded{\let\scr@currentlco\relax}%
214 }{%
215 \noexpand\def\noexpand\scr@currentlco{\scr@currentlco}%
216 }%
217 }%
218 % \end{macrocode}
219 % \changes{v3.18}{2015/06/03}{manage \cs{RequirePackage} and \cs{usepackage}
220 % inside \texttt{lco}-files after \cs{begin\{document\}}}
221 % \changes{v3.28}{2019/11/24}{\cs{usepackage} typo fixed}
222 % \begin{description}
223 % \item[ToDo:] I don't think, that the following really works. So maybe it
224 % should simple be removed to get the usual error message using
225 % \cs{RequirePackage} or \cs{usepackage} inside a document.
226 % \end{description}
227 % \begin{macrocode}
228 \if@atdocument
229 \edef\reserved@a{%
230 \unexpanded\expandafter{\reserved@a}%
231 \ifx\RequirePackage\@notprerr
232 \unexpanded{\let\RequirePackage\@notprerr}%
233 \else
234 \noexpand\def\noexpand\RequirePackage{%
235 \unexpanded\expandafter{\RequirePackage}%
236 }%
237 \fi
238 \ifx\usepackage\@notprerr
239 \unexpanded{\let\usepackage\@notprerr}%
240 \else
241 \noexpand\def\noexpand\usepackage{%
242 \unexpanded\expandafter{\usepackage}%
243 }%
244 \fi
245 }%
246 \let\RequirePackage\lco@RequirePackage
247 \let\usepackage\lco@RequirePackage
248 \expandafter\reserved@a
249 \else \expandafter\reserved@a
250 \fi
251 \@tempcnta=\@restore@catcode@level\relax
252 \advance\@tempcnta by \m@ne\relax
253 \edef\@restore@catcode@level{\the\@tempcnta}%
254 \ifnum\@tempcnta =\z@
255 \@restore@catcode
256 \fi
257 }
258 % \end{macrocode}
259 % \begin{macro}{\lco@RequirePackage}
260 % \changes{v3.18}{2015/06/03}{added}
261 % \changes{v3.26}{2018/08/29}{\cs{KV@@sp@def} replaced by
262 % \cs{scr@trim@spaces}}
263 % \changes{v3.46}{2025/08/15}{\cs{scr@gobbleopt} replaced by \cs{@gobble@o}}
264 % \begin{description}
265 % \item[ToDo:] See the note above.
266 % \end{description}
267 % \begin{macrocode}
268 \newcommand*{\lco@RequirePackage}[2][]{%
269 \begingroup
270 \@for\reserved@a:=#2\do{%
271 \scr@trim@spaces\reserved@a
272 \scr@ifundefinedorrelax{ver@\reserved@a.\scr@pkgextension}{%
273 %<class> \ClassError{\KOMAClassName}{%
274 %<package> \PackageError{scrletter}{%
275 lco-file `\scr@currentlco' can be used only in preamble%
276 }{%
277 The lco-file `\scr@currentlco' uses \string\RequirePackage\space or
278 \string\usepackage\space to load\MessageBreak
279 package `\reserved@a'. This means you have to either load
280 `\reserved@a'\MessageBreak
281 or lco-file `\scr@currentlco' in the document preamble.
282 }%
283 }{}%
284 }%
285 \endgroup
286 \@gobble@o
287 }
288 % \end{macrocode}
289 % \end{macro}^^A \lco@RequirePackage
290 % \end{command}^^A \LoadLetterOption
291 %
292 % \begin{command}{\LoadLetterOptions}
293 % \changes{v3.14}{2014/10/04}{added}
294 % \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}
295 % \changes{v3.26}{2018/08/29}{special treatment of space entries not needed
296 % any more}
297 % Similar to \cs{LoadLetterOption} but with \meta{list of letter configuration
298 % options} instead of a single \meta{letter configuration option}.
299 % \begin{macrocode}
300 \newcommand*{\LoadLetterOptions}[1]{%
301 \begingroup
302 \def\reserved@a{\endgroup}%
303 \@for\reserved@b:=#1\do{%
304 \scr@trim@spaces\reserved@b
305 \ifx\reserved@b\@empty\else
306 \edef\reserved@a{\expandafter\unexpanded\expandafter{\reserved@a
307 \LoadLetterOption}{\reserved@b}\relax}%
308 \fi
309 }%
310 \reserved@a
311 }
312 % \end{macrocode}
313 % \end{command}^^A \LoadLetterOptions
314 %
315 % \begin{command}{\LetterOptionNeedsPapersize}
316 % \changes{v2.8q}{2001/10/17}{added}
317 % With
318 % \begin{quote}
319 % \cs{LetterOptionNeedsPapersize}\marg{letter configuration
320 % option}\marg{paper size}
321 % \end{quote}
322 % inside a \meta{letter configuration option} file we can define a \meta{paper
323 % size} to be used. This does not change the paper size, but adds a test to
324 % \cs{opening}, that warns if another paper size is used.
325 % \begin{macro}{\@PapersizeWarning}
326 % \changes{v2.8q}{2002/03/25}{added}
327 % \changes{v3.12}{2013/11/05}{differences of +/- 1\,mm are tolerated}
328 % \changes{v3.23}{2017/02/22}{using \cs{PaperNameToSize}}
329 % \begin{macro}{\@@PapersizeWarning,\LOPNP@size,\LOPNP@option}
330 % \changes{v2.8q}{2002/03/25}{added}
331 % \begin{macrocode}
332 \newcommand*{\LOPNP@option}{}
333 \newcommand*{\LOPNP@size}{}
334 \newcommand*{\@PapersizeWarning}{%
335 \begingroup%
336 \edef\@tempc{\noexpand\@tempswafalse
337 \noexpand\ifdim\paperwidth<\the\dimexpr\paperwidth-.1mm\relax
338 \relax
339 \noexpand\else
340 \noexpand\ifdim\paperwidth>\the\dimexpr\paperwidth+.1mm\relax
341 \relax
342 \noexpand\else
343 \noexpand\ifdim\paperheight<\the\dimexpr\paperheight-.1mm\relax
344 \relax
345 \noexpand\else
346 \noexpand\ifdim\paperheight>\the\dimexpr\paperheight+.1mm\relax
347 \relax
348 \noexpand\else
349 \noexpand\@tempswatrue
350 \noexpand\fi
351 \noexpand\fi
352 \noexpand\fi
353 \noexpand\fi
354 \noexpand\@@PapersizeWarning
355 }%
356 \def\@tempb{letter}\ifx\LOPNP@size\@tempb%
357 \setlength{\paperheight}{11in}\setlength{\paperwidth}{8.5in}%
358 \else\def\@tempb{legal}\ifx\LOPNP@size\@tempb%
359 \setlength{\paperheight}{14in}\setlength{\paperwidth}{8.5in}%
360 \else\def\@tempb{executive}\ifx\LOPNP@size\@tempb%
361 \setlength{\paperheight}{10.5in}\setlength{\paperwidth}{7.25in}%
362 \else%
363 \PaperNameToSize[letter]{\LOPNP@size}%
364 \fi
365 \fi
366 \fi
367 \@tempc
368 \endgroup%
369 }
370 %<class>\AfterPackage*{typearea}{%
371 \ProvideUnknownPaperSizeError{letter}{%
372 %<class> \ClassError{scrlttr2}{%
373 %<package> \PackageError{scrletter}{%
374 papersize `\LOPNP@size' undefined}{%
375 You've told me to check for paper size
376 `\LOPNP@size'\MessageBreak
377 at letter option file `\[email protected]',\MessageBreak
378 but this paper size is not supported.\MessageBreak
379 See the KOMA-Script manual for informations about known
380 paper sizes.}%
381 }
382 %<class>}
383 \newcommand*{\@@PapersizeWarning}{%
384 \if@tempswa\else%
385 %<class> \ClassWarningNoLine{scrlttr2}%
386 %<package> \PackageWarningNoLine{scrletter}%
387 {%
388 Letter option file `\[email protected]'\MessageBreak
389 needs paper size `\LOPNP@size'.\MessageBreak
390 Current paper size is not `\LOPNP@size'!\MessageBreak
391 \scr@ifundefinedorrelax{KOMAClassName}{%
392 You should load package `typearea' either\MessageBreak
393 with option `paper=\LOPNP@size,paper=portrait' or
394 additionally\MessageBreak
395 }{%
396 You should add `paper=\LOPNP@size,paper=portrait' at the\MessageBreak
397 option list of `\string\documentclass' or\MessageBreak
398 }%
399 add `\string\KOMAoptions{paper=\LOPNP@size,paper=portrait}'\MessageBreak
400 before starting this letter!\MessageBreak
401 Maybe you know what you are doing,\MessageBreak
402 so I do not change this myself%
403 }%
404 \fi
405 }
406 % \end{macrocode}
407 % \end{macro}
408 % \end{macro}
409 % \begin{macrocode}
410 \newcommand*{\LetterOptionNeedsPapersize}[2]{%
411 \edef\LOPNP@size{#2}\edef\LOPNP@option{#1}%
412 }
413 %</body>
414 % \end{macrocode}
415 % \end{command}
416 %
417 % \begin{macrocode}
418 %</(class|package)&letter>
419 % \end{macrocode}
420 %
421 % \section{Implementation of the Letter Configuration Option Files}
422 %
423 % Most of the predefined letter configuration option files define a letter
424 % layout, e.g, depending on a norm. The main thing in this case is to setup
425 % pseudo-lengths. Sometimes additionally macros or commands are (re-)defined.
426 %
427 % \begin{macrocode}
428 %<*lco>
429 % \end{macrocode}
430 %
431 % \subsection{The file header}
432 %
433 % The head has to identify the file:
434 % \changes{v3.04}{2009/04/21}{\file{NF.lco} by Jean-Marie Pacquet added}
435 % \changes{v3.04}{2009/06/26}{\file{USletter2w.lco} with contribution of
436 % Engelbert Buxbaum and Richard Ar\`es}
437 % \changes{v3.04}{2009/06/29}{\file{UScommercial9DW-lco} for paper formats
438 % letter or legal and envelopes with format no.\,9 with two windows}
439 % \changes{v3.04}{2009/06/30}{\file{UScommercial9} for paper formats
440 % letter or legal and envelopes with format commercial No.\,9 with one
441 % window based on \url{http://www.envelopesuperstore.com/}}
442 % \changes{v3.04}{2009/06/26}{long existing \file{visualize.lco} added}
443 % \changes{v3.17}{2015/02/17}{\file{DIN5008A.lco} and \file{DIN5008B.lco} added}
444 % \begin{macrocode}
445 %<*head>
446 \ProvidesFile{%
447 %<visualize> visualize%
448 %<DIN> DIN%
449 %<5008> 5008%
450 %<A> A%
451 %<B> B%
452 %<DINmoretext> DINmtext%
453 %<SN> SN%
454 %<SNold> SNold%
455 %<SwissLeft> SNleft%
456 %<KOMAold> KOMAold%
457 %<NF> NF%
458 %<USletter2w> USletter2w
459 %<UScommercial9> UScommercial9
460 %<UScommercial9DW> UScommercial9DW
461 .lco}[\KOMAScriptVersion\space letter-class-option]
462 % \end{macrocode}
463 %
464 % Some of the \file{LCO} files need others:
465 % \begin{macrocode}
466 %<*5008>
467 \LoadLetterOption{%
468 %<A> DINmtext%
469 %<B> DIN%
470 }
471 %</5008>
472 % \end{macrocode}
473 %
474 % \begin{command}{\LCOWarningNoLine,\LCOWarning}
475 % \changes{v2.95}{2006/03/24}{added}
476 % These are similar to \cs{PackageWarningNoLine} and \cs{PackageWarning} but
477 % for \file{lco} files.
478 % \begin{macrocode}
479 %<*!5008>
480 \providecommand*\LCOWarningNoLine[2]{%
481 \LCOWarning{#1}{#2\@gobble}%
482 }
483 \providecommand*\LCOWarning[2]{%
484 \GenericWarning{%
485 (#1)\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces
486 }{%
487 Letter configuration option #1 Warning: #2%
488 }%
489 }
490 %</!5008>
491 %</head>
492 % \end{macrocode}
493 % \end{command}
494 %
495 %
496 % \subsection{Main part of layout option files}
497 %
498 % The dimensions of some of the options has been researched by others:
499 % \begin{center}
500 % \begin{tabular}{ll}
501 % \texttt{lco} file & source \\\hline\\[-1.6ex]
502 % DIN & me \\
503 % DINmtext & me \\
504 % DIN5008A & me \\
505 % DIN5008B & me \\
506 % KOMAold & me \\
507 % SNleft & Roger Luethi \\
508 % SN & Roger Luethi \\
509 % NF & Jean-Marie Pacquet \\
510 % USletter2w & Engelbert Buxbaum \\
511 % UScommercial9 & me \\
512 % UScommercial9DW & me \\
513 % \end{tabular}
514 % \end{center}
515 %
516 % Test for the correct class or package:
517 % \begin{macrocode}
518 %<*body&!visualize>
519 %<*!5008>
520 \@ifundefined{scr@fromname@var}{%
521 \LCOWarningNoLine{%
522 %<DIN> DIN%
523 %<DINmoretext> DINmtext%
524 %<SN> SN%
525 %<SNold> SNold%
526 %<SwissLeft> SNleft%
527 %<KOMAold> KOMAold%
528 %<NF> NF%
529 %<USletter2w> USletter2w%
530 %<UScommercial9> UScommercial9%
531 %<UScommercial9DW> UScommercial9DW%
532 }{%
533 This letter configuration option file was made only\MessageBreak
534 to be used with KOMA-Script letter class\MessageBreak
535 `scrlttr2' or letter package `scrletter'.\MessageBreak
536 Use with other classes and without that package\MessageBreak
537 can result in a lot of errors%
538 }%
539 }{}
540 % \end{macrocode}
541 %
542 % Make sure, the correct paper size has been used:
543 % \begin{macrocode}
544 \LetterOptionNeedsPapersize{%
545 %<DIN> DIN%
546 %<DINmoretext> DINmtext%
547 %<SN> SN%
548 %<SNold> SNold%
549 %<SwissLeft> SNleft%
550 %<KOMAold> KOMAold%
551 %<NF> NF%
552 %<USletter2w> USletter2w%
553 %<UScommercial9> UScommercial9%
554 %<UScommercial9DW> UScommercial9DW%
555 %<*DIN|DINmoretext|SN|SNold|SwissLeft|KOMAold|NF>
556 }{a4}
557 %</DIN|DINmoretext|SN|SNold|SwissLeft|KOMAold|NF>
558 %<*USletter2w|UScommercial9|UScommercial9DW>
559 }{letter}
560 %</USletter2w|UScommercial9|UScommercial9DW>
561 % \end{macrocode}
562 %
563 % And now the dimensions and variables:
564 % \begin{variable}{fromzipcode}
565 % \changes{v3.03}{2009/03/04}{change of output name added}
566 % \begin{macrocode}
567 %<!KOMAold>\setkomavar*{fromzipcode}{%
568 %<DIN|DINmoretext> D}
569 %<SwissLeft|SN> CH}
570 %<NF> F}
571 %<USletter2w|UScommercial9|UScommercial9DW> US}
572 % \end{macrocode}
573 % \end{variable}
574 % \begin{pseudolength}{foldmarkhpos,tfoldmarkvpos,mfoldmarkvpos,bfoldmarkvpos,
575 % lforlmarkhpos}
576 % \changes{v2.97e}{2007/11/20}{several new fold marks to setup}
577 % \begin{macrocode}
578 \setplength{foldmarkhpos}{3.5mm}
579 \setplength{tfoldmarkvpos}{%
580 %<DIN|SwissLeft|SN> 105mm}
581 %<DINmoretext> 87mm}
582 %<KOMAold> 103.5mm}
583 %<NF> 99mm}
584 %<USletter2w|UScommercial9|UScommercial9DW> 3.75in}
585 \setplength{mfoldmarkvpos}{\z@}
586 \setplength{bfoldmarkvpos}{%
587 %<DIN|SwissLeft|SN> 210mm}
588 %<DINmoretext> 192mm}
589 %<KOMAold> 202.5mm}
590 %<NF> 198mm}
591 %<USletter2w> 7.4in}
592 %<UScommercial9|UScommercial9DW> 7.375in}
593 \setplength{lfoldmarkhpos}{\z@}
594 % \end{macrocode}
595 % \end{pseudolength}
596 % \begin{pseudolength}{toaddrvpos,toaddrhpos,toaddrwidth,toaddrheight,
597 % backaddrheight,specialmainindent,specialmailrightindent}
598 % \changes{v3.03}{2009/06/25}{the documentation says, the back-address is part
599 % of the address field}
600 % \begin{macrocode}
601 \setplength{toaddrvpos}{%
602 %<DIN|SN> 45mm}
603 %<DINmoretext> 27mm}
604 %<SwissLeft> 35.5mm}
605 %<KOMAold> 49mm}
606 %<NF> 35mm}
607 %<USletter2w> 1.8in}
608 %<UScommercial9|UScommercial9DW> 2.1875in}
609 \setplength{toaddrhpos}{%
610 %<DIN|DINmoretext|SwissLeft> 20mm}
611 %<SN> -8mm}
612 %<KOMAold> 1in}
613 %<KOMAold>\addtoplength{toaddrhpos}{\oddsidemargin}
614 %<NF> -10mm}
615 %<USletter2w> .73in}
616 %<UScommercial9> 0.6875in}
617 %<UScommercial9DW> .5625in}
618 \setplength{toaddrwidth}{%
619 %<DIN|DINmoretext> 85mm}
620 %<SN> 90mm}
621 %<SwissLeft|NF> 100mm}
622 %<KOMAold> 70mm}
623 %<USletter2w> 3.11in}
624 %<UScommercial9> 4.5in}
625 %<UScommercial9DW> 3.625in}
626 \setplength{toaddrheight}{%
627 %<DIN|DINmoretext|SN|SwissLeft|KOMAold|NF> 45mm}
628 %<USletter2w> 1.17in}
629 %<UScommercial9|UScommercial9DW> 1.125in}
630 %</!5008>
631 \setplength{toaddrindent}{%
632 %<DIN|DINmoretext|SN|SwissLeft|KOMAold|USletter2w|UScommercial9|UScommercial9DW> \z@}
633 %<5008> 5mm}
634 %<NF> 10mm}
635 %<*!5008>
636 \setplength{backaddrheight}{%
637 %<DIN|DINmoretext|SN|SwissLeft|KOMAold|NF> 5mm}
638 %<USletter2w|UScommercial9|UScommercial9DW> \z@}
639 %<USletter2w|UScommercial9|UScommercial9DW>\KOMAoptions{backaddress=false}
640 \setplength{specialmailindent}{\fill}
641 \setplength{specialmailrightindent}{1em}
642 %</!5008>
643 %<*5008>
644 \setplength{specialmailindent}{\useplength{toaddrindent}}
645 \setplength{specialmailrightindent}{\z@}
646 %</5008>
647 % \end{macrocode}
648 % \end{pseudolength}
649 % \begin{pseudolength}{locvpos,locwidth,lochpos}
650 % \begin{macrocode}
651 %<*5008>
652 \setplength{locvpos}{%
653 \dimexpr\useplength{toaddrvpos}+\useplength{backaddrheight}}
654 %</5008>
655 \setplength{locwidth}{%
656 %<DIN|DINmoretext|SN|SwissLeft|KOMAold|NF|USletter2w|UScommercial9|UScommercial9DW> \z@}
657 %<5008> 75mm}
658 %<5008>\setplength{lochpos}{10mm}
659 %<*!5008>
660 % \end{macrocode}
661 % \end{pseudolength}
662 % \begin{pseudolength}{firstheadvpos,firstheadhpos,firstheadwidth}
663 % \begin{macrocode}
664 \setplength{firstheadvpos}{%
665 %<DIN|DINmoretext|SN|SwissLeft> 8mm}
666 %<KOMAold> 6mm}
667 %<NF> 15mm}
668 %<USletter2w> .36in}
669 %<UScommercial9|UScommercial9DW> .4375in}
670 %</!5008>
671 %<*5008>
672 \setplength{firstheadhpos}{%
673 \dimexpr \useplength{toaddrhpos}+\useplength{toaddrindent}}
674 %</5008>
675 \setplength{firstheadwidth}{%
676 %<KOMAold> \textwidth}
677 %<NF> 170mm}
678 %<*DIN|DINmoretext|SN|SwissLeft|UScommercial9>
679 \paperwidth}
680 \ifdim \useplength{toaddrhpos}>\z@
681 \addtoplength[-2]{firstheadwidth}{\useplength{toaddrhpos}}
682 \else
683 \addtoplength[2]{firstheadwidth}{\useplength{toaddrhpos}}
684 \fi
685 %</DIN|DINmoretext|SN|SwissLeft|UScommercial9>
686 %<5008> \dimexpr 125mm-\useplength{firstheadhpos}}
687 %<*USletter2w>
688 \paperwidth}
689 \addtoplength[-]{firstheadwidth}{.68in}
690 %</USletter2w>
691 %<*UScommercial9DW>
692 \paperwidth}
693 \addtoplength[-]{firstheadwidth}{.25in}
694 %</UScommercial9DW>
695 % \end{macrocode}
696 % \end{pseudolength}
697 % \begin{pseudolength}{firstfootwidth,firstfootvpos}
698 % \changes{v2.9u}{2005/03/05}{optional the footer is placed 16\,mm above the
699 % lower paper edge}
700 % \begin{macrocode}
701 %<!5008>\setplength{firstfootwidth}{\useplength{firstheadwidth}}
702 %<*5008>
703 \setplength{firstfoothpos}{%
704 \dimexpr\useplength{toaddrhpos}+\useplength{toaddrindent}}%
705 \setplength{firstfootwidth}{%
706 \dimexpr \paperwidth-\useplength{toaddrhpos}-\useplength{firstfoothpos}}%
707 %</5008>
708 %<KOMAold>\setplength{firstfootvpos}{\paperheight}
709 %<KOMAold>\addtoplength{firstfootvpos}{-2cm}
710 %<!KOMAold&!NF>\setplength{firstfootvpos}{\paperheight}
711 %<!KOMAold&!NF>\addtoplength{firstfootvpos}{-16mm}
712 %<!KOMAold&!NF>\scr@ifundefinedorrelax{scr@v@is@le}{}{%
713 %<!KOMAold&!NF> \expandafter\ifnum \scr@v@is@le{2.9t}\relax\else
714 %<!KOMAold&!NF> \setplength{firstfootvpos}{1in}%
715 %<!KOMAold&!NF> \addtoplength{firstfootvpos}{\topmargin}%
716 %<!KOMAold&!NF> \addtoplength{firstfootvpos}{\headheight}%
717 %<!KOMAold&!NF> \addtoplength{firstfootvpos}{\headsep}%
718 %<!KOMAold&!NF> \addtoplength{firstfootvpos}{\textheight}%
719 %<!KOMAold&!NF> \addtoplength{firstfootvpos}{\footskip}%
720 %<!KOMAold&!NF> \fi
721 %<!KOMAold&!NF>}%
722 %<NF>\setplength{firstfootvpos}{266.679mm}
723 % \end{macrocode}
724 % \end{pseudolength}
725 % \begin{pseudolength}{refvpos,refaftervskip,refwidth}
726 % \begin{macrocode}
727 %<!(5008&B)>\setplength{refvpos}{%
728 %<DIN|SN> 98.5mm}
729 %<DINmoretext> 80.5mm}
730 %<5008&A> 79.4mm}
731 %<SwissLeft> 89mm}
732 %<KOMAold> 89.5mm}
733 %<NF> \useplength{tfoldmarkvpos}}
734 %<USletter2w> 3.1in}
735 %<UScommercial9|UScommercial9DW> 3.4375in}
736 \setplength{refaftervskip}{%
737 %<!KOMAold&!5008> \baselineskip}
738 %<KOMAold> 2\baselineskip}
739 %<5008> 8.46mm}
740 %<*!5008>
741 % \end{macrocode}
742 % The width of the reference line is somehow special, because setting of
743 % option \opt{refline=wide} or \opt{refline=narrow} should be possible after
744 % loading a \file{lco} file. So we use the initial special value 0 and
745 % calculate it inside \cs{opening} if it is still 0.
746 % \begin{macrocode}
747 \setplength{refwidth}{0pt}
748 % \end{macrocode}
749 % \end{pseudolength}
750 % \begin{pseudolength}{sigindent,sigbeforevskip}
751 % \begin{macrocode}
752 \setplength{sigindent}{0mm}
753 \setplength{sigbeforevskip}{2\baselineskip}
754 %<DIN|DINmoretext|SN|SwissLeft>\let\raggedsignature=\centering
755 %<KOMAold|NF|USletter2w|UScommercial9|UScommercial9DW>\let\raggedsignature=\raggedright
756 % \end{macrocode}
757 % \end{pseudolength}
758 % \begin{macro}{\scr@default@firsthead@fromaddress@hook}
759 % \changes{v3.13b}{2014/04/02}{added}
760 % \changes{v3.27}{2019/04/02}{removed}
761 % \end{macro}
762 %
763 % \begin{command}{\yourref,\yourmail,\myref,\customer,\invoice,\defaultfields,
764 % \toname,\toaddress,\branch,\signature,\fromsig,\name,
765 % \fromname,\location,\fromlocation,\backaddress,
766 % \frombackaddress,\telephone,\telephonenum,\specialmail,
767 % \title,\subject,\place,\fromplace,\ccnameseparator,
768 % \enclnameseparator,\foldmarkson,\foldmarksoff,\addrfieldon,
769 % \addrfieldoff,\subjecton,\subjectoff,\subjectafteron,
770 % \subjectafteroff}
771 % \begin{macro}{\@title,\@subject}
772 % \begin{variable}{refitemi,refitemii,refitemiii,branch}
773 % We have also to do the compatibility commands and variables for
774 % \file{KOMAold.lco}.
775 % \begin{macrocode}
776 %<*KOMAold>
777 \def\yourref{\setkomavar{yourref}}
778 \def\yourmail{\setkomavar{yourmail}}
779 \def\myref{\setkomavar{myref}}
780 \def\customer{\setkomavar{customer}}
781 \def\invoice{\setkomavar{invoice}}
782 \@ifundefined{scr@refitemi@var}{\newkomavar{refitemi}}{}
783 \def\refitemi{\setkomavar{refitemi}}
784 \def\refitemnamei{\setkomavar*{refitemi}}
785 \@ifundefined{scr@refitemii@var}{\newkomavar{refitemii}}{}
786 \def\refitemii{\setkomavar{refitemii}}
787 \def\refitemnameii{\setkomavar*{refitemii}}
788 \@ifundefined{scr@refitemiii@var}{\newkomavar{refitemiii}}{}
789 \def\refitemiii{\setkomavar{refitemiii}}
790 \def\refitemnameiii{\setkomavar*{refitemiii}}
791 \l@addto@macro{\defaultreffields}{%
792 \addtoreffields{refitemi}%
793 \addtoreffields{refitemii}%
794 \addtoreffields{refitemiii}%
795 }
796 \addtoreffields{refitemi}%
797 \addtoreffields{refitemii}%
798 \addtoreffields{refitemiii}%
799 \def\toname{\usekomavar{toname}}
800 \def\toaddress{\usekomavar{toaddress}}
801 \@ifundefined{scr@branch@var}{\newkomavar{branch}}{}
802 \def\branch{\setkomavar{branch}}
803 \def\frombranch{\usekomavar{branch}}
804 \def\signature{\setkomavar{signature}}
805 \def\fromsig{\usekomavar{signature}}
806 \def\name{\setkomavar{fromname}}
807 \def\fromname{\usekomavar{fromname}}
808 \def\address{\setkomavar{fromaddress}}
809 \def\fromaddress{\usekomavar{fromaddress}}
810 \def\location{\setkomavar{location}}
811 \def\fromlocation{\usekomavar{location}}
812 \def\backaddress{\setkomavar{backaddress}}
813 % \end{macrocode}
814 % \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
815 % \cs{Ifkomavarempty}}
816 % Note: This is dangerous if someone uses a new \KOMAScript{} but copies the
817 % wrong code.
818 % \begin{macrocode}
819 \def\@tempa{%
820 \Ifkomavarempty{fromname}{}{%
821 \strut\ignorespaces\usekomavar{fromname}%
822 \Ifkomavarempty{fromaddress}{}{\\}}%
823 \Ifkomavarempty{fromaddress}{}{%
824 \strut\ignorespaces\usekomavar{fromaddress}}%
825 }
826 \ifx\@tempa\scr@backaddress@var%
827 \setkomavar{backaddress}{}
828 \else
829 \def\@tempa{%
830 \ifkomavarempty{fromname}{}{%
831 \strut\ignorespaces\usekomavar{fromname}%
832 \ifkomavarempty{fromaddress}{}{\\}}%
833 \ifkomavarempty{fromaddress}{}{%
834 \strut\ignorespaces\usekomavar{fromaddress}}%
835 }
836 \ifx\@tempa\scr@backaddress@var%
837 \setkomavar{backaddress}{}
838 \fi
839 \fi
840 \def\frombackaddress{\usekomavar{backaddress}}
841 \def\telephone{\setkomavar{fromphone}}
842 \def\telephonenum{\usekomavar{fromphone}}
843 \def\specialmail{\setkomavar{specialmail}}
844 \def\@specialmail{\usekomavar{specialmail}}
845 \def\title{\setkomavar{title}}
846 \def\@title{\usekomavar{title}}
847 \def\subject{\setkomavar{subject}}
848 \def\@subject{\usekomavar{subject}}
849 \def\place{\setkomavar{place}}
850 \def\fromplace{\usekomavar{place}}
851 \let\ccnameseparator=\scr@ccseparator@var
852 \setkomavar{ccseparator}{\ccnameseparator}
853 \let\enclnameseparator=\scr@enclseparator@var
854 \setkomavar{enclseparator}{\enclnameseparator}
855 \setkomafont{fromname}{\scshape}
856 \def\foldmarkson{\@ObsoleteCommand{\foldmarkson}{foldmarks=on}}
857 \def\foldmarksoff{\@ObsoleteCommand{\foldmarksoff}{foldmarks=off}}
858 \def\addrfieldon{\@ObsoleteCommand{\addrfieldon}{addrfield=on}}
859 \def\addrfieldoff{\@ObsoleteCommand{\addrfieldoff}{addrfield=off}}
860 \def\subjecton{\@ObsoleteCommand{\subjecton}{subject=titled}}
861 \def\subjectoff{\@ObsoleteCommand{\subjectoff}{subject=untitled}}
862 \def\subjectafteron{%
863 \@ObsoleteCommand{\subjectafteron}{subject=afteropening}}
864 \def\subjectafteroff{%
865 \@ObsoleteCommand{\subjectafteroff}{subject=beforeopening}}
866 %</KOMAold>
867 % \end{macrocode}
868 % \end{variable}
869 % \end{macro}
870 % \end{command}
871 %
872 %
873 % \begin{pseudolength}{specialmailheight}
874 % \begin{macro}{\@PapersizeWarning}
875 % For \file{DIN5008a.lco} and \file{DIN5008b.lco} we need additional settings:
876 % \changes{v3.30}{2020/02/25}{white spaces and end of warning removed}
877 % \begin{macrocode}
878 %</!5008>
879 %<*5008>
880 \newplength{specialmailheight}
881 \setplength{specialmailheight}{12.7mm}
882 \areaset[5mm]{165mm}{233mm}
883 \KOMAoptions{%
884 fromalign=locationleft,
885 addrfield=topaligned,
886 refline=narrow,
887 parskip=full
888 }
889 \l@addto@macro\@PapersizeWarning{%
890 \begingroup
891 \@tempswafalse
892 \ifdim\oddsidemargin<\dimexpr 25mm-1in-1pt\relax\@tempswatrue\else
893 \ifdim\oddsidemargin>\dimexpr 25mm-1in+1pt\relax\@tempswatrue\fi\fi
894 \ifdim\textwidth<\dimexpr \paperwidth-45mm-1pt\relax\@tempswatrue\else
895 \ifdim\textwidth>\dimexpr \paperwidth-45mm+1pt\relax\@tempswatrue\fi\fi
896 \if@tempswa
897 \LCOWarning{DIN5008%
898 %<A> A%
899 %<B> B%
900 }{%
901 DIN5008 orders exact margins and text\MessageBreak
902 width. Without following these values,\MessageBreak
903 your document does not conform DIN5008.\MessageBreak
904 You should use, e.g.,\MessageBreak
905 \space\string\areaset[5mm]{%
906 \the\dimexpr \paperwidth-45mm\relax}{%
907 \the\dimexpr 1.414\dimexpr \paperwidth-45mm\relax\relax}\MessageBreak
908 to follow the norm%
909 }%
910 \fi
911 \ifdim \dimexpr\parskip\relax=\dimexpr\baselineskip\relax\else
912 \LCOWarning{DIN5008%
913 %<A> A%
914 %<B> B%
915 }{%
916 DIN5008 orders paragraph separation by\MessageBreak
917 exactly one line. Without this, your\MessageBreak
918 document does not conform DIN5008.\MessageBreak
919 You shoud use, e.g.,\MessageBreak
920 \space\string\KOMAoption{parskip}{full}\MessageBreak
921 to follow the norm%
922 }%
923 \fi
924 \endgroup
925 }
926 % \end{macrocode}
927 % \end{macro}
928 % \end{pseudolength}
929 % \begin{macro}{\backaddr@format}
930 % \changes{v3.25}{2017/11/15}{using \cs{scr@endstrut} instead of
931 % \cs{unskip}\cs{strut}}
932 % Multi line back address without underline.
933 % \begin{macrocode}
934 \renewcommand{\backaddr@format}[1]{\hspace*{\useplength{toaddrindent}}%
935 \parbox[t][\useplength{backaddrheight}][t]%
936 {\dimexpr\useplength{toaddrwidth}-\useplength{toaddrindent}}%
937 {\strut\ignorespaces #1\ifhmode\scr@endstrut\fi}%
938 }
939 % \end{macrocode}
940 % \end{macro}
941 % \begin{macro}{\specialmail@format}
942 % \changes{v3.25}{2017/11/15}{using \cs{scr@endstrut} instead of
943 % \cs{unskip}\cs{strut}}
944 % Multi line special sending.
945 % \begin{macrocode}
946 \renewcommand{\specialmail@format}[1]{%
947 \parbox[t][\useplength{specialmailheight}][t]%
948 {\dimexpr\useplength{toaddrwidth}
949 -\useplength{specialmailindent}
950 -\useplength{specialmailrightindent}}%
951 {\strut\ignorespaces #1\ifhmode\scr@endstrut\fi}%
952 }
953 % \end{macrocode}
954 % \end{macro}
955 % \begin{fontelement}{specialmail,backaddress,addressee,fromname,fromaddress,refvalue}
956 % Some font settings.
957 % \begin{macrocode}
958 \setkomafont{specialmail}{\sffamily\fontsize{10pt}{12pt}\selectfont}
959 \setkomafont{backaddress}{\sffamily\fontsize{8pt}{10pt}\selectfont}
960 \setkomafont{addressee}{\sffamily\fontsize{10pt}{12pt}\selectfont}
961 \setkomafont{fromname}{\sffamily\fontsize{10pt}{12pt}\selectfont}
962 \setkomafont{fromaddress}{\sffamily\fontsize{10pt}{12pt}\selectfont}
963 \setkomafont{refvalue}{\sffamily\fontsize{10pt}{12pt}\selectfont}
964 \let\raggedsignature\raggedright
965 %</5008>
966 %</body&!visualize>
967 % \end{macrocode}
968 % \end{fontelement}
969 %
970 %
971 % \subsection{Visualizing several fields of a letter}
972 %
973 % These macros are using be \file{visualize.lco} only.
974 %
975 % It needs \pkg{eso-pic}.
976 % \changes{v3.18}{2015/06/03}{loading \textsf{eso-pic} always}
977 % \begin{macrocode}
978 %<*visualize&body>
979 \RequirePackage{eso-pic}
980 % \end{macrocode}
981 %
982 % \begin{command}{\showfields}
983 % \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}
984 % Command
985 % \begin{quote}
986 % \cs{showfields}\marg{field list}
987 % \end{quote}
988 % is used to visualize fields of the note paper. The \meta{field list} is a
989 % comma-separated list of field names. Unknown fields do not result in errors
990 % but warnings only. The visualization is done in the background using
991 % \pkg{eso-pic}. A visualized field cannot be un-visualized.
992 % \begin{macrocode}
993 \newcommand*{\showfields}[1]{%
994 \AtBeginLetter{%
995 \begingroup
996 \@for \@tempa:=#1\do{%
997 \scr@trim@spaces\@tempa
998 \ifx\@tempa\@empty\else
999 \@ifundefined{showfield@\@tempa}{%
1000 \LCOWarning{visualize}{Unknown field `\@tempa' ignored}%
1001 }{%
1002 \edef\@tempa{%
1003 \noexpand\AddToShipoutPicture*{%
1004 \noexpand\AtPageUpperLeft{%
1005 \noexpand\usekomafont{field}%
1006 \noexpand\@nameuse{showfield@\@tempa}%
1007 }%
1008 }%
1009 }\@tempa
1010 }%
1011 \fi
1012 }%
1013 \endgroup
1014 }%
1015 }
1016 % \end{macrocode}
1017 % \begin{fontelement}{field}
1018 % The element is used to change the color. Changing the font doesn't make sense.
1019 % \begin{macrocode}
1020 \newkomafont{field}{\normalcolor}
1021 % \end{macrocode}
1022 % \end{fontelement}
1023 % \end{command}
1024 %
1025 % \begin{command}{\showfield}
1026 % A single field is visualized using:
1027 % \begin{quote}
1028 % \cs{showfield}\marg{field name}
1029 % \end{quote}
1030 % This uses a macro \cs{showfield@\meta{field name}}. Usually fields are
1031 % rectangles. Such fields can be visualized always the same way using four
1032 % parameters: \meta{offset from left}, \meta{offset from top}, \meta{width},
1033 % \meta{height}. A negative \meta{height} means a minimum of -\meta{height}
1034 % but maybe more.
1035 %
1036 % \begin{macro}{\showfield@by@frame}
1037 % To show a field by a frame
1038 % \begin{quote}
1039 % \cs{showfield@by@frame}\marg{offset from left}\marg{offset from top}%
1040 % \marg{width}\marg{height}
1041 % \end{quote}
1042 % is used. If \meta{height} is negative, arrows of length -\meta{height} are
1043 % used and the frame bottom is omitted.
1044 % \begin{macrocode}
1045 \newcommand*{\showfield@by@frame}[4]{%
1046 \thinlines
1047 \ifdim #4<\z@
1048 \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(1,0){\LenToUnit{#3}}}%
1049 \setlength{\@tempdima}{\dimexpr #1+#3\relax}%
1050 \setlength{\@tempdimb}{#4}
1051 \put(\LenToUnit{#1},-\LenToUnit{#2}){%
1052 \vector(0,-1){\LenToUnit{-\@tempdimb}}}%
1053 \put(\LenToUnit\@tempdima,-\LenToUnit{#2}){%
1054 \vector(0,-1){\LenToUnit{-\@tempdimb}}}%
1055 \else
1056 \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(1,0){\LenToUnit{#3}}}%
1057 \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(0,-1){\LenToUnit{#4}}}%
1058 \setlength{\@tempdima}{\dimexpr #1+#3\relax}%
1059 \setlength{\@tempdimb}{\dimexpr #2+#4\relax}%
1060 \put(\LenToUnit\@tempdima,\LenToUnit{-\@tempdimb}){%
1061 \line(-1,0){\LenToUnit{#3}}}%
1062 \put(\LenToUnit\@tempdima,\LenToUnit{-\@tempdimb}){%
1063 \line(0,1){\LenToUnit{#4}}}%
1064 \fi
1065 }
1066 % \end{macrocode}
1067 % \end{macro}
1068 %
1069 % \begin{macro}{\showfield@by@edges}
1070 % To show a field by edge markers
1071 % \begin{quote}
1072 % \cs{showfield@by@edges}\marg{offset from left}\marg{offset from top}%
1073 % \marg{width}\marg{height}
1074 % \end{quote}
1075 % is used. If \meta{height} is negative the bottom markers are omitted.
1076 % \begin{macrocode}
1077 \newcommand*{\showfield@by@edges}[4]{%
1078 \thinlines
1079 \setlength{\@tempdima}{\dimexpr #1+#3\relax}%
1080 \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(1,0){\LenToUnit{\edgesize}}}%
1081 \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(0,-1){\LenToUnit{\edgesize}}}%
1082 \put(\LenToUnit{\@tempdima},-\LenToUnit{#2}){\line(-1,0){\LenToUnit{\edgesize}}}%
1083 \put(\LenToUnit{\@tempdima},-\LenToUnit{#2}){\line(0,-1){\LenToUnit{\edgesize}}}%
1084 \ifdim #4<\z@\else
1085 \setlength{\@tempdimb}{\dimexpr #2+#4\relax}%
1086 \put(\LenToUnit{#1},-\LenToUnit{\@tempdimb}){\line(1,0){\LenToUnit{\edgesize}}}%
1087 \put(\LenToUnit{#1},-\LenToUnit{\@tempdimb}){\line(0,1){\LenToUnit{\edgesize}}}%
1088 \put(\LenToUnit{\@tempdima},-\LenToUnit{\@tempdimb}){\line(-1,0){\LenToUnit{\edgesize}}}%
1089 \put(\LenToUnit{\@tempdima},-\LenToUnit{\@tempdimb}){\line(0,1){\LenToUnit{\edgesize}}}%
1090 \fi
1091 }
1092 % \end{macrocode}
1093 % \begin{command}{\edgesize}
1094 % The size of the edges is 1\,ex by default.
1095 % \begin{macrocode}
1096 \newcommand*{\edgesize}{1ex}
1097 % \end{macrocode}
1098 % \end{command}
1099 % \end{macro}
1100 %
1101 % \begin{macro}{\showfield@by@rule}
1102 % To show a field by a filled frame (without frame border)
1103 % \begin{quote}
1104 % \cs{showfield@by@rune}\marg{offset from left}\marg{offset from top}%
1105 % \marg{width}\marg{height}
1106 % \end{quote}
1107 % is used. The absolute value of \meta{height} is used.
1108 % \begin{macrocode}
1109 \newcommand*{\showfield@by@rule}[4]{%
1110 \ifdim #4<\z@
1111 \put(\LenToUnit{#1},-\LenToUnit{#2}){\rule[#4]{#3}{-#4}}%
1112 \else
1113 \put(\LenToUnit{#1},-\LenToUnit{#2}){\rule[-#4]{#3}{#4}}%
1114 \fi
1115 }
1116 % \end{macrocode}
1117 % \end{macro}
1118 %
1119 % \begin{command}{\showfield}
1120 % The default is to use a frame.
1121 % \begin{macrocode}
1122 \newcommand*{\showfield}{}
1123 \let\showfield\showfield@by@frame
1124 % \end{macrocode}
1125 % \end{command}
1126 %
1127 % \begin{command}{\setshowstyle}
1128 % But the default can changed using
1129 % \begin{quote}
1130 % \cs{setshowstyle}\marg{style}
1131 % \end{quote}
1132 % A warning (no error!) is reported if \cs{showfield@by@\meta{style}} does not
1133 % exist. In this case \meta{style} is \texttt{frame} again.
1134 % \begin{macrocode}
1135 \newcommand*{\setshowstyle}[1]{%
1136 \@ifundefined{showfield@by@#1}{%
1137 \LCOWarning{visualize}{Unknown show type `#1'.\MessageBreak
1138 You should simply set one of the supported\MessageBreak
1139 show types `frame', `edges', `rule'.\MessageBreak
1140 Style `frame' will be used instead}%
1141 \let\showfield\showfield@by@frame
1142 }{%
1143 \expandafter\let\expandafter\showfield\csname showfield@by@#1\endcsname
1144 }%
1145 }
1146 % \end{macrocode}
1147 % \end{command}
1148 % \end{command}
1149 %
1150 % Currently following fields are available:
1151 % \begin{macro}{\showfield@test}
1152 % \texttt{test} is a test field with coordinates:
1153 % $(1\,\mathrm{cm},1\,\mathrm{cm})\times(10\,\mathrm{cm},15\,\mathrm{cm})$
1154 % \begin{macrocode}
1155 \newcommand*{\showfield@test}{%
1156 \showfield{1cm}{1cm}{10cm}{15cm}%
1157 }
1158 % \end{macrocode}
1159 % \end{macro}
1160 % \begin{macro}{\showfield@head}
1161 % \changes{v3.05}{2009/11/09}{using \plen{firstheadhpos}}
1162 % \texttt{head} is the header of the note paper.
1163 % \begin{macrocode}
1164 \newcommand*{\showfield@head}{%
1165 \ifdim\useplength{firstheadhpos}<\paperwidth
1166 \ifdim \useplength{firstheadhpos}>-\paperwidth
1167 \ifdim \useplength{firstheadhpos}<\z@
1168 \setlength\@tempskipa{\paperwidth}%
1169 \addtolengthplength{\@tempskipa}{firstheadhpos}%
1170 \addtolengthplength[-]{\@tempskipa}{firstheadwidth}%
1171 \else
1172 \setlength{\@tempskipa}{\useplength{firstheadhpos}}%
1173 \fi
1174 \else
1175 \setlength\@tempskipa{\oddsidemargin}%
1176 \addtolength\@tempskipa{1in}%
1177 \fi
1178 \else
1179 \setlength\@tempskipa{.5\paperwidth}%
1180 \addtolengthplength[-.5]{\@tempskipa}{firstheadwidth}%
1181 \fi
1182 \showfield{\@tempskipa}%
1183 {\useplength{firstheadvpos}}%
1184 {\useplength{firstheadwidth}}%
1185 {-\headheight}%
1186 }
1187 % \end{macrocode}
1188 % \end{macro}
1189 % \begin{macro}{\showfield@foot}
1190 % \changes{v3.05}{2009/11/09}{using \plen{firstfoothpos}}
1191 % \texttt{foot} is the footer of the note paper.
1192 % \begin{macrocode}
1193 \newcommand*{\showfield@foot}{%
1194 \ifdim\useplength{firstfoothpos}<\paperwidth
1195 \ifdim \useplength{firstfoothpos}>-\paperwidth
1196 \ifdim \useplength{firstfoothpos}<\z@
1197 \setlength\@tempskipa{\paperwidth}%
1198 \addtolengthplength{\@tempskipa}{firstfoothpos}%
1199 \addtolengthplength[-]{\@tempskipa}{firstfootwidth}%
1200 \else
1201 \setlength{\@tempskipa}{\useplength{firstfoothpos}}%
1202 \fi
1203 \else
1204 \setlength\@tempskipa{\oddsidemargin}%
1205 \addtolength\@tempskipa{1in}%
1206 \fi
1207 \else
1208 \setlength\@tempskipa{.5\paperwidth}%
1209 \addtolengthplength[-.5]{\@tempskipa}{firstfootwidth}%
1210 \fi
1211 \showfield{\@tempskipa}%
1212 {\useplength{firstfootvpos}}%
1213 {\useplength{firstfootwidth}}%
1214 {-\baselineskip}%
1215 }
1216 % \end{macrocode}
1217 % \end{macro}
1218 % \begin{macro}{\showfield@address}
1219 % \changes{v3.07a}{2011/01/10}{implementation adapted for change in
1220 % \cls*{scrlttr2} 3.03b}
1221 % \texttt{address} is the address field of the addressee.
1222 % \begin{macrocode}
1223 \newcommand*{\showfield@address}{%
1224 \setlengthtoplength{\@tempskipa}{toaddrhpos}%
1225 \ifdim \@tempskipa<\z@
1226 \addtolength{\@tempskipa}{\paperwidth}%
1227 \addtolengthplength[-]{\@tempskipa}{toaddrwidth}%
1228 \fi
1229 \showfield{\@tempskipa}{\useplength{toaddrvpos}}%
1230 {\useplength{toaddrwidth}}%
1231 {\dimexpr\useplength{toaddrheight}\relax}%
1232 }
1233 % \end{macrocode}
1234 % \end{macro}
1235 % \begin{macro}{\showfield@location}
1236 % \changes{v3.07a}{2011/01/10}{implementation adapted for change in
1237 % \cls*{scrlttr2} 3.03b}
1238 % \texttt{location} is the field with extra information about the sender.
1239 % \begin{macrocode}
1240 \newcommand*{\showfield@location}{%
1241 \begingroup
1242 \ifdim \useplength{locwidth}=\z@%
1243 \setplength{locwidth}{\paperwidth}%
1244 \ifdim \useplength{toaddrhpos}>\z@
1245 \addtoplength[-2]{locwidth}{\useplength{toaddrhpos}}%
1246 \else
1247 \addtoplength[2]{locwidth}{\useplength{toaddrhpos}}%
1248 \fi
1249 \addtoplength[-1]{locwidth}{\useplength{toaddrwidth}}%
1250 \if@bigloc%
1251 \setplength[.66667]{locwidth}{\useplength{locwidth}}%
1252 \else%
1253 \setplength[.5]{locwidth}{\useplength{locwidth}}%
1254 \fi%
1255 \fi%
1256 \ifdim \useplength{lochpos}=\z@%
1257 \setplength{lochpos}{\useplength{toaddrhpos}}%
1258 \fi
1259 \ifdim \useplength{locvpos}=\z@%
1260 \setplength{locvpos}{\useplength{toaddrvpos}}%
1261 \fi
1262 \ifdim \useplength{locheight}=\z@%
1263 \setplength{locheight}{\useplength{toaddrheight}}%
1264 \fi
1265 \setlengthtoplength[-]{\@tempskipa}{lochpos}%
1266 \ifdim \@tempskipa<\z@
1267 \addtolength{\@tempskipa}{\paperwidth}%
1268 \else
1269 \addtolengthplength{\@tempskipa}{locwidth}%
1270 \fi
1271 \addtolengthplength[-]{\@tempskipa}{locwidth}%
1272 \showfield{\@tempskipa}{\useplength{locvpos}}%
1273 {\useplength{locwidth}}{\useplength{locheight}}%
1274 \endgroup
1275 }
1276 % \end{macrocode}
1277 % \end{macro}
1278 % \begin{macro}{\showfield@refline}
1279 % \texttt{refline} is the reference line.
1280 % \begin{macrocode}
1281 \newcommand*{\showfield@refline}{%
1282 \begingroup
1283 \ifdim\useplength{refwidth}=\z@
1284 \if@refwide
1285 \setplength{refwidth}{\paperwidth}%
1286 \ifdim \useplength{toaddrhpos}>\z@
1287 \setplength{refhpos}{\useplength{toaddrhpos}}%
1288 \else
1289 \setplength[-]{refhpos}{\useplength{toaddrhpos}}%
1290 \fi
1291 \addtoplength[-2]{refwidth}{\useplength{refhpos}}%
1292 \else
1293 \setplength{refwidth}{\textwidth}%
1294 \setplength{refhpos}{\oddsidemargin}%
1295 \addtoplength{refhpos}{1in}%
1296 \fi
1297 \else\ifdim\useplength{refhpos}=\z@
1298 \begingroup
1299 \setlength\@tempdima{\textwidth}%
1300 \addtolengthplength[-]{\@tempdima}{refwidth}%
1301 \setlength\@tempdimb{\oddsidemargin}%
1302 \addtolength\@tempdimb{1in}%
1303 \setlength{\@tempdimc}{\paperwidth}%
1304 \addtolength{\@tempdimc}{-\textwidth}%
1305 \divide\@tempdimb by 32768\relax
1306 \divide\@tempdimc by 32768\relax
1307 \ifdim\@tempdimc=\z@\else
1308 \multiply\@tempdima by\@tempdimb
1309 \divide\@tempdima by\@tempdimc
1310 \fi
1311 \edef\@tempa{\noexpand\endgroup
1312 \noexpand\setplength{refhpos}{\the\@tempdima}}%
1313 \@tempa
1314 \fi\fi
1315 \showfield{\useplength{refhpos}}{\useplength{refvpos}}%
1316 {\useplength{refwidth}}{-1.5\baselineskip}%
1317 \endgroup
1318 }
1319 % \end{macrocode}
1320 % \end{macro}
1321 %
1322 % \begin{command}{\showenvelope}
1323 % \begin{macro}{\@showenvelope}
1324 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
1325 % \cs{kernel@ifnextchar}}
1326 % \begin{macro}{\@@showenvelope,\@@@showenvelope}
1327 % \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
1328 % \cs{kernel@ifnextchar}}
1329 % \changes{v3.18}{2015/06/03}{always loading \pkg{graphicx}}
1330 % We can also visualize an envelope. Here are several parameters needed.
1331 % \begin{quote}
1332 % \cs{showenvelope}\marg{width}\marg{height}\marg{hoffset}\marg{voffset}%
1333 % \marg{commands}
1334 % \end{quote}
1335 % The envelope is shown in portrait format at the current page. Package
1336 % \pkg{graphicx} is used. The \meta{hoffset} is the horizontal distance of the
1337 % note paper from the left and right edge of the envelope. The \meta{voffset}
1338 % is the same for the top and bottom edge. The \meta{commands} is extra code
1339 % to show the some elements.
1340 % \begin{macrocode}
1341 \RequirePackage{graphicx}
1342 \newcommand*{\showenvelope}{}
1343 \newcommand*{\@@showenvelope}{}
1344 \newcommand*{\@@@showenvelope}{}
1345 \def\showenvelope(#1,#2){%
1346 \kernel@ifnextchar (%)
1347 {\@showenvelope({#1},{#2})}%
1348 {\@@@showenvelope({#1},{#2})}%
1349 }
1350 \def\@@@showenvelope(#1,#2){%
1351 \begingroup
1352 \def\@tempa{\endgroup}%
1353 \ifdim \paperwidth>#1\relax
1354 \LCOWarning{visualize}{%
1355 \string\paperwidth\space > envelope width not supported}%
1356 \else
1357 \ifdim \paperheight>#2\relax
1358 \ifdim .5\paperheight>#2\relax
1359 \expandafter\ifdim \useplength{tfoldmarkvpos}>#2\relax
1360 \LCOWarning{visualize}{%
1361 tfoldmarkvpos > envelope height not supported}%
1362 \else
1363 \def\@tempa{\endgroup
1364 \@showenvelope({#1},{#2})%
1365 ({\dimexpr (#1-\paperwidth)/2\relax},%
1366 {\dimexpr (#2-\expandafter\dimexpr
1367 \useplength{tfoldmarkvpos}\relax)%
1368 /2\relax})%
1369 }%
1370 \fi
1371 \else
1372 \def\@tempa{\endgroup
1373 \@showenvelope({#1},{#2})%
1374 ({\dimexpr (#1-\paperwidth)/2\relax},%
1375 {\dimexpr (#2-.5\paperheight)/2\relax})%
1376 }%
1377 \fi
1378 \else
1379 \def\@tempa{\endgroup
1380 \@showenvelope({#1},{#2})%
1381 ({\dimexpr (#1-\paperwidth)/2\relax},%
1382 {\dimexpr (#2-\paperheight)/2\relax})%
1383 }%
1384 \fi
1385 \fi
1386 \@tempa
1387 }
1388 \def\@showenvelope(#1,#2)(#3,#4){%
1389 \kernel@ifnextchar [%]
1390 {\@@showenvelope({#1},{#2})({#3},{#4})}%
1391 {\@@showenvelope({#1},{#2})({#3},{#4})[]}%
1392 }
1393 \def\@@showenvelope(#1,#2)(#3,#4)[#5]{%
1394 % \end{macrocode}
1395 % \begin{macrocode}
1396 \newpage
1397 \vspace*{\fill}
1398 \rotatebox{90}{%
1399 \begin{picture}(0,0)
1400 \begin{picture}(\LenToUnit{#1},\LenToUnit{#2})(0,\LenToUnit{#2})
1401 \newcommand*{\PlusHOffset}[1]{%
1402 \dimexpr \expandafter\dimexpr ##1\relax + #3\relax
1403 }%
1404 \newcommand*{\MinusHOffset}[1]{%
1405 \dimexpr \expandafter\dimexpr ##1\relax - #3\relax
1406 }%
1407 \newcommand*{\PlusVOffset}[1]{%
1408 \dimexpr \expandafter\dimexpr ##1\relax + #4\relax
1409 }%
1410 \newcommand*{\MinusVOffset}[1]{%
1411 \dimexpr \expandafter\dimexpr ##1\relax - #4\relax
1412 }%
1413 \newcommand{\AtEnvelopeUpperLeft}[1]{%
1414 \put(\LenToUnit{\PlusHOffset\z@},\LenToUnit{\MinusVOffset{#2}}){##1}%
1415 }%
1416 \newcommand{\AtEnvelopeLowerLeft}[1]{%
1417 \put(\LenToUnit{\PlusHOffset\z@},\LenToUnit{\PlusVOffset\z@}){##1}%
1418 }%
1419 \newcommand{\AtEnvelopeUpperRight}[1]{%
1420 \put(\LenToUnit{\MinusHOffset{#1}},\LenToUnit{\MinusVOffset{#2}}){##1}%
1421 }%
1422 \newcommand{\AtEnvelopeLowerRight}[1]{%
1423 \put(\LenToUnit{\MinusHOffset{#1}},\LenToUnit{\PlusVOffset\z@}){##1}%
1424 }%
1425 \newcommand*{\measuredIFrame}{}%
1426 \def\measuredIFrame(##1,##2)(##3,##4){%
1427 \put(\LenToUnit{##1},\LenToUnit{##2}){%
1428 \measuredFrameLB({##3},{##4})%
1429 }%
1430 \put(\LenToUnit{\MinusHOffset\z@},%
1431 \LenToUnit{\dimexpr ##2-.5mm\relax}){%
1432 \measureLineHB{\PlusHOffset{##1}}%
1433 }%
1434 \put(\LenToUnit{\dimexpr ##1+##3\relax},%
1435 \LenToUnit{\dimexpr ##2-.5mm\relax}){%
1436 \measureLineHB{\dimexpr #1-%
1437 \PlusHOffset{\dimexpr ##1+##3\relax}\relax}%
1438 }%
1439 \put(\LenToUnit{\dimexpr ##1-.5mm\relax},%
1440 \LenToUnit{\dimexpr ##2+##4\relax}){%
1441 \measureLineVL{\PlusVOffset{\dimexpr -##2-##4\relax}}%
1442 }%
1443 \put(\LenToUnit{\dimexpr ##1-.5mm\relax},%
1444 \LenToUnit{\PlusVOffset{-#2}}){%
1445 \measureLineVL{\dimexpr #2-%
1446 \PlusVOffset{\dimexpr -##2\relax}\relax}%
1447 }%
1448 }%
1449 \put(0,0){%
1450 \thicklines
1451 \usekomafont{envelope}%
1452 \measuredFrameLB({#1},{#2})%
1453 }%
1454 \AtEnvelopeLowerLeft{%
1455 \usekomafont{letter}%
1456 \dashbox{\LenToUnit{1mm}}%
1457 (\LenToUnit{\MinusHOffset{\MinusHOffset{#1}}},%
1458 \LenToUnit{\MinusVOffset{\MinusVOffset{#2}}}){}%
1459 }%
1460 \expandafter\ifdim \useplength{toaddrhpos}<\z@
1461 \AtEnvelopeUpperLeft{%
1462 \thicklines
1463 \usekomafont{envelope}%
1464 \measuredIFrame(\expandafter\dimexpr \useplength{toaddrhpos}+
1465 \MinusHOffset{\MinusHOffset{#1}}\relax,%
1466 -\dimexpr %
1467 \expandafter\dimexpr\useplength{toaddrvpos}\relax
1468 +
1469 \expandafter
1470 \dimexpr\useplength{toaddrheight}\relax
1471 \relax)%
1472 (\useplength{toaddrwidth},\useplength{toaddrheight})%
1473 }%
1474 \else
1475 \AtEnvelopeUpperLeft{%
1476 \thicklines
1477 \usekomafont{envelope}%
1478 \measuredIFrame(\useplength{toaddrhpos},%
1479 -\dimexpr %
1480 \expandafter\dimexpr\useplength{toaddrvpos}\relax
1481 +
1482 \expandafter
1483 \dimexpr\useplength{toaddrheight}\relax
1484 \relax)%
1485 (\useplength{toaddrwidth},\useplength{toaddrheight})%
1486 }%
1487 \fi
1488 \AtEnvelopeUpperLeft{#5}%
1489 \end{picture}
1490 \end{picture}
1491 }%
1492 \newpage
1493 }
1494 % \end{macrocode}
1495 % \begin{fontelement}{envelope}
1496 % Used to change the color of the envelope frame (font changes do not make sense).
1497 % \begin{macrocode}
1498 \newkomafont{envelope}{\normalcolor}
1499 % \end{macrocode}
1500 % \end{fontelement}
1501 % \begin{fontelement}{letter}
1502 % Used to change the color of the dashed note paper inside the envelope (font
1503 % changes do not make sende).
1504 % \begin{macrocode}
1505 \newkomafont{letter}{\normalcolor}
1506 % \end{macrocode}
1507 % \end{fontelement}
1508 % \begin{command}{\unmeasuredFrame}
1509 % Show a frame without measuring.
1510 % \begin{macrocode}
1511 \newcommand*{\unmeasuredFrame}{}
1512 \def\unmeasuredFrame(#1,#2){%
1513 \put(0,0){\line(1,0){\LenToUnit{#1}}}%
1514 \put(\LenToUnit{#1},0){\line(0,1){\LenToUnit{#2}}}%
1515 \put(\LenToUnit{#1},\LenToUnit{#2}){\line(-1,0){\LenToUnit{#1}}}%
1516 \put(0,\LenToUnit{#2}){\line(0,-1){\LenToUnit{#2}}}%
1517 }
1518 % \end{macrocode}
1519 % \end{command}
1520 % \begin{command}{\measuredFrameLB,\measuredFrameLT,\measuredFrameRB,
1521 % \measuredFrameRT}
1522 % Show the measuring of a frame.
1523 % \begin{macrocode}
1524 \newcommand*{\measuredFrameLB}{}
1525 \def\measuredFrameLB(#1,#2){%
1526 \unmeasuredFrame({#1},{#2})%
1527 \put(\LenToUnit{-.5mm},0){\measureLineVL{#2}}%
1528 \put(0,\LenToUnit{-.5mm}){\measureLineHB{#1}}%
1529 }
1530 \newcommand*{\measuredFrameLT}{}
1531 \def\measuredFrameLT(#1,#2){%
1532 \unmeasuredFrame({#1},{#2})%
1533 \put(\LenToUnit{-.5mm},0){\measureLineVL{#2}}%
1534 \put(0,\LenToUnit{\expandafter\dimexpr #2+.5mm\relax}){\measureLineHT{#1}}%
1535 }
1536 \newcommand*{\measuredFrameRB}{}
1537 \def\measuredFrameRB(#1,#2){%
1538 \unmeasuredFrame({#1},{#2})%
1539 \put(\LenToUnit{\expandafter\dimexpr #1+.5mm\relax},0){\measureLineVR{#2}}%
1540 \put(0,\LenToUnit{-.5mm}){\measureLineHB{#1}}%
1541 }
1542 \newcommand*{\measuredFrameRT}{}
1543 \def\measuredFrameRT(#1,#2){%
1544 \unmeasuredFrame({#1},{#2})%
1545 \put(\LenToUnit{\expandafter\dimexpr #1+.5mm\relax},0){\measureLineVR{#2}}%
1546 \put(0,\LenToUnit{\expandafter\dimexpr #2+.5mm\relax}){\measureLineHT{#1}}%
1547 }
1548 % \end{macrocode}
1549 % \end{command}
1550 % \end{macro}
1551 % \end{macro}
1552 % \end{command}
1553 % \begin{command}{\measureLineV}
1554 % Vertical measuring without text.
1555 % \begin{macrocode}
1556 \newcommand*{\measureLineV}[1]{%
1557 \begin{picture}(0,0)
1558 \thinlines
1559 \usekomafont{measure}%
1560 \put(0,0){\vector(0,1){\LenToUnit{#1}}}%
1561 \put(0,\LenToUnit{#1}){\vector(0,-1){\LenToUnit{#1}}}%
1562 \end{picture}
1563 }
1564 % \end{macrocode}
1565 % \end{command}
1566 % \begin{command}{\measureLineVL,\measureLineVR}
1567 % Vertical measuring with text left or right of the line.
1568 % \begin{macrocode}
1569 \newcommand*{\measureLineVL}[1]{%
1570 \begin{picture}(0,0)
1571 \usekomafont{measure}%
1572 \put(0,0){\measureLineV{#1}}%
1573 \put(0,0){\makebox(0,\LenToUnit{#1})[r]{\ValPerUnit{#1}}}%
1574 \end{picture}
1575 }
1576 \newcommand*{\measureLineVR}[1]{%
1577 \begin{picture}(0,0)
1578 \usekomafont{measure}%
1579 \put(0,0){\measureLineV{#1}}%
1580 \put(0,0){\makebox(0,\LenToUnit{#1})[l]{\ValPerUnit{#1}}}%
1581 \end{picture}
1582 }
1583 % \end{macrocode}
1584 % \begin{command}{\ValPerUnit,\unitfactor}
1585 % Shows a length in \len{unitlength} with a accuracy of 1/\cs{unitfactor}.
1586 % \begin{macrocode}
1587 \newcommand*{\ValPerUnit}[1]{%
1588 \begingroup
1589 \setlength{\@tempdima}{%
1590 \dimexpr #1/(\unitlength/\unitfactor)*\p@/\unitfactor\relax
1591 }%
1592 \strip@pt\@tempdima
1593 \endgroup
1594 }
1595 \newcommand*{\unitfactor}{1}
1596 % \end{macrocode}
1597 % \end{command}
1598 % \begin{command}{\measureLineH}
1599 % Horizontal measuring without text.
1600 % \begin{macrocode}
1601 \newcommand*{\measureLineH}[1]{%
1602 \begin{picture}(0,0)
1603 \usekomafont{measure}%
1604 \put(0,0){\vector(1,0){\LenToUnit{#1}}}%
1605 \put(\LenToUnit{#1},0){\vector(-1,0){\LenToUnit{#1}}}%
1606 \end{picture}
1607 }
1608 % \end{macrocode}
1609 % \end{command}
1610 % \begin{command}{\measureLineHB,\measureLineHT}
1611 % Horizontal measuring with text below or above.
1612 % \begin{macrocode}
1613 \newcommand*{\measureLineHB}[1]{%
1614 \begin{picture}(0,0)
1615 \usekomafont{measure}%
1616 \put(0,0){\measureLineH{#1}}%
1617 \put(0,\LenToUnit{\dimexpr -\ht\strutbox-.5mm\relax}){%
1618 \makebox(\LenToUnit{#1},\LenToUnit{\baselineskip})[c]{\ValPerUnit{#1}}}%
1619 \end{picture}
1620 }
1621 \newcommand*{\measureLineHT}[1]{%
1622 \begin{picture}(0,0)
1623 \usekomafont{measure}%
1624 \put(0,0){\measureLineH{#1}}%
1625 \put(0,0){%
1626 \makebox(\LenToUnit{#1},\LenToUnit{\baselineskip})[c]{\ValPerUnit{#1}}}%
1627 \end{picture}
1628 }
1629 % \end{macrocode}
1630 % \end{command}
1631 % \begin{fontelement}{measure}
1632 % Used to change the color of a measuring line (font changes doe not make sense).
1633 % \begin{macrocode}
1634 \newkomafont{measure}{\normalcolor}
1635 % \end{macrocode}
1636 % \end{fontelement}
1637 % \end{command}
1638 %
1639 % \begin{command}{\showISOenvelope}
1640 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
1641 % Show a DIN/ISO C4, C5, DL=C5/6, or C6/5 envelope, depending on the argument.
1642 % \begin{macrocode}
1643 \newcommand*{\showISOenvelope}[1]{%
1644 \Ifstr{#1}{C4}{%
1645 \showenvelope(324mm,229mm)%
1646 }{%
1647 \Ifstr{#1}{C5}{%
1648 \showenvelope(229mm,162mm)%
1649 }{%
1650 \Ifstr{#1}{C5/6}{%
1651 \showenvelope(220mm,110mm)%
1652 }{%
1653 \Ifstr{#1}{DL}{%
1654 \showenvelope(220mm,110mm)%
1655 }{%
1656 \Ifstr{#1}{C6/5}{%
1657 \showenvelope(229mm,114mm)%
1658 }{%
1659 \Ifstr{#1}{C6}{%
1660 \showenvelope(162mm,114mm)%
1661 }{%
1662 \LCOWarning{visualize}{envelope size `ISO #1' unsupported}%
1663 }%
1664 }%
1665 }%
1666 }%
1667 }%
1668 }%
1669 }
1670 % \end{macrocode}
1671 % \end{command}
1672 %
1673 % \begin{command}{\showUScommercial}
1674 % \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
1675 % Show a US commercial no. 9 or 10 envelope, depending on the argument.
1676 % \begin{macrocode}
1677 \newcommand*{\showUScommercial}[1]{%
1678 \Ifstr{#1}{9}{%
1679 \showenvelope(8.875in,3.875in)%
1680 }{%
1681 \Ifstr{#1}{10}{%
1682 \showenvelope(9.5in,4.125in)%
1683 }{%
1684 \LCOWarning{visualize}{envelope size `US commercial #1' unsupported}%
1685 }%
1686 }%
1687 }
1688 % \end{macrocode}
1689 % \end{command}
1690 %
1691 % \begin{command}{\showUScheck}
1692 % Show a US check envelope.
1693 % \begin{macrocode}
1694 \newcommand*{\showUScheck}{%
1695 \showenvelope(8.625in,3.625in)%
1696 }
1697 %</visualize&body>
1698 % \end{macrocode}
1699 % \end{command}
1700 %
1701 %
1702 % \begin{command}{\showUSletterCixDW}
1703 % Show a Us commercial no. 9 envelope with two windows (this is defined in
1704 % \file{UScommercial9DW.lco} not in \file{visualize.lco}).
1705 % The sender window is $3\frac{1}{2}\,\mathrm{in}\times\frac{7}{8}\,\mathrm{in}$,
1706 % $\frac{5}{16}\,\mathrm{in}$ from the left and $2\frac{1}{2}\,\mathrm{in}$
1707 % from the bottom.
1708 % \begin{macrocode}
1709 %<*!visualize&UScommercial9DW&body>
1710 \newcommand*{\showUSletterCixDW}{%
1711 \showUScommercial9[{%
1712 \thicklines
1713 \usekomafont{envelope}%
1714 \measuredIFrame({\dimexpr (\paperwidth-
1715 \expandafter\dimexpr \useplength{firstheadwidth}\relax%
1716 )/2\relax},%
1717 -\expandafter\dimexpr\useplength{firstheadvpos}\relax)%
1718 (3.5in,.875in)%
1719 }]%
1720 }
1721 %</!visualize&UScommercial9DW&body>
1722 % \end{macrocode}
1723 % \end{command}
1724 %
1725 % \begin{macrocode}
1726 %</lco>
1727 % \end{macrocode}
1728 %
1729 % \Finale
1730 % \PrintChanges
1731 %
1732 \endinput
1733 % Local Variables:
1734 % mode: doctex
1735 % ispell-local-dictionary: "en_US"
1736 % eval: (flyspell-mode 1)
1737 % TeX-master: t
1738 % TeX-engine: luatex-dev
1739 % 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"))
1740 % End: