%^^A  This file was restored after it was accidentally replaced
%^^A   by version 1.0, sometime between Jun 11-25, 2010.
%^^A PWD 2011-01-19
%^^A Next update for Göttingen address, 2014-02-10
%^^A Another update for new MPS logo and letter format, 2022-07-07
% \iffalse      THIS IS A META-COMMENT
%<*dtx>
\ProvidesFile
%========================================================================
                              {MPSLET.DTX}
%========================================================================
%</dtx>
% This is a LaTeX class for writing MPS letters
%     Docstrip options available:
%        class   - to produce a .cls file with the uncommented coding
%        predef  - to extract mpslet.def, for preprogrammed names
%        local   - to extract a sample mpslet.cfg, a local configuration
%        driver  - to produce a LaTeX driver file to print the documentation
%  Installation:
%    LaTeX this file: ==> docstrip installation file mpslet.ins
%                         AND the (LaTeX) documentation
%    (La)TeX mpslet.ins: ==> package file mpslet.sty, driver mpslet.drv
%                             mpslet.def, mpslet.cfg
%    (mpslet.ins may be edited as needed)
%--------------------------------------------------------------------------
%
%  *** Identify the class file:-
%<class>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%<class>\ProvidesClass{mpslet}
%
%  *** Identify the configuration files:-
%<predef>\ProvidesFile{mpslet.def}
%<local>\ProvidesFile{mpslet.cfg}
%
%  *** Identify the driver file:-
%<driver>\NeedsTeXFormat{LaTeX2e}
%<driver>\ProvidesFile{mpslet.drv}
%
%  *** The DATE, VERSION, and other INFO
%\fi
%\ProvidesFile{mpslet}
          [2022/11/10 3.3 (PWD)]
%\iffalse
%<*class>
 %-------------------------------------------------------------------
 % 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
 %
 %-----------------------------------------------------------
%</class>
%                    END META-COMMENT \fi
%
% \changes{0.1}{2004 Jul 1}{Trial version following renaming MPAe to MPS}
% \changes{0.2}{2004 Aug 31}{Add VV's bar}
% \changes{1.0}{2005 Jun 16}{Conform to revised printed paper and text format}
% \changes{1.0a}{2008 Jan 23}{Change VV to Director Emeritus}
% \changes{1.1}{2008 Jan 28}{Add extra phone numbers: private, mobile, homefax}
% \changes{1.2}{2008 May 08}{Use \texttt{ngerman} instead of \texttt{german} package}
% \changes{1.3}{2009 Oct 01}{Change Institute's bank account}
% \changes{1.3a}{2011 Jan 19}{Restore after almost losing to version 1.0}
% \changes{2.0}{2014 Feb 10}{Change for G\"ottingen address, add option Lindau for old address}
% \changes{3.0}{2022 Jul 07}{New MPS logo and letter format}
% \changes{3.0}{2022 Jul 13}{Add option to have footline without banking data included}
% \changes{3.1}{2022 Jul 14}{Correct IBAN number}
% \changes{3.2}{2022 Nov 07}{Correct textwidth to 165 instead of 175cm}
% \changes{3.3}{2022 Nov 10}{Institute name language dependent in footer and opening}
% \CheckSum{1065}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%\iffalse
%<*install>
%^^A =============================================
%^^A    Here is the docstrip installation file
%^^A    It is written on first LaTeX run
%^^A =============================================
\begin{filecontents}{mpslet.ins}
% Simply TeX or LaTeX this file to extract various files from
%  the source file `mpslet.dtx'

\input docstrip

\keepsilent

\askforoverwritefalse

\preamble

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.
\endpreamble

\postamble
End of file \noexpand\outFileName.^^J\string\endinput
\endpostamble

\declarepreamble\define

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.

This is a file containing preprogrammed entries for several
special letter writers at MPS. To be read in by the mpslet
class file.
\endpreamble

\declarepreamble\cfg

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.

This is a file containing preprogrammed entries for a local
configuration at MPS. To be read in by the mpslet class file.
\endpreamble


\declarepreamble\drv

This is the driver file to produce the LaTeX documentation from the
source file \inFileName.
Make changes to it as needed.
\endpreamble

% CONSIDER IF YOU REALLY NEED A DRIVER
\generate{%
    \file{mpslet.cls}{\from{mpslet.dtx}{class}}
\askforoverwritetrue
    \file{mpslet.def}{\usepreamble\define\from{mpslet.dtx}{predef}}
    \file{mpslet.cfg}{\usepreamble\cfg\from{mpslet.dtx}{local}}
\askforoverwritefalse
%    \file{mpslet.drv}{\usepreamble\drv\from{mpslet.dtx}{driver}}
}

\obeyspaces
\Msg{*******************************************}%
\Msg{* For documentation, process mpslet.dtx}%
\Msg{*    or the driver file      mpslet.drv}%
\Msg{*******************************************}

\endbatchfile
\end{filecontents}
%</install>
%<*driver>
\documentclass[a4paper,twoside]{ltxdoc}
\raggedbottom

 %** To include the detailed explanation of the coding, comment out
 %**   the next line
\OnlyDescription

 %** To produce a command index: add the following line for one run,
 %**   then run  makeindex -s gind.ist model
 %**   and reprocess, with or without this line (much faster without)
%<driver>% \EnableCrossrefs\CodelineIndex

 %** To produce a change history: add the following line for one run,
 %**   then run  makeindex -s gglo.ist -o model.gls model.glo
 %**   and reprocess, with or without this line (faster without)
%<driver>% \RecordChanges

\DisableCrossrefs %May stay; zapped by \EnableCrossrefs
\CodelineNumbered %May stay

\begin{document}
   \DocInput{mpslet.dtx}
\end{document}
%</driver>
%\fi
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\ ,\",\,,\@,\@date,\@empty,\@evenfoot,\@evenhead,\@namedef}
% \DoNotIndex{\@oddfoot,\@oddhead,\@unexpandable@protect,\\,\ ,\AtBeginDocument}
% \DoNotIndex{\cdot,\centering,\definecolor,\edef,\else,\encodingdefault}
% \DoNotIndex{\fi,\fill,\fontsize,\footskip,\gdef,\hfill,\hspace,\ifnum,\ifx}
% \DoNotIndex{\ignorespaces,\includegraphics,\InputIfFileExists,\language}
% \DoNotIndex{\leavevmode,\let,\lowercase,\makebox,\marginparpush}
% \DoNotIndex{\marginparsep,\marginparwidth,\medskipamount,\multicolumn}
% \DoNotIndex{\newcommand,\newif,\newlength,\nobreak,\noindent,\oddsidemargin}
% \DoNotIndex{\pagename,\paperheight,\paperwidth,\par,\parbox,\parskip}
% \DoNotIndex{\protect,\providecommand,\raggedbottom,\raggedright,\raisebox}
% \DoNotIndex{\relax,\renewcommand,\rule,\slshape,\ss,\stopbreaks,\strut}
% \DoNotIndex{\textsl,\thepage,\thispagestyle}
% \DoNotIndex{\typeout,\usefont,\vspace,\z@}
% \DoNotIndex{\headtoname,\jobname,\addtolength,\=,\p@}
% \DoNotIndex{\date,\dth,\dva,\pwd,\expandafter,\evensidemargin,\oddsidemargin}
% \DoNotIndex{\setlength,\textbf,\texttt,\date,\color,\today}
%
% \setcounter{IndexColumns}{3}
% \setlength{\IndexMin}{10cm}
% \setcounter{StandardModuleDepth}{1}
%
% \setcounter{secnumdepth}{2}
%
% \GetFileInfo{mpslet}
% \title{\bfseries Official MPS Letters with \LaTeX}
%
% \author{Patrick W. Daly}
%
% \date{This paper describes class \texttt{\filename}\\
%       version \fileversion{} from \filedate}
%
% \maketitle
%
% \pagestyle{myheadings}
% \markboth{P. W. Daly}{The MPS Letter Class}
%
%^^A In order to keep all marginal notes on the one (left) side:
%^^A (otherwise they switch sides disasterously with twoside option)
% \makeatletter \@mparswitchfalse \makeatother
%
%^^A \begin{small}\begin{center}\textbf{Summary}\end{center}
%^^A The stripped version of this file contains the following brief description:
%\iffalse
%<*class>
 % A LaTeX Class for official MPS letters
%^^A\fi
%^^A \begin{verbatim}
 % 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)
 %
%^^A \end{verbatim}
%^^A\iffalse
 % For more details, obtain a manual by LaTeXing mpslet.dtx
 %-----------------------------------------------------------
%</class>
%\fi
%^^A\end{small}
%
% \section{Introduction}
%
% This is a variant on the standard \LaTeX{} \texttt{letter} class for
% producing official letters for the Max-Planck-Institut f\"ur
% Sonnensystemforschung. Official letters should be printed on paper
% with the approved letterhead and logo. One can either have \LaTeX\ print this
% letterhead (on a colour printer) or print the letter without the letterhead
% on preprinted stationery.
%
% Another option is to print the letterhead in black \& white on a non-colour
% printer, as a copy, say.
%
% As of June, 2022, a new set of logos have become the required for use at MPS,
%  which combine both the MPS and the MPG Minerva, with a colour change as well.
%  The format for official letters has also been modified. This class now conforms
%  to these new regulations, but an option is available to produce the old logos
%  and format for backward compatibility, to reproduce old letters.
%
% \section{Invoking the Class}
% This class in invoked with the \LaTeXe{} command
% \begin{quote}
% |\documentclass|\oarg{options}|{|\texttt{\filename}|}|\\
% \end{quote}
% where possible options are
% \begin{description}
% \item \texttt{10pt 11pt 12pt} to specify the basic font size (default is
%       \texttt{10pt}).
%
% \item \texttt{color colour} (default) to output the letterhead and logo in colour.
%      Note that both spelling variants are allowed.
%
% \item \texttt{bw sw} to output the letterhead and logo in black \& white.
%
% \item \texttt{bank nobank} for banking data in the footline or not,
%        default is without.
%
% \item \texttt{logo nologo} to turn on or off the printing with letterhead
%       (default is on). With \texttt{nologo}, it is expected that the output
%       is printed on pre-printed letterhead paper. Subsequent pages will have
%       a black or coloured continuation header according to the other options.
%
% \item \texttt{doc nodoc} to turn on or off the printing of the source \LaTeX\
%       file name. Default is off.
%
% \item \texttt{german}, \texttt{ngerman} to load the package
%       texttt{ngerman.sty} to switch
%       to German names for explicit words, German word division, and so
%       on (for new spelling, not old).
%
% \item \texttt{english} (default) also loads \texttt{ngerman.sty} but selects
%       language \texttt{english} (UK date).
%
% \item \texttt{Lindau}, \texttt{lindau} to use the old address and telephone numbers for the
%       Lindau institute, just to be able to reproduce old letters.
%
% \item \texttt{oldmps} to use the logos and letter format used prior to June 2022,
%       to reproduce older letters as they were then. Default is to use the newer ones.
% \end{description}
%
% \section{Entering the Writer's Data}
%
% \DescribeMacro{\name}
% \DescribeMacro{\signature}
% The writer's name and other data are entered with the following
% \begin{quote}
% |\name|\marg{main\_name}\\
% |\signature|\marg{sig\_name}
% \end{quote}
% The \emph{main\_name} goes in the official heading. The \emph{sig\_name}
% is placed below the space for the signature; if it is omitted, then
% \emph{main\_name} is used.
%
% \DescribeMacro{\telephone}
% \DescribeMacro{\fax}
% \DescribeMacro{\internet}
% \DescribeMacro{\email}
% The writer's telephone extension and his or her computer account names
% are entered with
% \begin{quote}
% |\telephone|\marg{num} \quad |\fax|\marg{num}\\
% |\internet|\marg{acct} \quad |\email|\marg{acct}
% \end{quote}
% Only the personal parts of the telephone and computer addresses are to be
% given, not the whole things. The command |\email| is the same as |\internet|.
%
% \DescribeMacro{\workstation}
% If some user has a domain name different from \texttt{mps}, this may be
% inserted with
% \begin{quote}
% |\workstation|\marg{domain\_name}
% \end{quote}
% This was originally provided in the MPAe letter class at times when many people
% had their own workstations with their own email addresses. Today, everyone
% should have \texttt{mps.mpg.de} as the external email address. However, some
% may prefer to keep the \texttt{linmpi.mpg.de} address, in which case they
% must give
% \begin{quote}
%   |\workstation{linmpi}|
% \end{quote}
% Admittedly, the name `workstation' is outdated in this context, but is kept
% for backward compatibility.
%

% \DescribeMacro{\myref}
% \DescribeMacro{\yref}
% \DescribeMacro{\ymail}
% \DescribeMacro{\subject}
% \DescribeMacro{\date}
% Information about the letter itself is entered with
% \begin{quote}
% |\myref|\marg{sender's marker for this letter}\\
% |\yref|\marg{marker on letter being answered}\\
% |\ymail|\marg{date of letter being answered}\\
% |\subject|\marg{topic of this letter}\\
% |\date|\marg{fixed date for this letter} [is current date if not given].
% \end{quote}
%
% \section{Structure of a Letter File}
%
% Like all \LaTeX{} files, a letter file must contain
% \begin{quote}
% |\documentclass|\marg{class} \\
% |\begin{document}| \dots |\end{document}|
% \end{quote}
% It may contain several letters, each one in a separate \texttt{letter}
% environment. The rules for how the information entries apply are
% \begin{enumerate}
% \item any entry before |\begin{document}| is \emph{global}, and applies
%       to all the letters;
%
% \item any entry between two \texttt{letter} environments applies to
%       all following letters;
%
% \item any entry inside a \texttt{letter} environment is \emph{local}, and
%       applies to that letter only; all local entries must be given before
%       the |\opening| command.
%
% \end{enumerate}
%
% \DescribeEnv{letter}
% \DescribeMacro{\opening}
% \DescribeMacro{\closing}
% \DescribeMacro{\encl}
% \DescribeMacro{\cc}
% \DescribeMacro{\ps}
% A sample letter file is as follows.
% \begin{quote}\small
% \begin{tabbing}
% |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|\=\kill
% |\documentclass[german,11pt]{mpslet}| \\
% |\name{Dr.\ P. W. Daly}|              \>Sets the header name globally\\
% |\email{daly}|                        \>also set globally\\
% |\begin{document}|\\
% |\begin{letter}{Mr.\ Smith\\|         \>Begin first letter\\
% |     123 Apple Rd.\\|                \>\quad with address\\
% |     Treetown, USA}|\\
% |\opening{Dear Harry,}|               \>The opening\\
% |. . . . . . . . . . . .|             \>Text of letter\\
% |\closing{Regards,}|                  \>The ending\\
% |\encl{...}|                          \>Optional, enclosures\\
% |\cc{...}|                            \>Optional, distribution\\
% |\ps{PS: Hope all is well.}|          \>Optional, postscript\\
% |\end{letter}|                        \>Terminate the letter\\
% |\begin{letter}{Dr.\ Johns\\|         \>Begin second letter\\
% |. . . . . . . . . . .|\\
% |\end{letter}|                        \>Terminate 2nd letter\\
% |\end{document}|                      \>End the file
% \end{tabbing}\end{quote}
%
% \noindent
% \textsl{The following paragraph applies only to the pre-June 2022 format:}
%
% An additional feature in \texttt{\filename.cls} is optional text for the
% continuation pages. Normally, the second and following pages contain a
% header with \textit{To~xxxx} where \textit{xxxx} is the first line of the
% address given as argument to the \texttt{letter} environment. Sometimes
% this first line is inappropriate for the continuation, in which case,
% alternative text may be inserted as
% \begin{quote}
% \begin{verbatim}
% \begin{letter}[all Fachbeirat members]{The Fachbeirat\\...}
% \end{verbatim}
% \end{quote}
%
% \subsection{Bilingual Entries}
%
% All of these entry commands enter their text to both the English and
% German versions of any letters. However, if the English text is to be
% different from the German, it may be given as an optional argument, as
% \begin{quote}
% |\signature[Mr.\ Burns\\Head]{Herr Burns\\Leiter}|
% \end{quote}
% This applies to all entry commands where such a distinction makes sense.
%
% \subsection{Switching Languages}
%
% \DescribeMacro{\selectlanguage}
% The package \texttt{ngerman} is always included, but by default with language
% \texttt{english} selected. One can add the option \texttt{german} or \texttt{ngerman} to the
% |documentclass| command to select German as default for all languages.
% Otherwise one can switch language between letters with
% \begin{quote}
% |\selectlanguage{USenglish}| \quad sets date as \textsl{January 1, 1995}\\
% |\selectlanguage{english}  | \quad sets date as \textsl{1st January 1995}\\
% |\selectlanguage{ngerman}   | \quad sets date as \textsl{1.\ Januar, 1995}\\
% |\selectlanguage{naustrian} | \quad sets date as \textsl{1.\ J\"anner, 1995}
% \end{quote}
%
% Note that here \texttt{ngerman} and \texttt{naustrian} must be used since the
% \texttt{ngerman} package does not recognize the old names.
% (Strictly speaking, the old names will switch the hyphenation patterns but will
%  not change the prestored names.)

% The language may be switched locally or globally.
%
% \subsection{Preprogrammed Entries}
%
% The entries for the special persons are stored in a file named
% \texttt{\filename.def} such that they are invoked by special commands.
% \begin{quote}
% |\dva| activates the entries for Prof.\ Vasyliunas.
% \end{quote}
% (This is a hold-over from the \texttt{mpaelet} class, and should be removed.)
%
% Any user can make up his or her own local configuration but putting the
% entry commands into a file named \texttt{\filename.cfg}. For example, my
% own local file contains
% \begin{quote}\small\begin{verbatim}
% \newcommand{\pwd}{\telephone{279}
%     \name[Dr.\ P. W. Daly\\Scientific Staff Member]
%          {Dr.\ P. W. Daly\\Wissenschaftlicher Mitarbeiter}
%     \signature{Patrick W. Daly}
%     \email{daly}}
% \end{verbatim}
% \end{quote}
% I only need to give |\pwd| in my letter files to enter my personal data.
%
% \subsection{Compatibility with older formats}
% As of February 2014, the MPS is located in G\"ottingen and that address and
% corresponding telephone numbers are now standard. In order to reproduce an older
% letter with the Lindau address, add the \texttt{Lindau} option. It is not expected
% that this option will be used much.
%
% As of June 2022, the MPS logo has been changed, as well as the format for
% official letters. This is now the default. To reproduce the previous logos
% and format, add the \texttt{oldmps} option. This is meant only to generate
% older letters as they were originally.
%
% \StopEventually{}
%
% \section{The Coding}
% This section presents and explains the actual coding of the macros.
% It is nested between |%<*class>| and |%</class>|, which
% are indicators to \texttt{docstrip} that this coding belongs to the class
% file.
%
% \subsection{Options}
%
% Begin by defining the options that are in addition to the
% regular ones for the standard \texttt{letter} class. They are all
% controlled by switches that may be set by options.
%
% \begin{macro}{\if@german}
% The \texttt{ngerman} package is always loaded automatically, but the
% options \texttt{german} and \texttt{english} determine which language is
% initially selected. This controls the hyphenation patterns and the form of
% the date with the |\today| command (the default for |\date|). The flag
% |\if@german| is set or unset by these options.
%
% Note that the option \texttt{ngerman} is the same as \texttt{german}. However,
% since the \texttt{ngerman} package is loaded, it is necessary to specify
% |\selectlanguage{ngerman}| explicitly; the language \texttt{german} is not recognized.
%    \begin{macrocode}
%<*class>
\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}
%    \end{macrocode}
% \end{macro}
% \changes{3.0}{2022 Jul 07}{Add \texttt{oldmps} option}
% \changes{2.0}{2014 Feb 10}{Add \texttt{Lindau} option}
% \changes{3.0}{2022 Jul 13}{Add \texttt{bank} and \texttt{nobank} options}
%
% \begin{macro}{\if@kolor}
% Whether the letterhead is output in colour or black \& white is controlled
% by the flag |\if@kolor|, which is set or unset by several options. There
% are spelling variants and German-English versions for black \& white.
%    \begin{macrocode}
\newif\if@kolor \@kolortrue
\DeclareOption{colour}{\@kolortrue}
\DeclareOption{color}{\@kolortrue}
\DeclareOption{bw}{\@kolorfalse}
\DeclareOption{sw}{\@kolorfalse}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@logo}
% By default, the letterhead (and footer) are output on the first page
% of a letter. An alternative is to print the letter on preprinted letterhead
% paper, in which case the \LaTeX\ letterhead is to be suppressed. This is
% controlled by the |\if@logo| flag.
%    \begin{macrocode}
\newif\if@logo \@logotrue
\DeclareOption{nologo}{\@logofalse\@kolorfalse}
\DeclareOption{logo}{\@logotrue}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@docname}
% \changes{1.0}{2005 Jun 16}{Add \texttt{doc} and \texttt{nodoc} options}
% The Word template adds the name of the Word file with the letter information
% at the top, something that is not a bad idea. The same thing is done in the \LaTeX\
% class, although the ending is always assumed to be \texttt{.tex}. Switch this
% feature on and off with |doc| and |nodoc| options. The |\if@docname| flag controls this.
%    \begin{macrocode}
\newif\if@docname \@docnamefalse
\DeclareOption{nodoc}{\@docnamefalse}
\DeclareOption{doc}{\@docnametrue}
%    \end{macrocode}
% \end{macro}
%
% Load the \texttt{letter} class and process the options. Load additional
% packages as needed.
%    \begin{macrocode}
\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
%    \end{macrocode}
%
% \subsection{Colours and fonts}
% \begin{macro}{\mpgcol}
% \begin{macro}{\mpslogo}
% \begin{macro}{\mpglogo}
% \begin{macro}{\mpsmpglogo}
% \changes{3.0}{2022 Jul 07}{Add macro}
% Set the colour for the letterhead text and determine the graphics files
%  containing the MPS and MPG logos, according to the |\if@kolor| flag.
% (This is no longer used after June 2022.)
%
% Note: the official MPG green should be |{cmyk}{1.,0.,.57,.3}| but the
% |{rgb}| system seems to work better on most printers (more uniform).
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\titlea}
% \begin{macro}{\titleb}
% \begin{macro}{\addfont}
% \begin{macro}{\senderfont}
% Set up various fonts for the first line in the letterhead, for the second line,
%  and for the info line (address at top and info in footer). The |\senderfont|
%  is for the sender's personal information, in black. For the old style we used New Century
%  for the first two lines (Institute name) and default roman for the info lines.
%
% For the newer style, we use Helvetica in black for both, trying to emulate the
%  sans font used in the Word template.
% \changes{1.0}{2005 Jun 16}{Use default roman for the sender info font}
% \changes{3.0}{2022 Jul 07}{Change sender and address font to Helvetica}
%    \begin{macrocode}
\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
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \subsection{Bilingual Definitions of Names}
%
% \begin{macro}{\gernames}
% \begin{macro}{\engnames}
% This is a complicated section. We need a method to define internal name
% commands to take on either the English or German version depending on
% which language has been selected by |\selectlanguage|.
%
% The definitions are to be put together in |\gernames| and |\engnames|.
% Calling either of these defines the stored commands with the
% corresponding text. They initially contain a message to be typed to the
% monitor.
%
%    \begin{macrocode}
\def\gernames{\protect\typeout{German Names}}
\def\engnames{\protect\typeout{English Names}}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\defGerEng}
% What |\defGerEng| does is to add a new definition to each of these. It
% takes three arguments, the command name without backslash, the German and
% English texts.
%
% What is added to |\gernames| and |\engnames| each time is |\Def| followed
% by the command name and the text. At this point |\Def| is |\relax| so it
% is not expanded by the |\edef|, but during execution it will be set to
% |\@namedef|.
%
% The definition of |\protect| is such as to allow robust commands in the
% arguments, such as |\textbf|, to weather the expansions properly. Fragile
% commands in the arguments must be |\protect|ed.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\MP@names}
% This macro is the one that decides which of |\gernames| and |\engnames|
% is to be executed, according to the current value of the |\language|
% counter. The number |\l@ngerman| is set to the language containing (new) German
% hyphenation patterns, either in the format by \textsf{initex}, or by
% the \texttt{ngerman} package, or as a last resort, here.
%
% The |\mpsmpglogo| is redefined here so that it can be changed between letters
% if necessary. (|\MP@names| is called at the start of each letter, by the
% |\opening| command.)
%    \begin{macrocode}
\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}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\name}
% \begin{macro}{\signature}
% Several commands are intended to transfer their argument as text to
% internal commands that are then placed in the letter text. Two of these,
% |\name| and |\signature| are in the standard \texttt{letter} class
% already, but are redefined to take bilingual arguments. These and the
% following transfer commands all have the same syntax: with one argument,
% that text is used for both English and German, but an optional
% argument gives the English, the mandatory the German text. For example
% \begin{quote}
% |\signature{Dr.\ P. W. Daly}| for both languages\\
% |\signature[Mr.\ Schmidt\\Head]{Herr Schmidt\\Leiter}|
% \end{quote}
%
% Recall that |\name| specifies the text in the return address, while
% |\signature| is optional, giving the signature text. If this is missing, the
% |\name| text is used for the signature.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\yrefname}
% \begin{macro}{\ymailname}
% \begin{macro}{\myrefname}
% \changes{1.0}{2005 Jun 16}{Add macro}
% \begin{macro}{\subjectname}
% \begin{macro}{\docname}
% \changes{1.0}{2005 Jun 16}{Add macro}
% Define some names bilingually that are needed in the top line.
%    \begin{macrocode}
\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:}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\enclname}
% \begin{macro}{\ccname}
% \begin{macro}{\phone}
% \changes{1.0}{2005 Jun 16}{Add macro}
% \begin{macro}{\pagename}
% \changes{3.0}{2022 Jul 07}{Add macro}
% \begin{macro}{\ofname}
% \changes{3.0}{2022 Jul 07}{Add macro}
% \begin{macro}{\germanyname}
% \changes{3.0}{2022 Jul 07}{Add macro}
% \begin{macro}{\intcode}
% \changes{1.1}{2008 Jan 28}{Add macro}
% \changes{2.0}{2014 Feb 10}{Add G\"ottingen telephone numbers}
% Define some names for special purposes. |\phone| is the Institute's phone
% number without the sender's extension, with national and international version.
%
% For the new style, |\pagename| and |\ofname| are used to add ``Page \emph{x}
% of \emph{y} in the footer; |\germanyname| provides alternate names for Germany.
%
% The |\precode| defined below is the fixed text for the footline.
%
% The |\intcode| is used for the private numbers which may have different Vorwahl.
%    \begin{macrocode}
\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\,}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\mydomain}
% \begin{macro}{\domain}
% \begin{macro}{\webpage}
% \begin{macro}{\precode}
% \begin{macro}{\firmgerm}
% \begin{macro}{\firmeng}
% \begin{macro}{\firmadd}
% Here are some unilingual texts to go into the letterhead and foot (old style).
% These include the institute name in German and English, the address,
% the general telephone number, and the email domains. Here |\mydomain| is
% the general domain name minus the user's own `workstation', while |\domain|
% is the full name with the official external domain name.
% \changes{2.0}{2014 Feb 10}{Add G\"ottingen address}
% \begin{macro}{\firmname}
% \changes{3.3}{2022 Nov 10}{Add macro}
% \begin{macro}{\firmtitle}
% \changes{3.3}{2022 Nov 10}{Add macro}
%
% For new style, the name of the institute is to be language-dependent in
%  the opening and footline. Use |\firmname| and |\firmtitle| for this.
%    \begin{macrocode}
\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
%    \end{macrocode}
% \end{macro}\end{macro}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
% \subsection{External Definitions}
%
% The file \texttt{\filename.def} contains commands that define the special
% inputs for the directors, administration, and so on. These are such that
% a single command activates them. (This feature should be removed. The
% directors do not use \LaTeX\ for their letters any more.)
%
% In addition, a local configuration file \texttt{\filename.cfg} is read in
% if it exists. This can contain the entries for a single user which he
% keeps in his own directory for his own use.
%    \begin{macrocode}
\InputIfFileExists{mpslet.def}{}{}
\InputIfFileExists{mpslet.cfg}{\typeout{%
*******************************************^^J%
* Read in local configuration mpslet.cfg *^^J%
*******************************************}}{}
%</class>
%    \end{macrocode}
%
% Here is the \texttt{\filename.def} file with the main `functions' and
% `offices' in the Institute.
%    \begin{macrocode}
%<*predef>
\def\dva{\defGerEng{phone}{089-}{+49-89-}
         %\homephone{89-66598320}
         \telephone{66598320}
         %\homefax{89-66598319}
         \fax{66598319}
          \name[PROF.\ V. M. VASYLI\=UNAS\\Director Emeritus]
               {Prof.\ Dr.\ V.\ M.\ Vasyli\=unas\\Emitierter Direktor}
          \internet{vasyliunas}
          \signature[Prof.\ Vytenis M. Vasyli\=unas\\Director Emeritus]
                    {Prof.\ Dr.\ Vytenis M. Vasyli\=unas\\Emitierter Direktor}}
% \def\dax{\telephone{439}
%          \fax{149}
%           \name[PROF.\ SIR IAN AXFORD, FRS\\Institute Director (Retired)]
%                {PROF.\ SIR IAN AXFORD, FRS\\Emitierter Direktor am Institut}
%           \internet{axford}
%           \signature{W.~I. Axford}}
%
% \def\dth{\telephone{414}
%           \name[PROF.\ TOR HAGFORS\\Institute Director (Retired)]
%                {PROF.\ DR.\ TOR HAGFORS\\Emitierter Direktor am Institut}
%           \internet{hagfors}
%           \signature{T. Hagfors}}
%</predef>
%    \end{macrocode}
%
% An example of a local configuration file is my own.
%    \begin{macrocode}
%<*local>
\def\pwd{\telephone{279}
         \mobile{176\,6404\,7330}
         \name{Dr. Patrick W. Daly}
         \signature{Patrick W. Daly}
         \email{daly}}
%</local>
%    \end{macrocode}
%
% \subsection{Page Size and Layout}
%
% These values have been set to emulate the preprinted letterhead paper,
% or the Word template for the new style.
%
% \textbf{Old Style:}
% The |\textheight| and |\fullwidth| are derived from the paper size (A4),
% while |\textwidth| is fixed. This is because the text is limited to |\textwidth|
% with a wide right margin, while the footline and header go across the whole page
% (|\fullwidth|). The |\headheight| is actually too small
% for the letterhead head, but that is written in a box of zero height, so
% that is no problem. It is set so continuation pages can have a smaller
% head, otherwise they would waste much space at the top of the page.
%
% \textbf{New Style:}
% The continuation pages have the same header as the first page, so only one
% page style is needed. The page parameters are set accordingly.
%
% By setting |\textwidth| to 165mm and the left (oddside) margin to 25mm,
% the right margin then is 20mm, which is larger than the 15mm given in the
% Word template, but is more appropriate.
%    \begin{macrocode}
%<*class>
\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
%    \end{macrocode}
%
% \subsection{The Opening: the Sender's Data}
%
% Set up a number of lengths that will be needed.
% The |\leftfield| contains recipient address, and is the same as |\textwidth|
% (but with a little extra bit so the |\rightfield| text does not abut too much)
% while |\rightfield| contains sender's info, date, a wide margin, and in the footline,
% the MPG Minerva.
% Their sum must be |\fullwidth|.
%
% For new style, |\rightfield| is given a fixed width, and the sum is no longer
%  |\fullwidth|.
%    \begin{macrocode}
\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
%    \end{macrocode}
%
% \begin{environment}{letter}
% Before proceding, let us patch up the \texttt{letter} environment somewhat.
% We add an optional argument which is the alternative text for the recipient's
% name on continuation pages. Normally this is the first line of the address in
% the argument to |\begin{letter}|, stored in |\toname| by the standard
% \texttt{letter} class.
%
% It is often useful to store recipients' names and addresses as commands in a
% database file, and then just invoke that command as the argument of the
% \texttt{letter} environment. However, this interferes with the parsing of the
% name/address into |\toname| and |\toaddress| because only the command is seen,
% not its expansion. The following coding expands the argument before sending it
% to the original |\letter| command.
% \emph{This feature is not used in the new style!}
%    \begin{macrocode}
\let\MPletter=\letter
\def\MP@letter#1\@?@?{\MPletter{#1}}
\renewcommand{\letter}[2][]{\gdef\alttoname{#1}%
      \expandafter\MP@letter#2\@?@?}
%    \end{macrocode}
% \end{environment}
%

% \begin{macro}{\senderdata}
% \changes{3.0}{2022 Jul 07}{Add macro}
% The sender's information is stored in |\senderdata|, which can then be used
%  for the opening of both styles.
%    \begin{macrocode}
\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
}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\opening}
% \changes{3.0}{2022 Jul 07}{Major changes for the new style}
% The |\opening| starts the letter, by printing the information about
% return address, writer's data (phone, computer address, etc.) It also
% contains, in the left field, the address of the recipient.
%
% In the old style, actual
% institute letterhead is contained only in the page style \texttt{firstpage},
% and continued pages have a minimal header. The new style uses the same
% page style for all pages, with the complete letter head, and footer.
%
% First the old style code:

% The command |\MP@names| sets the bilingual texts to English or German.
% By putting it here, the language can change between letters within one file.
%    \begin{macrocode}
\if@oldstyle
\renewcommand{\opening}[1]{\MP@names\thispagestyle{firstpage}
%    \end{macrocode}
% Because the letterhead head is bigger than |\headheight| (it sticks downwards)
%  we must shove the opening downwards accordingly.
%    \begin{macrocode}
 \vspace*{1.3cm}%
%    \end{macrocode}
% Now set the recipient's address in the left field, and the sender's data
% in the right one.
% \changes{1.0}{2005 Jun 16}{Put reference info below the sender's data; add
%  the source file name}
%    \begin{macrocode}
 \parbox[t][2.5cm][t]{\leftfield}{%
    \toname\\\toaddress}%
 \raisebox{-3mm}{\parbox[t][4cm][t]{\rightfield}{\senderfont
   \senderdata }}
%    \end{macrocode}
%
% We are not finished. Now comes another block below the above two,
% containing the date and the subject line.
%    \begin{macrocode}
 \hspace*{\leftfield}%
 \makebox[\rightfield][l]{\@date}\par
         \ifx\@empty\@subject \else\@subject\par\fi
 \vspace{2\parskip}
 #1\par\nobreak}
%    \end{macrocode}
%
% Now the new style coding:
%
%    \begin{macrocode}
\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
%    \end{macrocode}
% \end{macro}
%
% \subsection{The Closings}
%
% A number of closing possibilities are provided.
%
% \begin{macro}{\rclosing}
% The closing with the signature centered in the right side. This is standard
% from \texttt{letter} class.
%    \begin{macrocode}
\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}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\lclosing}
% \begin{macro}{\closing}
% The closing with the signature flush left. This is German standard.
%    \begin{macrocode}
\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
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\nosigclosing}
% A closing with no signature.
%    \begin{macrocode}
\newcommand{\nosigclosing}[1]{\par\nobreak\vspace{\parskip}
 \stopbreaks
 \noindent
 \hspace*{\longindentation}%
 \parbox{\indentedwidth}{\centering \ignorespaces #1}
 \par}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Page Styles}
%
% \begin{macro}{\ps@firstpage}
% The \texttt{firstpage} page style is only used for the old style.
%
% Define the header and footer for the first page, the one containing the
% official letterhead and logo and the general information in the footer.
%
% The head contains the name of the Institute in German and English, plus an
% address line, with the logo on the side. If |\if@logo| is false, all this is
% skipped.
% \changes{1.0}{2005 Jun 16}{Revise header for new format of information, although
%   result for ``preprinted'' parts is the same}
%    \begin{macrocode}
\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}
%    \end{macrocode}
% The footer contains address and telephone number once more, and the
% MPG logo. This is defined in |\firmfoot|.
%    \begin{macrocode}
   \def\@oddfoot{\if@logo\firmfoot\fi}%
\def\@evenhead{}\def\@evenfoot{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\firmfoot}
% \changes{1.0}{2005 Jun 16}{Revised data in footline, as per new preprinted
%  letterhead paper.}
% \changes{3.0}{2022 Jul 07}{Revised for new style of 2022}
% \changes{3.0}{2022 Jul 13}{Add option to leave off banking data in footer}
% \changes{3.1}{2022 Jul 14}{Correct IBAN number}
% The footer text.
%
%    \begin{macrocode}
\newcommand*{\firmfoot}{%
  \if@oldstyle
%    \end{macrocode}
% The old style code:
%    \begin{macrocode}
  \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
%    \end{macrocode}
% The new style code, with page number and total pages.
%
% Two versions, with and without the banking data, since both versions are
%  provided in the Word templates.
%    \begin{macrocode}
  \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} }
%    \end{macrocode}
% Now the version without banking data; needs to be lowered to put the bottom
% line at the same position as with bank data.
%    \begin{macrocode}
    \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
}
%    \end{macrocode}
% \end{macro}
%
% The page style for continued pages in the old style. This places the name of the institute
% across the top, with the recipient's name and date of letter.
%
% For the new style, this applies even to the first page.
%
% If the letterhead is not to be printed directly on the output, then
% successive pages are page style \texttt{plain}.
% \begin{macro}{\ps@headings}
% \changes{1.0}{2005 Jun 16}{Revise continued headings slightly}
% \changes{3.0}{2022 Jul 07}{Revise page style, using same one even for first page}
%    \begin{macrocode}
\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
%    \end{macrocode}
% \end{macro}
%
% \subsection{Info Entering Commands}
%
% \begin{macro}{\yref}
% \begin{macro}{\ymail}
% \begin{macro}{\myref}
% \begin{macro}{\subject}
% \changes{1.0}{2005 Jun 16}{Subject text written in boldface, without ``Subj.'' or ``Betr.''}
% Entering information about recipient's and sender's correspondence.
%    \begin{macrocode}
\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{}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
%
% \begin{macro}{\internet}
% \begin{macro}{\email}
% \begin{macro}{\workstation}
% \begin{macro}{\fax}
% Some additional information: email name, workstation name, fax number, if
% different from that of the institute. Note: |\internet| and |\email| are
% identical, just provided for historical reasons.
%
% There is no |\telephone| because this is in the basic \texttt{letter} class.
%    \begin{macrocode}
\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{}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}

% \begin{macro}{\homephone}
% \changes{1.1}{2008 Jan 28}{Add macro}
% \begin{macro}{\homefax}
% \changes{1.1}{2008 Jan 28}{Add macro}
% \begin{macro}{\mobile}
% \changes{1.1}{2008 Jan 28}{Add macro}
% Additional telephone numbers for private (home) phone and fax can be added
%  as well as for mobile phone. The arguments include the Vorwahl without leading
%  0, since that is added automatically (0 or +49-). Only German number can be given.
%    \begin{macrocode}
\def\homephone#1{\def\@homephone{#1}} \def\@homephone{}
\def\homefax#1{\def\@homefax{#1}} \def\@homefax{}
\def\mobile#1{\def\@mobilenum{#1}} \def\@mobilenum{}
%</class>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \Finale
%
% \PrintIndex\PrintChanges
