%\CheckSum{374}
%
% \iffalse
%
% File `tmmaths.dtx'
% Copyright (c) 1999--2001 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.drv}
%</driver>
%<tmmaths>\ProvidesPackage{tmmaths}
%<tmmathm>\ProvidesPackage{tmmathm}
           [2001/10/09 v2.1 (WaS/MicroPress)]
%
%<*driver> 
\documentclass[11pt]{ltxdoc}
\RequirePackage{url}
\CodelineNumbered
\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
%
% \GetFileInfo{tmmaths.drv}
% \DeleteShortVerb{\|}
% \MakeShortVerb{\+}
% 
% \title{The \LaTeX{} macro packages \\ \texttt{tmmaths} and \texttt{tmmathm}}
% \author{Walter Schmidt\thanks{\texttt{<mailto:was@VR-Web.de>}}}
% \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}
% Use of the TM-Math fonts with \LaTeX{} is supported through 
% the macro packages \texttt{tmmaths} and \texttt{tmmathm}.
%
%
% \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.
%
% \subsection{Font encoding}
% The package does \emph{not} change the default output font
% encoding from OT1.  It is, however, recommended to make use of
% the font family \texttt{tmr} through 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.
% Regardless of the option, the new commands
% +\upDelta+ and +\upOmega+ will \emph{always} provide 
% upright \( \Delta \) and \( \Omega \) symbols.
%
% \subsection{Bold math alphabet}
% The \texttt{tmmaths} package provides a {\bfseries\itshape bold italic}
% math alphabet  +\mathbold+.  
% (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 packages \texttt{amssymb} or \texttt{amsfonts} 
% are loaded in conjunction with \texttt{tmmaths}.
% 
%
% \section{The package \texttt{tmmathm}}
% Despite having been desigend to blend with Adobe Times, 
% the TM-Math fonts match also similar text fonts such as
% TimesTen or, for instance, central-european variants
% of Times.  Doing so is supported through the package \texttt{tmmathm}.
% It affects only the \emph{math} fonts used by \LaTeX, 
% whereas the \emph{text} fonts can be chosen separately.  
%
% Strangely, certain Times variants (TimesTen, Monotype TimesNewRoman) 
% are about 5\% larger than `ordinary' Adobe Times.
% The \texttt{tmmathm} package can be loaded with the option
% \texttt{[TMlargescale]} to enlarge the TM-Math fonts accordingly.
%
% For instance, if TimesTen (with real smallcaps) is installed as font family 
% \texttt{pttx},
% the following commands change the default roman text font family to 
% \texttt{pttx} and load TM-Math, enlarged by 5\%, for the formulas:
% \begin{verse}
% +\renewcommand{\rmdefault}{pttx}+\\
% +\usepackage[TMlargescale]{tmmaths}+
% \end{verse}
% 
% As to the \texttt[slantedGreek] option, the +\mathbold+ alphabet, and
% the use of the AMS fonts, the \texttt{tmmathm} package does not differ 
% from \texttt{tmmaths}---see above.
% 
%
%
% \section{Availability and support}
% The latest versions of these packages can be obtained from the directory
% \path{macros/latex/contrib/supported/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}
% Only the \texttt{tmmathm} package needs to provide optional scaling:
%    \begin{macrocode}
%<*tmmathm>
\let\tmr@@Scale\@empty
\DeclareOption{TMlargescale}{\def\tmr@@Scale{s*[1.05]}}
%</tmmathm>
%    \end{macrocode}
% Both packages optionally support slanted uppercase Greek:
%    \begin{macrocode}
%<*tmmaths|tmmathm>
\newif\iftmmath@slantedGreek
\DeclareOption{slantedGreek}{\tmmath@slantedGreektrue}
\ProcessOptions\relax
%</tmmaths|tmmathm>
%    \end{macrocode}
%
% \subsection{The font definitions}
% The package \texttt{tmmathm} provides its own 
% font definitions for the TM-Math fonts to support scaling.
%    \begin{macrocode}
%<*tmmathm>
\DeclareFontFamily{OT1}{tmr}{}%
\DeclareFontShape{OT1}{tmr}{m}{n}{ <-> \tmr@@Scale tmrm10ot}{}%
\DeclareFontShape{OT1}{tmr}{m}{it}{<-> \tmr@@Scale tmri10ot}{}%
\DeclareFontShape{OT1}{tmr}{bx}{n}{<-> \tmr@@Scale tmrb10ot}{}%
\DeclareFontShape{OT1}{tmr}{bx}{it}{<-> \tmr@@Scale tmbi10ot}{}%
%    \end{macrocode}
%    \begin{macrocode}
\DeclareFontFamily{OML}{tmm}{\skewchar\font127 }%
\DeclareFontShape{OML}{tmm}{m}{it}{ <-> \tmr@@Scale tmmi10}{}%
\DeclareFontShape{OML}{tmm}{b}{it}{ <-> \tmr@@Scale tmmib10}{}%
%    \end{macrocode}
%    \begin{macrocode}
\DeclareFontFamily{OMS}{tmsy}{\skewchar\font48 }%
\DeclareFontShape{OMS}{tmsy}{m}{n}{<-> \tmr@@Scale tmsy10}{}%
\DeclareFontShape{OMS}{tmsy}{b}{n}{<-> \tmr@@Scale tmbsy10}{}%
%    \end{macrocode}
%    \begin{macrocode}
\DeclareFontFamily{OMX}{tmex}{}%
\DeclareFontShape{OMX}{tmex}{m}{n}{<-> \tmr@@Scale tmex10}{}%
\DeclareFontShape{OMX}{tmex}{b}{n}{<-> \tmr@@Scale tmexb10}{}%
%</tmmathm>
%    \end{macrocode}
% The \texttt{tmmaths} package, in contrast, relies on the FD files
% that come with the fonts.
%
% \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}
%<*tmmaths>
\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
%</tmmaths>
%    \end{macrocode}
%
% \subsection{Setting up the math fonts}
% \subsubsection{Math alphabets}
%
% In the \texttt{tmmaths} package
% the definition of the `operators' font is quite straightforward:
%    \begin{macrocode}
%<*tmmaths>
\DeclareSymbolFont{operators}{OT1}{tmr}{m}{n}%
\SetSymbolFont{operators}{bold}{OT1}{tmr}{bx}{n}%
%</tmmaths>
%    \end{macrocode}
% The package \texttt{tmmathm} uses the default roman text font.
% Possibly it is changed after loading of the \texttt{tmmathm} package,
% so we defer the declaration of the `operators' font:
%    \begin{macrocode}
%<*tmmathm>
\AtBeginDocument{%
  \DeclareSymbolFont{operators}{\encodingdefault}{\rmdefault}{m}{n}%
  \SetSymbolFont{operators}{bold}{\encodingdefault}{\rmdefault}{bx}{n}%
}
%    \end{macrocode}
% We have a problem now:  The text font does not provide the
% upright Greek alphabet, and several symbols may not be appropriate for
% math typesetting:  plus, equals, parentheses, brackets, math accents.
% So we  have to set up OT1/tmr as an additional SymbolFont named `upright', 
% where we can take these symbols from:
%    \begin{macrocode}
\DeclareSymbolFont{upright}{OT1}{tmr}{m}{n}%
\SetSymbolFont{upright}{bold}{OT1}{tmr}{bx}{n}%
%</tmmathm>
%    \end{macrocode}
% For the actual redefinitions of the particular symbols see below!
%
% Both packages set up the other SymbolFonts as usual:
%    \begin{macrocode}
%<*tmmaths|tmmathm>
\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}
%
% \subsubsection{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}
%</tmmaths|tmmathm>
%    \end{macrocode}
%
% Uppercase Greek; the code differs between the two packages,
% as far as the upright symbols are concerned:
%    \begin{macrocode}
%<*tmmaths|tmmathm>
\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}
%</tmmaths|tmmathm>
%<*tmmaths>
  \DeclareMathSymbol{\upDelta}{\mathord}{operators}{1}
  \DeclareMathSymbol{\upOmega}{\mathord}{operators}{10}
\else
  \let\upDelta=\Delta
  \let\upOmega=\Omega
\fi  
%</tmmaths>
%<*tmmathm>
  \DeclareMathSymbol{\upDelta}{\mathord}{upright}{1}
  \DeclareMathSymbol{\upOmega}{\mathord}{upright}{10}
\else  
  \DeclareMathSymbol{\Gamma}{\mathord}{upright}{0}
  \DeclareMathSymbol{\Delta}{\mathord}{upright}{1}
  \DeclareMathSymbol{\Theta}{\mathord}{upright}{2}
  \DeclareMathSymbol{\Lambda}{\mathord}{upright}{3}
  \DeclareMathSymbol{\Xi}{\mathord}{upright}{4}
  \DeclareMathSymbol{\Pi}{\mathord}{upright}{5}
  \DeclareMathSymbol{\Sigma}{\mathord}{upright}{6}
  \DeclareMathSymbol{\Upsilon}{\mathord}{upright}{7}
  \DeclareMathSymbol{\Phi}{\mathord}{upright}{8}
  \DeclareMathSymbol{\Psi}{\mathord}{upright}{9}
  \DeclareMathSymbol{\Omega}{\mathord}{upright}{10}
  \let\upDelta=\Delta
  \let\upOmega=\Omega
\fi  
%</tmmathm>
%    \end{macrocode}
%
% \subsubsection{Miscellaneous symbols}
%
% The TM-Math fonts provide a ready-made +\hbar+:
%    \begin{macrocode}
%<*tmmaths|tmmathm>
\DeclareMathSymbol{\hbar}{\mathord}{letters}{"80}%
%</tmmaths|tmmathm>
%    \end{macrocode}
%
% The following symbols, too, must be redefined,
% when the `operators' font is \emph{not} OT1/tmr, i.e., with the
% \texttt{tmmathm} package:
%    \begin{macrocode}
%<*tmmathm>
\DeclareMathSymbol{,}{\mathpunct}{operators}{44}
\DeclareMathSymbol{.}{\mathord}{operators}{46}
\DeclareMathSymbol{+}{\mathbin}{upright}{"2B}
\DeclareMathSymbol{:}{\mathrel}{upright}{"3A}
\DeclareMathSymbol{=}{\mathrel}{upright}{"3D}
\DeclareMathDelimiter{(}{\mathopen} {upright}{"28}{largesymbols}{"00}
\DeclareMathDelimiter{)}{\mathclose}{upright}{"29}{largesymbols}{"01}
\DeclareMathDelimiter{[}{\mathopen} {upright}{"5B}{largesymbols}{"02}
\DeclareMathDelimiter{]}{\mathclose}{upright}{"5D}{largesymbols}{"03}
\DeclareMathDelimiter{/}{\mathord}{upright}{"2F}{largesymbols}{"0E}
\DeclareMathAccent{\acute}{\mathalpha}{upright}{"13}
\DeclareMathAccent{\grave}{\mathalpha}{upright}{"12}
\DeclareMathAccent{\ddot}{\mathalpha}{upright}{"7F}
\DeclareMathAccent{\tilde}{\mathalpha}{upright}{"7E}
\DeclareMathAccent{\bar}{\mathalpha}{upright}{"16}
\DeclareMathAccent{\breve}{\mathalpha}{upright}{"15}
\DeclareMathAccent{\check}{\mathalpha}{upright}{"14}
\DeclareMathAccent{\hat}{\mathalpha}{upright}{"5E}
\DeclareMathAccent{\dot}{\mathalpha}{upright}{"5F}
\DeclareMathAccent{\mathring}{\mathalpha}{upright}{"17}
\def\vdots{%
\setbox0=\hbox{$\m@th\ldotp$}
\vbox{\baselineskip4pt \lineskiplimit\z@
    \kern6pt\copy0\copy0\box0}}
\def\ddots{%
\setbox0=\hbox{$\m@th\ldotp$}
\mathinner{\mkern1mu\raise7pt
    \vbox{\kern7pt\copy0}\mkern2mu
    \raise4pt\copy0\mkern2mu\raise\p@\box0\mkern1mu}}
%</tmmathm>
%    \end{macrocode}
% Note that the default definitions of +\vdots+ and +\ddots+ take
% the dot symbols from the text font.  This is correct, as long as 
% the font family \texttt{tmr} is used for both text and formulas.
% Otherwise (i.e., in the \texttt{tmmathm} package), 
% +\vdots+ and +\ddots+ must be redefined to take their dots from TM-Math,
% in order to match +\ldots+ and +\cdots+.
%
% \subsection{Using the AMS packages and fonts}
%    \begin{macrocode}
%<*tmmaths|tmmathm>
\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}{}{}{}}%
  }{}
%</tmmaths|tmmathm>
%    \end{macrocode}
%
% Use the TM-Math versions of the AMS symbol fonts.
% With \texttt{tmmathm} we have to  care for scaling;
% with \texttt{tmmaths}, this is not required:
%    \begin{macrocode}
%<*tmmaths>
  \DeclareFontFamily{U}{msa}{}
  \DeclareFontShape{U}{msa}{m}{n}{<->tmam10}{}
  \DeclareFontFamily{U}{msb}{}
  \DeclareFontShape{U}{msb}{m}{n}{<->tmbm10}{}
%</tmmaths>
%<*tmmathm>
  \DeclareFontFamily{U}{msa}{}
  \DeclareFontShape{U}{msa}{m}{n}{<->\tmr@@Scale tmam10}{}
  \DeclareFontFamily{U}{msb}{}
  \DeclareFontShape{U}{msb}{m}{n}{<->\tmr@@Scale tmbm10}{}
%</tmmathm>
%    \end{macrocode}
%    \begin{macrocode}
%<*tmmaths|tmmathm>
}
%</tmmaths|tmmathm>
%    \end{macrocode}
%
%
% \section*{DocStrip modules in this file \texttt{tmmaths.dtx}}
% \begin{quote}
% \begin{tabular}{ll}
% module: & contents:\\[0.5ex]
% +tmmaths+ & file \texttt{tmmaths.sty}\\
% +tmmathm+ & file \texttt{tmmathm.sty}\\
% +driver+ &  driver for documentation \\
% \end{tabular}
% \end{quote}
% The next line of code prevents DocStrip from adding the
% character table to the modules:
%    \begin{macrocode}
\endinput
%    \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         \~}
%%

