% brief.sty 8-Mar-94

\input{briefini}

\catcode`\@=11
\typeout{}
\typeout{User Document Style `brief' V0.53$\beta$ <8. M„rz 94> von Gundolf Frank}
\typeout{entstanden aus dem orignal Letter-Style von Leslie Lamport}
\typeout{}

\def\@ptsize{0}
  \@namedef{ds@10pt}{\def\@ptsize{0}}
  \@namedef{ds@11pt}{\def\@ptsize{1}}
  \@namedef{ds@12pt}{\def\@ptsize{2}}
\newif\ifdinformat
\dinformattrue
\def\ds@din{\dinformattrue}
\def\ds@us{\dinformatfalse}
\newif\ifbankverbindung
\bankverbindungfalse
\def\ds@bank{\bankverbindungtrue}
\newif\ifvolleadresse
\volleadressefalse
\def\ds@adresse{\volleadressetrue}
\newif\ifkopf
\kopftrue
\def\ds@keinkopf{\kopffalse}
\newif\iffax
\faxfalse
\def\ds@fax{\faxtrue}
\newif\ifadresseleer
\adresseleertrue
\newif\ifserienbrief
\serienbrieffalse

\@twosidefalse

\def\ds@draft{\overfullrule 5\p@}

\@options

\lineskip 1pt
\normallineskip 1pt
\def\baselinestretch{1}

\ifcase \@ptsize\relax

\def\@normalsize{\@setsize\normalsize{12pt}\xpt\@xpt
\abovedisplayskip 10\p@ plus2\p@ minus5\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip  \z@ plus3\p@
\belowdisplayshortskip  6\p@ plus3\p@ minus3\p@
\let\@listi\@listI}

\def\small{\@setsize\small{11pt}\ixpt\@ixpt
\abovedisplayskip 8.5\p@ plus3\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus2\p@
\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini
\topsep 4\p@ plus2\p@ minus2\p@\parsep 2\p@ plus\p@ minus\p@
\itemsep \parsep}}

\def\footnotesize{\@setsize\footnotesize{9.5pt}\viiipt\@viiipt
\abovedisplayskip 6\p@ plus2\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus\p@
\belowdisplayshortskip 3\p@ plus\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini
\topsep 3\p@ plus\p@ minus\p@\parsep 2\p@ plus\p@ minus\p@
\itemsep \parsep}}

\def\scriptsize{\@setsize\scriptsize{8pt}\viipt\@viipt}
\def\tiny{\@setsize\tiny{6pt}\vpt\@vpt}
\def\large{\@setsize\large{14pt}\xiipt\@xiipt}
\def\Large{\@setsize\Large{18pt}\xivpt\@xivpt}
\def\LARGE{\@setsize\LARGE{22pt}\xviipt\@xviipt}
\def\huge{\@setsize\huge{25pt}\xxpt\@xxpt}
\def\Huge{\@setsize\Huge{30pt}\xxvpt\@xxvpt}

\or

\def\@normalsize{\@setsize\normalsize{13.6pt}\xipt\@xipt
\abovedisplayskip 11\p@ plus3\p@ minus6\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip  \z@ plus3\p@
\belowdisplayshortskip  6.5\p@ plus3.5\p@ minus3\p@
\let\@listi\@listI}

\def\small{\@setsize\small{12pt}\xpt\@xpt
\abovedisplayskip 10\p@ plus2\p@ minus5\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip  \z@ plus3\p@
\belowdisplayshortskip  6\p@ plus3\p@ minus3\p@
\def\@listi{\leftmargin\leftmargini
\topsep 6\p@ plus2\p@ minus2\p@\parsep 3\p@ plus2\p@ minus\p@
\itemsep \parsep}}

\def\footnotesize{\@setsize\footnotesize{11pt}\ixpt\@ixpt
\abovedisplayskip 8\p@ plus2\p@ minus4\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus\p@
\belowdisplayshortskip 4\p@ plus2\p@ minus2\p@
\def\@listi{\leftmargin\leftmargini
\topsep 4\p@ plus2\p@ minus2\p@\parsep 2\p@ plus\p@ minus\p@
\itemsep \parsep}}

\def\scriptsize{\@setsize\scriptsize{9.5pt}\viiipt\@viiipt}
\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt}
\def\large{\@setsize\large{14pt}\xiipt\@xiipt}
\def\Large{\@setsize\Large{18pt}\xivpt\@xivpt}
\def\LARGE{\@setsize\LARGE{22pt}\xviipt\@xviipt}
\def\huge{\@setsize\huge{25pt}\xxpt\@xxpt}
\def\Huge{\@setsize\Huge{30pt}\xxvpt\@xxvpt}

\or

\def\@normalsize{\@setsize\normalsize{15pt}\xiipt\@xiipt
\abovedisplayskip 12\p@ plus3\p@ minus7\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip  \z@ plus3\p@
\belowdisplayshortskip  6.5\p@ plus3.5\p@ minus3\p@
\let\@listi\@listI}

\def\small{\@setsize\small{13.6pt}\xipt\@xipt
\abovedisplayskip 11\p@ plus3\p@ minus6\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip  \z@ plus3\p@
\belowdisplayshortskip  6.5\p@ plus3.5\p@ minus3\p@
\def\@listi{\leftmargin\leftmargini
\parsep 4.5\p@ plus2\p@ minus\p@
            \itemsep \parsep
            \topsep 9\p@ plus3\p@ minus5\p@}}

\def\footnotesize{\@setsize\footnotesize{12pt}\xpt\@xpt
\abovedisplayskip 10\p@ plus2\p@ minus5\p@
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip  \z@ plus3\p@
\belowdisplayshortskip  6\p@ plus3\p@ minus3\p@
\def\@listi{\leftmargin\leftmargini
\topsep 6\p@ plus2\p@ minus2\p@\parsep 3\p@ plus2\p@ minus\p@
\itemsep \parsep}}

\def\scriptsize{\@setsize\scriptsize{9.5pt}\viiipt\@viiipt}
\def\tiny{\@setsize\tiny{7pt}\vipt\@vipt}
\def\large{\@setsize\large{18pt}\xivpt\@xivpt}
\def\Large{\@setsize\Large{22pt}\xviipt\@xviipt}
\def\LARGE{\@setsize\LARGE{25pt}\xxpt\@xxpt}
\def\huge{\@setsize\huge{30pt}\xxvpt\@xxvpt}
\let\Huge=\huge
\fi

\normalsize

\def\ccname{cc}
\def\enclname{encl}
\def\pagename{Page}
\def\headtoname{To}

\def\nachname{}
\def\vorname{}
\def\firma{}
\def\abteilung{}
\def\strasse{}
\def\ort{} 
\def\tel{}
\def\fax{}
\def\email{}
\def\cosename{}
\def\geburtsdatum{}
\def\paraer{}
\def\parazw{}
\def\geschlecht{}
\def\kontakt{}

\def\pagenum{??}

\def\signature#1{\def\fromsig{#1}}
\def\unterschrift#1{\def\fromsig{#1}}

\def\name#1{\def\fromname{#1}}

\def\address#1{\def\fromaddress{#1}}
\def\absender#1{\def\fromaddress{#1}}

\def\telephone#1{\def\telephonenum{#1}}

\def\ihrzeichen#1{\def\@yref{#1}}
\def\yref#1{\def\@yref{#1}}
\def\@yref{}

\def\ihrenachrichtvom#1{\def\@ymail{#1}}
\def\@ymail{}

\def\meinzeichen#1{\def\@myref{#1}}
\def\myref#1{\def\@myref{#1}}

\def\betrifft#1{\def\@subject{#1}}
\def\subject#1{\def\@subject{#1}}
\def\@subject{}

\def\datum#1{\def\@date{#1}}
\def\date#1{\def\@date{#1}}

\def\sdate{\number\day.\number\month.\number\year}

% expands to the actual time (hours:minutes)
% written by Dimitris Dranidis
% (modified by Michael Mehlich to avoid temporary counter)
\newcount\hours
\newcount\minutes
%calculate hours and minutes
%hours = time/60 = ((time/60)*60)/60
%minutes = time-(time/60)*60
\minutes\time
\hours\minutes\divide\hours60\multiply\hours60
\advance\minutes-\hours
\divide\hours60
%macro to output calculated time
\def\@time{\the\hours :\ifnum\minutes<10 0\else\fi\the\minutes}

\def\uhrzeit{\@time}

\xdef\greetings{}

\def\optional#1#2[#3]{%
  \escapechar=-1
  \if\def#1%
    \edef#2{\futurelet\noexpand\next
            \csname\string#2@@body\endcsname}
    \expandafter\edef\csname\string#2@@body\endcsname{%
      \noexpand\if[\noexpand\next
                 \def\noexpand\next{\csname\string#2@@do\endcsname}%
                 \noexpand
                \else
                 \def\noexpand\next
                   {\csname\string#2@@do\endcsname
                    [\expandafter
                     \noexpand\csname\string#2@@default\endcsname]}%
                 \noexpand
               \fi
      \noexpand\next}%
    \expandafter\noexpand\expandafter
    \def\csname\string#2@@default\endcsname{#3}%
    \edef\optional@continue{
      \expandafter\noexpand\expandafter
      \def\csname\string#2@@do\endcsname[####1]}%
    \escapechar="5C\relax
    \let\next=\optional@continue
   \else
    \escape="5C
    \errmessage{\string\def fehlt nach \string\optional}
    \let\next=\relax
  \fi
  \next}

\voffset -1.4in
\topmargin 1cm
\headheight 0.5cm
\headsep 1.6cm
\topskip 0.5cm
\ifdinformat
  \ifvolleadresse
    \textheight 23.7cm
  \else
    \textheight 24.2cm
  \fi
  \typeout{Papierformat DIN eingestellt}
  \typeout{Bitte bei Ausgabe die Option "/h29.7cm" angeben}
 \else
  \ifvolleadresse
    \textheight 24.48cm
  \else
    \textheight 24.98cm
  \fi
  \typeout{Papierformat Endlos/US-Papier eingestellt}
  \typeout{Bitte bei Ausgabe die Option "/h12in" angeben}
\fi
\ifvolleadresse
  \footskip 1.5cm 
  \footheight 1cm
\else
  \footskip 1cm
  \footheight 0.5cm
\fi
\hoffset -1in
\oddsidemargin 2.5cm                  \marginparsep 0.4cm
\evensidemargin 2.5cm                 \marginparwidth 3cm
                                      \marginparpush 0.2cm
\textwidth 16cm
\columnseprule 0cm
\columnsep 0,5cm

\raggedbottom

\footnotesep 0.4cm

\skip\footins 10pt plus 2pt minus 4pt

\floatsep 12pt plus 2pt minus 2pt
\textfloatsep  20pt plus 2pt minus 4pt
\intextsep 12pt plus 2pt minus 2pt
\dblfloatsep 12pt plus 2pt minus 2pt
\dbltextfloatsep 20pt plus 2pt minus 4pt
\@maxsep 20pt
\@dblmaxsep 20pt
\@fptop 0pt plus 1fil
\@fpsep 8pt plus 2fil
\@fpbot 0pt plus 1fil
\@dblfptop 0pt plus 1fil
\@dblfpsep 8pt plus 2fil
\@dblfpbot 0pt plus 1fil

\unitlength1cm

\newlength {\leftfield}
\leftfield110mm
\newlength {\rightfield}
\rightfield50mm

\newsavebox {\firm}
\newsavebox {\firmadress}
\newsavebox {\firmreturn}
\newbox     {\firmhead}
\newbox     {\firmfoot}

\savebox{\firm}[\leftfield][l]{ \ifcase \@ptsize\relax
                                  \LARGE
                                 \or
                                  \Large
                                 \or
                                  \large
                                \fi
                                \sf \fromname}

\sbox{\firmreturn}{\ifcase \@ptsize\relax
                     \normalsize
                    \or
                     \small
                    \or
                     \footnotesize
                   \fi
                  \underline{\sf \fromadress}}

\savebox{\firmadress}[\rightfield][l]{\ifx\bilddateiname\empty
                                      \else
                                         \input{\bilddateiname}
                                         \setletbild
                                      \fi}

\sbox{\firmhead}{\parbox{\textwidth}{
     \begin{picture}(0,0)
     \put(-1.5,-8.0){\line(1,0){0.2}}
     \put(17,-8.0){\line(1,0){0.2}}
     \ifdinformat
       \put(-1.5,-12.25){\line(1,0){0.2}}
       \put(17,-12.25){\line(1,0){0.2}}
      \else
       \put(-1.5,-12.44){\line(1,0){0.2}}
       \put(17,-12.44){\line(1,0){0.2}}
     \fi
     \end{picture}
     \usebox{\firm}%\raisebox{6pt}
     {\usebox{\firmadress}}\\[1mm]
     \rule{\textwidth}{0.1mm}}}

% Fu\ss{}teil setzen
\sbox{\firmfoot}{\parbox{\textwidth}{
                    \ifcase \@ptsize\relax
                      \small
                     \or
                      \footnotesize
                     \or
                      \scriptsize
                    \fi
                    \ifvolleadresse
                      \sf\rule{\textwidth}{1pt}
                      \begin{tabular}{l}
                         \fromname\\
                         \fromstreet\\
                         \fromlocation
                      \end{tabular}
                      \hfill
                      \begin{tabular}{ll}
                         Telefon: &\precode/\telephonenum\\
                         Fax:     &\precode/\myfax\\
                         E-Mail:  &\myemail
                      \end{tabular}
                      \ifbankverbindung
                        \hfill
                        \begin{tabular}{ll}
                           Bank:         & \bankname\\
                           Bankleitzahl: & \blz\\
                           Kontonummer:  & \ktonr
                        \end{tabular}
                      \fi
                    \else
                      \ifbankverbindung
                        \sf\rule{\textwidth}{1pt}
                        \underline{Bankverbindung:} \bankname \hfill
                        Bankleitzahl: \blz \hfill Kontonummer: \ktonr
                      \fi
                    \fi
              }}

\newdimen\longindentation
\longindentation=.5\textwidth
\newdimen\indentedwidth
\indentedwidth=\textwidth
\advance\indentedwidth -\longindentation

\newif\iftestnegativ

\optional\def\anrede[{}]#2{
   \batchmode
   \thispagestyle{firstpage}
   \parbox[t]{\leftfield}{\usebox{\firmreturn}\\
                          \to@label{\toname}{\toaddress}}
   \parbox[t]{\rightfield}{}
   \par
   \rule{\textwidth}{0.1mm}
   \tabcolsep0em
   \begin{tabular}{l}
      \ifcase \@ptsize\relax
        \small
      \or
        \footnotesize
       \or
        \scriptsize
       \fi
       Datum\\
       \normalsize
       \sdate
   \end{tabular}
   \iffax
     \hfill
     \begin{tabular}{l}
      \ifcase \@ptsize\relax
        \small
      \or
        \footnotesize
       \or
        \scriptsize
       \fi
       Uhrzeit\\
       \normalsize
       \@time
     \end{tabular}
     \hfill
     \begin{tabular}{c}
      \ifcase \@ptsize\relax
        \small
      \or
        \footnotesize
       \or
        \scriptsize
       \fi
       Gesamtseitenanzahl\\
       \normalsize
       \pagenum
     \end{tabular}
   \fi
   \hfill
   \begin{tabular}{l}
      \ifcase\@ptsize\relax
        \small
       \or
        \footnotesize
       \or
        \scriptsize
       \fi
       \myrefname\\
       \normalsize
       \@myref
   \end{tabular}\hfill
   \ifx\@empty\@yref\else
                    \begin{tabular}{l}
                       \ifcase\@ptsize\relax
                         \small
                        \or
                         \footnotesize
                        \or
                         \scriptsize
                        \fi\yrefname\\
                        \normalsize\@yref
                    \end{tabular}\hfill\fi
   \ifx\@empty\@ymail\else
                    \begin{tabular}{l}
                       \ifcase\@ptsize\relax
                         \small
                        \or
                         \footnotesize
                        \or
                         \scriptsize
                        \fi\ymailname\\
                        \normalsize\@ymail
                    \end{tabular}\hfill\fi
   \par
   \tabcolsep1em
   \vspace{3\parskip}
   \ifx\@empty\@subject
    \else
     \ifx\subjectname\empty
        {\bf \@subject}
      \else
        {\bf\subjectname}\space\@subject
     \fi
     \par
     \vspace{2\parskip}
   \fi
   \def\uebergabe{#1}
   \def\zwparameter{#2}
   \ifx\zwparameter\empty
     \ifx\uebergabe\empty
       \xdef\uebergabe{\anredekurzoa}
       \def\test{herzlich}
       \ifx\test\kontakt%
         \def\test{w}
         \ifx\test\geschlecht%
            \xdef\uebergabe{\anredekurzd}
         \fi
         \def\test{m}
         \ifx\test\geschlecht%
            \xdef\uebergabe{\anredekurze}
         \fi
         \def\zwparameter{\cosename} 
       \fi 
       \def\test{formal}
       \ifx\test\kontakt%
         \def\test{w}
         \ifx\test\geschlecht
           \ifx\nachname\empty
             \xdef\uebergabe{\anredekurzob}
           \else      
             \xdef\uebergabe{\anredekurza}
           \fi
         \fi
         \def\test{m}
         \ifx\test\geschlecht
           \ifx\nachname\empty
             \xdef\uebergabe{\anredekurzoc}
           \else      
             \xdef\uebergabe{\anredekurzb}
           \fi
         \fi
         \def\test{n}
         \ifx\test\geschlecht
            \xdef\uebergabe{\anredekurzoa}
         \fi
         \def\zwparameter{\nachname}
       \fi   
     \else
       \ifx\anredekurzd\uebergabe
         \def\zwparameter{\cosename}
       \fi
       \ifx\anredekurze\uebergabe
         \def\zwparameter{\cosename}
       \fi
       \ifx\anredekurzb\uebergabe
         \def\zwparameter{\nachname}
       \fi
       \ifx\anredekurza\uebergabe
         \def\zwparameter{\nachname}
       \fi
     \fi
   \fi
   \testnegativtrue
   \ignorespaces
   \ifx\anredekurzoa\uebergabe
     \anredeoa,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurza}
     \fi
     \testnegativfalse
   \fi
   \ifx\anredekurzd\uebergabe
     \anreded\space\zwparameter,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurzd}
     \fi
     \testnegativfalse
   \fi
   \ifx\anredekurze\uebergabe
     \anredee\space\zwparameter,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurzd}
     \fi
     \testnegativfalse
   \fi
   \ifx\anredekurzf\uebergabe
     \anredef\space\zwparameter,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurza}
     \fi
     \testnegativfalse
   \fi
   \ifx\anredekurzb\uebergabe
     \anredeb\space\zwparameter,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurza}
     \fi
     \testnegativfalse
   \fi
   \ifx\anredekurza\uebergabe
     \anredea\space\zwparameter,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurza}
     \fi
     \testnegativfalse
   \fi
   \ifx\anredekurzoc\uebergabe
     \anredeoc,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurza}
     \fi
     \testnegativfalse
   \fi
   \def\test{sgF}
   \ifx\anredekurzob\uebergabe
     \anredeob,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurza}
     \fi
     \testnegativfalse
   \fi
   \ifx\anredekurzc\uebergabe
     \anredec\space\zwparameter,\\
     \ifx\greetings\empty
       \xdef\greetings{\grusskurza}
     \fi
     \testnegativfalse
   \fi
   \iftestnegativ
     \zwparameter\\
   \fi
   \par\nobreak
   \errorstopmode
   }

\optional\def\opening[{}]#2{\anrede[#1]{#2}}

\def\gruss#1{
  \batchmode
  \par\nobreak\vspace{\parskip}%
  \stopbreaks
  \noindent
  \hspace*{\longindentation}
  \parbox{\indentedwidth}{\raggedright
       \ifx\greetings\empty
         \xdef\greetings{\grusskurza}
       \fi
       \def\uebergabe{#1}
       \ifx\uebergabe\empty
        \else
         \def\greetings{#1}
       \fi
       \testnegativtrue
       \ignorespaces
       \ifx\grusskurza\greetings
         \grussa\\
         \def\kontakt{formal}
         \testnegativfalse
       \fi
       \ifx\grusskurzc\greetings
         \grussc\\
         \def\kontakt{herzlich}
         \testnegativfalse
       \fi
       \ifx\grusskurzd\greetings
         \grussd\\
         \def\kontakt{herzlich}
         \testnegativfalse
       \fi
       \ifx\grusskurzb\greetings
         \grussb\\
         \def\kontakt{herzlich}
         \testnegativfalse
       \fi
       \ifx\grusskurze\greetings
         \grusse
         \def\kontakt{formal}
         \testnegativfalse
       \fi
       \iftestnegativ
         \def\kontakt{formal}
         \greetings\\
       \fi
       \def\test{herzlich}
       \ifx\kontakt\test
         Dein
         \iffax
           \ifx\unterschriftdateiname\empty
             \vspace{6\medskipamount}
           \else
             \par
             \vspace{3 \medskipamount}
             \hspace{1em}
             \input{\unterschriftdateiname}
             \setuntersc
             \par
           \fi
         \else
           \vspace{6\medskipamount}
         \fi
       \else
         \iffax
           \ifx\unterschriftdateiname\empty
             \vspace{6\medskipamount}
           \else
             \par
             \vspace{3 \medskipamount}
             \hspace{1em}
             \input{\unterschriftdateiname}
             \setuntersc
             \par
           \fi
         \else
           \vspace{6\medskipamount}
         \fi
         \vspace{1\medskipamount}
         (\fromsig)
       \fi\strut}%
  \par
  \errorstopmode}

\def\closing#1{\gruss{#1}}

\def\PS{\par\startbreaks}

\def\anlagen#1{\par\noindent
  \parbox[t]{\textwidth}{\@hangfrom{\reset@font
                                    \rm \enclname: }%
                       \ignorespaces #1\strut}\par}
\def\encl#1{\anlagen{#1}}

\def\kopiean#1{\par\noindent
  \parbox[t]{\textwidth}{\@hangfrom{\reset@font
                                    \rm \ccname: }%
                       \ignorespaces #1\strut}\par}
\def\cc#1{\kopiean{#1}}

\def\stopletter{}

\def\to@label#1#2{\setbox0\vbox{\parbox{\leftfield}
   {#1\\#2}}\vbox to 3.5cm{\vss\box0\vss}}

\def\returnaddress{}
\newcount\labelcount

\def\startlabels{\labelcount\z@
\pagestyle{empty}%
\let\@texttop\relax
\topmargin -50\p@
\headsep \z@
\oddsidemargin -35\p@
\evensidemargin -35\p@
\textheight 25.4cm
\@colht\textheight  \@colroom\textheight \vsize\textheight
\textwidth 550\p@
\columnsep 25\p@
\ifcase \@ptsize\relax
  \normalsize
 \or
  \small
 \or
  \footnotesize
 \fi
\baselineskip \z@
\lineskip \z@
\boxmaxdepth \z@
\parindent \z@
\twocolumn\relax}

\def\mlabel#1#2{\setbox0\vbox{\parbox[b]{3.6in}%
                                        {\strut\ignorespaces #2}}%
         \vbox to 2in{\vss \box0 \vss}}


\optional\def\letter[{}]#2{
  \batchmode
  \newpage
  \c@page\@ne
  \interlinepenalty=200
  \def\uebergabe{#1}
  \def\zwparameter{#2}
  \ifserienbrief
    \loop
    \def\ende{gleich}
  \else
    \ifx\zwparameter\empty
      \errhelp{Bei \begin{letter}[Optionen]{adresse} sollte eine Adresse angegeben werden.
              Wenn Sie jetzt <RETURN> drucken wird der Brief weiter "ubersetzt,
              aber das Adressfeld bleibt frei.}
      \errmessage{Es wurde keine Adresse angegeben!}
    \fi
    \openin7=\dateinameadresse
    \def\test{---}
    \def\ende{}
    \def\zeile{}
    \loop
      \endlinechar=-1
      \read7to\zeile
      \endlinechar=13
      \ifx\zeile\test
        \endlinechar=-1
        \read7to\nachname
        \read7to\vorname
        \read7to\firma
        \read7to\abteilung
        \read7to\strasse
        \read7to\ort
        \read7to\tel
        \read7to\fax
        \read7to\email
        \read7to\cosename
        \read7to\geburtsdatum
        \read7to\paraer
        \read7to\parazw
        \read7to\geschlecht
        \read7to\kontakt
        \endlinechar=13
        \ifx\cosename\empty
          \def\cosename{\vorname}
        \fi
        \ifx#1\empty
          \ifx\zwparameter\nachname
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Nachname}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\nachname
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Vorname}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\vorname
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Firma}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\firma
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Abteilung}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\abteilung
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Strasse}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\strasse
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Ort}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\ort
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Telefonnummer}
        \ifx\uebergabe\bedingung%
          \ifx\zwparameter\tel
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Faxnummer}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\fax
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{E-Mail}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\email
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Geburtsdatum}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\Geburtsdatum
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Cosename}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\cosename
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Zusatz 1}
        \ifx\uebergabe\bedingung%
          \ifx\zwparameter\paraer%
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Zusatz 2}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\parazw
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Geschlecht}
        \ifx\uebergabe\bedingung
          \ifx\zwparameter\geschlecht
             \def\ende{gleich}
          \fi
        \fi
        \def\bedingung{Kontakt}
        \ifx\uebergabe\bedingung%
          \ifx\zwparameter\kontakt%
             \def\ende{gleich}
          \fi
        \fi
      \fi
      \ifeof7
        \def\ende{eof}
      \fi
      \ifx\ende\empty
    \repeat
    \closein7
  \fi
  \def\test{gleich}
  \ifx\ende\test
    \def\test{n}%
    \ifx\geschlecht\test%
      \def\zwparameter{%
         \firma\\
         \ifx\abteilung\empty
           \ \\
         \else
           Abteilung \abteilung\\
         \fi
         \strasse\\
         \ort
      }
    \fi
    \def\test{w}
    \ifx\geschlecht\test%
      \ifx\firma\empty%
        \def\zwparameter{%
          Frau\\
          \vorname\space\nachname\\
          \strasse\\
          \ort
        }
      \else
        \def\zwparameter{%
          \firma\\
          \ifx\abteilung\empty%
          \else
             Abteilung \abteilung\\
          \fi
          \ifx\nachname\empty
            \ \\
          \else
            z.H. Frau \nachname\\
          \fi
          \strasse\\
          \ort
        }
      \fi
    \fi
    \def\test{m}%
    \ifx\geschlecht\test%
      \ifx\firma\empty
        \def\zwparameter{%
          Herr\\
          \vorname\space\nachname\\
          \strasse\\
          \ort
        }
      \else 
        \def\zwparameter{%
          \firma\\
          \ifx\abteilung\empty%
          \else
            Abteilung \abteilung\\
          \fi
          \ifx\nachname\empty
            \ \\
          \else
            z.H. Herr \nachname\\
          \fi
          \strasse\\
          \ort
        }
      \fi   
    \fi
    \errorstopmode
    \typeout{}
    \typeout{Anschrift gefunden:}
    \if\firma\empty
    \else
      \typeout{\firma}
    \fi
    \if\abteilung\empty
    \else
      \typeout{Abteilung\space\abteilung}
    \fi  
    \typeout{\vorname\space\nachname}
    \typeout{\strasse}
    \typeout{\ort}
    \typeout{}
  \else
    \def\nachname{}
  \fi
  \@processto{\leavevmode\zwparameter}
  }

\def\endletter{
  \batchmode
  \stopletter\@@par\pagebreak\@@par
  \if@filesw
    \begingroup
      \let\\=\relax
      \def\protect##1{\string##1\space}%
        \immediate\write\@auxout{\string\mlabel{\returnaddress}{\toname
           \\\toaddress}}%
    \endgroup
  \fi
  \errorstopmode}

\long\def\@processto#1{\@xproc#1\\@@@\ifx\toaddress\@empty
    \else \@yproc#1@@@\fi}
\long\def\@xproc#1\\#2@@@{\def\toname{#1}\def\toaddress{#2}}
\long\def\@yproc#1\\#2@@@{\def\toaddress{#2}}

\def\stopbreaks{\interlinepenalty \@M
   \def\par{\@@par\nobreak}\let\\=\@nobreakcr
   \let\vspace\@nobreakvspace}

\def\@nobreakvspace{\@ifstar{\@nobreakvspacex}{\@nobreakvspacex}}

\def\@nobreakvspacex#1{\ifvmode\nobreak\vskip #1\relax\else
               \@bsphack\vadjust{\nobreak\vskip #1}\@esphack\fi}

\def\@nobreakcr{\vadjust{\penalty\@M}\@ifstar{\@xnewline}{\@xnewline}}

\def\startbreaks{\let\\=\@normalcr
   \interlinepenalty 200\def\par{\@@par\penalty 200\relax}}

\def\document{\endgroup
  \@colht\textheight  \@colroom\textheight \vsize\textheight
   \columnwidth\textwidth \@clubpenalty\clubpenalty
   \if@twocolumn \advance\columnwidth -\columnsep
      \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
   \fi
  \hsize\columnwidth \linewidth\hsize
  \begingroup\@floatplacement\@dblfloatplacement\endgroup
  \iffax
    \immediate\openin\@mainaux=\jobname.aux
    \ifeof\@mainaux
    \else
      \immediate\closein\@mainaux
      \input \jobname.aux
    \fi
  \fi
  \if@filesw \immediate\openout\@mainaux=\jobname.aux
   \immediate\write\@mainaux
    {\string\startlabels\string\@startlabels}
  \else
    \iffax
       \immediate\openout\@mainaux=\jobname.aux
    \fi
  \fi
  \csname process@table\endcsname
  \let\glb@currsize\@empty
  \def\do##1{\let ##1\@notprerr}%
  \@preamblecmds
  \let\do\noexpand
  \@normalsize\everypar{}}

\def\enddocument{
\iffax
  \addtocounter{page}{-1}
  \immediate\write\@mainaux{\string\def\string\pagenum{\thepage}}
  \addtocounter{page}{1}
\fi
\@checkend{document}
\newpage\begingroup
\if@filesw 
  \immediate\closeout\@mainaux
  \makeatletter\input \jobname.aux\clearpage
\else
  \iffax
     \immediate\closeout\@mainaux
  \fi
\fi
\endgroup\deadcycles\z@\@@end}

\def\makelabels{\@fileswtrue}

\def\@startlabels{}

\def\ps@headings{
   \ifkopf
     \headheight1.27cm
     \def\@oddhead{\usebox{\firmhead}}
    \else
     \def\@oddhead{}
   \fi
   \def\@oddfoot{}
   \let\@evenhead\@oddhead}
%end \def\ps@headings


\def\ps@empty{\def\@oddhead{}
              \def\@oddfoot{}
              \def\@evenhead{}
              \def\@evenfoot{}}

\def\ps@firstpage{
   \ifkopf
     \headheight1.27cm
     \def\@oddhead{\usebox{\firmhead}}
    \else
     \def\@oddhead{}
   \fi
   \def\@oddfoot{\raisebox{0pt}[0pt]{\usebox{\firmfoot}}}
   \let\@evenhead\@oddhead
   \let\@evenfoot\@oddfoot}
%end \def\ps@firstpage

\def\ps@plain{
   \ifkopf
     \headheight1.27cm
     \def\@oddhead{\usebox{\firmhead}}
    \else
     \def\@oddhead{}
   \fi
   \def\@oddfoot{
      \rm
      \hfil
      \thepage 
      \iffax
        /\pagenum
      \fi
      \hfil}
   \let\@evenhead\@oddhead
   \let\@evenfoot\@oddfoot}

\parskip .7em
\parindent 0pt

\partopsep 0pt

\@lowpenalty   51
\@medpenalty  151
\@highpenalty 301

\@beginparpenalty -\@lowpenalty

\@endparpenalty   -\@lowpenalty

\@itempenalty     -\@lowpenalty

\leftmargini   2.5em
\leftmarginii  2.2em
\leftmarginiii 1.87em
\leftmarginiv  1.7em
\leftmarginv   1em
\leftmarginvi  1em

\leftmargin\leftmargini
\labelwidth\leftmargini\advance\labelwidth-\labelsep
\labelsep 5pt
\parsep 0pt

\def\@listI{\leftmargin\leftmargini
 \topsep .4em\relax
 \itemsep .4em\relax}

\let\@listi\@listI
\@listi

\def\@listii{\leftmargin\leftmarginii
   \labelwidth\leftmarginii\advance\labelwidth-\labelsep}

\def\@listiii{\leftmargin\leftmarginiii
    \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
    \topsep .2em
    \itemsep \topsep}

\def\@listiv{\leftmargin\leftmarginiv
     \labelwidth\leftmarginiv\advance\labelwidth-\labelsep}

\def\@listv{\leftmargin\leftmarginv
     \labelwidth\leftmarginv\advance\labelwidth-\labelsep}

\def\@listvi{\leftmargin\leftmarginvi
     \labelwidth\leftmarginvi\advance\labelwidth-\labelsep}

\def\labelenumi{\arabic{enumi}.}
\def\theenumi{\arabic{enumi}}

\def\labelenumii{(\alph{enumii})}
\def\theenumii{\alph{enumii}}
\def\p@enumii{\theenumi}

\def\labelenumiii{\roman{enumiii}.}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\theenumi(\theenumii)}

\def\labelenumiv{\Alph{enumiv}.}
\def\theenumiv{\Alph{enumiv}}
\def\p@enumiv{\p@enumiii\theenumiii}

\def\labelitemi{$\m@th\bullet$}
\def\labelitemii{\bf --}
\def\labelitemiii{$\m@th\triangleright$}
\def\labelitemiv{$\m@th\cdot$}

\def\verse{\let\\=\@centercr
  \list{}{\itemsep\z@ \itemindent -15\p@\listparindent \itemindent
          \rightmargin\leftmargin\advance\leftmargin 15\p@}\item[]}
\let\endverse\endlist

\def\quotation{\list{}{\listparindent 1.5em
    \itemindent\listparindent
    \rightmargin\leftmargin}\item[]}
\let\endquotation=\endlist

\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist

\def\descriptionlabel#1{\hspace\labelsep \bf #1}
\def\description{\list{}{\labelwidth\z@ \itemindent-\leftmargin
       \let\makelabel\descriptionlabel}}

\let\enddescription\endlist

\def\theequation{\arabic{equation}}

\arraycolsep 5pt

\tabcolsep 6pt

\arrayrulewidth .4pt
\doublerulesep 2pt

\tabbingsep \labelsep

\skip\@mpfootins = \skip\footins

\fboxsep = 3pt

\fboxrule = .4pt

\def\footnoterule{\kern-1\p@
  \hrule width .4\columnwidth
  \kern .6\p@}

\long\def\@makefntext#1{\noindent
    \hangindent 5\p@\hbox
    to5\p@{\hss $\m@th^{\@thefnmark}$}#1}

\c@topnumber=2
\def\topfraction{.7}
\c@bottomnumber=1
\def\bottomfraction{.3}
\c@totalnumber=3
\def\textfraction{.2}
\def\floatpagefraction{.5}
\c@dbltopnumber= 2
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.5}

\smallskipamount=.5\parskip

\medskipamount=\parskip
\bigskipamount=2\parskip

% Spezielle Funktionen f\"ur Serienbrief

\long\def\text#1{\def\serientext{#1}}
\optional\def\briefan[{}]#2{\begin{letter}[#1]{#2}
                            \anrede[]{}
                            \serientext
                            \gruss{mhg}
                            \end{letter}
                           }
\optional\def\serienbrief[{}]#2{
   \batchmode
   \def\serienbriefuebergabe{#1}
   \def\zwparameter{#2}
   \ifx\zwparameter\empty
      \errhelp{Bei \serienbrief[Optionen]{suchkriterium} mu\ss{} ein Suchkriterium angegeben werden.}
      \errmessage{Es wurde kein Suchkriterium angegeben!}
   \fi
   \openin7=\dateinameadresse
   \loop
     \def\ende{}
     \def\zeile{}
     \def\test{---}
     \endlinechar=-1
     \read7to\zeile
     \endlinechar=13
     \ifx\zeile\test
       \endlinechar=-1
       \read7to\nachname
       \read7to\vorname
       \read7to\firma
       \read7to\abteilung
       \read7to\strasse
       \read7to\ort
       \read7to\tel
       \read7to\fax
       \read7to\email
       \read7to\cosename
       \read7to\geburtsdatum
       \read7to\paraer
       \read7to\parazw
       \read7to\geschlecht
       \read7to\kontakt
       \endlinechar=13
       \ifx\cosename\empty
         \def\cosename{\vorname}
       \fi
       \ifx#1\empty
         \ifx\zwparameter\nachname
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Nachname}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\nachname
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Vorname}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\vorname
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Firma}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\firma
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Abteilung}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\abteilung
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Strasse}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\strasse
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Ort}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\ort
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Telefonnummer}
       \ifx\serienbriefuebergabe\bedingung%
         \ifx\zwparameter\tel
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Faxnummer}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\fax
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{E-Mail}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\email
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Geburtsdatum}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\Geburtsdatum
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Cosename}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\cosename
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Zusatz 1}
       \ifx\serienbriefuebergabe\bedingung%
         \ifx\zwparameter\paraer%
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Zusatz 2}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\parazw
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Geschlecht}
       \ifx\serienbriefuebergabe\bedingung
         \ifx\zwparameter\geschlecht
            \def\ende{gleich}
         \fi
       \fi
       \def\bedingung{Kontakt}
       \ifx\serienbriefuebergabe\bedingung%
         \ifx\zwparameter\kontakt%
            \def\ende{gleich}
         \fi
       \fi
       \def\test{gleich}
       \ifx\ende\test
          \serienbrieftrue
          \begin{letter}[]{}
            \anrede[]{}
            \serientext
            \gruss{}
          \end{letter}
          \def\ende{}
       \fi
     \fi
     \ifeof7
       \def\ende{eof}
     \fi
     \ifx\ende\empty
   \repeat
   \closein7
   \serienbrieffalse
   \errorstopmode
}

\ps@plain
\pagenumbering{arabic}
\onecolumn
\@fileswfalse
\catcode`\@=12
\endinput
