%NAME: greek.sty
%
% GREEK.STY Greek Style For LaTeX Files and KD family of greek fonts
% ~~~~~~~~~
%
\typeout{Document Style Option `greek' <Dec 7,1992>}
\ifx\gr@@kformatloaded\relax\def\d@next{\endinput}
 \else
   \let\gr@@kformatloaded\relax
   \def\d@next{}
\fi
\d@next
%
\newif\ifdelimsbar\delimsbarfalse       % Check for | as delimiter
\chardef\|=`\|                          % A way to access |
\gdef\t@f@nt{\gr}                    	% Remember font used last
\gdef\t@f@m{\fam\grfam}			% Remember family used last
\newlanguage\greek                      % Define Greek as a new language
\def\lt{<}                              % Remember Less than
\def\gt{>}                              % and greater than signs

\def\gr@@km@de{%
\ifdelimsbar\else\catcode`\|=11\fi%	This is to allow the use of | as iota
\catcode`\<=11%
\catcode`\>=11%
\catcode`\'=11%
\catcode`\`=11%
\catcode`\~=11%
\catcode`\"=11%
\lccode`\<=`\<%
\lccode`\>=`\>%
\lccode`\'=`\'%
\lccode`\~=`\~%
\lccode`\"=`\"%
}

\def\l@tinm@de{
\catcode`\<=12%
\catcode`\>=12%
\catcode`\'=12%
\catcode`\`=12%
\catcode`\~=12%
\catcode`\"=12%
}
%
% Create a new LaTeX Environment
%
\newenvironment{greektext}{\language\greek\gr@@km@de%
\t@f@m\t@f@nt\ignorespaces}%
{\xdef\t@f@nt{\the\font}\xdef\t@f@m{\noexpand\fam\the\fam}}

\gdef\greekdelims#1{\edef\c@mp@re{#1}\def\t@st@a{bar}\def\t@st@b{dollar}%
\ifx\c@mp@re\t@st@a\gr@@kdelimsbar\else%
\ifx\c@mp@re\t@st@b\gr@@kdelimsdol\fi\fi}
%
%       Bar as delimeter
%
{\catcode`\|=13\gdef\gr@@kdelimsbar{\catcode`\|=13\delimsbartrue%
\def|{\ifnum\language=\greek\end{greektext}\else\begin{greektext}\fi}}
}
%
%       Dollar as delimiter
%
\let\m@thm@de=$
{\catcode`\$=13%
\gdef\gr@@kdelimsdol{\catcode`\$=13%
\def${\ifnum\language=\greek\end{greektext}\else\begin{greektext}\fi}%
\global\let\math=\m@thm@de%
\gdef\display{\math\math}\gdef\enddisplay{\math\math}}%
}

\input grfonts.tex
%% End of greek.sty
