%GERMAN
% This is GERMAN.TEX or GERMAN.DOC or GERMAN.STY, as of 17 Nov 1987,
%    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), and others.
% DOCUMENT STYLE OPTION for writing german texts with TeX or LaTeX.
% 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.                                       !
% +-------------------------------------------------------------------+
%
% 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.
% ":                 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 (")
% \setlanguage{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).
%
% 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 \lcc'ed to enable hyphenation.
% \mdqon            makes " an active (meta-) character that does the
%                   pretty things described above.
% \mdqoff           restores " to its original meaning.
% \verbatim,\verb   are redefined to include \mdqoff and to avoid the
%                   spanish ligatures ?` and !`.
% \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 \setlanguage and can be used
%                   by document style declarations like
%                      \ifnum\language=\english .textengl.\else
%                      \ifnum\language=\german  .textgerm.\fi\fi
%                   and/or by ``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
% \setlanguage are ``fragile'' with LaTeX and should not be used
% within arguments of macro calls.
% 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.
%

% \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 as of 17 Nov 1987}

% \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\umlautlow{\def\"{\protect\newumlaut}}
\gdef\newumlaut#1{\leavevmode\allowhyphens
     \vbox{\baselineskip\z@skip \lineskip.25ex
%          \baselineskip 0pt
     \ialign{##\crcr\hidewidth
     \setbox\U@B=\hbox{#1}\U@D=.01pt\U@C=\U@D
     \U@D=\ht\U@B\advance\U@D by-1ex\divide\U@D by\U@C
     \U@C=\U@D\U@D=\the\fontdimen1\the\font
     \multiply\U@D by\U@C\divide\U@D by100\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}}\allowhyphens}
\gdef\highumlaut#1{\leavevmode\allowhyphens
     \accent127 #1\allowhyphens}

\gdef\@glqq{{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF=\empty \fi
     \setbox\z@=\hbox{\lower1.36775ex\hbox{''}\kern-.04em}\dp\z@=.36775ex
     \leavevmode\box\z@\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
     \setbox\z@=\hbox{\lower1.36775ex\hbox{'}\kern-.04em}\dp\z@=.36775ex
     \leavevmode\box\z@\allowhyphens\@SF\relax}}
\gdef\grq{\kern-.07em`\kern.07em}
\gdef\@flqq{\ifhmode \edef\@SF{\spacefactor\the\spacefactor}\else
     \let\@SF=\empty \fi
     \ifmmode \ll \else \leavevmode
     \raise 0.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 0.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 0.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 0.2ex \hbox{$\scriptscriptstyle > $}\fi \@SF\relax}
\gdef\frq{\protect\@frq}

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

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

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

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

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

{\mdqon
\gdef"#1{\if\string#1`{\glqq}%
\else\if\string#1'{\grqq}%
\else\if\string#1a{\ifmmode\@MATHUMLAUT{a}\else\@UMLAUT{a}\fi}%
\else\if\string#1o{\ifmmode\@MATHUMLAUT{o}\else\@UMLAUT{o}\fi}%
\else\if\string#1u{\ifmmode\@MATHUMLAUT{u}\else\@UMLAUT{u}\fi}%
\else\if\string#1A{\ifmmode\@MATHUMLAUT{A}\else\@UMLAUT{A}\fi}%
\else\if\string#1O{\ifmmode\@MATHUMLAUT{O}\else\@UMLAUT{O}\fi}%
\else\if\string#1U{\ifmmode\@MATHUMLAUT{U}\else\@UMLAUT{U}\fi}%
\else\if\string#1e{\ifmmode\@MATHUMLAUT{e}\else\protect\highumlaut{e}\fi}%
\else\if\string#1i{\ifmmode\@MATHUMLAUT{i}\else\protect\highumlaut{\i}\fi}%
\else\if\string#1E{\ifmmode\@MATHUMLAUT{E}\else\protect\highumlaut{E}\fi}%
\else\if\string#1I{\ifmmode\@MATHUMLAUT{I}\else\protect\highumlaut{I}\fi}%
\else\if\string#1s{\ifmmode\@SS\else{\ss}\fi}%
\else\if\string#1-{\allowhyphens\-\allowhyphens}%
\else\if\string#1\string"{\hskip\z@skip}%
\else\if\string#1:{\discretionary{-}{}{\kern.03em}}%
\else\if\string#1c{\allowhyphens\discretionary{k-}{}{c}\allowhyphens}%
\else\if\string#1f{\allowhyphens\discretionary{ff-}{}{f}\allowhyphens}%
\else\if\string#1l{\allowhyphens\discretionary{ll-}{}{l}\allowhyphens}%
\else\if\string#1m{\allowhyphens\discretionary{mm-}{}{m}\allowhyphens}%
\else\if\string#1n{\allowhyphens\discretionary{nn-}{}{n}\allowhyphens}%
\else\if\string#1p{\allowhyphens\discretionary{pp-}{}{p}\allowhyphens}%
\else\if\string#1t{\allowhyphens\discretionary{tt-}{}{t}\allowhyphens}%
\else\if\string#1<{\flqq}%
\else\if\string#1>{\frqq}%
\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}
}

{\catcode`\?=\active
\catcode`\!=\active
\gdef\add@dospecials{\catcode`\?=\active
\catcode`\!=\active
\def?{\char63{\kern\z@}}%
\def!{\char33{\kern\z@}}%
\mdqoff }
}

% This modifies LaTeX 2.09 version January 1986:
\gdef\@verbatim{\trivlist \item[]\if@minipage\else\vskip\parskip\fi
\leftskip\@totalleftmargin\rightskip\z@
\parindent\z@\parfillskip\@flushglue\parskip\z@
\@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par}
\add@dospecials %<---
\obeylines \tt \let\do\@makeother \dospecials}

\gdef\verb{\begingroup
\add@dospecials %<---
\tt \let\do\@makeother \dospecials
\@ifstar{\@sverb}{\@verb}}

\gdef\dateaustrian{\def\today{\number\day.~\ifcase\month\or
  J\"anner\or Feber\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 23rd\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. Lines like
%     \def\tableofcontents{\section*{Contents\markboth{CONTENTS}{CONTENTS}}
%     \@starttoc{toc}}
% should be replaced by lines like
%     \def\contentsname{Contents} % <---
%     \def\tableofcontents{\section*{\contentsname
%     \markboth{\uppercase{\contentsname}}{\uppercase{\contentsname}}}
%     \@starttoc{toc}}
% 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}%
\def\listfigurename{Abbildungsverzeichnis}%
\def\listtablename{Tabellenverzeichnis}%
\def\indexname{Index}%
\def\figurename{Abbildung}%
\def\tablename{Tabelle}%
\def\partname{Teil}}

\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}}

\gdef\captionsfrench{%
\def\refname{R\'ef\'erences}%
\def\abstractname{R\'esum\'e}%
\def\bibname{Bibliographie}%
\def\chaptername{Chapitre}%
\def\appendixname{Appendice}%
\def\contentsname{Table des mati\`eres}%
\def\listfigurename{Liste des figures}%
\def\listtablename{Liste des tables}%
\def\indexname{Index}%
\def\figurename{Figure}%
\def\tablename{Table}%
\def\partname{Partie}}%

\newcount\language % if not yet declared by ``multilingual T^eX''
\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\setlanguage#1{\language=#1\relax
  \expandafter\ifcase #1\relax
  \dateUSenglish  \captionsenglish   \or
  \dategerman     \captionsgerman    \or
  \dateaustrian   \captionsgerman    \or
  \datefrench     \captionsfrench    \or
  \dateenglish    \captionsenglish   \fi}

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

} % return to previous catcodes

% Now, switch on what is appropriate for german:

\germanTeX

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