%GERMAN
% This is GERMAN.TEX or GERMAN.DOC or GERMAN.STY, Vers. 2.3c, 28 Aug 1990,
%    collected by H.Partl (TU Wien),
%    using ideas by W.Appelt, F.Hommes et al. (GMD St.Augustin),
%    T.Hofmann (CIBA-GEIGY Basel), N.Schwarz (Uni Bochum),
%    J.Schrod (TH Darmstadt), D.Armbruster (Uni Stuttgart),
%    R.Schoepf (Uni Mainz, Uni Heidelberg) and F.Mittelbach
%    (Uni Mainz, EDS Ruesselsheim), J.Knappen (Uni Mainz),
%    P.Breitenlohner (MPI Muenchen), and many others.
%
% DOCUMENT STYLE OPTION for writing german texts
% with TeX version 2.x (Plain TeX) or with LaTeX version 2.09.
%
% It can be called via
%    \input german
% or (with LaTeX) via
%    \documentstyle[german]{anystyle}
%
% This file conforms to the standard for "Einheitliche deutsche
% TeX-Befehle" as proposed at the 6th Meeting of German TeX Users
% in Muenster, October 1987. It is available from DANTE (the users
% group of German speaking TeX users) at the Uni Heidelberg.
%
% Commands to be used by the end users:
% "a                 for Umlaut-a (like \"a), also for all other vowels.
% "s                 for sharp s  (like \ss{}).
% "ck                for ck to be hyphenated as k-k.
% "ff                for ff to be hyphenated as ff-f, also for certain
%                    other consonants.
% "S                 for SS to be \uppercase{"s}
% "A, "CK, "FF etc.  uppercase versions of the above
% "|                 to separate ligatures.
% "-                 like \-, but allowing hyphenation in the rest of
%                    the word.
% ""                 like "-, but producing no hyphen sign.
% "` or \glqq        for german left  double quotes  (similar to ,,)
% "' or \grqq        for german right double quotes  (similar to ``)
%       \glq         for german left  single quotes  (similar to , )
%       \grq         for german right single quotes  (similar to ` )
% "< or \flqq        for french left  double quotes  (similar to <<)
% "> or \frqq        for french right double quotes  (similar to >>)
%       \flq         for french left  single quotes  (similar to < )
%       \frq         for french right single quotes  (similar to > )
% \dq                for the original quotes character (")
% \selectlanguage{n} to switch to the language specified by n, which
%                    should be one of the following command names:
%                    \austrian \french \english \german \USenglish;
%                    - this changes the date format, captions and (if
%                    ``multilingual TeX''is installed) hyphenation.
% \originalTeX       to restore everything to the original settings
%                    of TeX and LaTeX (well, almost everything).
% \germanTeX         to re-activate the german settings.
%
% Obsolete commands, provided for compatibility with existing
% applications:
% \3                 for sharp s (like "s).
% \ck                for ck to be hyphenated as k-k (like "ck).
% \setlanguage (if not defined, i.e. not with TeX 3.x) = \selectlanguage
%
% Lower level commands and features:
% \umlautlow        redefines the Umlaut accent such that the dots come
%                   nearer to the letter and that hyphenation is enabled
%                   in the rest of the word.
% \umlauthigh       restores \" to its original meaning.
% \ss               is \lccode'd to enable hyphenation.
% \mdqon            makes " an active (meta-) character that does the
%                   pretty things described above.
% \mdqoff           restores " to its original meaning.
% \dospecials,\@sanitize  are extended to include the ".
% \dateaustrian, \dategerman, \dateenglish, \dateUSenglish, \datefrench
%                   redefine \today to use the respective date format.
% \captionsgerman, \captionsenglish, \captionsfrench
%                   switch to german, english or french chapter captions
%                   and the like, resp.  This will have an effect only
%                   if the document style files use the symbolic names
%                   \chaptername etc. instead of the original english
%                   words.
% \language         a count that is set by \selectlanguage and can be used
%                   by document style declarations like
%                      \ifnum\language=\english .textengl.\else
%                      \ifnum\language=\german  .textgerm.\fi\fi
%                   and/or by M.Ferguson's ``Multilingual T^eX''.
%
% Finally, \germanTeX is switched on.
%
% Notes:
% This file can be used both with Plain TeX and with LaTeX and other
% macro packages, and with the original TeX and LaTeX fonts. Usage
% of german hyphenation patterns is recommended to accompany this
% style file when writing german texts.
% The file should be read in vertical mode only (usually at the
% beginning of the document) to avoid spurious spaces.
% \undefined must be an undefined control sequence.
% Multiple calls of this file (e.g. at the beginning of each subfile)
% will do no harm. Only the first call (i.e., if \mdqon is undefined)
% performs all the definitions and settings.
% The catcode of @ remains unchanged after processing of this file.
% All definitions are global, the switching on of the german options
% is local.
% The commands \mdqon, \mdqoff, \originalTeX, \germanTeX, and
% \selectlanguage are ``fragile'' with LaTeX and should not be used
% within arguments of macro calls.
% In Plain TeX, `\protect' should be \let to `\relax' normally and to
% something like `\string' inside the arguments of `\write' or `\message'
% (see LaTeX.TEX for all the details).
% The command \umlautlow may need adaption to font parameters (see
% comments there for details).
% The commands \flqq, \frqq, \flq, \frq, and \datefrench  in their
% present forms do not work properly with all font sizes and styles,
% they still require a better solution. A LaTeX-only solution might be
% to use {\ly(}, {\ly(\kern-0.166em(}, {\ly)} etc., but this would not
% work with Plain TeX.
%

% \ifundefined{mdqon} or \mdqon=\relax
\expandafter\ifx\csname mdqon\endcsname\relax
% \then go ahead \else do nothing
\else \endinput \fi

\message{Document Style Option `german'  Version 2.3c of 28 Aug 1990}

% \ifundefined{protect}
\ifx\protect\undefined
% \then define it
\let\protect=\relax \fi

{\catcode`\@=11 % \makeatletter

\gdef\allowhyphens{\penalty\@M \hskip\z@skip}
%                 {\nobreak    \hskip 0pt plus 0pt\relax}

\newcount\U@C\newbox\U@B\newdimen\U@D
% \gdef\umlauthigh{\def\"##1{{\accent127 ##1}}}
\gdef\umlauthigh{\def\"##1{{\dirtyumlaut##1}}}

%\gdef\umlautlow{\def\"{\protect\newumlaut}}

\gdef\umlautlow{\def\"{\protect\dirtyumlautlow}}

\gdef\dirtyumlautlow#1{\if#1A{\discretionary
{\kern 4321sp m\kern 196sp\kern-4517sp\kern-1em}{}{\protect\newumlaut#1}}\else
\if#1O{\discretionary
{\kern 4321sp m\kern 214sp\kern-4535sp\kern-1em}{}{\protect\newumlaut#1}}\else
\if#1U{\discretionary
{\kern 4321sp m\kern 220sp\kern-4541sp\kern-1em}{}{\protect\newumlaut#1}}\else
\if#1a{\discretionary
{\kern 4321sp m\kern 228sp\kern-4549sp\kern-1em}{}{\protect\newumlaut#1}}\else
\if#1o{\discretionary
{\kern 4321sp m\kern 246sp\kern-4567sp\kern-1em}{}{\protect\newumlaut#1}}\else
\if#1u{\discretionary
{\kern 4321sp m\kern 252sp\kern-4573sp\kern-1em}{}{\protect\newumlaut#1}}\else
\if#1s{\discretionary
{\kern 4321sp m\kern 255sp\kern-4573sp\kern-1em}{}
{\ss}}\else{\protect\newumlaut#1}\fi\fi\fi\fi\fi\fi\fi}


\gdef\newumlaut#1{\leavevmode
     \vbox{\baselineskip\z@skip \lineskip.25ex
%          \baselineskip 0pt
     \ialign{##\crcr\hidewidth
     \setbox\U@B\hbox{#1}\U@D .01\p@\U@C\U@D
     \U@D\ht\U@B\advance\U@D -1ex\divide\U@D \U@C
     \U@C\U@D\U@D\the\fontdimen1\the\font
     \multiply\U@D \U@C\divide\U@D 100\kern\U@D
     \vbox to .20ex  % <--- depending on the METAFONT parameters
%                           of the fonts, the height of this \vbox
%                           may vary around the value of .20ex  --
%                           just try out, which will look best!
     {\hbox{\char127}\vss}\hidewidth\crcr#1\crcr}}}

\gdef\highumlaut#1{\leavevmode\dirtyumlaut#1}

\gdef\set@low@box#1{\setbox\tw@\hbox{,}\setbox\z@\hbox{#1}\dimen\z@\ht\z@
     \advance\dimen\z@ -\ht\tw@
     \setbox\z@\hbox{\lower\dimen\z@ \box\z@}\ht\z@\ht\tw@ \dp\z@\dp\tw@ }
%    (this lowers the german left quotes to the same level as the comma.)

\gdef\@glqq{{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi \leavevmode
     \set@low@box{''}\box\z@\kern-.04em\allowhyphens\@SF\relax}}
\gdef\glqq{\protect\@glqq}
\gdef\@grqq{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi \kern-.07em``\kern.07em\@SF\relax}
\gdef\grqq{\protect\@grqq}
\gdef\@glq{{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi \leavevmode
     \set@low@box{'}\box\z@\kern-.04em\allowhyphens\@SF\relax}}
\gdef\glq{\protect\@glq}
\gdef\@grq{\kern-.07em`\kern.07em}
\gdef\grq{\protect\@grq}
\gdef\@flqq{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi
     \ifmmode \ll \else \leavevmode
     \raise .2ex \hbox{$\scriptscriptstyle \ll $}\fi \@SF\relax}
\gdef\flqq{\protect\@flqq}
\gdef\@frqq{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi
     \ifmmode \gg \else \leavevmode
     \raise .2ex \hbox{$\scriptscriptstyle \gg $}\fi \@SF\relax}
\gdef\frqq{\protect\@frqq}
\gdef\@flq{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi
     \ifmmode < \else \leavevmode
     \raise .2ex \hbox{$\scriptscriptstyle < $}\fi \@SF\relax}
\gdef\flq{\protect\@flq}
\gdef\@frq{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF\empty \fi
     \ifmmode > \else \leavevmode
     \raise .2ex \hbox{$\scriptscriptstyle > $}\fi \@SF\relax}
\gdef\frq{\protect\@frq}

% enable hyphenations after \ss:
\global\lccode`\^^Y=`\^^Y

\global\let\original@three=\3 % Note that \3 may be defined or undefined.

% add the quotes to the definitions of dospecials and sanitize:
\begingroup
\def\do{\noexpand\do\noexpand}%
% note that "\xdef" means "\global\edef"
\xdef\dospecials{\dospecials\do\"}%
% not ( \ifundefined{@sanitize} or \@sanitize=\relax ) = if LaTeX
\expandafter\ifx\csname @sanitize\endcsname\relax \else
  \def\@makeother{\noexpand\@makeother\noexpand}%
  \xdef\@sanitize{\@sanitize\@makeother\"}%
\fi
\endgroup

\gdef\mdqon{\catcode`\"\active}
\gdef\mdqoff{\catcode`\"12 }

\gdef\ck{\allowhyphens\discretionary{k-}{k}{ck}\allowhyphens}

{\mdqoff
\gdef\@UMLAUT{\"}
\gdef\@MATHUMLAUT{\mathaccent"707F }
\gdef\@SS{\mathchar"7019 }
\gdef\dq{"}
}

{\mdqon
\gdef"{\protect\active@dq}
\gdef\active@dq{\futurelet\next@after@dq\first@active@dq}
% For efficency, first the most frequent ones in a short macro only:
\gdef\first@active@dq#1{%
           \ifx \next@after@dq\bgroup\dq {#1}%
     \else \expandafter\ifx \space\next@after@dq\dq\space #1%
     % The two lines above are needed before everything else, to take care of
     % (empty or non-empty) groups and spaces after the active quote!
     % Now the real thing:
     \else \ifx #1s\ifmmode\@SS          \else \ss\fi{}%
                              % note the empty group to avoid gobbling spaces.
     \else \ifx #1a\ifmmode\@MATHUMLAUT a\else \@UMLAUT a\fi
     \else \ifx #1o\ifmmode\@MATHUMLAUT o\else \@UMLAUT o\fi
     \else \ifx #1u\ifmmode\@MATHUMLAUT u\else \@UMLAUT u\fi
     \else \ifx #1A\ifmmode\@MATHUMLAUT A\else \@UMLAUT A\fi
     \else \ifx #1O\ifmmode\@MATHUMLAUT O\else \@UMLAUT O\fi
     \else \ifx #1U\ifmmode\@MATHUMLAUT U\else \@UMLAUT U\fi
     \else \ifx #1`\glqq{}%
     \else \ifx #1'\grqq{}%
     \else \other@active@dq{#1}%
     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi }
% And now a separate command for the less frequent ones:
\gdef\other@active@dq#1{%
           \ifx #1e\ifmmode\@MATHUMLAUT e\else \highumlaut e\fi
     \else \ifx #1i\ifmmode\@MATHUMLAUT i\else \highumlaut\i \fi
     \else \ifx #1E\ifmmode\@MATHUMLAUT E\else \highumlaut E\fi
     \else \ifx #1I\ifmmode\@MATHUMLAUT I\else \highumlaut I\fi
     \else \ifx #1SSS%
     \else \ifx #1-\allowhyphens\-\allowhyphens
     \else \ifx #1"\hskip\z@skip
     \else \ifx #1|\discretionary{-}{}{\kern.03em}%
     \else \ifx #1c\allowhyphens\discretionary{k-}{}{c}\allowhyphens
     \else \ifx #1f\allowhyphens\discretionary{ff-}{}{f}\allowhyphens
     \else \ifx #1l\allowhyphens\discretionary{ll-}{}{l}\allowhyphens
     \else \ifx #1m\allowhyphens\discretionary{mm-}{}{m}\allowhyphens
     \else \ifx #1n\allowhyphens\discretionary{nn-}{}{n}\allowhyphens
     \else \ifx #1p\allowhyphens\discretionary{pp-}{}{p}\allowhyphens
     \else \ifx #1t\allowhyphens\discretionary{tt-}{}{t}\allowhyphens
     \else \ifx #1C\allowhyphens\discretionary{K-}{}{C}\allowhyphens
     \else \ifx #1F\allowhyphens\discretionary{FF-}{}{F}\allowhyphens
     \else \ifx #1L\allowhyphens\discretionary{LL-}{}{L}\allowhyphens
     \else \ifx #1M\allowhyphens\discretionary{MM-}{}{M}\allowhyphens
     \else \ifx #1N\allowhyphens\discretionary{NN-}{}{N}\allowhyphens
     \else \ifx #1P\allowhyphens\discretionary{PP-}{}{P}\allowhyphens
     \else \ifx #1T\allowhyphens\discretionary{TT-}{}{T}\allowhyphens
     \else \ifx #1<\flqq{}%
     \else \ifx #1>\frqq{}%
                              % note the empty group to avoid gobbling spaces.
     \else \ifx #1\active@dq\hskip\z@skip
     \else        \dq #1%
     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
     \fi\fi\fi\fi\fi }
} % end of \mdqon

\gdef\dateaustrian{\def\today{\number\day.~\ifcase\month\or
  J\"anner\or Februar\or M\"arz\or April\or Mai\or Juni\or
  Juli\or August\or September\or Oktober\or November\or Dezember\fi
  \space\number\year}}
\gdef\dategerman{\def\today{\number\day.~\ifcase\month\or
  Januar\or Februar\or M\"arz\or April\or Mai\or Juni\or
  Juli\or August\or September\or Oktober\or November\or Dezember\fi
  \space\number\year}}
\gdef\dateUSenglish{\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}}
\gdef\dateenglish{\def\today{\ifcase\day\or
  1st\or 2nd\or 3rd\or 4th\or 5th\or
  6th\or 7th\or 8th\or 9th\or 10th\or
  11th\or 12th\or 13th\or 14th\or 15th\or
  16th\or 17th\or 18th\or 19th\or 20th\or
  21st\or 22nd\or 237rd\or 24th\or 25th\or
  26th\or 27th\or 28th\or 29th\or 30th\or
  31st\fi
  ~\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space \number\year}}
\gdef\datefrench{\def\today{\ifnum\day=1\relax 1\/$^{\rm er}$\else
  \number\day\fi \space\ifcase\month\or
  janvier\or f\'evrier\or mars\or avril\or mai\or juin\or
  juillet\or ao\^ut\or septembre\or octobre\or novembre\or d\'ecembre\fi
  \space\number\year}}

% Here is, how you can modify the LaTeX document style files and option
% files, to benefit from the following \captionsxxxxx commands. Def's like
%     \def\tableofcontents{\section*{Contents\markboth{CONTENTS}{CONTENTS}}
%     \@starttoc{toc}}
% should be redefined by def's like
%     \def\contentsname{Contents} % <---
%     \def\tableofcontents{\section*{\contentsname
%     \markboth{\uppercase{\contentsname}}{\uppercase{\contentsname}}}
%     \@starttoc{toc}}
% (it's best to put all these new lines to the end of the origignal files),
% and of course, you should modify the change date in the file header and
% in the \typeout command.

\gdef\captionsgerman{%
\def\refname{Literatur}%
\def\abstractname{Zusammenfassung}%
\def\bibname{Literaturverzeichnis}%
\def\chaptername{Kapitel}%
\def\appendixname{Anhang}%
\def\contentsname{Inhaltsverzeichnis}% % oder nur: Inhalt
\def\listfigurename{Abbildungsverzeichnis}%
\def\listtablename{Tabellenverzeichnis}%
\def\indexname{Index}%
\def\figurename{Abbildung}%
\def\tablename{Tabelle}% % oder: Tafel
\def\partname{Teil}%
\def\enclname{Anlage(n)}% % oder: Beilage(n)
\def\ccname{Verteiler}%   % oder: Kopien an
\def\headtoname{An}%
\def\pagename{Seite}}

\gdef\captionsenglish{%
\def\refname{References}%
\def\abstractname{Abstract}%
\def\bibname{Bibliography}%
\def\chaptername{Chapter}%
\def\appendixname{Appendix}%
\def\contentsname{Contents}%
\def\listfigurename{List of Figures}%
\def\listtablename{List of Tables}%
\def\indexname{Index}%
\def\figurename{Figure}%
\def\tablename{Table}%
\def\partname{Part}%
\def\enclname{encl}%
\def\ccname{cc}%
\def\headtoname{To}%
\def\pagename{Page}}

\gdef\captionsfrench{%
\def\refname{R\'ef\'erences}%
\def\abstractname{R\'esum\'e}%
\def\bibname{Bibliographie}%
\def\chaptername{Chapitre}%
\def\appendixname{Annexe}%
\def\contentsname{Table des mati\`eres}%
\def\listfigurename{Liste des figures}%
\def\listtablename{Liste des tableaux}%
\def\indexname{Index}%
\def\figurename{Figure}%
\def\tablename{Tableau}%
\def\partname{Partie}%
\def\enclname{P.~J.}%
\def\ccname{Copie \`a}%
\def\headtoname{A}%
\def\pagename{Page}}

\newcount\l@nguage
% This will be re-declared as \language if the latter has not yet been
% declared neither by Ferguson's ``Multilingual T^eX'' nor by TeX 3:
% \ifundefined{language}
\expandafter\ifx\csname language\endcsname\relax
\global\let\language=\l@nguage
\fi

\newcount\USenglish  \global\USenglish=0
\newcount\german     \global\german=1
\newcount\austrian   \global\austrian=2
\newcount\french     \global\french=3
\newcount\english    \global\english=4

\gdef\selectlanguage#1{\language #1\relax
  \expandafter\ifcase #1\relax
  \dateUSenglish  \captionsenglish   \or
  \dategerman     \captionsgerman    \or
  \dateaustrian   \captionsgerman    \or
  \datefrench     \captionsfrench    \or
  \dateenglish    \captionsenglish   \fi}

% \ifundefined{setlanguage} (= TeX version < 3 )
\expandafter\ifx\csname setlanguage\endcsname\relax
\global\let\setlanguage=\selectlanguage
\fi

\gdef\originalTeX{\mdqoff \umlauthigh \let\3\original@three
                  \selectlanguage{\USenglish}}
\gdef\germanTeX{\mdqon \umlautlow \let\3\ss
                \selectlanguage{\german}}

} % return to previous catcodes

% Now, switch on what is appropriate for german:

\germanTeX

% This is the end of GERMAN.STY/DOC/TEX.
\endinput