%\CheckSum{305}
%
% \iffalse
%
% File `tmmaths.dtx'
% Copyright (c) 1999--2003 Walter Schmidt
%
% This program may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.2
% of this license 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.2 or later is part of all distributions of LaTeX
% version 1999/12/01 or later.
%
% This program consists of the files tmmaths.dtx, tmmaths.ins and
% tmmaths.txt.
% 
% \fi
%
% \iffalse
%
%<*driver>
\ProvidesFile{tmmaths.dtx}
%</driver>
%<tmmaths>\ProvidesPackage{tmmaths}
           [2004/01/19 v2.4 (WaS/MicroPress)]
%
%<*driver> 
\documentclass[11pt]{ltxdoc}
\RequirePackage{url}
\CodelineNumbered
\OnlyDescription
\parindent1em
\leftmargini=2em
\leftmarginii=2em
\leftmarginiii=2em
\leftmarginiv=2em
\leftmargin\leftmargini
\labelwidth\leftmargin \advance\labelwidth by -\labelsep
\begin{document}
 \DocInput{tmmaths.dtx}
\end{document}
%</driver>
% \fi
%
% \DeleteShortVerb{\|}
% \MakeShortVerb{\+}
% 
% \GetFileInfo{tmmaths.dtx}
% \title{The \LaTeX{} macro package \texttt{tmmaths}}
% \author{Walter Schmidt\thanks{\texttt{w.a.schmidt@gmx.net}}}
% \date{\fileversion{} -- \filedate}
% \maketitle
%
%
%
% \section{The TM-Math font set}
%                                                      
% MicroPress' TM-Math font set extends the Adobe Times typefaces:
% \begin{itemize}
%   \item Additional text and text companion symbols make the 
%   full OT1 and T1 character sets and a subset of the 
%   text companion symbols available, including the Euro sign.
%   With \LaTeX, the enhanced Times typefaces are provided
%   as a font family named \texttt{tmr}.
%   \item Several math fonts, matching the `Times' style, are provided
%   to support all of \TeX's math typesetting capabilites and fully
%  replace the default Computer Modern fonts.
% \end{itemize}
%
%
% \section{The package \texttt{tmmaths}}
% Loading the package \texttt{tmmaths}
% \begin{verse}
% +\usepackage{tmmaths}+
% \end{verse}
% makes \LaTeX{} use the Times and TM-Math fonts:
% The default roman text font family (+\rmdefault+) is changed to \texttt{tmr},
% i.e.\ enhanced Adobe Times, and the math fonts are changed to TM-Math.
% Notice that the +\mathsf+ and +\mathtt+ alphabets remains unchanged, i.e., 
% CM Sans Serif and CM Typewriter.
%
% \subsection{Font encoding}
% The package does \emph{not} change the default output font
% encoding from OT1.  It is, however, recommended to switch to
% the extended T1 and TS1 encodings,
% so as to provide access all glyphs.
% This is enabled by the following additional commands:
% \begin{verse}
% +\usepackage[T1]{fontenc}+\\
% +\usepackage{textcomp}+
% \end{verse}
%
% \subsection{The \texttt{slantedGreek} option}
% When the macro package is loaded using the option \texttt{[slantedGreek]},
% uppercase Greek letters in math will, by default, be slanted.
%
% \subsection{Upright Greek}
% A full upright Greek alphabet is made available.
% The macros +\upalpha+, +\upbeta+ \dots\ +\upGamma+, +\upDelta+ etc.\ 
% always produce upright Greek letters, regardless of the \texttt{slantedGreek} option.
%
% \subsection{Bold italic letters in formulas}
% The \texttt{tmmaths} package provides a {\bfseries\itshape bold italic}
% math alphabet  +\mathbold+.  It includes both Latin and Greek.
% (Do not mix this up with +\mathbf+, which implements
% the {\bfseries bold upright} text font for use in math!)
% 
% \subsection{Using the AMS math symbol fonts}
% The TM-Math font set includes matching AMS symbol fonts, too.
% \LaTeX{} will use these, if the package \texttt{amssymb} 
% is loaded in conjunction with \texttt{tmmaths}.  The sequence of loading does
% not matter.
%
% \subsection{Changes over \texttt{tmmath.sty}}
% As compared with MicroPress' original \texttt{tmmath.sty}, this package
% provides a numbe of improvements:
% \begin{itemize}
% \item the option \texttt{slantedGreek}
% \item support for a full upright Greek alphabet, without loading
% any additional package
% \item AMS symbols can be used by just loading the package \texttt{amssymb};
% no extra packages are needed, and the sequence of of loading does not matter.
% \end{itemize}
%
%
% \section{Availability and support}
% The latest versions of these packages can be obtained from the directory
% \path{macros/latex/contrib/psnfssx/tmmath} of any CTAN host.
%
% \noindent
% The TM-Math fonts are provided by 
% \begin{verse}
% MicroPress, Inc.\\
% 6830~Harrow~Street\\
% Forest Hills NY 11375\\
% USA\\
% \texttt{<http://www.micropress-inc.com>}.
% \end{verse}
% 
% 
% \StopEventually{\par\vfill\noindent{\small
% Adobe is a trademark of Adobe Systems Incorporated.
% Times is a registered trademark of Linotype-Hell AG and/or
% its subsidiaries.  Times New Roman is a trademark of The
% Monotype Corporation.
% TM-Math is a trademark of \mbox{MicroPress},~Inc.
% \par}}
%
%
%
% \section{The package code}
%
% \subsection{The options}
% The option for slanted uppercase Greek:
%    \begin{macrocode}
%<*tmmaths>
\newif\iftmmath@slantedGreek
\DeclareOption{slantedGreek}{\tmmath@slantedGreektrue}
\ProcessOptions\relax
%    \end{macrocode}
%
% \subsection{Setting up the text fonts}
% The package \texttt{tmmaths} switches the default roman text font
% family to \texttt{tmr} and provides an improved Aring, at least 
% with OT1 encoding:
%    \begin{macrocode}
\renewcommand*\rmdefault{tmr}
\def\tmmath@Aring
{%
  \leavevmode
  \setbox0\hbox{h}%
  \dimen@\ht0 %
  \advance\dimen@-1ex%
  {\ooalign{\hfil\raise.65\dimen@\hbox{\r{}}\hfil\crcr A}}%
}%
\DeclareTextCompositeCommand{\r}{OT1}{A}{\tmmath@Aring}%
\normalfont
%    \end{macrocode}
%
% \subsection{Setting up the math fonts}
% The definitions of the standard symbol fonts are straightforward:
%    \begin{macrocode}
\DeclareSymbolFont{operators}{OT1}{tmr}{m}{n}%
\SetSymbolFont{operators}{bold}{OT1}{tmr}{bx}{n}%
\DeclareSymbolFont{letters}{OML}{tmm}{m}{it}%
\DeclareSymbolFont{symbols}{OMS}{tmsy}{m}{n}%
\DeclareSymbolFont{largesymbols}{OMX}{tmex}{m}{n}%
\SetSymbolFont{letters}{bold}{OML}{tmm}{b}{it}%
\SetSymbolFont{symbols}{bold}{OMS}{tmsy}{b}{n}%
\DeclareMathAlphabet{\mathbf}{OT1}{tmr}{bx}{n}%
\DeclareMathAlphabet{\mathit}{OT1}{tmr}{m}{it}%
\SetMathAlphabet\mathit{bold}{OT1}{tmr}{bx}{it}%
\DeclareMathAlphabet{\mathbold}{OML}{tmm}{b}{it}
%    \end{macrocode}
%
% \subsection{Lowercase Greek}
% Make +\mathbold+ act on lowercase Greek, too:
%    \begin{macrocode}
\DeclareMathSymbol{\alpha}{\mathalpha}{letters}{11}
\DeclareMathSymbol{\beta}{\mathalpha}{letters}{12}
\DeclareMathSymbol{\gamma}{\mathalpha}{letters}{13}
\DeclareMathSymbol{\delta}{\mathalpha}{letters}{14}
\DeclareMathSymbol{\epsilon}{\mathalpha}{letters}{15}
\DeclareMathSymbol{\zeta}{\mathalpha}{letters}{16}
\DeclareMathSymbol{\eta}{\mathalpha}{letters}{17}
\DeclareMathSymbol{\theta}{\mathalpha}{letters}{18}
\DeclareMathSymbol{\iota}{\mathalpha}{letters}{19}
\DeclareMathSymbol{\kappa}{\mathalpha}{letters}{20}
\DeclareMathSymbol{\lambda}{\mathalpha}{letters}{21}
\DeclareMathSymbol{\mu}{\mathalpha}{letters}{22}
\DeclareMathSymbol{\nu}{\mathalpha}{letters}{23}
\DeclareMathSymbol{\xi}{\mathalpha}{letters}{24}
\DeclareMathSymbol{\pi}{\mathalpha}{letters}{25}
\DeclareMathSymbol{\rho}{\mathalpha}{letters}{26}
\DeclareMathSymbol{\sigma}{\mathalpha}{letters}{27}
\DeclareMathSymbol{\tau}{\mathalpha}{letters}{28}
\DeclareMathSymbol{\upsilon}{\mathalpha}{letters}{29}
\DeclareMathSymbol{\phi}{\mathalpha}{letters}{30}
\DeclareMathSymbol{\chi}{\mathalpha}{letters}{31}
\DeclareMathSymbol{\psi}{\mathalpha}{letters}{32}
\DeclareMathSymbol{\omega}{\mathalpha}{letters}{33}
\DeclareMathSymbol{\varepsilon}{\mathalpha}{letters}{34}
\DeclareMathSymbol{\vartheta}{\mathalpha}{letters}{35}
\DeclareMathSymbol{\varpi}{\mathalpha}{letters}{36}
\DeclareMathSymbol{\varphi}{\mathalpha}{letters}{39}
\DeclareMathSymbol{\varrho}{\mathalpha}{letters}{37}
\DeclareMathSymbol{\varsigma}{\mathalpha}{letters}{38}
%    \end{macrocode}
% The uppercase Greek letters are redefined, if the option
% \texttt{slantedGreeek} has been selected:
%    \begin{macrocode}
\iftmmath@slantedGreek
  \DeclareMathSymbol{\Gamma}{\mathalpha}{letters}{0}
  \DeclareMathSymbol{\Delta}{\mathalpha}{letters}{1}
  \DeclareMathSymbol{\Theta}{\mathalpha}{letters}{2}
  \DeclareMathSymbol{\Lambda}{\mathalpha}{letters}{3}
  \DeclareMathSymbol{\Xi}{\mathalpha}{letters}{4}
  \DeclareMathSymbol{\Pi}{\mathalpha}{letters}{5}
  \DeclareMathSymbol{\Sigma}{\mathalpha}{letters}{6}
  \DeclareMathSymbol{\Upsilon}{\mathalpha}{letters}{7}
  \DeclareMathSymbol{\Phi}{\mathalpha}{letters}{8}
  \DeclareMathSymbol{\Psi}{\mathalpha}{letters}{9}
  \DeclareMathSymbol{\Omega}{\mathalpha}{letters}{10}
\fi
%    \end{macrocode}
%
% \subsection{Upright Greek}
% Uppercase upright Greek is taken from the `operators' font:
%    \begin{macrocode}
\DeclareMathSymbol{\upGamma}  {\mathord}{operators}{"00}
\DeclareMathSymbol{\upDelta}  {\mathord}{operators}{"01}
\DeclareMathSymbol{\upTheta}  {\mathord}{operators}{"02}
\DeclareMathSymbol{\upLambda} {\mathord}{operators}{"03}
\DeclareMathSymbol{\upXi}     {\mathord}{operators}{"04}
\DeclareMathSymbol{\upPi}     {\mathord}{operators}{"05}
\DeclareMathSymbol{\upSigma}  {\mathord}{operators}{"06}
\DeclareMathSymbol{\upUpsilon}{\mathord}{operators}{"07}
\DeclareMathSymbol{\upPhi}    {\mathord}{operators}{"08}
\DeclareMathSymbol{\upPsi}    {\mathord}{operators}{"09}
\DeclareMathSymbol{\upOmega}  {\mathord}{operators}{"0A}
%    \end{macrocode}
% The lowercase upright Greek letters are -- unfortunately -- not in the `letters'
% font, so we  need to set up a particular math alphabet for them:
%    \begin{macrocode}
\DeclareFontFamily{U}{tmrmex}{}
\DeclareFontShape{U}{tmrmex}{m}{n}{<->tmrm10ex}{}
\DeclareFontShape{U}{tmrmex}{b}{n}{<->tmrb10ex}{}
\DeclareSymbolFont{upright}{U}{tmrmex}{m}{n}%
\SetSymbolFont{upright}{bold}{U}{tmrmex}{b}{n}
\DeclareMathSymbol{\upalpha}{\mathord}{upright}{211}
\DeclareMathSymbol{\upbeta}{\mathord}{upright}{212}
\DeclareMathSymbol{\upgamma}{\mathord}{upright}{213}
\DeclareMathSymbol{\updelta}{\mathord}{upright}{214}
\DeclareMathSymbol{\upepsilon}{\mathord}{upright}{215}
\DeclareMathSymbol{\upzeta}{\mathord}{upright}{216}
\DeclareMathSymbol{\upeta}{\mathord}{upright}{217}
\DeclareMathSymbol{\uptheta}{\mathord}{upright}{218}
\DeclareMathSymbol{\upiota}{\mathord}{upright}{219}
\DeclareMathSymbol{\upkappa}{\mathord}{upright}{220}
\DeclareMathSymbol{\uplambda}{\mathord}{upright}{221}
\DeclareMathSymbol{\upmu}{\mathord}{upright}{222}
\DeclareMathSymbol{\upnu}{\mathord}{upright}{223}
\DeclareMathSymbol{\upxi}{\mathord}{upright}{224}
\DeclareMathSymbol{\uppi}{\mathord}{upright}{225}
\DeclareMathSymbol{\uprho}{\mathord}{upright}{226}
\DeclareMathSymbol{\upsigma}{\mathord}{upright}{227}
\DeclareMathSymbol{\uptau}{\mathord}{upright}{228}
\DeclareMathSymbol{\upupsilon}{\mathord}{upright}{229}
\DeclareMathSymbol{\upphi}{\mathord}{upright}{230}
\DeclareMathSymbol{\upchi}{\mathord}{upright}{231}
\DeclareMathSymbol{\uppsi}{\mathord}{upright}{232}
\DeclareMathSymbol{\upomega}{\mathord}{upright}{233}
\DeclareMathSymbol{\upvarepsilon}{\mathord}{upright}{234}
\DeclareMathSymbol{\upvartheta}{\mathord}{upright}{235}
\DeclareMathSymbol{\upvarpi}{\mathord}{upright}{236}
\DeclareMathSymbol{\upvarphi}{\mathord}{upright}{239}
\DeclareMathSymbol{\upvarrho}{\mathord}{upright}{237}
\DeclareMathSymbol{\upvarsigma}{\mathord}{upright}{238}
%    \end{macrocode}
%
% \subsubsection{Miscellaneous symbols}
% The TM-Math fonts provide a ready-made +\hbar+:
%    \begin{macrocode}
\DeclareMathSymbol{\hbar}{\mathord}{letters}{"80}%
%    \end{macrocode}
%
% \subsection{Using the AMS packages and fonts}
% The following code is deferred until +\begin{document}+:
%    \begin{macrocode}
\AtBeginDocument{%
%    \end{macrocode}
% Fix multiple integrals from \texttt{amsmath} for use with TM-Math fonts:
%    \begin{macrocode}
  \@ifpackageloaded{amsmath}{%
    \def\intkern@{\mkern-3mu\mathchoice{\mkern-1.5mu}{}{}{}}%
  }{}
%    \end{macrocode}
% AMS symbols should be taken from the TM fonts:
%    \begin{macrocode}
  \DeclareFontFamily{U}{msa}{}
  \DeclareFontShape{U}{msa}{m}{n}{<->tmam10}{}
  \DeclareFontFamily{U}{msb}{}
  \DeclareFontShape{U}{msb}{m}{n}{<->tmbm10}{}
}
%</tmmaths>
%    \end{macrocode}
%
%
% \section*{DocStrip modules in the source file \texttt{tmmaths.dtx}}
% \begin{quote}
% \begin{tabular}{ll}
% module: & contents:\\[0.5ex]
% +tmmaths+ & file \texttt{tmmaths.sty}\\
% +driver+ &  driver for documentation \\
% \end{tabular}
% \end{quote}
%
%
% \Finale
%
%
% \iffalse
% The next line of code prevents DocStrip from adding the
% character table to the modules:
\endinput
% \fi
%
%% \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         \~}
%%