% \CheckSum{0}
% \iffalse
% ======================================================================
% plength.dtx
% Copyright (c) Markus Kohm, 2005-2017
%
% 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.txt.
% ----------------------------------------------------------------------
% plength.dtx
% Copyright (c) Markus Kohm, 2005-2017
%
% Dieses Werk darf nach den Bedingungen der LaTeX Project Public Lizenz,
% Version 1.3c, verteilt und/oder veraendert werden.
% Die neuste Version dieser Lizenz ist
%   http://www.latex-project.org/lppl.txt
% und Version 1.3c ist Teil aller Verteilungen von LaTeX
% Version 2005/12/01 oder spaeter und dieses Werks.
%
% Dieses Werk hat den LPPL-Verwaltungs-Status "author-maintained"
% (allein durch den Autor verwaltet).
%
% Der Aktuelle Verwalter und Autor dieses Werkes ist Markus Kohm.
% 
% Dieses Werk besteht aus den in manifest.txt aufgefuehrten Dateien.
% ======================================================================
%
% Generation of plength figures at scrlttr2 chapter of the KOMA-Script guide
% Maintained by Markus Kohm
% Original source by Stephan Hennig
%
% ---------------------------------------------------------------------------
%
% Erzeugung der plength Abbildungen im scrlttr2-Kapitel der
%   KOMA-Script-Anleitung
% Verwaltet von Markus Kohm
% Originalquellen von Stephan Hennig
%
% ============================================================================
%<*ins>
\def\batchfile{plength.dtx}
\input docstrip.tex

\ifx\askonceonly\undefined\else\askonceonly\fi

\preamble
\endpreamble

\postamble
\endpostamble

\keepsilent
\askforoverwritefalse

\generate{%
  \file{plength.drv}{\from{plength.dtx}{driver}}%
  \file{plenDIN.mp}{\from{plength.dtx}{main,DIN,length,terms,\languagename}}%
  \file{varDIN.mp}{\from{plength.dtx}{main,DIN,variables,\languagename}}%
% Ebenfalls enthalten, derzeit aber nicht verwendet:
%  \file{plenSN.mp}{\from{plength.dtx}{main,SN,length,\languagename}}%
%  \file{varSN.mp}{\from{plength.dtx}{main,SN,variables,\languagename}}%
  \file{plinc.mp}{\from{plength.dtx}{include}}%
  \file{pltex-vars.mp}{\from{plength.dtx}{tex}}%
  \file{pltex-terms.mp}{\from{plength.dtx}{tex,terms}}%
  \file{pllcoDIN.mp}{\from{plength.dtx}{DIN,values}}%
% Ebenfalls enthalten, derzeit aber nicht verwendet:
%  \file{pllcoSN.mp}{\from{plength.dtx}{SN,values}}%
}

\csname endinput\endcsname
%</ins>
%
%<*driver>
%    \begin{macrocode}
\ProvidesFile{plength.drv}[2014/02/28 plength MetaPost graphics]
\documentclass{ltxdoc}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\begin{document}
  \DocInput{plength.dtx}
\end{document}
%    \end{macrocode}
%</driver>
% \fi
%
% \title{MetaPost-Grafiken für das Briefkapitel}
% \author{Stephan Hennig und Markus Kohm}
% \date{2010-02-09}
% \maketitle
%
% Es werden diverse Dateien erzeugt: \texttt{plenDINde.mp},
% \texttt{varDINde.mp}, \texttt{plenSNde.mp}, \texttt{varSNde.mp}, \dots Diese
% mit
% \begin{flushleft}
% \texttt{mpost --tex=latex} \meta{mp-file}
% \end{flushleft}
% bearbeitet ergibt \texttt{1}-Dateien. Diese können als EPS-Dateien
% geladen werden. Es kann aber auch mit
% \begin{flushleft}
% \texttt{mptopdf} \meta{1-Datei}
% \end{flushleft}
% eine PDF-Datei erzeugt werden.
%
% Anpassungen werden ausschließlich in der \texttt{dtx}-Datei vorgenommen!
% Wesentlich ist dabei der Abschnitt \texttt{main}.
% 
%<*main>
% \section{Der Abschnitt \texttt{main}}
% Diese Abschnitt erzeugt die Haupttreiberdateien, die dann mit \texttt{mpost}
% bearbeitet werden.
%
% Hinweise zu den Variablen:
% \begin{itemize}
% \item \texttt{input pllcoDIN} oder \texttt{input pllcoSN}\hfill\\
%   legt fest, ob die Maße für Briefe nach DIN oder SN
%   geladen werden. Damit kann gewählt werden, welches Layout
%   verdeutlicht werden soll. Sollen die Längen eingezeichnet werden,
%   ist pllcoDIN zu verwenden.
% \item \texttt{grafikhoehe}\hfill\\
%   legt die Höhe der Ausgabedatei fest.
% \item \texttt{strichstaerke}\hfill\\
%   bestimmt die Stiftbreite, die zum Zeichnen des
%   Briefbogens, der Faltmarken und der From-Rule benutzt wird.
% \item \texttt{framestrichstaerke}\hfill\\
%   bestimmt die Stiftbreite zum Zeichnen der
%   Element-Rahmen (nicht der Hilfsrahmen).
% \item \texttt{hilfsstrichstaerke}\hfill\\
%   bestimmt die Stiftbreite zum Zeichnen der
%   Bemaßung und der Hilfsrahmen.
% \item \texttt{tickhoehe}\hfill\\
%   legt die Höhe der vertikalen Linien horizontaler
%   Bemaßung fest (Makro hmeasure). Die Maßlinie wird auf halber Höhe
%   von tickhoehe gezeichnet. Für die Makros vmeasure und dmeasure gilt
%   ähnliches. In dmeasure wird jedoch ein Vielfaches von tickhoehe
%   verwendet.
% \item \texttt{framed} und \texttt{filled}\hfill\\ 
%   legen fest, ob die Elemente mit einem Rahmen
%   versehen bzw. gefüllt werden sollen.
% \item \texttt{drawcolor}\hfill\\
%   legt die Farbe von Linien und Text fest.
% \item \texttt{fillcolor}\hfill\\
%   legt die Füllfarbe fest, falls filled=true ist.
% \item \texttt{latexlengths}\hfill\\
%   legt fest, ob die unveränderlichen LaTeX-Längen
%   angezeigt werden sollen.
% \item \texttt{latexlengthcolor}\hfill\\
%     legt die Farbe fest, mit der LaTeX-Längen
%   gezeichnet werden.
% \item \texttt{language}\hfill\\
%   legt die Sprache der Beschreibung fest.
% \item \texttt{ahlength}\hfill\\
%   Da foldmarkhpos sehr klein ist, können sich bei kleinen Grafiken
%   die Pfeilspitzen der Bemaßung berühren. Um das zu verhindern, kann
%   mit der MetaPost-internen Variablen ahlength die Pfeillänge
%   verringert werden.
% \end{itemize}
%
%    \begin{macrocode}
prologues:=1;
%<DIN>input pllcoDIN
%<SN>input pllcoSN
input plinc
%<!terms>input pltex-vars
%<terms>input pltex-terms
beginfig(1);
  numeric grafikhoehe;
  numeric tickhoehe;
  numeric strichstaerke, framestrichstaerke, hilfsstrichstaerke;
  boolean framed, filled, latexlengths;
  color drawcolor, fillcolor, latexlengthcolor;
  string language;
  grafikhoehe := 167mm;
  strichstaerke := 0.6pt;
  framestrichstaerke := 0.2pt;
  hilfsstrichstaerke := 0.2pt;
  tickhoehe := 10pt;
  framed := true;
  filled := true;
  drawcolor := black;
  fillcolor := .8white;
  latexlengths := true;
  latexlengthcolor := .4white;
%<ngerman>  language := "de";
%<english>  language := "en";
  ahlength := 0.7mm;
  picture description[], plength[], latexlength[];
  transform T;
  T = identity reflectedabout ((0pt,.5*paperheight),
        (paperwidth,.5*paperheight)) scaled (grafikhoehe/paperheight);
%<length>  lengths; writedescription(language);
%<variables>  describe(language);
endfig
end
%    \end{macrocode}
%</main>
%
%<*tex>
% \section{Der Abschnitt \texttt{tex}}
%
% Dieser Abschnitt enthält sozusagen den \TeX{}-Part der Grafiken.
% Hier werden beispielsweise die Fonts festgelegt.
%
% \begin{macrocode}
verbatimtex
%<<LATEX
%&latex
%LATEX
\documentclass[fontsize=8pt]{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\IfFileExists{scrnonfree.tex}{%
  \usepackage{charter}%
  \usepackage[scaled=0.87]{luximono}%
  \usepackage[scaled=0.92]{frutiger}%
}{%
  \usepackage{lmodern}%
}
\newcommand*{\plength}{\fontsize{7}{8}\sffamily}
\newcommand*{\descr}{\fontsize{7}{8}\itshape}
\newcommand*{\latexlength}{\fontsize{7}{8}\ttfamily}
\newcommand*{\Macro}[1]{{\fontsize{7}{8}\ttfamily
    \expandafter\string\csname #1\endcsname}}
\newcommand*{\Parameter}[1]{{\fontsize{7}{8}\ttfamily\itshape\{#1\}}}
\newcommand*{\PParameter}[1]{{\fontsize{7}{8}\ttfamily\{#1\}}}
\newcommand*{\Variable}[1]{{\fontsize{7}{8}\ttfamily\bfseries #1}}
\newcommand*{\Multi}[1]{%
  {\def\and{, }%
    \begin{tabular}{@{}l@{}}
      #1
    \end{tabular}
  }%
}
\begin{document}
etex

def deflengths =
begingroup
  plength[1]=btex \plength{}backaddrheight etex;
  plength[2]=btex \plength{}bfoldmarkvpos etex;
  plength[3]=btex \plength{}firstfootvpos etex;
  plength[4]=btex \plength{}firstfootwidth etex;
  plength[5]=btex \plength{}firstheadvpos etex;
  plength[6]=btex \plength{}firstheadwidth etex;
  plength[7]=btex \plength{}foldmarkhpos etex;
  plength[8]=btex \plength{}locwidth\strut etex;
  plength[9]=btex \plength{}refaftervskip etex;
  plength[10]=btex \plength{}refvpos etex;
  plength[11]=btex \plength{}refwidth etex;
  plength[12]=btex \plength{}sigbeforevskip etex;
  plength[13]=btex \plength{}sigindent etex;
  plength[14]=btex \plength{}specialmailindent etex;
  plength[15]=btex \plength{}specialmailrightindent etex;
  plength[16]=btex \plength{}tfoldmarkvpos etex;
  plength[17]=btex \plength{}toaddrhpos\strut etex;
  plength[18]=btex \plength{}toaddrindent\strut etex;
  plength[19]=btex \plength{}toaddrvpos etex;
  plength[20]=btex \plength{}toaddrwidth\strut etex;
  plength[21]=btex \plength{}toaddrheight etex;
  plength[22]=btex \plength{}refhpos etex;
  plength[23]=btex \plength{}fromrulewidth etex;
  plength[24]=btex \plength{}-toaddrhpos\strut etex;
  plength[25]=btex \plength{}lochpos etex;
  plength[26]=btex \plength{}-lochpos etex;
  plength[27]=btex \plength{}locvpos etex;
  plength[28]=btex \plength{}locheight etex;
  plength[29]=btex \plength{}subjectaftervskip etex;
  plength[30]=btex \plength{}+subjectbeforevskip etex;
  plength[31]=btex \plength{}firstfoothpos etex;
  plength[32]=btex \plength{}-firstfoothpos etex;
  plength[33]=btex \plength{}firstheadhpos etex;
  plength[34]=btex \plength{}-firstheadhpos etex;
endgroup
enddef;

def deflatexlengths =
begingroup
  latexlength[1] = btex \latexlength{}\string\baselineskip etex;
  latexlength[2] = btex \latexlength{}2\string\baselineskip etex;
  latexlength[3] = btex \latexlength{}\string\textwidth etex;
  latexlength[4] = btex \latexlength{}$\geq$\string\footskip etex;
endgroup
enddef;


def defdescriptionde =
begingroup
%<*terms>
  description[1]=btex \descr{}Briefkopf etex;
  description[2]=btex \descr{}Brief"|fuß{} etex;
  description[3]=btex \descr{}Rücksendeadresse etex;
  description[4]=btex \descr{}Versandart etex;
  description[5]=btex \descr{}Empfängeradresse etex;
  description[6]=btex \descr{}Geschäftszeile etex;
  description[7]=btex \descr{}Titel etex;
  description[8]=btex \descr{}Betreff etex;
  description[9]=btex \descr{}Anrede etex;
  description[10]=btex \descr{}Brieftext etex;
  description[11]=btex \descr{}Grußfloskel etex;
  description[12]=btex \descr{}Signatur etex;
  description[13]=btex \descr{}\begin{tabular}{@{}c@{}}Absender-\\ergänzung\end{tabular} etex;
%</terms>
%<*!terms>
  description[1]=btex \Multi{\Variable{firsthead}\\
                             \Variable{fromname}\and
                             \Variable{fromaddress}\and
                             \Variable{fromphone}\and
                             \Variable{fromfax}\and
                             \Variable{fromemail}\and
                             \Variable{fromurl}} etex;
  description[2]=btex \Variable{firstfoot} etex;
  description[3]=btex \Variable{backaddress} etex;
  description[4]=btex \Variable{specialmail} etex;
  description[5]=btex \Macro{begin}\PParameter{letter}\Parameter{Name und Adresse} etex;
  description[6]=btex \Multi{\Variable{yourref}\and
                             \Variable{yourmail}\and
                             \Variable{myref}\and
                             \Variable{customer}\and
                             \Variable{invoice}\and
                             \Variable{place}\and
                             \Variable{date}} etex;
  description[7]=btex \Variable{title} etex;
  description[8]=btex \Variable{subject} etex;
  description[9]=btex \Macro{opening}\Parameter{Anrede} etex;
  description[10]=btex \descr{}Brieftext etex;
  description[11]=btex \Macro{closing}\Parameter{Floskel} etex;
  description[12]=btex \Variable{signature} etex;
  description[13]=btex \Variable{location} etex;
%</!terms>
endgroup
enddef;

def defdescriptionen =
begingroup
%<*terms>
  description[1]=btex \descr{}letterhead etex;
  description[2]=btex \descr{}letter footer etex;
  description[3]=btex \descr{}return address etex;
  description[4]=btex \descr{}mode of dispatch etex;
  description[5]=btex \descr{}addressee etex;
  description[6]=btex \descr{}reference fields line etex;
  description[7]=btex \descr{}title etex;
  description[8]=btex \descr{}subject etex;
  description[9]=btex \descr{}opening etex;
  description[10]=btex \descr{}letter body etex;
  description[11]=btex \descr{}closing etex;
  description[12]=btex \descr{}signature etex;
  description[13]=btex \descr{}\begin{tabular}{@{}c@{}}supplemental\\data\end{tabular} etex;
%</terms>
%<*!terms>
  description[1]=btex \Multi{\Variable{firsthead}\\
                             \Variable{fromname}\and
                             \Variable{fromaddress}\and
                             \Variable{fromphone}\and
                             \Variable{fromfax}\and
                             \Variable{fromemail}\and
                             \Variable{fromurl}} etex;
  description[2]=btex \Variable{firstfoot} etex;
  description[3]=btex \Variable{backaddress} etex;
  description[4]=btex \Variable{specialmail} etex;
  description[5]=btex \Macro{begin}\PParameter{letter}\Parameter{addressee} etex;
  description[6]=btex \Multi{\Variable{yourref}\and
                             \Variable{yourmail}\and
                             \Variable{myref}\and
                             \Variable{customer}\and
                             \Variable{invoice}\and
                             \Variable{place}\and
                             \Variable{date}} etex;
  description[7]=btex \Variable{title} etex;
  description[8]=btex \Variable{subject} etex;
  description[9]=btex \Macro{opening}\Parameter{opening term} etex;
  description[10]=btex \descr{}letter body etex;
  description[11]=btex \Macro{closing}\Parameter{closing term} etex;
  description[12]=btex \Variable{signature} etex;
  description[13]=btex \Variable{location} etex;
%</!terms>
endgroup
enddef;
% \end{macrocode}
%</tex>
%
%<*values>
% \section{Der Abschnitt \texttt{values}}
% In diesem Abschnitt finden sich Maße für die unterschiedlichen Briefe
% ausgehend von \texttt{11pt}, \texttt{a4paper}.
%
%<*DIN>
% \section{Maße für DIN-Briefe}
%
%\begin{macrocode}
numeric paperwidth;
numeric paperheight;
numeric textwidth;
numeric textheight;
numeric evensidemargin;
numeric oddsidemargin;
numeric topmargin;
numeric headheight;
numeric headsep;
numeric topskip;
numeric footskip;
numeric baselineskip;

paperwidth     = 597.50793pt;
paperheight    = 845.04694pt;
textwidth      = 418.25555pt;
textheight     = 595.80026pt;
evensidemargin = 17.3562pt;
oddsidemargin  = 17.3562pt;
topmargin      = -25.16531pt;
headheight     = 17.0pt;
headsep        = 20.40001pt;
topskip        = 11.0pt;
footskip       = 47.60002pt;
baselineskip   = 13.6pt;



numeric foldmarkhpos;
numeric tfoldmarkvpos;
numeric bfoldmarkvpos;
numeric tfoldmarklength;
numeric pfoldmarklength;
numeric bfoldmarklength;
numeric toaddrvpos;
numeric refvpos;
numeric refaftervskip;
numeric toaddrhpos;
numeric toaddrwidth;
numeric toaddrheight;
numeric toaddrindent;
numeric specialmailindent;
numeric specialmailrightindent;
numeric locwidth;
numeric backaddrheight;
numeric firstheadvpos;
numeric firstheadwidth;
numeric firstfootwidth;
numeric firstfootvpos;
numeric refwidth;
numeric sigindent;
numeric sigbeforevskip;


foldmarkhpos = 3.5mm;
tfoldmarkvpos = 105mm;
bfoldmarkvpos = 210mm;
tfoldmarklength = 2mm;
pfoldmarklength = 4mm;
bfoldmarklength = 2mm;
toaddrvpos = 45mm;
refvpos = 98.5mm;
refaftervskip = baselineskip;
toaddrhpos = 20mm;
toaddrwidth = 85mm;
toaddrheight = 40mm;
toaddrindent = 0mm;
%specialmailindent = \fill;
specialmailrightindent = 11pt;
locwidth = 3.75cm;
backaddrheight = 5mm;
firstheadvpos = 8mm;
firstheadwidth = paperwidth - 2*abs(toaddrhpos);
firstfootwidth = firstheadwidth;
firstfootvpos = 1in + topmargin + headheight + headsep + textheight + footskip;
refwidth = 0pt;
sigindent = 0mm;
sigbeforevskip = 2*baselineskip;

%    \end{macrocode}
% weitere Hilfsvariablen
%    \begin{macrocode}
numeric firstheadhpos;
numeric firstheadheight;
numeric firstfoothpos;
numeric firstfootheight;
numeric fromrulewidth;
numeric fromrulehpos;
numeric specialmailwidth;
numeric specialmailheight;
numeric lochpos;
numeric refhpos;
numeric refheight;
numeric titlevpos;
numeric titlewidth;
numeric titleheight;
numeric subjectvpos;
numeric subjectwidth;
numeric subjectheight;
numeric openingvpos;
numeric openingwidth;
numeric openingheight;
numeric bodyvpos;
numeric bodywidth;
numeric bodyheight;
numeric typeareabottom;
numeric sigvpos;
numeric sigwidth;
numeric sigheight;
firstheadhpos = 0.5*(paperwidth-firstheadwidth);
firstheadheight = 5*baselineskip;
firstfoothpos = 0.5*(paperwidth-firstfootwidth);
firstfootheight = 3*baselineskip;
fromrulewidth = 0.5*firstheadwidth;
fromrulehpos = firstheadhpos+0.5*(firstheadwidth-fromrulewidth);
specialmailwidth = 5cm;
specialmailheight = baselineskip;
specialmailindent = toaddrwidth-specialmailrightindent-specialmailwidth;
lochpos = paperwidth-toaddrhpos-locwidth;
refhpos = 1in+oddsidemargin;
refheight = 2*baselineskip;
refwidth := textwidth;
titlevpos = refvpos+refheight+refaftervskip;
titlewidth = 9cm;
titleheight = 1.2*baselineskip;
subjectvpos = titlevpos+titleheight+1*baselineskip;
subjectwidth = 8cm;
subjectheight = baselineskip;
openingvpos = subjectvpos+subjectheight+2*baselineskip;
openingwidth = 6cm;
openingheight = baselineskip;
bodyvpos = openingvpos+openingheight+baselineskip;
bodywidth = textwidth;
bodyheight = 8*baselineskip;
typeareabottom = firstfootvpos-footskip; 
sigvpos = bodyvpos+bodyheight+baselineskip;
sigwidth = 5cm;
sigheight = baselineskip;
%    \end{macrocode}
%</DIN>
%
%<*SN>
% \section{Maße für SN-Briefe}
%    \begin{macrocode}
numeric paperwidth;
numeric paperheight;
numeric textwidth;
numeric textheight;
numeric evensidemargin;
numeric oddsidemargin;
numeric topmargin;
numeric headheight;
numeric headsep;
numeric topskip;
numeric footskip;
numeric baselineskip;

paperwidth     = 597.50793pt;
paperheight    = 845.04694pt;
textwidth      = 418.25555pt;
textheight     = 595.80026pt;
evensidemargin = 17.3562pt;
oddsidemargin  = 17.3562pt;
topmargin      = -25.16531pt;
headheight     = 17.0pt;
headsep        = 20.40001pt;
topskip        = 11.0pt;
footskip       = 47.60002pt;
baselineskip   = 13.6pt;



numeric foldmarkhpos;
numeric tfoldmarkvpos;
numeric bfoldmarkvpos;
numeric tfoldmarklength;
numeric pfoldmarklength;
numeric bfoldmarklength;
numeric toaddrvpos;
numeric refvpos;
numeric refaftervskip;
numeric toaddrhpos;
numeric toaddrwidth;
numeric toaddrheight;
numeric toaddrindent;
numeric specialmailindent;
numeric specialmailrightindent;
numeric locwidth;
numeric backaddrheight;
numeric firstheadvpos;
numeric firstheadwidth;
numeric firstfootwidth;
numeric firstfootvpos;
numeric refwidth;
numeric sigindent;
numeric sigbeforevskip;


foldmarkhpos = 3.5mm;
tfoldmarkvpos = 105mm;
bfoldmarkvpos = 210mm;
tfoldmarklength = 2mm;
pfoldmarklength = 4mm;
bfoldmarklength = 2mm;
toaddrvpos = 45mm;
refvpos = 98.5mm;
refaftervskip = baselineskip;
toaddrhpos = -8mm;
toaddrwidth = 90mm;
toaddrheight = 40mm;
toaddrindent = 0mm;
%specialmailindent = \fill;
specialmailrightindent = 11pt;
locwidth = (paperwidth-2*abs(toaddrhpos)-toaddrwidth)/2;
backaddrheight = 5mm;
firstheadvpos = 8mm;
firstheadwidth = paperwidth - 2*abs(toaddrhpos);
firstfootwidth = firstheadwidth;
firstfootvpos = 1in + topmargin + headheight + headsep + textheight + footskip;
show firstfootvpos;
refwidth = 0pt;
sigindent = 0mm;
sigbeforevskip = 2*baselineskip;


%    \end{macrocode}
% weitere Hilfsvariablen
%    \begin{macrocode}
numeric firstheadhpos;
numeric firstheadheight;
numeric firstfoothpos;
numeric firstfootheight;
numeric fromrulewidth;
numeric fromrulehpos;
numeric specialmailwidth;
numeric specialmailheight;
numeric lochpos;
numeric refhpos;
numeric refheight;
numeric titlevpos;
numeric titlewidth;
numeric titleheight;
numeric subjectvpos;
numeric subjectwidth;
numeric subjectheight;
numeric openingvpos;
numeric openingwidth;
numeric openingheight;
numeric bodyvpos;
numeric bodywidth;
numeric bodyheight;
numeric typeareabottom;
numeric sigvpos;
numeric sigwidth;
numeric sigheight;
firstheadhpos = 0.5*(paperwidth-firstheadwidth);
firstheadheight = 4*baselineskip;
firstfoothpos = 0.5*(paperwidth-firstfootwidth);
firstfootheight = 3*baselineskip;
fromrulewidth = 0.5*firstheadwidth;
fromrulehpos = firstheadhpos+0.5*(firstheadwidth-fromrulewidth);
specialmailwidth = 5cm;
specialmailheight = baselineskip;
specialmailindent = toaddrwidth-specialmailrightindent-specialmailwidth;
lochpos = -toaddrhpos;
refhpos = 1in+oddsidemargin;
refheight = 2*baselineskip;
refwidth := textwidth;
titlevpos = refvpos+refheight+refaftervskip;
titlewidth = 9cm;
titleheight = 1.2*baselineskip;
subjectvpos = titlevpos+titleheight+1*baselineskip;
subjectwidth = 8cm;
subjectheight = baselineskip;
openingvpos = subjectvpos+subjectheight+2*baselineskip;
openingwidth = 6cm;
openingheight = baselineskip;
bodyvpos = openingvpos+openingheight+baselineskip;
bodywidth = textwidth;
bodyheight = 8*baselineskip;
typeareabottom = firstfootvpos-footskip; 
sigvpos = bodyvpos+bodyheight+baselineskip;
sigwidth = 5cm;
sigheight = baselineskip;
%    \end{macrocode}
%</SN>
%</values>
%
%<*include>
% \section{Der Abschnitt \texttt{include}}
% \changes{}{2005-08-30}{Korrektur der Stiftstärken}
%
% Dieser Abschnitt erzeugt die Datei \texttt{plinc.mp} mit den wesentlichen
% Definitionen für die Erzeugung eines Elements. Eine Element ist
% beispielsweise eine Pseudolänge, eine Beschreibung (Variable), ein Feld,
% \dots).
%
%    \begin{macrocode}
def lengths =
  toaddrindent := 0.7cm;
%    \end{macrocode}
% Die Breite des \texttt{location}-Feldes wird später berechnet und deshalb
% hier nicht mehr mit
% \begin{verbatim}
%  locwidth := 3.7cm;
% \end{verbatim}
% gesetzt.
%    \begin{macrocode}
  firstheadheight := firstheadheight-3pt;
  firstheadvpos := firstheadvpos+3pt;
  sigindent := 1cm;
  if (latexlengths=true):
    writelatexlengths;
  fi
  if (filled=true):
    drawfilledelements;
  fi
  if (framed=true):
    drawframedelements;
  fi
  drawpaperandfoldmarks;
  drawboxes;
%    \end{macrocode}
% From-Rule:
%    \begin{macrocode}
  draw ((fromrulehpos,firstheadvpos+firstheadheight-strichstaerke)--
    (fromrulehpos+fromrulewidth,firstheadvpos+firstheadheight-strichstaerke)) 
    transformed T withpen pencircle scaled strichstaerke;
  writelengths;
enddef;

def describe(expr lang) =
  drawpaperandfoldmarks;
  if (filled=true):
    drawfilledelements;
  fi
  if (framed=true):
    drawframedelements;
  fi
  writedescription(lang);
enddef;    

def drawframedelements =
  if toaddrhpos < 0 :
    istoaddrhpos := paperwidth-abs(toaddrhpos)-toaddrwidth;
  else :
    istoaddrhpos := toaddrhpos;
  fi
  pickup pencircle scaled framestrichstaerke;
  drawoptions(withcolor drawcolor);
%    \end{macrocode}
% Kopf und Fuß
%    \begin{macrocode}
  draw unitsquare xscaled firstheadwidth yscaled firstheadheight 
    shifted (firstheadhpos, firstheadvpos) transformed T;
  draw unitsquare xscaled firstfootwidth yscaled firstfootheight 
    shifted (firstfoothpos, firstfootvpos) transformed T;
%    \end{macrocode}
% Adressfeld
%    \begin{macrocode}
  draw unitsquare xscaled toaddrwidth yscaled backaddrheight 
    shifted (istoaddrhpos, toaddrvpos) transformed T;
  draw unitsquare xscaled specialmailwidth yscaled specialmailheight 
    shifted (istoaddrhpos+toaddrwidth-specialmailwidth-specialmailrightindent, 
             toaddrvpos+backaddrheight) transformed T;
  draw unitsquare xscaled (toaddrwidth-2*toaddrindent) 
    yscaled (toaddrheight-backaddrheight-specialmailheight) 
    shifted (istoaddrhpos+toaddrindent, 
             toaddrvpos+backaddrheight+specialmailheight) transformed T;
%    \end{macrocode}
% Absenderergänzung:
%    \begin{macrocode}
  draw unitsquare xscaled locwidth yscaled toaddrheight 
    shifted (lochpos, toaddrvpos) transformed T;
%    \end{macrocode}
% Geschäftszeile:
%    \begin{macrocode}
  draw unitsquare xscaled refwidth yscaled refheight 
    shifted (1in+oddsidemargin, refvpos) transformed T;
%    \end{macrocode}
% Titel:
%    \begin{macrocode}
  draw unitsquare xscaled titlewidth yscaled titleheight 
    shifted (1in+oddsidemargin+0.5(textwidth-titlewidth), titlevpos) 
    transformed T;
%    \end{macrocode}
% Betreff:
%    \begin{macrocode}
  draw unitsquare xscaled subjectwidth yscaled subjectheight 
    shifted (1in+oddsidemargin, subjectvpos) transformed T;
%    \end{macrocode}
% Anrede:
%    \begin{macrocode}
  draw unitsquare xscaled openingwidth yscaled openingheight 
    shifted (1in+oddsidemargin, openingvpos) transformed T;
%    \end{macrocode}
% Brieftext:
%    \begin{macrocode}
  draw unitsquare xscaled bodywidth yscaled bodyheight 
    shifted (1in+oddsidemargin, bodyvpos) transformed T;
%    \end{macrocode}
% Signatur:
%    \begin{macrocode}
  draw unitsquare xscaled sigwidth yscaled sigheight 
    shifted (1in+oddsidemargin+sigindent, sigvpos) transformed T;
  draw unitsquare xscaled (0.8*sigwidth) yscaled sigheight 
    shifted (1in+oddsidemargin+sigindent+.1*sigwidth, 
             sigvpos+sigheight+sigbeforevskip) transformed T;
enddef;

def drawfilledelements =
  if toaddrhpos < 0 :
    istoaddrhpos := paperwidth-abs(toaddrhpos)-toaddrwidth;
  else :
    istoaddrhpos := toaddrhpos;
  fi
  drawoptions (withcolor fillcolor);
%    \end{macrocode}
% Kopf und Fuß:
%    \begin{macrocode}
  fill unitsquare xscaled firstheadwidth yscaled firstheadheight 
    shifted (firstheadhpos, firstheadvpos) transformed T;
  fill unitsquare xscaled firstfootwidth yscaled firstfootheight 
    shifted (firstfoothpos, firstfootvpos) transformed T;
%    \end{macrocode}
% Adressfeld:
%    \begin{macrocode}
  fill unitsquare xscaled toaddrwidth yscaled backaddrheight 
    shifted (istoaddrhpos, toaddrvpos) transformed T;
  fill unitsquare xscaled specialmailwidth yscaled specialmailheight 
    shifted (istoaddrhpos+toaddrwidth-specialmailwidth-specialmailrightindent, 
             toaddrvpos+backaddrheight) transformed T;
  fill unitsquare xscaled (toaddrwidth-2*toaddrindent) 
    yscaled (toaddrheight-backaddrheight-specialmailheight) 
    shifted (istoaddrhpos+toaddrindent,
             toaddrvpos+backaddrheight+specialmailheight) transformed T;
%    \end{macrocode}
% Absenderergänzung:
%    \begin{macrocode}
  fill unitsquare xscaled locwidth yscaled toaddrheight 
    shifted (lochpos, toaddrvpos) transformed T;
%    \end{macrocode}
% Geschäftszeile:
%    \begin{macrocode}
  fill unitsquare xscaled refwidth yscaled refheight 
    shifted (refhpos, refvpos) transformed T;
%    \end{macrocode}
% Titel:
%    \begin{macrocode}
  fill unitsquare xscaled titlewidth yscaled titleheight 
    shifted (1in+oddsidemargin+0.5(textwidth-titlewidth), titlevpos) 
    transformed T;
%    \end{macrocode}
% Betreff:
%    \begin{macrocode}
  fill unitsquare xscaled subjectwidth yscaled subjectheight 
    shifted (1in+oddsidemargin, subjectvpos) transformed T;
%    \end{macrocode}
% Anrede:
%    \begin{macrocode}
  fill unitsquare xscaled openingwidth yscaled openingheight 
    shifted (1in+oddsidemargin, openingvpos) transformed T;
%    \end{macrocode}
% Brieftext:
%    \begin{macrocode}
  fill unitsquare xscaled bodywidth yscaled bodyheight 
    shifted (1in+oddsidemargin, bodyvpos) transformed T;
%    \end{macrocode}
% Signatur:
%    \begin{macrocode}
  fill unitsquare xscaled sigwidth yscaled sigheight 
    shifted (1in+oddsidemargin+sigindent, sigvpos) transformed T;
  fill unitsquare xscaled (0.8*sigwidth) yscaled sigheight 
    shifted (1in+oddsidemargin+sigindent+.1*sigwidth, 
             sigvpos+sigheight+sigbeforevskip) transformed T;
enddef;

def drawpaperandfoldmarks =
  pickup pencircle scaled strichstaerke;
  drawoptions(withcolor drawcolor);
%    \end{macrocode}
% Briefbogen:
%    \begin{macrocode}
  draw unitsquare xscaled paperwidth yscaled paperheight transformed T;
%    \end{macrocode}
% Falzmarken:
%    \begin{macrocode}
  draw ((foldmarkhpos,tfoldmarkvpos)--
        (foldmarkhpos+tfoldmarklength,tfoldmarkvpos)) transformed T;
  draw ((foldmarkhpos,0.5*paperheight)--
        (foldmarkhpos+pfoldmarklength,0.5*paperheight)) transformed T;
  draw ((foldmarkhpos,bfoldmarkvpos)--
        (foldmarkhpos+bfoldmarklength,bfoldmarkvpos)) transformed T;
enddef;

def drawboxes =
  if toaddrhpos < 0 :
    istoaddrhpos := paperwidth-abs(toaddrhpos)-toaddrwidth;
  else :
    istoaddrhpos := toaddrhpos;
  fi
  pickup pencircle scaled hilfsstrichstaerke;
  drawoptions(withcolor drawcolor);
%    \end{macrocode}
% Kasten Adressfeld:
%    \begin{macrocode}
  draw unitsquare xscaled toaddrwidth yscaled toaddrheight 
    shifted (istoaddrhpos, toaddrvpos) transformed T;
%    \end{macrocode}
% ^^A auskommentiert:
% ^^A Kasten Adresszeile
% ^^A draw unitsquare xscaled (paperwidth-2*toaddrhpos) 
% ^^A   yscaled toaddrheight shifted (toaddrhpos, toaddrvpos) transformed T;
% Kasten Signatur:
%    \begin{macrocode}
  draw unitsquare xscaled sigwidth yscaled (2*sigheight+sigbeforevskip) 
    shifted (1in+oddsidemargin+sigindent,sigvpos) transformed T;
%    \end{macrocode}
% Kasten Satzspiegel:
%    \begin{macrocode}
  draw unitsquare xscaled textwidth yscaled (typeareabottom-titlevpos) 
    shifted (1in+oddsidemargin,titlevpos) transformed T;
enddef;

def writelengths =
begingroup
  if toaddrhpos < 0 :
    istoaddrhpos := paperwidth-abs(toaddrhpos)-toaddrwidth;
  else :
    istoaddrhpos := toaddrhpos;
  fi
  deflengths;
  pickup pencircle scaled hilfsstrichstaerke;
  drawoptions(withcolor drawcolor);
%    \end{macrocode}
% \texttt{firstheadhpos}:
%    \begin{macrocode}
  if firstheadhpos > 0 :
    hmeasure((0,firstheadvpos), firstheadhpos, plength[33], (12pt,0pt), top);
  else :
    hmeasure((0,firstheadvpos), -firstheadhpos, plength[34], (12pt,0pt), top);
  fi
%    \end{macrocode}
% \texttt{firstheadwidth}:
%    \begin{macrocode}
  hmeasure((firstheadhpos,firstheadvpos), firstheadwidth, plength[6], origin, 
           top);
%    \end{macrocode}
% \texttt{fromrulewidth}:
%    \begin{macrocode}
  hmeasure((fromrulehpos,firstheadvpos+firstheadheight-strichstaerke), 
           fromrulewidth, plength[23], origin, top);
%    \end{macrocode}
% \texttt{toaddrwidth}:
%    \begin{macrocode}
  hmeasure((istoaddrhpos,toaddrvpos), toaddrwidth, plength[20], origin, top);
%    \end{macrocode}
% \texttt{locwidth}:
%    \begin{macrocode}
  hmeasure((lochpos,toaddrvpos), locwidth, plength[8], origin, top);
%    \end{macrocode}
% \texttt{specialmailindent}:
%    \begin{macrocode}
  hmeasure((istoaddrhpos, 
            toaddrvpos+backaddrheight+0.5*(specialmailheight+tickhoehe)), 
           specialmailindent, plength[14], (-0.5*specialmailindent+toaddrindent,+14pt), rt);
%    \end{macrocode}
% \texttt{specialmailrightindent}:
%    \begin{macrocode}
  hmeasure((istoaddrhpos+toaddrwidth-specialmailrightindent,
            toaddrvpos+backaddrheight+0.5*(specialmailheight+tickhoehe)), 
           specialmailrightindent, plength[15], 
           (0.5*specialmailrightindent-3pt,0pt), rt);
%    \end{macrocode}
% \texttt{toaddrhpos}:
%    \begin{macrocode}
  if toaddrhpos > 0 :
  hmeasure((0,toaddrvpos), toaddrhpos, plength[17], (6pt,0pt), top);
  else :
  hmeasure((0,toaddrvpos), -toaddrhpos, plength[24], (6pt,0pt), top);
  fi
%    \end{macrocode}
% \texttt{lochpos}:
%    \begin{macrocode}
  if toaddrhpos > 0 :
  hmeasure((lochpos+locwidth,toaddrvpos), toaddrhpos, plength[25], (-6pt,0pt), 
           top);
  else :
  hmeasure((paperwidth+toaddrhpos,toaddrvpos), -toaddrhpos, plength[26], 
           (-6pt,0pt), top);
  fi
%    \end{macrocode}
% \texttt{toaddrindent}:
%    \begin{macrocode}
  hmeasure((istoaddrhpos,
            toaddrvpos+0.75*(toaddrheight+backaddrheight+specialmailheight+tickhoehe)), 
           toaddrindent, plength[18], (0.5*toaddrindent,0pt), rt);
  hmeasure((istoaddrhpos+toaddrwidth-toaddrindent,
            toaddrvpos+0.75*(toaddrheight+backaddrheight+specialmailheight+tickhoehe)), 
           toaddrindent, plength[18], (-0.5*toaddrindent,0pt), lft);
% \end{macrocode}
% \texttt{refwidth}:
%    \begin{macrocode}
  hmeasure((1in+oddsidemargin,refvpos), refwidth, plength[11], origin, top);
%    \end{macrocode}
% \texttt{refhpos}:
%    \begin{macrocode}
  hmeasure((0,refvpos), refhpos, plength[22], origin, top);
%    \end{macrocode}
% \texttt{foldmarkhpos}:
%    \begin{macrocode}
  hmeasure((0,bfoldmarkvpos+tickhoehe), foldmarkhpos, plength[7], 
           (-6pt,0.5*tickhoehe), lrt);
%    \end{macrocode}
% \texttt{sigindent}:
%    \begin{macrocode}
  hmeasure((1in+oddsidemargin,sigvpos+0.5*(sigheight+tickhoehe)), sigindent, 
           plength[13], (-0.5*sigindent,0pt), lft);
%    \end{macrocode}
% \texttt{firstfoothpos}:
%    \begin{macrocode}
  if firstfoothpos > 0 :
    hmeasure((0,firstfootvpos+firstfootheight+tickhoehe), firstfoothpos, plength[31], (12pt,0pt), bot);
  else :
    hmeasure((firstfootwidth-firstfoothpos,firstfootvpos+firstfootheight+tickhoehe), -firstfoothpos, plength[32], (12pt,0pt), bot);
  fi
%    \end{macrocode}
% \texttt{firstfootwidth}:
%    \begin{macrocode}
  hmeasure((firstfoothpos,firstfootvpos), firstfootwidth, plength[4], origin, 
           top);
%    \end{macrocode}
% \texttt{toaddrheight}:
%    \begin{macrocode}
  vmeasure((istoaddrhpos-tickhoehe,toaddrvpos), toaddrheight, 
           plength[21] rotated 90, origin, lft);
%    \end{macrocode}
% \texttt{locheight}:
%    \begin{macrocode}
  vmeasure((lochpos+locwidth,toaddrvpos), toaddrheight, 
           plength[28] rotated 90, origin, rt);
%    \end{macrocode}
% \texttt{subjectbeforevskip}
%    \begin{macrocode}
  label(plength[30], 
    (1in+oddsidemargin+openingwidth+152pt, subjectvpos-.5*baselineskip) 
      transformed T);
%    \end{macrocode}
% \texttt{subjectaftervskip}
%    \begin{macrocode}
  vmeasure((1in+oddsidemargin+openingwidth,subjectvpos+baselineskip), 
           2*baselineskip, plength[29], origin, rt);
%    \end{macrocode}
% \texttt{backaddrheight}:
%    \begin{macrocode}
  vmeasure((istoaddrhpos+toaddrwidth,toaddrvpos), backaddrheight, plength[1], 
           origin, rt);
%    \end{macrocode}
% \texttt{refaftervskip}:
% ^^A auskommentiert:
% ^^A  vmeasure((1in+oddsidemargin+0.5*(textwidth+titlewidth),
% ^^A           refvpos+refheight), refaftervskip, plength[9], origin, rt);
%    \begin{macrocode}
  vmeasure((1in+oddsidemargin+textwidth,refvpos+refheight), refaftervskip, 
           plength[9], origin, rt);
%    \end{macrocode}
% \texttt{sigbeforvskip}:
%    \begin{macrocode}
  vmeasure((1in+oddsidemargin+sigindent+0.1*sigwidth-tickhoehe,
           sigvpos+sigheight), sigbeforevskip, plength[12], origin, rt);
%    \end{macrocode}
% \texttt{firstheadvpos}:
%    \begin{macrocode}
  if firstheadhpos < 0 :
    dmeasure((-firstheadhpos-2*tickhoehe,firstheadvpos), plength[5], origin, rt);
  else :
    dmeasure((firstheadhpos+firstheadwidth,firstheadvpos), plength[5], origin, lft);
  fi
%    \end{macrocode}
% \texttt{toaddrvpos}:
%    \begin{macrocode}
  if toaddrhpos > 0 :
    dmeasure((istoaddrhpos+toaddrwidth,toaddrvpos), plength[19], origin, top);
  else :
    dmeasure((istoaddrhpos-2*tickhoehe,toaddrvpos), plength[19], origin, top);
  fi
%    \end{macrocode}
% \texttt{locvpos}:
%    \begin{macrocode}
  if toaddrhpos > 0 :
    dmeasure((lochpos-2*tickhoehe,toaddrvpos), plength[27], origin, top);
  else :
    dmeasure((lochpos+locwidth,toaddrvpos), plength[27], origin, top);
  fi
%    \end{macrocode}
% \texttt{refvpos}:
%    \begin{macrocode}
  dmeasure((refhpos+refwidth,refvpos), plength[10], (0pt,0pt), top);
%    \end{macrocode}
% \texttt{tfoldmarkvpos}:
%    \begin{macrocode}
  dmeasure((foldmarkhpos+tfoldmarklength,tfoldmarkvpos), plength[16], 
           (18pt,1.5*tickhoehe), bot);
%    \end{macrocode}
% \texttt{bfoldmarkvpos}:
%    \begin{macrocode}
  dmeasure((foldmarkhpos+bfoldmarklength,bfoldmarkvpos), plength[2], 
           (18pt,0pt), top);
%    \end{macrocode}
% \texttt{firstfootvpos}:
%    \begin{macrocode}
  dmeasure((firstfoothpos-2*tickhoehe,firstfootvpos), plength[3], origin, top);
endgroup
enddef;

def writelatexlengths =
begingroup
  color temp;
  deflatexlengths;
  temp := drawcolor;
  drawcolor := latexlengthcolor;
  pickup pencircle scaled hilfsstrichstaerke;
%    \end{macrocode}
% \LaTeX-Längen:
%    \begin{macrocode}
  vmeasure((1in+oddsidemargin+openingwidth,subjectvpos-baselineskip), 
           baselineskip, latexlength[1], origin, rt);
  vmeasure((1in+oddsidemargin+openingwidth,openingvpos+baselineskip), 
           baselineskip, latexlength[1], origin, rt);
  vmeasure((1in+oddsidemargin+sigindent+sigwidth,sigvpos-baselineskip), 
           baselineskip, latexlength[1], origin, rt);
  hmeasure((1in+oddsidemargin,typeareabottom+tickhoehe), 
           textwidth, latexlength[3], (0pt,-3pt), bot);
  draw ((1in+oddsidemargin+textwidth,typeareabottom)--
       (firstfoothpos+firstfootwidth,typeareabottom)) transformed T;
  vmeasure((firstfoothpos+firstfootwidth,typeareabottom), 
           firstfootvpos-typeareabottom, latexlength[4] rotated 90, origin,
           rt);
  drawcolor := temp;
endgroup
enddef;
%    \end{macrocode}
% Anker ist links unten.
%    \begin{macrocode}
def hmeasure(expr p, breite, pic, s)(suffix alig) =
begingroup
  save pleft, pright;
  pair pleft, pright;
  drawoptions(withcolor drawcolor);
%    \end{macrocode}
% linker Tick:
%    \begin{macrocode}
  draw (p--p shifted (0,-tickhoehe)) transformed T;
%    \end{macrocode}
% rechter Tick:
%    \begin{macrocode}
  draw (p--p shifted (0,-tickhoehe)) shifted (breite,0) transformed T;
%    \end{macrocode}
% Messlinie;
% die Korrektur der Stiftstärke muss nach der Transformation
% in Zeichenkoordinaten erfolgen:
%    \begin{macrocode}
  pleft = p shifted (0,-0.5*tickhoehe)
    transformed T shifted (hilfsstrichstaerke,0);
  pright = p shifted (0,-0.5*tickhoehe) shifted (breite,0)
    transformed T shifted (-hilfsstrichstaerke,0);
  drawdblarrow pleft--pright;
  label.alig(pic, (p shifted (0.5*breite, -0.5*tickhoehe) shifted s) 
    transformed T);
endgroup
enddef;


%    \end{macrocode}
% Anker ist links oben.
%    \begin{macrocode}
def vmeasure(expr p, breite, pic, s)(suffix alig) =
begingroup
  save ptop, pbottom;
  pair ptop, pbottom;
  drawoptions(withcolor drawcolor);
%    \end{macrocode}
% oberer Tick:
%    \begin{macrocode}
  draw (p--p shifted (tickhoehe,0)) transformed T;
%    \end{macrocode}
% unterer Tick:
%    \begin{macrocode}
  draw (p--p shifted (tickhoehe,0)) shifted (0,breite)  transformed T;
%    \end{macrocode}
% Messlinie;
% die Korrektur der Stiftstärke muss nach der Transformation
% in Zeichenkoordinaten erfolgen:
%    \begin{macrocode}
  ptop = p shifted (0.5*tickhoehe,0)
    transformed T shifted (0,-hilfsstrichstaerke);
  pbottom = p shifted (0.5*tickhoehe,0) shifted (0,breite)
    transformed T shifted (0,hilfsstrichstaerke);
  drawdblarrow ptop--pbottom;
  label.alig(pic, (p shifted (0.5*tickhoehe, 0.5*breite) shifted s) 
    transformed T);
endgroup
enddef;


%    \end{macrocode}
% Anker ist links unten.
%    \begin{macrocode}
def dmeasure(expr p, pic, s)(suffix alig) =
begingroup
  save ptop, pbottom;
  pair ptop, pbottom;
  drawoptions(withcolor drawcolor);
%    \end{macrocode}
% horizontale Linie:
%    \begin{macrocode}
   draw (p--p shifted (2*tickhoehe,0)) transformed T;
%    \end{macrocode}
% Messlinie:
%    \begin{macrocode}
  ptop = p shifted (0,-1.5*tickhoehe) shifted (tickhoehe,0)
     transformed T;
%    \end{macrocode}
% Die Korrektur der Stiftstärke muss nach der Transformation
% in Zeichenkoordinaten erfolgen.
%    \begin{macrocode}
  pbottom = p shifted (tickhoehe,0)
    transformed T shifted (0,hilfsstrichstaerke);
  drawarrow ptop--pbottom;
   label.alig(pic, (p shifted (tickhoehe, -1.5*tickhoehe) shifted s)
     transformed T);
endgroup
enddef;


def writedescription(expr lang) =
  if toaddrhpos < 0 :
    istoaddrhpos := paperwidth-abs(toaddrhpos)-toaddrwidth;
  else :
    istoaddrhpos := toaddrhpos;
  fi
  if (lang="de"): defdescriptionde;
  else: defdescriptionen;
  fi
  drawoptions(withcolor drawcolor);
%    \end{macrocode}
% Kopf und Fuß:
%    \begin{macrocode}
  label(description[1], 
    (firstheadhpos+0.5*firstheadwidth, firstheadvpos+0.5*firstheadheight) 
      transformed T);
  label(description[2], 
    (firstfoothpos+0.5*firstfootwidth, firstfootvpos+0.5*firstfootheight) 
      transformed T);
%    \end{macrocode}
% Adressfeld:
%    \begin{macrocode}
  label(description[3], 
    (istoaddrhpos+0.5*toaddrwidth, toaddrvpos+0.5*backaddrheight) 
      transformed T);
  label(description[4],
    (istoaddrhpos+toaddrwidth-specialmailrightindent-0.5*specialmailwidth, 
     toaddrvpos+backaddrheight+0.5*specialmailheight) transformed T);
  label(description[5], 
    (istoaddrhpos+0.5*toaddrwidth, 
      toaddrvpos+backaddrheight+specialmailheight+0.5*(toaddrheight-backaddrheight-specialmailheight)) 
      transformed T);
%    \end{macrocode}
% Absenderergänzung:
%    \begin{macrocode}
  label(description[13], (lochpos+0.5*locwidth, toaddrvpos+0.5*toaddrheight) 
    transformed T);
%    \end{macrocode}
% Geschäftszeile:
%    \begin{macrocode}
  label(description[6], (1in+oddsidemargin+0.5*refwidth,
  refvpos+0.5*refheight)
    transformed T);
%    \end{macrocode}
% Titel:
%    \begin{macrocode}
  label(description[7], 
    (1in+oddsidemargin+0.5textwidth, titlevpos+0.5*titleheight) 
    transformed T);
%    \end{macrocode}
% Betreff:
%    \begin{macrocode}
  label(description[8], 
    (1in+oddsidemargin+0.5*subjectwidth, subjectvpos+0.5*subjectheight) 
    transformed T);
%    \end{macrocode}
% Anrede:
%    \begin{macrocode}
  label(description[9], 
    (1in+oddsidemargin+0.5*openingwidth, openingvpos+0.5*openingheight) 
    transformed T);
%    \end{macrocode}
% Brieftext:
%    \begin{macrocode}
  label(description[10], 
    (1in+oddsidemargin+0.5*bodywidth, bodyvpos+0.5*bodyheight) 
    transformed T);
%    \end{macrocode}
% Signatur:
%    \begin{macrocode}
  label(description[11], 
    (1in+oddsidemargin+sigindent+0.5*sigwidth, sigvpos+0.5*sigheight) 
    transformed T);
  label(description[12], 
    (1in+oddsidemargin+sigindent+0.5*sigwidth, 
     sigvpos+sigheight+sigbeforevskip+0.5*sigheight) transformed T);
enddef;
%    \end{macrocode}
%</include>
%
% \iffalse
\endinput
%%% Local Variables: 
%%% mode: doctex
%%% coding: iso-latin-1
%%% TeX-master: t
%%% End: 
% \fi
