% \iffalse meta-comment
%
% Copyright 1999
% Karsten Tinnefeld <karsten@tinnefeld.com>
%
% -----------------------------------------
% This file is part of the mtgreek package,
% a contribution to the LaTeX2e system. 
% -----------------------------------------
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License, either version 1.1 of this licence, or
% (at your option) any later version. The latest version of this
% license is in http://www.latex-project.org/lppl.txt and version 1.1
% is part of all distributions of LaTeX version 1999/06/01 or later.
%
\NeedsTeXFormat{LaTeX2e}
%<*dtx>
\ProvidesFile{mtgreek.dtx}
%</dtx>
%<!driver>\ProvidesPackage{mtgreek}
%<driver>\ProvidesFile{mtgreek.drv}
% \fi
% \ProvidesFile{mtgreek.dtx}
  [1999/07/29 v0.01 upright and italic Greek letters with MathTime]
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\usepackage{multicol}
\GetFileInfo{mtgreek.dtx}
\newcommand*{\docdate}{1999/07/29}
\EnableCrossrefs
%\DisableCrossrefs% when index is ready
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
% \CheckSum{89}
%
% \changes{v0.01}{1999/07/29}{Initial Revision (KT).}
%
%  \DoNotIndex{\advance, \begingroup, \count, \count@, \def, \divide,
%  \endgroup, \expandafter, \global, \hexnumber@, \mathchardef,
%  \multiply, \newcommand, \ProcessOptions, \relax, \RequirePackage,
%  \sixt@@n, \tw@, \z@}
%
% \date{printed \today}
% \title{\texttt{mtgreek}, a package for enabling upright and italic
%   Greek math letters with MathTime\texttrademark\thanks{This file
%   has version number \fileversion, last revised on \filedate,
%   documentation dated \docdate.}}
% \author{Karsten Tinnefeld\\
%         Universit\"at Dortmund\\
%         \texttt{karsten@tinnefeld.com}}
% \maketitle
%
%  \section{Introduction}
%  This package is an add-on to the |MathTime| style, a style to
%  provide TeX support for the use of the MathTime\texttrademark\
%  commercially distributed by Y\&Y, Inc.
%
%  The style file for MathTime has hard-wired uppercase Greek letters,
%  they are upright and only upright, though the fonts come with
%  italic letters as well for each and every weight. This package
%  provides a switch to choose between both kinds of Greek uppercase
%  letters.
%
%  \DescribeMacro{\uprightupcasegreek} With the command
%  |\uprightupcasegreek| you turn to upright letters, with
%  \DescribeMacro{\italicupcasegreek} |\italicupcasegreek| you turn to
%  italics.
%
%  \StopEventually {}
%
%  \section{Realization}
%  The whole stuff is realized by tweaking NFSS2, since Greek
%  characters are distributed rather madly in the fonts. In fact,
%  after a no-op option processing event
%
%    \begin{macrocode}
\ProcessOptions\relax
%    \end{macrocode}
%
%  and the explicit care, that we do not tweak the original math font
%  setup,
%
%    \begin{macrocode}
\RequirePackage{mathtime}
%    \end{macrocode}
%
%  we in fact adapt the core \LaTeX2e\ routines for command-character
%  mapping |\DeclareMathSymbol| and |\set@mathsymbol| by throwing away
%  all warning, other operators or |\@onlypreamble|-stuff.
%
%  \begin{macro}{\mtg@realloc}
%    The macro |\mtg@realloc| turns the decimal digit into a
%    hexadecimal one (why isn't there a central routine for more than
%    one digit?) and calls |\mtg@re@lloc|,
%
%    \begin{macrocode}
\def\mtg@realloc#1#2{%
  \begingroup
  \count\z@=#2\relax
  \count\tw@\count\z@
  \divide\count\z@\sixt@@n
  \count@\count\z@
  \multiply\count@\sixt@@n
  \advance\count\tw@-\count@
  \expandafter\mtg@re@lloc
  #1{\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}%
  \endgroup}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@mtg@re@lloc}
%    then overwrites the |\mathchardef|inition for a single letter.
%
%    \begin{macrocode}
\def\mtg@re@lloc#1#2{\global\mathchardef#1="01#2\relax } 
%    \end{macrocode}
%\end{macro}
%
%  The two switches take the character codes and plug them into the
%  appropriate letter commands, e basta cos\`\i!
%
%    \begin{macrocode}
\newcommand *\uprightupcasegreek {%
  \mtg@realloc\Gamma   {48}\mtg@realloc\Delta   {49}%
  \mtg@realloc\Theta   {50}\mtg@realloc\Lambda  {51}%
  \mtg@realloc\Xi      {52}\mtg@realloc\Pi      {53}%
  \mtg@realloc\Sigma   {54}\mtg@realloc\Upsilon {55}%
  \mtg@realloc\Phi     {56}\mtg@realloc\Psi     {57}%
  \mtg@realloc\Omega  {127}}
\newcommand *\italicupcasegreek {%
  \mtg@realloc\Gamma    {0}\mtg@realloc\Delta    {1}%
  \mtg@realloc\Theta    {2}\mtg@realloc\Lambda   {3}%
  \mtg@realloc\Xi       {4}\mtg@realloc\Pi       {5}%
  \mtg@realloc\Sigma    {6}\mtg@realloc\Upsilon  {7}%
  \mtg@realloc\Phi      {8}\mtg@realloc\Psi      {9}%
  \mtg@realloc\Omega    {10}}
%    \end{macrocode}
%
%\Finale
%
%% \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         \~}
%
%\endinput
