%%
%% This is file `mpslet.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mpslet.dtx  (with options: `class')
%% 
%% DO NOT CHANGE THIS FILE!
%% Make any changes in the master MPSLET.DTX and extract
%% this file from it. Otherwise, changes here will be lost.
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesClass{mpslet}
          [2022/11/10 3.3 (PWD)]
 %-------------------------------------------------------------------
 % NOTICE:
 % This file may only be used for producing official letters
 %  of the Max-Planck-Institut f\"ur Sonnensystemforschung
 %
%% Copyright (C) 2022 Max-Planck-Institut f\"ur Sonnensystemforschung
 % Just-von-Liebig-Weg 3
 % 37077 G\"ottigen
 % Germany
 %
 % Written by Patrick W. Daly, based on earlier versions
 %  for MPI Aeronomie (MPAe), predecessor to MPS
 %
 %-----------------------------------------------------------
 % A LaTeX Class for official MPS letters
 % Call as  \documentclass[<options>]{mpslet}
 % where <options> can be
 %     10pt  11pt   12pt  for basic font size (default=10pt)
 %     german             loads german.sty and translates some texts to German
 %     english            selects (UK) English, ie English texts and UK date
 %     bank | nobank      to include,exclude bank data in foot, def is without
 %     colour | color     for colour output (def)
 %     bw | sw            for black&white output
 %     nologo             for no logos, intended to print on preprinted paper
 %     logo               to output MPS header and footer on first page (def)
 %     doc                adds name of source file to head info
 %     nodoc              suppresses adding name of source file (def)
 %     Lindau | lindau    for old Lindau address and telephone
 %     oldmps             backwards compatibility: logo and format before June 2022
 %
 % Enter letter information with
 %   \name{...} \signature{...} (if \signature omitted, then name used)
 %   \telephone{..} \internet{..} \email{..} (Optional)
 %   \fax{..}  \workstation{..} (last defaults to mps)
 %   \homephone{..} \homefax{..} \mobile{..} (with Vorwahl without 0)
 %   \myref{..} \yref{..} \ymail{..} \subject{..} \date{..} (all optional)
 %
 % For more details, obtain a manual by LaTeXing mpslet.dtx
 %-----------------------------------------------------------


\newif\if@german \@germanfalse
\newif\if@lindau \@lindaufalse
\newif\if@oldstyle \@oldstylefalse
\newif\if@bankdata \@bankdatafalse
\DeclareOption{german}{\@germantrue}
\DeclareOption{ngerman}{\@germantrue}
\DeclareOption{english}{\@germanfalse}
\DeclareOption{Lindau}{\@lindautrue}
\DeclareOption{lindau}{\@lindautrue}
\DeclareOption{oldmps}{\@oldstyletrue}
\DeclareOption{bank}{\@bankdatatrue}
\DeclareOption{nobank}{\@bankdatafalse}
\newif\if@kolor \@kolortrue
\DeclareOption{colour}{\@kolortrue}
\DeclareOption{color}{\@kolortrue}
\DeclareOption{bw}{\@kolorfalse}
\DeclareOption{sw}{\@kolorfalse}
\newif\if@logo \@logotrue
\DeclareOption{nologo}{\@logofalse\@kolorfalse}
\DeclareOption{logo}{\@logotrue}
\newif\if@docname \@docnamefalse
\DeclareOption{nodoc}{\@docnamefalse}
\DeclareOption{doc}{\@docnametrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{letter}}
\ProcessOptions
\LoadClass[a4paper]{letter}
\RequirePackage{ngerman}
\if@german\else\selectlanguage{english}\fi
\if@lindau \@oldstyletrue \fi
\if@oldstyle \else
  \RequirePackage{lastpage}
\fi
\if@kolor
  \RequirePackage{color}
  \definecolor{mpg}{rgb}{.187,.613,.594}
  \newcommand*\mpgcol{\leavevmode\color{mpg}}
  \newcommand*\mpslogo{mps_color}
  \newcommand*\mpglogo{minerva_logo}
  \if@german
    \newcommand*\mpsmpglogo{MPS_Wide_D}
  \else
    \newcommand*\mpsmpglogo{MPS_Wide_E}
  \fi
\else
  \let\mpgcol=\relax
  \newcommand*\mpslogo{mps_grau}
  \newcommand*\mpglogo{minerva_logo_bw}
  \if@german
    \newcommand*\mpsmpglogo{MPS_Wide_D_black}
  \else
    \newcommand*\mpsmpglogo{MPS_Wide_E_black}
  \fi
\fi
\RequirePackage{graphicx}
\if@oldstyle
  \newcommand{\titlea}{\fontsize{19}{24}\usefont{\encodingdefault}{pnc}{m}{n}%
    \mpgcol}
  \newcommand{\titleb}{\fontsize{10.6}{13}\usefont{\encodingdefault}{pnc}{m}{n}%
    \mpgcol}
  \newcommand{\addfont}{\fontsize{7}{8}\usefont{\encodingdefault}{phv}{m}{n}%
    \mpgcol}
  \newcommand{\senderfont}{\fontsize{8}{9}\usefont{\encodingdefault}{\rmdefault}{m}{n}}
\else
  \newcommand{\addfont}{\fontsize{6}{7}\usefont{\encodingdefault}{phv}{m}{n}}
  \newcommand{\senderfont}{\fontsize{8}{10}\usefont{\encodingdefault}{phv}{m}{n}}
\fi
\def\gernames{\protect\typeout{German Names}}
\def\engnames{\protect\typeout{English Names}}
\newcommand{\defGerEng}[3]{%
  \let\Def\relax
  \let\protect\@unexpandable@protect
  \edef\gernames{\gernames\Def{#1}{#2}}%
  \edef\engnames{\engnames\Def{#1}{#3}}
  \let\Def\@namedef
  \let\protect\relax}
\newcommand*{\MP@names}{\ifnum\language=\l@ngerman\gernames
  \if@kolor
    \renewcommand*\mpsmpglogo{MPS_Wide_D}
  \else
    \renewcommand*\mpsmpglogo{MPS_Wide_D_black}
  \fi
     \else\engnames
  \if@kolor
    \renewcommand*\mpsmpglogo{MPS_Wide_E}
  \else
    \renewcommand*\mpsmpglogo{MPS_Wide_E_black}
  \fi
     \fi}
\AtBeginDocument{\providecommand{\l@ngerman}{1}}
\renewcommand*{\name}[2][\@empty]
    {\ifx\@empty#1\defGerEng{fromname}{#2}{#2}\else
        \defGerEng{fromname}{#2}{#1}\fi}
\renewcommand*{\signature}[2][\@empty]
    {\ifx\@empty#1\defGerEng{fromsig}{#2}{#2}\else
        \defGerEng{fromsig}{#2}{#1}\fi}
\defGerEng{yrefname}    {Ihr Zeichen:}{Your Ref.:}
\defGerEng{myrefname}    {Unser Zeichen:}{Our Ref.:}
\defGerEng{ymailname}   {Ihr Schreiben vom}{Your letter of}
\defGerEng{subjectname} {\textsl{Betr.}\,}{\textsl{Subject}}
\defGerEng{docname}     {Dok:}{Doc:}
\defGerEng{enclname}{Anlagen}{encl}
\defGerEng{ccname}{Kopien an}{cc}
\defGerEng{pagename}{Seite}{Page}
\defGerEng{ofname}{von}{of}
\defGerEng{germanyname}{Deutschland}{Germany}
\if@lindau
  \defGerEng{phone}{(05556)\,979\,}{+49\,5556\,979\,}
\else
  \defGerEng{phone}{0551\,384\,979\,}{+49\,551\,384\,979\,}
\fi
\defGerEng{intcode}{0}{+49\,}
\newcommand*\mydomain{.mpg.de}
\newcommand*\domain{@mps.mpg.de}
\newcommand*\webpage{www.mps.mpg.de}
\newcommand*\firmgerm{Max--Planck--Institut f\"ur Sonnensystemforschung}
\newcommand*\firmeng{Max Planck Institute for Solar System Research}
\defGerEng{firmname}  {\firmgerm}{\firmeng}
\defGerEng{firmtitle} {f\"ur Sonnensystemforschung}
                      {for Solar System Research}
\if@lindau
  \newcommand*\precode{\,+\,49\,(0)5556\,979\,-\,}
  \newcommand*\firmadd{MPI f\"ur Sonnensystemforschung $\cdot$ Max-Planck-Str.~2
      $\cdot$ 37191 Katlenburg-Lindau, Germany}
\else
  \newcommand*\precode{\,+\,49\,\if@oldstyle(0)\fi 551\,384\,979\,-\,}
  \if@oldstyle
  \newcommand*\firmadd{MPI f\"ur Sonnensystemforschung $\cdot$
  Justus-von-Liebig-Weg 3
      $\cdot$ 37077 G\"ottingen, Germany}
  \else
  \newcommand*\firmadd{MPI \firmtitle\ $\cdot$
  Justus-von-Liebig-Weg 3
      $\cdot$ 37077 G\"ottingen}
  \fi
\fi
\InputIfFileExists{mpslet.def}{}{}
\InputIfFileExists{mpslet.cfg}{\typeout{%
*******************************************^^J%
* Read in local configuration mpslet.cfg *^^J%
*******************************************}}{}
\if@oldstyle
  \setlength{\textwidth}{137mm}
  \setlength{\topmargin}      {-20mm}
  \setlength{\headheight}     {16mm}
  \setlength{\oddsidemargin}  {-5mm} % +1in = 20mm
  \setlength{\headsep}        {25pt}
\else
  \setlength{\textwidth}{165mm}
  \setlength{\oddsidemargin}  {-.4mm} % +1in = 25mm
  \setlength{\topmargin}      {-18mm}
  \setlength{\headheight}     {25mm}
  \setlength{\headsep}        {13mm}
\fi
\setlength{\evensidemargin} {-20mm}% +1in = 5mm
\setlength{\marginparwidth} {90pt}
\setlength{\marginparsep}   {11pt}
\setlength{\marginparpush}  {5pt}

\setlength{\footskip}       {30pt}
\setlength{\textheight}     {\paperheight}
 \addtolength{\textheight}{-1.75in}
 \addtolength{\textheight}{-\topmargin}
 \addtolength{\textheight}{-\headheight}
 \addtolength{\textheight}{-\headsep}
 \addtolength{\textheight}{-\footskip}
 \if@oldstyle\else \addtolength{\textheight}{-6mm}\fi

\newlength{\fullwidth}
\setlength{\fullwidth}{\paperwidth}
 \addtolength{\fullwidth}{-2in}
 \addtolength{\fullwidth}{-\oddsidemargin}
 \addtolength{\fullwidth}{-\evensidemargin}
\setlength{\columnsep}      {10pt}
\setlength{\columnseprule}  {0pt}
\raggedbottom
\setlength{\longindentation}{.4\textwidth}
\setlength{\indentedwidth}{\textwidth}
\addtolength{\indentedwidth}{-\longindentation}
\newlength{\leftfield}
\setlength{\leftfield}{\textwidth}
\addtolength{\leftfield}{5\p@}
\newlength{\rightfield}
\if@oldstyle
  \setlength{\rightfield}{\fullwidth}
  \addtolength{\rightfield}{-\leftfield}
\else
  \setlength{\rightfield}{60mm}
\fi
\let\MPletter=\letter
\def\MP@letter#1\@?@?{\MPletter{#1}}
\renewcommand{\letter}[2][]{\gdef\alttoname{#1}%
      \expandafter\MP@letter#2\@?@?}

\newcommand{\senderdata}{%
      \ifx\@empty\fromname\else\textbf{\fromname}\fi
    \ifx\@empty\telephonenum\else\\
       Tel.: \phone\telephonenum \fi
    \ifx\@empty\@homephone\else\\
       Pri.: \intcode\@homephone \fi
     \ifx\@empty\@fax\else\\
       Fax: \phone\@fax \fi
     \ifx\@empty\@homefax\else\\
       Fax: \intcode\@homefax \fi
     \ifx\@empty\@mobilenum\else\\
       Mob: \intcode\@mobilenum \fi
     \ifx\@empty\@internet\else\\
           \@internet @\@workstation\mydomain\fi
     \vspace*{1ex}
     \ifx\@empty\@myref\else\\
        \myrefname\ \@myref\fi
     \ifx\@empty\@yref\else\\
        \yrefname\ \@yref\fi
     \ifx\@empty\@ymail\else\\
        \ymailname\ \@ymail\fi
     \if@docname\\\docname\ \jobname.tex\fi
}


\if@oldstyle
\renewcommand{\opening}[1]{\MP@names\thispagestyle{firstpage}
 \vspace*{1.3cm}%
 \parbox[t][2.5cm][t]{\leftfield}{%
    \toname\\\toaddress}%
 \raisebox{-3mm}{\parbox[t][4cm][t]{\rightfield}{\senderfont
   \senderdata }}
 \hspace*{\leftfield}%
 \makebox[\rightfield][l]{\@date}\par
         \ifx\@empty\@subject \else\@subject\par\fi
 \vspace{2\parskip}
 #1\par\nobreak}
\else
  \renewcommand{\opening}[1]{\MP@names
  \raisebox{1mm}[\z@][\z@]{%
  \parbox[t][\z@]{\fullwidth}{\addfont\firmadd
  \hfill\parbox[t][55mm][t]{\rightfield}{\senderfont\senderdata}%
  }}%
\\[8mm]
 \parbox[t][4cm][t]{\fullwidth}{%
    \toname\\\toaddress}\par
    \parbox{\fullwidth}{%
    \ifx\@empty\@subject\mbox{} \else\@subject\fi
  \hfill\makebox[\rightfield][l]{\@date}}\par%
 #1\par\nobreak
  }%
\fi
\newcommand{\rclosing}[1]{\par\nobreak\vspace{\parskip}
 \stopbreaks
 \noindent
 \hspace*{\longindentation}%
 \parbox{\indentedwidth}{\centering
 \ignorespaces #1\\[6\medskipamount]
 \ifx\@empty\fromsig
   \ifx\@empty\fromname\else\fromname\fi
 \else \fromsig \fi\strut}
 \par}
\newcommand{\lclosing}[1]{\par\nobreak\vspace{\parskip}
 \stopbreaks
 \noindent
 \parbox{\indentedwidth}{\raggedright
 \ignorespaces #1\\[6\medskipamount]
 \ifx\@empty\fromsig
   \ifx\@empty\fromname\else\fromname\fi
 \else \fromsig \fi\strut}
 \par}

\let\closing\lclosing
\newcommand{\nosigclosing}[1]{\par\nobreak\vspace{\parskip}
 \stopbreaks
 \noindent
 \hspace*{\longindentation}%
 \parbox{\indentedwidth}{\centering \ignorespaces #1}
 \par}
\renewcommand{\ps@firstpage}{%
  \def\@oddhead{\if@logo\parbox[b][\z@][t]{\fullwidth}{%
    {\titlea \firmgerm}\\
    {\titleb \firmeng}\\[1.3cm]
    {\addfont \firmadd}\hspace{82mm}%
      \raisebox{-1mm}[\z@][\z@]{\makebox[\z@][r]
      {\includegraphics[width=5cm,clip]{\mpslogo}}\hfill}}\fi}
   \def\@oddfoot{\if@logo\firmfoot\fi}%
\def\@evenhead{}\def\@evenfoot{}}
\newcommand*{\firmfoot}{%
  \if@oldstyle
  \makebox[\textwidth]{\addfont
    \begin{tabular}[t]{@{}l}
      Max-Planck-Institut f\"ur\\
      Sonnensystemforschung\\
      \if@lindau
      Max-Planck-Stra{\ss}e 2\\
      37191 Katlenburg-Lindau
      \else
      Justus-von-Liebig-Weg 3\\
      37077 G\"ottingen
      \fi \\
      Germany
    \end{tabular}
    \hfill
    \begin{tabular}[t]{@{}c@{}}
      Tel.:  \precode 0\\
      Fax.:  \precode 240\\
      www.mps.mpg.de
    \end{tabular}
    \hfill
    \begin{tabular}[t]{@{}r@{}}
    Deutsche Bank M\"unchen\\
    BLZ 700\,700\,10 $\cdot$\ Konto 19\,51\,300\,20\\
    BIC (SWIFT-Code): DEUTDEMMXX\\
    IBAN: DE02\,7007\,0010\,0195\,1300\,20\\
    Sr-Nr. 143/219/10158 $\cdot$\ USt-ID: DE 129517720
    \end{tabular}
  }%
    \hspace{11mm}\raisebox{0mm}[\z@]{\makebox[\z@][l]{%
      \includegraphics[width=3.2cm]{\mpglogo}}}\hfill
  \else
    \if@bankdata
  \makebox[\textwidth]{\senderfont
    \begin{tabular}[t]{@{}l}
      \firmname\\
      Justus-von-Liebig-Weg 3\\
      37077 G\"ottingen\\
      \germanyname
    \end{tabular}
    \hfill
    \begin{tabular}[t]{@{}l@{}}
      Tel  \precode 0\\
      Fax  \precode 240\\
      www.mps.mpg.de
    \end{tabular}
    \hfill
    \begin{tabular}[t]{@{}l@{}}
    Deutsche Bank M\"unchen\\
    BLZ 700\,700\,10 $\cdot$\ Konto 19\,51\,300\,20\\
    BIC (SWIFT-Code): DEUTDEMMXX\\
    IBAN: DE02\,7007\,0010\,0195\,1300\,20\\
    Sr-Nr. 143/219/10158 $\cdot$\ USt-ID: DE 129517720
    \end{tabular}
    \hfill
    \begin{tabular}[t]{@{}r@{}}
    \pagename\ \thepage\\
    \ofname\ \pageref{LastPage}
    \end{tabular} }
    \else
      \raisebox{-7mm}{\makebox[\textwidth]{\senderfont
      \firmname
      \hfill
      \begin{tabular}[t]{@{}l}
        Justus-von-Liebig-Weg 3\\
        37077 G\"ottingen\\
        \germanyname
      \end{tabular}
      \hfill
      \begin{tabular}[t]{@{}l@{}}
        Tel  \precode 0\\
        www.mps.mpg.de
      \end{tabular}
      \hfill
      \begin{tabular}[t]{@{}r@{}}
      \pagename\ \thepage\\
      \ofname\ \pageref{LastPage}
      \end{tabular}
    }}
    \fi
  \fi
}
\renewcommand{\ps@headings}{%
  \if@oldstyle
    \def\@oddhead{\parbox{0.95\fullwidth}{{\titleb\firmgerm}\\[10pt]
       \slshape\headtoname\
         \ifx\alttoname\@empty\toname\else\alttoname\fi
         \hfill\@date\hfill\pagename\ \thepage\\
       }}
    \def\@oddfoot{}
  \else
    \def\@oddhead{\parbox[t]{.99\fullwidth}{\hfill\includegraphics[width=12.4cm]{\mpsmpglogo}}}%
    \def\@oddfoot{\firmfoot}%
  \fi
 }
\if@logo
  \ps@headings
\else
  \ps@plain
  \def\@oddfoot{}
\fi
\def\yref#1{\def\@yref{#1}}            \def\@yref{}
\def\ymail#1{\def\@ymail{#1}}         \def\@ymail{}
\def\myref#1{\def\@myref{#1}}         \def\@myref{}
\def\subject#1{\def\@subject{\textbf{#1}}}   \def\@subject{}
\def\internet#1{\def\@internet{\lowercase{#1}}}   \def\@internet{}
\let\email=\internet
\def\workstation#1{\def\@workstation{#1}}    \def\@workstation{mps}
\def\fax#1{\def\@fax{#1}}           \def\@fax{}

\def\homephone#1{\def\@homephone{#1}} \def\@homephone{}
\def\homefax#1{\def\@homefax{#1}} \def\@homefax{}
\def\mobile#1{\def\@mobilenum{#1}} \def\@mobilenum{}
%% End of file mpslet.cls.
\endinput
%%
%% End of file `mpslet.cls'.
