% \iffalse meta-comment
% ======================================================================
% scrkernel-letterclassoptions.dtx
% Copyright (c) Markus Kohm, 2006-2022
%
% This file is part of the LaTeX2e KOMA-Script bundle.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX 
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "author-maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of all files listed in MANIFEST.md.
% ======================================================================
%%% From File: $Id: scrkernel-letterclassoptions.dtx 3981 2022-11-09 10:07:16Z kohm $
%<option>%%%            (run: option)
%<head>%%%            (run: head)
%<body>%%%            (run: body)
%<*dtx>
\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
\begingroup
  \def\filedate$#1: #2-#3-#4 #5${\gdef\filedate{#2/#3/#4}}
  \filedate$Date: 2022-11-09 11:07:16 +0100 (Mi, 09. Nov 2022) $
  \def\filerevision$#1: #2 ${\gdef\filerevision{r#2}}
  \filerevision$Revision: 3981 $
\endgroup
\ProvidesFile{scrkernel-letterclassoptions.dtx}
             [\filedate\space \filerevision\space
              KOMA-Script source (letter configuration options)]
\documentclass[USenglish]{koma-script-source-doc}
\usepackage{babel}
\setcounter{StandardModuleDepth}{2}
\begin{document}
\DocInput{scrkernel-letterclassoptions.dtx}
\end{document}
%</dtx>
% \fi
%
% \changes{v2.95}{2006/03/22}{new by splitting \file{scrclass.dtx}}
% \changes{v3.36}{2022/02/26}{switch over from \cls*{scrdoc} to
%   \cls*{koma-script-source-doc}}
% \changes{v3.36}{2022/02/26}{\cs{@setplength} replaced by \cs{setplength}}
% \changes{v3.36}{2022/02/26}{\cs{@addtoplength} replaced by \cs{addtoplength}}
% \changes{v3.36}{2022/02/26}{\cs{@newplength} replaced by \cs{newplength}}
% \changes{v3.36}{2022/02/26}{whole implementation documentation in English}
%
%
% \GetFileInfo{scrkernel-letterclassoptions.dtx}
% \title{Handling and Implementation of Letter Configuration Options of
%   \href{https://komascript.de}{\KOMAScript} Letter Class and Package}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \date{Revision \fileversion{} of \filedate}
% \maketitle
% \begin{abstract}
%   The \KOMAScript{} letter class \cls*{scrlttt2} and the \KOMAScript{}
%   letter package \pkg*{scrletter} has something special: the letter
%   configuration option files formerly known as letter class option
%   files. These are used to setup either layouts or user configurations. Both
%   the implementation of these files and the handling of them can be found in
%   \file{scrkernel-letterclassoptions.dtx}.
% \end{abstract}
% \tableofcontents
%
% \section{User Manual}
%
% You can find the user documentation the commands and files implemented here
% in the \KOMAScript{} manual, either the German \file{scrguide} or the
% English \file{scrguien}.
% 
% \MaybeStop{\PrintIndex}
%
% \section{Implementation of the Handling of Letter Configuration Options}
%
% We need this feature only with letter classes and packages.
%
%    \begin{macrocode}
%<*(class|package)&letter>
%    \end{macrocode}
%
%
% \subsection{Options for the letter configuration option files}
%
% \begin{macro}{\lco@test}
% \changes{v2.95}{2006/03/22}{added}
% \changes{v2.97c}{2007/09/12}{modified for new option handling}
% \changes{v3.36}{2022/02/26}{deprecated}
% The \KOMAScript{} letter class \cls*{scrlttr2} allows to load a letter
% configuration option file by classic class options to \cs{documentclass},
% \cs{LoadClass} or \cs{PassOptionsToClass}. This is done inside via the
% general \cs{DeclareOption*}, that is used for several other deprecated (and
% some standard) options too. \cs{lco@test} simply tests, if
% \file{\CurrentOption.lco} does exist and in this case load it a the end of
% the class. Note: The \KOMAScript{} letter package \pkg*{scrletter} does not
% support loading of letter configuration option files via global or package
% option. Moreover, from \KOMAScript{} v3.36 loading via class option is also
% deprecated for \cls*{scrlttr2}.
%    \begin{macrocode}
%<*class&option>
\newcommand*{\lco@test}{%
  \IfFileExists{\CurrentOption.lco}{%
    \ClassWarningNoLine{\KOMAClassName}{%
      loading of LCO via class option
      `\CurrentOption'.\MessageBreak
      Note: Loading a LCO via class option is deprecated.\MessageBreak
      \space\space\space\space\space\space
      You should use
      `\string\LoadLetterOption\string{\CurrentOption\string}'\MessageBreak
      instead%
    }%
    \expandafter\AtEndOfClass\expandafter{%
      \expandafter\LoadLetterOption\expandafter{\CurrentOption}%
    }%
    \expandafter\def\expandafter\scr@pti@nerr@r\expandafter{%
      \expandafter\def\expandafter\scr@pti@nerr@r\expandafter{%
        \scr@pti@nerr@r
      }%
    }%
  }{}%
}
%</class&option>
%    \end{macrocode}
% \end{macro}
%
% \file{DIN.lco} is the default and therefore loaded first at the end of the
% class or package.
%    \begin{macrocode}
%<*option>
%<class>\AtEndOfClass
%<package>\AtEndOfPackage
  {\LoadLetterOption{DIN}}
%</option>
%    \end{macrocode}
%
%
% \subsection{Makros für Letter-Class-Options}
%
% \begin{command}{\LoadLetterOption}
% \changes{v2.8q}{2001/10/08}{added}
% \changes{v3.14}{2014/10/04}{ignoring white spaced}
% \changes{v3.26}{2018/08/29}{\cs{KV@@sp@def} replaced by \cs{scr@sp@def}}
% Command
% \begin{quote}
%   \cs{LoadLetterOption}\marg{letter configuration option}
% \end{quote}
% loads \file{\meta{letter configuration option}.lco}. The \cs{catcode} of
% ``|@|'' is changed to letter for loading the file. But because \file{lco}
% files can load other \file{lco} files using \cs{LoadLetterOption} this has
% to be reset only for the outer \cs{LoadLetterOption}.
% \begin{description}
% \item[ToDo:] can't we do this more simply just using either some
% \cs{expandafter} magic or an internal stack?
% \end{description}
%    \begin{macrocode}
%<*body>
\newcommand*{\LoadLetterOption}[1]{%
  \@ifundefined{@restore@catcode@level}%
    {\let\@restore@catcode@level=\z@}{}%
  \ifnum\@restore@catcode@level =\z@
    \ifnum\catcode`\@=11
      \let\@restore@catcode\relax
    \else
      \@tempcnta=\catcode`\@
      \edef\@restore@catcode{%
        \noexpand\catcode`\noexpand\@=\the\@tempcnta}%
      \makeatletter
    \fi
  \fi
  \@tempcnta=\@restore@catcode@level\relax
  \advance\@tempcnta by \@ne\relax
  \edef\@restore@catcode@level{\the\@tempcnta}%
  \scr@sp@def\reserved@a{#1}%
  \edef\reserved@a{%
    \noexpand\edef\noexpand\scr@currentlco{\reserved@a}%
%    \end{macrocode}
% \changes{v3.99}{2022/10/25}{local definition of \cs{scr@compatibility}}
% For compatibility of old \file{lco} files with \KOMAScript~4 we locally
% define \cs{scr@compatibility} to the highest possible number.
%    \begin{macrocode}
%<*v4>
    \ifdefined\scr@compatibility\else
      \noexpand\edef\noexpand\scr@compatibility{\the\maxdimen}%
    \fi
%</v4>
    \noexpand\InputIfFileExists{\reserved@a.lco}{%
%<class>      \noexpand\ClassInfo{scrlttr2}%
%<package>      \noexpand\PackageInfo{scrletter}%
      {Letter-Class-Option `#1' loaded}%
    }{%
%<class>      \noexpand\ClassError{scrlttr2}%
%<package>      \noexpand\PackageError{scrletter}%
      {%
        Letter-Class-Option file `#1.lco' not found%
      }{%
        You've told me to load the Letter-Class-Option `#1'. So I have
        to load\noexpand\MessageBreak
        the file `#1.lco'. But the file isn't available.}%
    }%
%<*v4>
    \ifdefined\scr@compatibility
      \noexpand\def\noexpand\scr@compatibility{\scr@compatibility}%
    \else
      \unexpanded{\let\scr@compatibility\undefined}%
    \fi
%</v4>
    \scr@ifundefinedorrelax{scr@currentlco}{%
      \unexpanded{\let\scr@currentlco\relax}%
    }{%
      \noexpand\def\noexpand\scr@currentlco{\scr@currentlco}%
    }%
  }%
%    \end{macrocode}
% \changes{v3.18}{2015/06/03}{manage \cs{RequirePackage} and \cs{usepackage}
%   inside \texttt{lco}-files after \cs{begin\{document\}}}
% \changes{v3.28}{2019/11/24}{\cs{usepackage} typo fixed}
% \begin{description}
% \item[ToDo:] I don't think, that the following really works. So maybe it
% should simple be removed to get the usual error message using
% \cs{RequirePackage} or \cs{usepackage} inside a document.
% \end{description}
%    \begin{macrocode}
  \if@atdocument
    \edef\reserved@a{%
      \unexpanded\expandafter{\reserved@a}%
      \ifx\RequirePackage\@notprerr
        \unexpanded{\let\RequirePackage\@notprerr}%
      \else
        \noexpand\def\noexpand\RequirePackage{%
          \unexpanded\expandafter{\RequirePackage}%
        }%
      \fi
      \ifx\usepackage\@notprerr
        \unexpanded{\let\usepackage\@notprerr}%
      \else
        \noexpand\def\noexpand\usepackage{%
          \unexpanded\expandafter{\usepackage}%
        }%
      \fi
    }%
    \let\RequirePackage\lco@RequirePackage
    \let\usepackage\lco@RequirePackage
    \expandafter\reserved@a
  \else \expandafter\reserved@a
  \fi
  \@tempcnta=\@restore@catcode@level\relax
  \advance\@tempcnta by \m@ne\relax
  \edef\@restore@catcode@level{\the\@tempcnta}%
  \ifnum\@tempcnta =\z@
    \@restore@catcode
  \fi
}
%    \end{macrocode}
% \begin{macro}{\lco@RequirePackage}
% \changes{v3.18}{2015/06/03}{added}
% \changes{v3.26}{2018/08/29}{\cs{KV@@sp@def} replaced by
%   \cs{scr@trim@spaces}}
% \begin{description}
% \item[ToDo:] See the note above.
% \end{description}
%    \begin{macrocode}
\newcommand*{\lco@RequirePackage}[2][]{%
  \begingroup
    \@for\reserved@a:=#2\do{%
      \scr@trim@spaces\reserved@a
      \scr@ifundefinedorrelax{ver@\reserved@a.\scr@pkgextension}{%
%<class>        \ClassError{\KOMAClassName}{%
%<package>        \PackageError{scrletter}{%
          lco-file `\scr@currentlco' can be used only in preamble%
        }{%
          The lco-file `\scr@currentlco' uses \string\RequirePackage\space or
          \string\usepackage\space to load\MessageBreak
          package `\reserved@a'. This means you have to either load
          `\reserved@a'\MessageBreak
          or lco-file `\scr@currentlco' in the document preamble.
        }%
      }{}%
    }%
  \endgroup
  \scr@gobbleopt
}
%    \end{macrocode}
% \end{macro}^^A \lco@RequirePackage
% \end{command}^^A \LoadLetterOption
%
% \begin{command}{\LoadLetterOptions}
% \changes{v3.14}{2014/10/04}{added}
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}
% \changes{v3.26}{2018/08/29}{special treatment of space entries not needed
%   any more}
% Similar to \cs{LoadLetterOption} but with \meta{list of letter configuration
% options} instead of a single \meta{letter configuration option}.
%    \begin{macrocode}
\newcommand*{\LoadLetterOptions}[1]{%
  \begingroup
    \def\reserved@a{\endgroup}%
    \@for\reserved@b:=#1\do{%
      \scr@trim@spaces\reserved@b
      \ifx\reserved@b\@empty\else
        \edef\reserved@a{\expandafter\unexpanded\expandafter{\reserved@a
            \LoadLetterOption}{\reserved@b}\relax}%
      \fi
    }%
  \reserved@a
}
%    \end{macrocode}
% \end{command}^^A \LoadLetterOptions
%
% \begin{command}{\LetterOptionNeedsPapersize}
%   \changes{v2.8q}{2001/10/17}{added}
% With
% \begin{quote}
%   \cs{LetterOptionNeedsPapersize}\marg{letter configuration
%   option}\marg{paper size}
% \end{quote}
% inside a \meta{letter configuration option} file we can define a \meta{paper
% size} to be used. This does not change the paper size, but adds a test to
% \cs{opening}, that warns if another paper size is used.
% \begin{macro}{\@PapersizeWarning}
% \changes{v2.8q}{2002/03/25}{added}
% \changes{v3.12}{2013/11/05}{differences of +/- 1\,mm are tolerated}
% \changes{v3.23}{2017/02/22}{using \cs{PaperNameToSize}}
% \begin{macro}{\@@PapersizeWarning,\LOPNP@size,\LOPNP@option}
% \changes{v2.8q}{2002/03/25}{added}
%    \begin{macrocode}
\newcommand*{\LOPNP@option}{}
\newcommand*{\LOPNP@size}{}
\newcommand*{\@PapersizeWarning}{%
  \begingroup%
    \edef\@tempc{\noexpand\@tempswafalse
      \noexpand\ifdim\paperwidth<\the\dimexpr\paperwidth-.1mm\relax
      \relax
      \noexpand\else
        \noexpand\ifdim\paperwidth>\the\dimexpr\paperwidth+.1mm\relax
        \relax
        \noexpand\else
          \noexpand\ifdim\paperheight<\the\dimexpr\paperheight-.1mm\relax
          \relax
          \noexpand\else
            \noexpand\ifdim\paperheight>\the\dimexpr\paperheight+.1mm\relax
            \relax
            \noexpand\else
              \noexpand\@tempswatrue
            \noexpand\fi
          \noexpand\fi
        \noexpand\fi
      \noexpand\fi
      \noexpand\@@PapersizeWarning
    }%
    \def\@tempb{letter}\ifx\LOPNP@size\@tempb%
      \setlength{\paperheight}{11in}\setlength{\paperwidth}{8.5in}%
    \else\def\@tempb{legal}\ifx\LOPNP@size\@tempb%
        \setlength{\paperheight}{14in}\setlength{\paperwidth}{8.5in}%
      \else\def\@tempb{executive}\ifx\LOPNP@size\@tempb%
          \setlength{\paperheight}{10.5in}\setlength{\paperwidth}{7.25in}%
        \else%
          \PaperNameToSize[letter]{\LOPNP@size}%
        \fi 
      \fi
    \fi
    \@tempc
  \endgroup%
}
%<class>\AfterPackage*{typearea}{%
\ProvideUnknownPaperSizeError{letter}{%
%<class>  \ClassError{scrlttr2}{%
%<package>  \PackageError{scrletter}{%
    papersize `\LOPNP@size' undefined}{%
    You've told me to check for paper size
    `\LOPNP@size'\MessageBreak
    at letter option file `\LOPNP@option.lco',\MessageBreak
    but this paper size is not supported.\MessageBreak
    See the KOMA-Script manual for informations about known
    paper sizes.}%
}
%<class>}
\newcommand*{\@@PapersizeWarning}{%
  \if@tempswa\else%
%<class>  \ClassWarningNoLine{scrlttr2}%
%<package>  \PackageWarningNoLine{scrletter}%
    {%
      Letter option file `\LOPNP@option.lco'\MessageBreak
      needs paper size `\LOPNP@size'.\MessageBreak
      Current paper size is not `\LOPNP@size'!\MessageBreak
      \scr@ifundefinedorrelax{KOMAClassName}{%
        You should load package `typearea' either\MessageBreak
        with option `paper=\LOPNP@size,paper=portrait' or
        additionally\MessageBreak
      }{%
        You should add `paper=\LOPNP@size,paper=portrait' at the\MessageBreak
        option list of `\string\documentclass' or\MessageBreak
      }%
      add `\string\KOMAoptions{paper=\LOPNP@size,paper=portrait}'\MessageBreak
      before starting this letter!\MessageBreak
      Maybe you know what you are doing,\MessageBreak
      so I do not change this myself%
    }%
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\newcommand*{\LetterOptionNeedsPapersize}[2]{%
  \edef\LOPNP@size{#2}\edef\LOPNP@option{#1}%
}
%</body>
%    \end{macrocode}
% \end{command}
%
%    \begin{macrocode}
%</(class|package)&letter>
%    \end{macrocode}
% 
% \section{Implementation of the Letter Configuration Option Files}
%
% Most of the predefined letter configuration option files define a letter
% layout, e.g, depending on a norm. The main thing in this case is to setup
% pseudo-lengths. Sometimes additionally macros or commands are (re-)defined.
%
%    \begin{macrocode}
%<*lco>
%    \end{macrocode}
% 
% \subsection{The file header}
%
% The head has to identify the file:
% \changes{v3.04}{2009/04/21}{\file{NF.lco} by Jean-Marie Pacquet added}
% \changes{v3.04}{2009/06/26}{\file{USletter2w.lco} with contribution of
%   Engelbert Buxbaum and Richard Ar\`es}
% \changes{v3.04}{2009/06/29}{\file{UScommercial9DW-lco} for paper formats
%   letter or legal and envelopes with format no.\,9 with two windows}
% \changes{v3.04}{2009/06/30}{\file{UScommercial9} for paper formats
%   letter or legal and envelopes with format commercial No.\,9 with one
%   window based on \url{http://www.envelopesuperstore.com/}}
% \changes{v3.04}{2009/06/26}{long existing \file{visualize.lco} added}
% \changes{v3.17}{2015/02/17}{\file{DIN5008A.lco} and \file{DIN5008B.lco} added}
%    \begin{macrocode}
%<*head>
\ProvidesFile{%
%<visualize>  visualize%
%<DIN>  DIN%
%<5008> 5008%
%<A>    A%
%<B>    B%
%<DINmoretext> DINmtext%
%<SN>  SN%
%<SNold>  SNold%
%<SwissLeft>  SNleft%
%<KOMAold>  KOMAold%
%<NF>  NF%
%<USletter2w>  USletter2w
%<UScommercial9>  UScommercial9
%<UScommercial9DW>  UScommercial9DW
  .lco}[\KOMAScriptVersion\space letter-class-option]
%    \end{macrocode}
%
% Some of the \file{LCO} files need others:
%    \begin{macrocode}
%<*5008>
\LoadLetterOption{%
%<A>  DINmtext%
%<B>  DIN%
}
%</5008>
%    \end{macrocode}
%
% \begin{command}{\LCOWarningNoLine,\LCOWarning}
% \changes{v2.95}{2006/03/24}{added}
% These are similar to \cs{PackageWarningNoLine} and \cs{PackageWarning} but
% for \file{lco} files.
%    \begin{macrocode}
%<*!5008>
\providecommand*\LCOWarningNoLine[2]{%
  \LCOWarning{#1}{#2\@gobble}%
}
\providecommand*\LCOWarning[2]{%
  \GenericWarning{%
    (#1)\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces\@spaces
  }{%
    Letter configuration option #1 Warning: #2%
  }%
}
%</!5008>
%</head>
%    \end{macrocode}
% \end{command}
%
%
% \subsection{Main part of layout option files}
%
% The dimensions of some of the options has been researched by others:
% \begin{center}
%   \begin{tabular}{ll}
%   \texttt{lco} file  & source \\\hline\\[-1.6ex]
%   DIN                & me \\
%   DINmtext           & me \\
%   DIN5008A           & me \\
%   DIN5008B           & me \\
%   KOMAold            & me \\
%   SNleft             & Roger Luethi \\
%   SN                 & Roger Luethi \\
%   NF                 & Jean-Marie Pacquet \\
%   USletter2w         & Engelbert Buxbaum \\
%   UScommercial9      & me \\
%   UScommercial9DW    & me \\
%   \end{tabular}
% \end{center}
%
% Test for the correct class or package:
%    \begin{macrocode}
%<*body&!visualize>
%<*!5008>
\@ifundefined{scr@fromname@var}{%
  \LCOWarningNoLine{%
%<DIN>    DIN%
%<DINmoretext>   DINmtext%
%<SN>    SN%
%<SNold>    SNold%
%<SwissLeft>    SNleft%
%<KOMAold>    KOMAold%
%<NF>    NF%
%<USletter2w>    USletter2w%
%<UScommercial9>    UScommercial9%
%<UScommercial9DW>    UScommercial9DW%
  }{%
    This letter configuration option file was made only\MessageBreak
    to be used with KOMA-Script letter class\MessageBreak
    `scrlttr2' or letter package `scrletter'.\MessageBreak
    Use with other classes and without that package\MessageBreak
    can result in a lot of errors%
  }%
}{}
%    \end{macrocode}
%
% Make sure, the correct paper size has been used:
%    \begin{macrocode}
\LetterOptionNeedsPapersize{%
%<DIN>  DIN%
%<DINmoretext>  DINmtext%
%<SN>  SN%
%<SNold>  SNold%
%<SwissLeft>  SNleft%
%<KOMAold>  KOMAold%
%<NF>  NF%
%<USletter2w>  USletter2w%
%<UScommercial9>  UScommercial9%
%<UScommercial9DW>  UScommercial9DW%
%<*DIN|DINmoretext|SN|SNold|SwissLeft|KOMAold|NF>
}{a4}
%</DIN|DINmoretext|SN|SNold|SwissLeft|KOMAold|NF>
%<*USletter2w|UScommercial9|UScommercial9DW>
}{letter}
%</USletter2w|UScommercial9|UScommercial9DW>
%    \end{macrocode}
%
% And now the dimensions and variables:
% \begin{variable}{fromzipcode}
% \changes{v3.03}{2009/03/04}{change of output name added}
%    \begin{macrocode}
%<!KOMAold>\setkomavar*{fromzipcode}{%
%<DIN|DINmoretext>  D}
%<SwissLeft|SN>  CH}
%<NF>  F}
%<USletter2w|UScommercial9|UScommercial9DW>  US}
%    \end{macrocode}
% \end{variable}
% \begin{pseudolength}{foldmarkhpos,tfoldmarkvpos,mfoldmarkvpos,bfoldmarkvpos,
%                      lforlmarkhpos}
% \changes{v2.97e}{2007/11/20}{several new fold marks to setup}
%    \begin{macrocode}
\setplength{foldmarkhpos}{3.5mm}
\setplength{tfoldmarkvpos}{%
%<DIN|SwissLeft|SN>  105mm}
%<DINmoretext>  87mm}
%<KOMAold>  103.5mm}
%<NF>  99mm}
%<USletter2w|UScommercial9|UScommercial9DW>  3.75in}
\setplength{mfoldmarkvpos}{\z@}
\setplength{bfoldmarkvpos}{%
%<DIN|SwissLeft|SN>  210mm}
%<DINmoretext>  192mm}
%<KOMAold>  202.5mm}
%<NF>  198mm}
%<USletter2w>  7.4in}
%<UScommercial9|UScommercial9DW>  7.375in}
\setplength{lfoldmarkhpos}{\z@}
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{toaddrvpos,toaddrhpos,toaddrwidth,toaddrheight,
%                      backaddrheight,specialmainindent,specialmailrightindent}
% \changes{v3.03}{2009/06/25}{the documentation says, the back-address is part
%   of the address field}
%    \begin{macrocode}
\setplength{toaddrvpos}{%
%<DIN|SN>  45mm}
%<DINmoretext>  27mm}
%<SwissLeft>  35.5mm}
%<KOMAold>  49mm}
%<NF>  35mm}
%<USletter2w>  1.8in}
%<UScommercial9|UScommercial9DW>  2.1875in}
\setplength{toaddrhpos}{%
%<DIN|DINmoretext|SwissLeft>  20mm}
%<SN>  -8mm}
%<KOMAold>  1in}
%<KOMAold>\addtoplength{toaddrhpos}{\oddsidemargin}
%<NF>  -10mm}
%<USletter2w>  .73in}
%<UScommercial9>  0.6875in}
%<UScommercial9DW>  .5625in}
\setplength{toaddrwidth}{%
%<DIN|DINmoretext>  85mm}
%<SN>  90mm}
%<SwissLeft|NF>  100mm}
%<KOMAold>  70mm}
%<USletter2w>  3.11in}
%<UScommercial9>  4.5in}
%<UScommercial9DW>  3.625in}
\setplength{toaddrheight}{%
%<DIN|DINmoretext|SN|SwissLeft|KOMAold|NF>  45mm}
%<USletter2w>  1.17in}
%<UScommercial9|UScommercial9DW>  1.125in}
%</!5008>
\setplength{toaddrindent}{%
%<DIN|DINmoretext|SN|SwissLeft|KOMAold|USletter2w|UScommercial9|UScommercial9DW>  \z@}
%<5008>  5mm}
%<NF>  10mm}
%<*!5008>
\setplength{backaddrheight}{%
%<DIN|DINmoretext|SN|SwissLeft|KOMAold|NF>  5mm}
%<USletter2w|UScommercial9|UScommercial9DW>  \z@}
%<USletter2w|UScommercial9|UScommercial9DW>\KOMAoptions{backaddress=false}
\setplength{specialmailindent}{\fill}
\setplength{specialmailrightindent}{1em}
%</!5008>
%<*5008>
\setplength{specialmailindent}{\useplength{toaddrindent}}
\setplength{specialmailrightindent}{\z@}
%</5008>
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{locvpos,locwidth,lochpos}
%    \begin{macrocode}
%<*5008>
\setplength{locvpos}{%
  \dimexpr\useplength{toaddrvpos}+\useplength{backaddrheight}}
%</5008>
\setplength{locwidth}{%
%<DIN|DINmoretext|SN|SwissLeft|KOMAold|NF|USletter2w|UScommercial9|UScommercial9DW>  \z@}
%<5008>  75mm}
%<5008>\setplength{lochpos}{10mm}
%<*!5008>
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{firstheadvpos,firstheadhpos,firstheadwidth}
%    \begin{macrocode}
\setplength{firstheadvpos}{%
%<DIN|DINmoretext|SN|SwissLeft>  8mm}
%<KOMAold>  6mm}
%<NF>  15mm}
%<USletter2w>  .36in}
%<UScommercial9|UScommercial9DW>  .4375in}
%</!5008>
%<*5008>
\setplength{firstheadhpos}{%
  \dimexpr \useplength{toaddrhpos}+\useplength{toaddrindent}}
%</5008>
\setplength{firstheadwidth}{%
%<KOMAold>  \textwidth}
%<NF>  170mm}
%<*DIN|DINmoretext|SN|SwissLeft|UScommercial9>
  \paperwidth}
\ifdim \useplength{toaddrhpos}>\z@
  \addtoplength[-2]{firstheadwidth}{\useplength{toaddrhpos}}
\else
  \addtoplength[2]{firstheadwidth}{\useplength{toaddrhpos}}
\fi
%</DIN|DINmoretext|SN|SwissLeft|UScommercial9>
%<5008>  \dimexpr 125mm-\useplength{firstheadhpos}}
%<*USletter2w>
  \paperwidth}
\addtoplength[-]{firstheadwidth}{.68in}
%</USletter2w>
%<*UScommercial9DW>
  \paperwidth}
\addtoplength[-]{firstheadwidth}{.25in}
%</UScommercial9DW>
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{firstfootwidth,firstfootvpos}
% \changes{v2.9u}{2005/03/05}{optional the footer is placed 16\,mm above the
%   lower paper edge}
%    \begin{macrocode}
%<!5008>\setplength{firstfootwidth}{\useplength{firstheadwidth}}
%<*5008>
\setplength{firstfoothpos}{%
  \dimexpr\useplength{toaddrhpos}+\useplength{toaddrindent}}%
\setplength{firstfootwidth}{%
  \dimexpr \paperwidth-\useplength{toaddrhpos}-\useplength{firstfoothpos}}%
%</5008>
%<KOMAold>\setplength{firstfootvpos}{\paperheight}
%<KOMAold>\addtoplength{firstfootvpos}{-2cm}
%<!KOMAold&!NF>\setplength{firstfootvpos}{\paperheight}
%<!KOMAold&!NF>\addtoplength{firstfootvpos}{-16mm}
%<!KOMAold&!NF>\scr@ifundefinedorrelax{scr@v@is@le}{}{%
%<!KOMAold&!NF>  \expandafter\ifnum \scr@v@is@le{2.9t}\relax\else
%<!KOMAold&!NF>    \setplength{firstfootvpos}{1in}%
%<!KOMAold&!NF>    \addtoplength{firstfootvpos}{\topmargin}%
%<!KOMAold&!NF>    \addtoplength{firstfootvpos}{\headheight}%
%<!KOMAold&!NF>    \addtoplength{firstfootvpos}{\headsep}%
%<!KOMAold&!NF>    \addtoplength{firstfootvpos}{\textheight}%
%<!KOMAold&!NF>    \addtoplength{firstfootvpos}{\footskip}%
%<!KOMAold&!NF>  \fi
%<!KOMAold&!NF>}%
%<NF>\setplength{firstfootvpos}{266.679mm}
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{refvpos,refaftervskip,refwidth}
%    \begin{macrocode}
%<!(5008&B)>\setplength{refvpos}{%
%<DIN|SN>  98.5mm}
%<DINmoretext>  80.5mm}
%<5008&A>  79.4mm}
%<SwissLeft>  89mm}
%<KOMAold>  89.5mm}
%<NF>  \useplength{tfoldmarkvpos}}
%<USletter2w>  3.1in}
%<UScommercial9|UScommercial9DW>  3.4375in}
\setplength{refaftervskip}{%
%<!KOMAold&!5008>  \baselineskip}
%<KOMAold>  2\baselineskip}
%<5008>  8.46mm}
%<*!5008>
%    \end{macrocode}
% The width of the reference line is somehow special, because setting of
% option \opt{refline=wide} or \opt{refline=narrow} should be possible after
% loading a \file{lco} file. So we use the initial special value 0 and
% calculate it inside \cs{opening} if it is still 0.
%    \begin{macrocode}
\setplength{refwidth}{0pt}
%    \end{macrocode}
% \end{pseudolength}
% \begin{pseudolength}{sigindent,sigbeforevskip}
%    \begin{macrocode}
\setplength{sigindent}{0mm}
\setplength{sigbeforevskip}{2\baselineskip}
%<DIN|DINmoretext|SN|SwissLeft>\let\raggedsignature=\centering
%<KOMAold|NF|USletter2w|UScommercial9|UScommercial9DW>\let\raggedsignature=\raggedright
%    \end{macrocode}
% \end{pseudolength}
% \begin{macro}{\scr@default@firsthead@fromaddress@hook}
% \changes{v3.13b}{2014/04/02}{added}
% \changes{v3.27}{2019/04/02}{removed}
% \end{macro}
%
% \begin{command}{\yourref,\yourmail,\myref,\customer,\invoice,\defaultfields,
%                 \toname,\toaddress,\branch,\signature,\fromsig,\name,
%                 \fromname,\location,\fromlocation,\backaddress,
%                 \frombackaddress,\telephone,\telephonenum,\specialmail,
%                 \title,\subject,\place,\fromplace,\ccnameseparator,
%                 \enclnameseparator,\foldmarkson,\foldmarksoff,\addrfieldon,
%                 \addrfieldoff,\subjecton,\subjectoff,\subjectafteron,
%                 \subjectafteroff}
% \begin{macro}{\@title,\@subject}
% \begin{variable}{refitemi,refitemii,refitemiii,branch}
% We have also to do the compatibility commands and variables for
% \file{KOMAold.lco}.
%    \begin{macrocode}
%<*KOMAold>
\def\yourref{\setkomavar{yourref}}
\def\yourmail{\setkomavar{yourmail}}
\def\myref{\setkomavar{myref}}
\def\customer{\setkomavar{customer}}
\def\invoice{\setkomavar{invoice}}
\@ifundefined{scr@refitemi@var}{\newkomavar{refitemi}}{}
\def\refitemi{\setkomavar{refitemi}}
\def\refitemnamei{\setkomavar*{refitemi}}
\@ifundefined{scr@refitemii@var}{\newkomavar{refitemii}}{}
\def\refitemii{\setkomavar{refitemii}}
\def\refitemnameii{\setkomavar*{refitemii}}
\@ifundefined{scr@refitemiii@var}{\newkomavar{refitemiii}}{}
\def\refitemiii{\setkomavar{refitemiii}}
\def\refitemnameiii{\setkomavar*{refitemiii}}
\l@addto@macro{\defaultreffields}{%
  \addtoreffields{refitemi}%
  \addtoreffields{refitemii}%
  \addtoreffields{refitemiii}%
  }
\addtoreffields{refitemi}%
\addtoreffields{refitemii}%
\addtoreffields{refitemiii}%
\def\toname{\usekomavar{toname}}
\def\toaddress{\usekomavar{toaddress}}
\@ifundefined{scr@branch@var}{\newkomavar{branch}}{}
\def\branch{\setkomavar{branch}}
\def\frombranch{\usekomavar{branch}}
\def\signature{\setkomavar{signature}}
\def\fromsig{\usekomavar{signature}}
\def\name{\setkomavar{fromname}}
\def\fromname{\usekomavar{fromname}}
\def\address{\setkomavar{fromaddress}}
\def\fromaddress{\usekomavar{fromaddress}}
\def\location{\setkomavar{location}}
\def\fromlocation{\usekomavar{location}}
\def\backaddress{\setkomavar{backaddress}}
%    \end{macrocode}
% \changes{v3.28}{2019/11/15}{\cs{ifkomavarempty} replaced by
%   \cs{Ifkomavarempty}}
% Note: This is dangerous if someone uses a new \KOMAScript{} but copies the
% wrong code.
%    \begin{macrocode}
\def\@tempa{%
  \Ifkomavarempty{fromname}{}{%
    \strut\ignorespaces\usekomavar{fromname}%
    \Ifkomavarempty{fromaddress}{}{\\}}%
  \Ifkomavarempty{fromaddress}{}{%
    \strut\ignorespaces\usekomavar{fromaddress}}%
}
\ifx\@tempa\scr@backaddress@var%
  \setkomavar{backaddress}{}
\else
  \def\@tempa{%
    \ifkomavarempty{fromname}{}{%
      \strut\ignorespaces\usekomavar{fromname}%
      \ifkomavarempty{fromaddress}{}{\\}}%
    \ifkomavarempty{fromaddress}{}{%
      \strut\ignorespaces\usekomavar{fromaddress}}%
  }
  \ifx\@tempa\scr@backaddress@var%
    \setkomavar{backaddress}{}
  \fi
\fi
\def\frombackaddress{\usekomavar{backaddress}}
\def\telephone{\setkomavar{fromphone}}
\def\telephonenum{\usekomavar{fromphone}}
\def\specialmail{\setkomavar{specialmail}}
\def\@specialmail{\usekomavar{specialmail}}
\def\title{\setkomavar{title}}
\def\@title{\usekomavar{title}}
\def\subject{\setkomavar{subject}}
\def\@subject{\usekomavar{subject}}
\def\place{\setkomavar{place}}
\def\fromplace{\usekomavar{place}}
\let\ccnameseparator=\scr@ccseparator@var
\setkomavar{ccseparator}{\ccnameseparator}
\let\enclnameseparator=\scr@enclseparator@var
\setkomavar{enclseparator}{\enclnameseparator}
\setkomafont{fromname}{\scshape}
\def\foldmarkson{\@ObsoleteCommand{\foldmarkson}{foldmarks=on}}
\def\foldmarksoff{\@ObsoleteCommand{\foldmarksoff}{foldmarks=off}}
\def\addrfieldon{\@ObsoleteCommand{\addrfieldon}{addrfield=on}}
\def\addrfieldoff{\@ObsoleteCommand{\addrfieldoff}{addrfield=off}}
\def\subjecton{\@ObsoleteCommand{\subjecton}{subject=titled}}
\def\subjectoff{\@ObsoleteCommand{\subjectoff}{subject=untitled}}
\def\subjectafteron{%
  \@ObsoleteCommand{\subjectafteron}{subject=afteropening}}
\def\subjectafteroff{%
  \@ObsoleteCommand{\subjectafteroff}{subject=beforeopening}}
%</KOMAold>
%    \end{macrocode}
% \end{variable}
% \end{macro}
% \end{command}
%
%
% \begin{pseudolength}{specialmailheight}
% \begin{macro}{\@PapersizeWarning}
% For \file{DIN5008a.lco} and \file{DIN5008b.lco} we need additional settings:
% \changes{v3.30}{2020/02/25}{white spaces and end of warning removed}
%    \begin{macrocode}
%</!5008>
%<*5008>
\newplength{specialmailheight}
\setplength{specialmailheight}{12.7mm}
\areaset[5mm]{165mm}{233mm}
\KOMAoptions{%
  fromalign=locationleft,
  addrfield=topaligned,
  refline=narrow,
  parskip=full
}
\l@addto@macro\@PapersizeWarning{%
  \begingroup
    \@tempswafalse
    \ifdim\oddsidemargin<\dimexpr 25mm-1in-1pt\relax\@tempswatrue\else
      \ifdim\oddsidemargin>\dimexpr 25mm-1in+1pt\relax\@tempswatrue\fi\fi
    \ifdim\textwidth<\dimexpr \paperwidth-45mm-1pt\relax\@tempswatrue\else
      \ifdim\textwidth>\dimexpr \paperwidth-45mm+1pt\relax\@tempswatrue\fi\fi
    \if@tempswa
      \LCOWarning{DIN5008%
%<A>        A%
%<B>        B%
      }{%
        DIN5008 orders exact margins and text\MessageBreak
        width. Without following these values,\MessageBreak
        your document does not conform DIN5008.\MessageBreak
        You should use, e.g.,\MessageBreak
        \space\string\areaset[5mm]{%
          \the\dimexpr \paperwidth-45mm\relax}{%
          \the\dimexpr 1.414\dimexpr \paperwidth-45mm\relax\relax}\MessageBreak
        to follow the norm%
      }%
    \fi
    \ifdim \dimexpr\parskip\relax=\dimexpr\baselineskip\relax\else
      \LCOWarning{DIN5008%
%<A>        A%
%<B>        B%
      }{%
        DIN5008 orders paragraph separation by\MessageBreak
        exactly one line. Without this, your\MessageBreak
        document does not conform DIN5008.\MessageBreak
        You shoud use, e.g.,\MessageBreak
        \space\string\KOMAoption{parskip}{full}\MessageBreak
        to follow the norm%
      }%
    \fi
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{pseudolength}
% \begin{macro}{\backaddr@format}
% \changes{v3.25}{2017/11/15}{using \cs{scr@endstrut} instead of
%   \cs{unskip}\cs{strut}}
% Multi line back address without underline.
%    \begin{macrocode}
\renewcommand{\backaddr@format}[1]{\hspace*{\useplength{toaddrindent}}%
  \parbox[t][\useplength{backaddrheight}][t]%
         {\dimexpr\useplength{toaddrwidth}-\useplength{toaddrindent}}%
         {\strut\ignorespaces #1\ifhmode\scr@endstrut\fi}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\specialmail@format}
% \changes{v3.25}{2017/11/15}{using \cs{scr@endstrut} instead of
%   \cs{unskip}\cs{strut}}
% Multi line special sending.
%    \begin{macrocode}
\renewcommand{\specialmail@format}[1]{%
  \parbox[t][\useplength{specialmailheight}][t]%
         {\dimexpr\useplength{toaddrwidth}
                 -\useplength{specialmailindent}
                 -\useplength{specialmailrightindent}}%
         {\strut\ignorespaces #1\ifhmode\scr@endstrut\fi}%
}
%    \end{macrocode}
% \end{macro}
% \begin{fontelement}{specialmail,backaddress,addressee,fromname,fromaddress,refvalue}
% Some font settings.
%    \begin{macrocode}
\setkomafont{specialmail}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\setkomafont{backaddress}{\sffamily\fontsize{8pt}{10pt}\selectfont}
\setkomafont{addressee}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\setkomafont{fromname}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\setkomafont{fromaddress}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\setkomafont{refvalue}{\sffamily\fontsize{10pt}{12pt}\selectfont}
\let\raggedsignature\raggedright
%</5008>
%</body&!visualize>
%    \end{macrocode}
% \end{fontelement}
%
%
% \subsection{Visualizing several fields of a letter}
%
% These macros are using be \file{visualize.lco} only.
%
% It needs \pkg{eso-pic}.
% \changes{v3.18}{2015/06/03}{loading \textsf{eso-pic} always}
%    \begin{macrocode}
%<*visualize&body>
\RequirePackage{eso-pic}
%    \end{macrocode}
%
% \begin{command}{\showfields}
% \changes{v3.26}{2018/08/29}{\cs{scr@trim@spaces} added}
% Command
% \begin{quote}
%   \cs{showfields}\marg{field list}
% \end{quote}
% is used to visualize fields of the note paper. The \meta{field list} is a
% comma-separated list of field names. Unknown fields do not result in errors
% but warnings only. The visualization is done in the background using
% \pkg{eso-pic}. A visualized field cannot be un-visualized.
%    \begin{macrocode}
\newcommand*{\showfields}[1]{%
  \AtBeginLetter{%
    \begingroup
      \@for \@tempa:=#1\do{%
        \scr@trim@spaces\@tempa
        \ifx\@tempa\@empty\else
          \@ifundefined{showfield@\@tempa}{%
            \LCOWarning{visualize}{Unknown field `\@tempa' ignored}%
          }{%
            \edef\@tempa{%
              \noexpand\AddToShipoutPicture*{%
                \noexpand\AtPageUpperLeft{%
                  \noexpand\usekomafont{field}%
                  \noexpand\@nameuse{showfield@\@tempa}%
                }%
              }%
            }\@tempa
          }%
        \fi
      }%
    \endgroup
  }%
}
%    \end{macrocode}
% \begin{fontelement}{field}
% The element is used to change the color. Changing the font doesn't make sense.
%    \begin{macrocode}
\newkomafont{field}{\normalcolor}
%    \end{macrocode}
% \end{fontelement}
% \end{command}
%
% \begin{command}{\showfield}
% A single field is visualized using:
% \begin{quote}
%   \cs{showfield}\marg{field name}
% \end{quote}
% This uses a macro \cs{showfield@\meta{field name}}. Usually fields are
% rectangles. Such fields can be visualized always the same way using four
% parameters: \meta{offset from left}, \meta{offset from top}, \meta{width},
% \meta{height}. A negative \meta{height} means a minimum of -\meta{height}
% but maybe more.
%
% \begin{macro}{\showfield@by@frame}
% To show a field by a frame
% \begin{quote}
%   \cs{showfield@by@frame}\marg{offset from left}\marg{offset from top}%
%   \marg{width}\marg{height}
% \end{quote}
% is used. If \meta{height} is negative, arrows of length -\meta{height} are
% used and the frame bottom is omitted.
%    \begin{macrocode}
\newcommand*{\showfield@by@frame}[4]{%
  \thinlines
  \ifdim #4<\z@
    \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(1,0){\LenToUnit{#3}}}%
    \setlength{\@tempdima}{\dimexpr #1+#3\relax}%
    \setlength{\@tempdimb}{#4}
    \put(\LenToUnit{#1},-\LenToUnit{#2}){%
      \vector(0,-1){\LenToUnit{-\@tempdimb}}}%
    \put(\LenToUnit\@tempdima,-\LenToUnit{#2}){%
      \vector(0,-1){\LenToUnit{-\@tempdimb}}}%
  \else
    \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(1,0){\LenToUnit{#3}}}%
    \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(0,-1){\LenToUnit{#4}}}%
    \setlength{\@tempdima}{\dimexpr #1+#3\relax}%
    \setlength{\@tempdimb}{\dimexpr #2+#4\relax}%
    \put(\LenToUnit\@tempdima,\LenToUnit{-\@tempdimb}){%
      \line(-1,0){\LenToUnit{#3}}}%  
    \put(\LenToUnit\@tempdima,\LenToUnit{-\@tempdimb}){%
      \line(0,1){\LenToUnit{#4}}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\showfield@by@edges}
% To show a field by edge markers
% \begin{quote}
%   \cs{showfield@by@edges}\marg{offset from left}\marg{offset from top}%
%   \marg{width}\marg{height}
% \end{quote}
% is used. If \meta{height} is negative the bottom markers are omitted.
%    \begin{macrocode}
\newcommand*{\showfield@by@edges}[4]{%
  \thinlines
  \setlength{\@tempdima}{\dimexpr #1+#3\relax}%
  \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(1,0){\LenToUnit{\edgesize}}}%
  \put(\LenToUnit{#1},-\LenToUnit{#2}){\line(0,-1){\LenToUnit{\edgesize}}}%
  \put(\LenToUnit{\@tempdima},-\LenToUnit{#2}){\line(-1,0){\LenToUnit{\edgesize}}}%
  \put(\LenToUnit{\@tempdima},-\LenToUnit{#2}){\line(0,-1){\LenToUnit{\edgesize}}}%
  \ifdim #4<\z@\else
    \setlength{\@tempdimb}{\dimexpr #2+#4\relax}%
    \put(\LenToUnit{#1},-\LenToUnit{\@tempdimb}){\line(1,0){\LenToUnit{\edgesize}}}%
    \put(\LenToUnit{#1},-\LenToUnit{\@tempdimb}){\line(0,1){\LenToUnit{\edgesize}}}%
    \put(\LenToUnit{\@tempdima},-\LenToUnit{\@tempdimb}){\line(-1,0){\LenToUnit{\edgesize}}}%
    \put(\LenToUnit{\@tempdima},-\LenToUnit{\@tempdimb}){\line(0,1){\LenToUnit{\edgesize}}}%
  \fi
}
%    \end{macrocode}
% \begin{command}{\edgesize}
% The size of the edges is 1\,ex by default.
%    \begin{macrocode}
\newcommand*{\edgesize}{1ex}
%    \end{macrocode}
% \end{command}
% \end{macro}
%
% \begin{macro}{\showfield@by@rule}
% To show a field by a filled frame (without frame border)
% \begin{quote}
%   \cs{showfield@by@rune}\marg{offset from left}\marg{offset from top}%
%   \marg{width}\marg{height}
% \end{quote}
% is used. The absolute value of \meta{height} is used.
%    \begin{macrocode}
\newcommand*{\showfield@by@rule}[4]{%
  \ifdim #4<\z@
    \put(\LenToUnit{#1},-\LenToUnit{#2}){\rule[#4]{#3}{-#4}}%
  \else
    \put(\LenToUnit{#1},-\LenToUnit{#2}){\rule[-#4]{#3}{#4}}%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{command}{\showfield}
% The default is to use a frame.
%    \begin{macrocode}
\newcommand*{\showfield}{}
\let\showfield\showfield@by@frame
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\setshowstyle}
% But the default can changed using
% \begin{quote}
%   \cs{setshowstyle}\marg{style}
% \end{quote}
% A warning (no error!) is reported if \cs{showfield@by@\meta{style}} does not
% exist. In this case \meta{style} is \texttt{frame} again.
%    \begin{macrocode}
\newcommand*{\setshowstyle}[1]{%
  \@ifundefined{showfield@by@#1}{%
    \LCOWarning{visualize}{Unknown show type `#1'.\MessageBreak
      You should simply set one of the supported\MessageBreak
      show types `frame', `edges', `rule'.\MessageBreak
      Style `frame' will be used instead}%
    \let\showfield\showfield@by@frame
  }{%
    \expandafter\let\expandafter\showfield\csname showfield@by@#1\endcsname
  }%
}
%    \end{macrocode}
% \end{command}
% \end{command}
%
% Currently following fields are available:
% \begin{macro}{\showfield@test}
% \texttt{test} is a test field with coordinates:
% $(1\,\mathrm{cm},1\,\mathrm{cm})\times(10\,\mathrm{cm},15\,\mathrm{cm})$
%    \begin{macrocode}
\newcommand*{\showfield@test}{%
  \showfield{1cm}{1cm}{10cm}{15cm}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\showfield@head}
% \changes{v3.05}{2009/11/09}{using \plen{firstheadhpos}}
% \texttt{head} is the header of the note paper.
%    \begin{macrocode}
\newcommand*{\showfield@head}{%
  \ifdim\useplength{firstheadhpos}<\paperwidth
    \ifdim \useplength{firstheadhpos}>-\paperwidth
      \ifdim \useplength{firstheadhpos}<\z@
        \setlength\@tempskipa{\paperwidth}%
        \addtolengthplength{\@tempskipa}{firstheadhpos}%
        \addtolengthplength[-]{\@tempskipa}{firstheadwidth}%
      \else
        \setlength{\@tempskipa}{\useplength{firstheadhpos}}%
      \fi
    \else
      \setlength\@tempskipa{\oddsidemargin}%
      \addtolength\@tempskipa{1in}%
    \fi
  \else
    \setlength\@tempskipa{.5\paperwidth}%
    \addtolengthplength[-.5]{\@tempskipa}{firstheadwidth}%
  \fi
  \showfield{\@tempskipa}%
            {\useplength{firstheadvpos}}%
            {\useplength{firstheadwidth}}%
            {-\headheight}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\showfield@foot}
% \changes{v3.05}{2009/11/09}{using \plen{firstfoothpos}}
% \texttt{foot} is the footer of the note paper.
%    \begin{macrocode}
\newcommand*{\showfield@foot}{%
  \ifdim\useplength{firstfoothpos}<\paperwidth
    \ifdim \useplength{firstfoothpos}>-\paperwidth
      \ifdim \useplength{firstfoothpos}<\z@
        \setlength\@tempskipa{\paperwidth}%
        \addtolengthplength{\@tempskipa}{firstfoothpos}%
        \addtolengthplength[-]{\@tempskipa}{firstfootwidth}%
      \else
        \setlength{\@tempskipa}{\useplength{firstfoothpos}}%
      \fi
    \else
      \setlength\@tempskipa{\oddsidemargin}%
      \addtolength\@tempskipa{1in}%
    \fi
  \else
    \setlength\@tempskipa{.5\paperwidth}%
    \addtolengthplength[-.5]{\@tempskipa}{firstfootwidth}%
  \fi
  \showfield{\@tempskipa}%
            {\useplength{firstfootvpos}}%
            {\useplength{firstfootwidth}}%
            {-\baselineskip}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\showfield@address}
% \changes{v3.07a}{2011/01/10}{implementation adapted for change in
%   \cls*{scrlttr2} 3.03b}
% \texttt{address} is the address field of the addressee.
%    \begin{macrocode}
\newcommand*{\showfield@address}{%
  \setlengthtoplength{\@tempskipa}{toaddrhpos}%
  \ifdim \@tempskipa<\z@
    \addtolength{\@tempskipa}{\paperwidth}%
    \addtolengthplength[-]{\@tempskipa}{toaddrwidth}%
  \fi
  \showfield{\@tempskipa}{\useplength{toaddrvpos}}%
            {\useplength{toaddrwidth}}%
            {\dimexpr\useplength{toaddrheight}\relax}%
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\showfield@location}
% \changes{v3.07a}{2011/01/10}{implementation adapted for change in
%   \cls*{scrlttr2} 3.03b}
% \texttt{location} is the field with extra information about the sender.
%    \begin{macrocode}
\newcommand*{\showfield@location}{%
  \begingroup
    \ifdim \useplength{locwidth}=\z@%
      \setplength{locwidth}{\paperwidth}%
      \ifdim \useplength{toaddrhpos}>\z@
        \addtoplength[-2]{locwidth}{\useplength{toaddrhpos}}%
      \else
        \addtoplength[2]{locwidth}{\useplength{toaddrhpos}}%
      \fi
      \addtoplength[-1]{locwidth}{\useplength{toaddrwidth}}%
      \if@bigloc%
        \setplength[.66667]{locwidth}{\useplength{locwidth}}%
      \else%
        \setplength[.5]{locwidth}{\useplength{locwidth}}%
      \fi%
    \fi%
    \ifdim \useplength{lochpos}=\z@%
      \setplength{lochpos}{\useplength{toaddrhpos}}%
    \fi
    \ifdim \useplength{locvpos}=\z@%
      \setplength{locvpos}{\useplength{toaddrvpos}}%
    \fi
    \ifdim \useplength{locheight}=\z@%
      \setplength{locheight}{\useplength{toaddrheight}}%
    \fi
    \setlengthtoplength[-]{\@tempskipa}{lochpos}%
    \ifdim \@tempskipa<\z@
      \addtolength{\@tempskipa}{\paperwidth}%
    \else
      \addtolengthplength{\@tempskipa}{locwidth}%
    \fi
    \addtolengthplength[-]{\@tempskipa}{locwidth}%
    \showfield{\@tempskipa}{\useplength{locvpos}}%
              {\useplength{locwidth}}{\useplength{locheight}}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\showfield@refline}
% \texttt{refline} is the reference line.
%    \begin{macrocode}
\newcommand*{\showfield@refline}{%
  \begingroup
    \ifdim\useplength{refwidth}=\z@
      \if@refwide
        \setplength{refwidth}{\paperwidth}%
        \ifdim \useplength{toaddrhpos}>\z@
          \setplength{refhpos}{\useplength{toaddrhpos}}%
        \else
          \setplength[-]{refhpos}{\useplength{toaddrhpos}}%
        \fi
        \addtoplength[-2]{refwidth}{\useplength{refhpos}}%
      \else
        \setplength{refwidth}{\textwidth}%
        \setplength{refhpos}{\oddsidemargin}%
        \addtoplength{refhpos}{1in}%
      \fi
    \else\ifdim\useplength{refhpos}=\z@
        \begingroup
          \setlength\@tempdima{\textwidth}%
          \addtolengthplength[-]{\@tempdima}{refwidth}%
          \setlength\@tempdimb{\oddsidemargin}%
          \addtolength\@tempdimb{1in}%
          \setlength{\@tempdimc}{\paperwidth}%
          \addtolength{\@tempdimc}{-\textwidth}%
          \divide\@tempdimb by 32768\relax
          \divide\@tempdimc by 32768\relax
          \ifdim\@tempdimc=\z@\else
            \multiply\@tempdima by\@tempdimb
            \divide\@tempdima by\@tempdimc
          \fi
          \edef\@tempa{\noexpand\endgroup
            \noexpand\setplength{refhpos}{\the\@tempdima}}%
        \@tempa
    \fi\fi
    \showfield{\useplength{refhpos}}{\useplength{refvpos}}%
              {\useplength{refwidth}}{-1.5\baselineskip}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{command}{\showenvelope}
% \begin{macro}{\@showenvelope}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% \begin{macro}{\@@showenvelope,\@@@showenvelope}
% \changes{v3.20}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% \changes{v3.18}{2015/06/03}{always loading \pkg{graphicx}}
% We can also visualize an envelope. Here are several parameters needed.
% \begin{quote}
%   \cs{showenvelope}\marg{width}\marg{height}\marg{hoffset}\marg{voffset}%
%   \marg{commands}
% \end{quote}
% The envelope is shown in portrait format at the current page. Package
% \pkg{graphicx} is used. The \meta{hoffset} is the horizontal distance of the
% note paper from the left and right edge of the envelope. The \meta{voffset}
% is the same for the top and bottom edge. The \meta{commands} is extra code
% to show the some elements.
%    \begin{macrocode}
\RequirePackage{graphicx}
\newcommand*{\showenvelope}{}
\newcommand*{\@@showenvelope}{}
\newcommand*{\@@@showenvelope}{}
\def\showenvelope(#1,#2){%
  \kernel@ifnextchar (%)
    {\@showenvelope({#1},{#2})}%
    {\@@@showenvelope({#1},{#2})}%
}
\def\@@@showenvelope(#1,#2){%
  \begingroup
    \def\@tempa{\endgroup}%
    \ifdim \paperwidth>#1\relax
      \LCOWarning{visualize}{%
        \string\paperwidth\space > envelope width not supported}%
    \else
      \ifdim \paperheight>#2\relax
        \ifdim .5\paperheight>#2\relax
          \expandafter\ifdim \useplength{tfoldmarkvpos}>#2\relax
            \LCOWarning{visualize}{%
              tfoldmarkvpos > envelope height not supported}%
          \else
            \def\@tempa{\endgroup
              \@showenvelope({#1},{#2})%
                            ({\dimexpr (#1-\paperwidth)/2\relax},%
                             {\dimexpr (#2-\expandafter\dimexpr
                                        \useplength{tfoldmarkvpos}\relax)%
                                       /2\relax})%
            }%
          \fi
        \else
          \def\@tempa{\endgroup
            \@showenvelope({#1},{#2})%
                          ({\dimexpr (#1-\paperwidth)/2\relax},%
                           {\dimexpr (#2-.5\paperheight)/2\relax})%
          }%
        \fi
      \else
        \def\@tempa{\endgroup
          \@showenvelope({#1},{#2})%
                        ({\dimexpr (#1-\paperwidth)/2\relax},%
                         {\dimexpr (#2-\paperheight)/2\relax})%
        }%
      \fi
    \fi
  \@tempa
}
\def\@showenvelope(#1,#2)(#3,#4){%
  \kernel@ifnextchar [%]
    {\@@showenvelope({#1},{#2})({#3},{#4})}%
    {\@@showenvelope({#1},{#2})({#3},{#4})[]}%
}
\def\@@showenvelope(#1,#2)(#3,#4)[#5]{%
%    \end{macrocode}
%    \begin{macrocode}
  \newpage
  \vspace*{\fill}
  \rotatebox{90}{%
    \begin{picture}(0,0)
      \begin{picture}(\LenToUnit{#1},\LenToUnit{#2})(0,\LenToUnit{#2})
        \newcommand*{\PlusHOffset}[1]{%
          \dimexpr \expandafter\dimexpr ##1\relax + #3\relax
        }%
        \newcommand*{\MinusHOffset}[1]{%
          \dimexpr \expandafter\dimexpr ##1\relax - #3\relax
        }%
        \newcommand*{\PlusVOffset}[1]{%
          \dimexpr \expandafter\dimexpr ##1\relax + #4\relax
        }%
        \newcommand*{\MinusVOffset}[1]{%
          \dimexpr \expandafter\dimexpr ##1\relax - #4\relax
        }%
        \newcommand{\AtEnvelopeUpperLeft}[1]{%
          \put(\LenToUnit{\PlusHOffset\z@},\LenToUnit{\MinusVOffset{#2}}){##1}%
        }%
        \newcommand{\AtEnvelopeLowerLeft}[1]{%
          \put(\LenToUnit{\PlusHOffset\z@},\LenToUnit{\PlusVOffset\z@}){##1}%
        }%
        \newcommand{\AtEnvelopeUpperRight}[1]{%
          \put(\LenToUnit{\MinusHOffset{#1}},\LenToUnit{\MinusVOffset{#2}}){##1}%
        }%
        \newcommand{\AtEnvelopeLowerRight}[1]{%
          \put(\LenToUnit{\MinusHOffset{#1}},\LenToUnit{\PlusVOffset\z@}){##1}%
        }%
        \newcommand*{\measuredIFrame}{}%
        \def\measuredIFrame(##1,##2)(##3,##4){%
          \put(\LenToUnit{##1},\LenToUnit{##2}){%
            \measuredFrameLB({##3},{##4})%
          }%
          \put(\LenToUnit{\MinusHOffset\z@},%
               \LenToUnit{\dimexpr ##2-.5mm\relax}){%
            \measureLineHB{\PlusHOffset{##1}}%
          }%
          \put(\LenToUnit{\dimexpr ##1+##3\relax},%
              \LenToUnit{\dimexpr ##2-.5mm\relax}){%
            \measureLineHB{\dimexpr #1-%
                             \PlusHOffset{\dimexpr ##1+##3\relax}\relax}%
          }%
          \put(\LenToUnit{\dimexpr ##1-.5mm\relax},%
               \LenToUnit{\dimexpr ##2+##4\relax}){%
            \measureLineVL{\PlusVOffset{\dimexpr -##2-##4\relax}}%
          }%
          \put(\LenToUnit{\dimexpr ##1-.5mm\relax},%
               \LenToUnit{\PlusVOffset{-#2}}){%
            \measureLineVL{\dimexpr #2-%
              \PlusVOffset{\dimexpr -##2\relax}\relax}%
          }%
        }%
        \put(0,0){%
          \thicklines
          \usekomafont{envelope}%
          \measuredFrameLB({#1},{#2})%
        }%
        \AtEnvelopeLowerLeft{%
          \usekomafont{letter}%
          \dashbox{\LenToUnit{1mm}}%
                  (\LenToUnit{\MinusHOffset{\MinusHOffset{#1}}},%
                   \LenToUnit{\MinusVOffset{\MinusVOffset{#2}}}){}%
        }%
        \expandafter\ifdim \useplength{toaddrhpos}<\z@
          \AtEnvelopeUpperLeft{%
            \thicklines
            \usekomafont{envelope}%
            \measuredIFrame(\expandafter\dimexpr \useplength{toaddrhpos}+
                              \MinusHOffset{\MinusHOffset{#1}}\relax,%
                            -\dimexpr %
                              \expandafter\dimexpr\useplength{toaddrvpos}\relax
                              +
                              \expandafter
                                \dimexpr\useplength{toaddrheight}\relax
                              \relax)%
                           (\useplength{toaddrwidth},\useplength{toaddrheight})%
          }%
        \else
          \AtEnvelopeUpperLeft{%
            \thicklines
            \usekomafont{envelope}%
            \measuredIFrame(\useplength{toaddrhpos},%
                            -\dimexpr %
                              \expandafter\dimexpr\useplength{toaddrvpos}\relax
                              +
                              \expandafter
                                \dimexpr\useplength{toaddrheight}\relax
                              \relax)%
                           (\useplength{toaddrwidth},\useplength{toaddrheight})%
          }%
        \fi
        \AtEnvelopeUpperLeft{#5}%
      \end{picture}
    \end{picture}
  }%
  \newpage
}
%    \end{macrocode}
% \begin{fontelement}{envelope}
% Used to change the color of the envelope frame (font changes do not make sense).
%    \begin{macrocode}
\newkomafont{envelope}{\normalcolor}
%    \end{macrocode}
% \end{fontelement}
% \begin{fontelement}{letter}
% Used to change the color of the dashed note paper inside the envelope (font
% changes do not make sende).
%    \begin{macrocode}
\newkomafont{letter}{\normalcolor}
%    \end{macrocode}
% \end{fontelement}
% \begin{command}{\unmeasuredFrame}
% Show a frame without measuring.
%    \begin{macrocode}
\newcommand*{\unmeasuredFrame}{}
\def\unmeasuredFrame(#1,#2){%
  \put(0,0){\line(1,0){\LenToUnit{#1}}}%
  \put(\LenToUnit{#1},0){\line(0,1){\LenToUnit{#2}}}%
  \put(\LenToUnit{#1},\LenToUnit{#2}){\line(-1,0){\LenToUnit{#1}}}%
  \put(0,\LenToUnit{#2}){\line(0,-1){\LenToUnit{#2}}}%
}
%    \end{macrocode}
% \end{command}
% \begin{command}{\measuredFrameLB,\measuredFrameLT,\measuredFrameRB,
%                 \measuredFrameRT}
% Show the measuring of a frame.
%    \begin{macrocode}
\newcommand*{\measuredFrameLB}{}
\def\measuredFrameLB(#1,#2){%
  \unmeasuredFrame({#1},{#2})%
  \put(\LenToUnit{-.5mm},0){\measureLineVL{#2}}%
  \put(0,\LenToUnit{-.5mm}){\measureLineHB{#1}}%
}
\newcommand*{\measuredFrameLT}{}
\def\measuredFrameLT(#1,#2){%
  \unmeasuredFrame({#1},{#2})%
  \put(\LenToUnit{-.5mm},0){\measureLineVL{#2}}%
  \put(0,\LenToUnit{\expandafter\dimexpr #2+.5mm\relax}){\measureLineHT{#1}}%
}
\newcommand*{\measuredFrameRB}{}
\def\measuredFrameRB(#1,#2){%
  \unmeasuredFrame({#1},{#2})%
  \put(\LenToUnit{\expandafter\dimexpr #1+.5mm\relax},0){\measureLineVR{#2}}%
  \put(0,\LenToUnit{-.5mm}){\measureLineHB{#1}}%
}
\newcommand*{\measuredFrameRT}{}
\def\measuredFrameRT(#1,#2){%
  \unmeasuredFrame({#1},{#2})%
  \put(\LenToUnit{\expandafter\dimexpr #1+.5mm\relax},0){\measureLineVR{#2}}%
  \put(0,\LenToUnit{\expandafter\dimexpr #2+.5mm\relax}){\measureLineHT{#1}}%
}
%    \end{macrocode}
% \end{command}
% \end{macro}
% \end{macro}
% \end{command}
% \begin{command}{\measureLineV}
% Vertical measuring without text.
%    \begin{macrocode}
\newcommand*{\measureLineV}[1]{%
  \begin{picture}(0,0)
    \thinlines
    \usekomafont{measure}%
    \put(0,0){\vector(0,1){\LenToUnit{#1}}}%
    \put(0,\LenToUnit{#1}){\vector(0,-1){\LenToUnit{#1}}}%
 \end{picture}
}
%    \end{macrocode}
% \end{command}
% \begin{command}{\measureLineVL,\measureLineVR}
% Vertical measuring with text left or right of the line.
%    \begin{macrocode}
\newcommand*{\measureLineVL}[1]{%
  \begin{picture}(0,0)
    \usekomafont{measure}%
    \put(0,0){\measureLineV{#1}}%
    \put(0,0){\makebox(0,\LenToUnit{#1})[r]{\ValPerUnit{#1}}}%
  \end{picture}
}
\newcommand*{\measureLineVR}[1]{%
  \begin{picture}(0,0)
    \usekomafont{measure}%
    \put(0,0){\measureLineV{#1}}%
    \put(0,0){\makebox(0,\LenToUnit{#1})[l]{\ValPerUnit{#1}}}%
  \end{picture}
}
%    \end{macrocode}
% \begin{command}{\ValPerUnit,\unitfactor}
% Shows a length in \len{unitlength} with a accuracy of 1/\cs{unitfactor}.
%    \begin{macrocode}
\newcommand*{\ValPerUnit}[1]{%
  \begingroup
    \setlength{\@tempdima}{%
      \dimexpr #1/(\unitlength/\unitfactor)*\p@/\unitfactor\relax
    }%
    \strip@pt\@tempdima
  \endgroup
}
\newcommand*{\unitfactor}{1}
%    \end{macrocode}
% \end{command}
% \begin{command}{\measureLineH}
% Horizontal measuring without text.
%    \begin{macrocode}
\newcommand*{\measureLineH}[1]{%
  \begin{picture}(0,0)
    \usekomafont{measure}%
    \put(0,0){\vector(1,0){\LenToUnit{#1}}}%
    \put(\LenToUnit{#1},0){\vector(-1,0){\LenToUnit{#1}}}%
 \end{picture}
}
%    \end{macrocode}
% \end{command}
% \begin{command}{\measureLineHB,\measureLineHT}
% Horizontal measuring with text below or above.
%    \begin{macrocode}
\newcommand*{\measureLineHB}[1]{%
  \begin{picture}(0,0)
    \usekomafont{measure}%
    \put(0,0){\measureLineH{#1}}%
    \put(0,\LenToUnit{\dimexpr -\ht\strutbox-.5mm\relax}){%
      \makebox(\LenToUnit{#1},\LenToUnit{\baselineskip})[c]{\ValPerUnit{#1}}}%
  \end{picture}
}
\newcommand*{\measureLineHT}[1]{%
  \begin{picture}(0,0)
    \usekomafont{measure}%
    \put(0,0){\measureLineH{#1}}%
    \put(0,0){%
      \makebox(\LenToUnit{#1},\LenToUnit{\baselineskip})[c]{\ValPerUnit{#1}}}%
  \end{picture}
}
%    \end{macrocode}
% \end{command}
% \begin{fontelement}{measure}
% Used to change the color of a measuring line (font changes doe not make sense).
%    \begin{macrocode}
\newkomafont{measure}{\normalcolor}
%    \end{macrocode}
% \end{fontelement}
% \end{command}
%
% \begin{command}{\showISOenvelope}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Show a DIN/ISO C4, C5, DL=C5/6, or C6/5 envelope, depending on the argument.
%    \begin{macrocode}
\newcommand*{\showISOenvelope}[1]{%
  \Ifstr{#1}{C4}{%
    \showenvelope(324mm,229mm)%
  }{%
    \Ifstr{#1}{C5}{%
      \showenvelope(229mm,162mm)%
    }{%
      \Ifstr{#1}{C5/6}{%
        \showenvelope(220mm,110mm)%
      }{%
        \Ifstr{#1}{DL}{%
          \showenvelope(220mm,110mm)%
        }{%
          \Ifstr{#1}{C6/5}{%
            \showenvelope(229mm,114mm)%
          }{%
            \Ifstr{#1}{C6}{%
              \showenvelope(162mm,114mm)%
            }{%
              \LCOWarning{visualize}{envelope size `ISO #1' unsupported}%
            }%
          }%
        }%
      }%
    }%
  }%
}
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\showUScommercial}
% \changes{v3.28}{2019/11/18}{\cs{ifstr} renamed to \cs{Ifstr}}
% Show a US commercial no. 9 or 10 envelope, depending on the argument.
%    \begin{macrocode}
\newcommand*{\showUScommercial}[1]{%
  \Ifstr{#1}{9}{%
    \showenvelope(8.875in,3.875in)%
  }{%
    \Ifstr{#1}{10}{%
      \showenvelope(9.5in,4.125in)%
    }{%
      \LCOWarning{visualize}{envelope size `US commercial #1' unsupported}%
    }%
  }%
}
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\showUScheck}
% Show a US check envelope.
%    \begin{macrocode}
\newcommand*{\showUScheck}{%
  \showenvelope(8.625in,3.625in)%
}
%</visualize&body>
%    \end{macrocode}
% \end{command}
%
%
% \begin{command}{\showUSletterCixDW}
% Show a Us commercial no. 9 envelope with two windows (this is defined in
% \file{UScommercial9DW.lco} not in \file{visualize.lco}).
% The sender window is $3\frac{1}{2}\,\mathrm{in}\times\frac{7}{8}\,\mathrm{in}$,
% $\frac{5}{16}\,\mathrm{in}$ from the left and $2\frac{1}{2}\,\mathrm{in}$
% from the bottom.
%    \begin{macrocode}
%<*!visualize&UScommercial9DW&body>
\newcommand*{\showUSletterCixDW}{%
  \showUScommercial9[{%
    \thicklines
    \usekomafont{envelope}%
    \measuredIFrame({\dimexpr (\paperwidth-
                         \expandafter\dimexpr \useplength{firstheadwidth}\relax%
                       )/2\relax},%
                    -\expandafter\dimexpr\useplength{firstheadvpos}\relax)%
                   (3.5in,.875in)%
  }]%
}
%</!visualize&UScommercial9DW&body>
%    \end{macrocode}
% \end{command}
%
%    \begin{macrocode}
%</lco>
%    \end{macrocode}
% 
% \Finale
% \PrintChanges
% 
\endinput
% Local Variables:
% mode: doctex
% ispell-local-dictionary: "en_US"
% eval: (flyspell-mode 1)
% TeX-master: t
% TeX-engine: luatex-dev
% 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"))
% End:
