%
% \iffalse
%% Copyright 1996 1997 Frank Mittelbach and David Carlisle.
%% Copyright 2001 Frank Mittelbach, David Carlisle and Walter Schmidt
%%
%% Development of this package was commissioned by Y&Y Inc.
%% http://www.yandy.com
%% 
%% This package may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, which is part
%% of the base LaTeX distribution.
%% The source file mtpro.dtx and the installation script mtpro.ins
%% must be distributed in common.
%%
%<*dtx>
          \ProvidesFile{mtpro.dtx}
%</dtx>
%<mtpro>\NeedsTeXFormat{LaTeX2e}[1997/06/01]
%<mtpro>\ProvidesPackage{mtpro}
%<MPY1mtt>\ProvidesFile{mpy1mtt.fd}
%<MPY2mtt>\ProvidesFile{mpy2mtt.fd}
%<MPY3mtt>\ProvidesFile{mpy3mtt.fd}
%<Umtt>\ProvidesFile{umtt.fd}
%<Umtms>\ProvidesFile{umtms.fd}
%<OMSlby>\ProvidesFile{omslby.fd}
%<driver>\ProvidesFile{mtpro.drv}
% \fi
%         \ProvidesFile{mtpro.dtx}
 [2001/04/20 v2.0.14 %
%<mtpro> MathTimePro font support (WaS)%
%<MPY1mtt> MathTimePro Encoding 1 (WaS)%
%<MPY2mtt> MathTimePro Encoding 2 (WaS)%
%<MPY3mtt> MathTimePro Encoding 3 (WaS)%
%<Umtt> MathTimePro Bold Alphabet (WaS)%
%<Umtms> Math Time Plus Script (FMi)%
%<OMSlby> Lucida New Math Symbols (FMi)%
]
%
% \iffalse
%
%<*driver>
\documentclass{ltxdoc}
\usepackage[scaled=0.93]{helvet}
\usepackage{mtpro}
\usepackage{xspace}
\newcommand*{\Lpack}[1]{\textsf{#1}}
\newcommand*{\Lopt}[1]{\textsf{#1}}
\renewcommand{\labelitemi}{$\triangleright$}
\newcommand{\mathtime}{{\itshape MathT\kern-.05em\i me}\xspace}
\newcommand{\mtpro}{{\itshape MathT\kern-.05em\i meProfes\-sional\/}\xspace}
\newcommand{\mtplus}{{\itshape MathT\kern-.05em\i me\/}~Plus\xspace}
\newcommand{\AmS}{{\protect\usefont{OMS}{cmsy}{m}{n}%
  A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
\def\mtmTeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.075emX\@}
\makeatletter
\DeclareRobustCommand{\mtmLaTeX}{L\kern-.3em
        {\setbox0\hbox{T}%                                                   
         \vbox to\ht0{\hbox{%                                                
                            \csname S@\f@size\endcsname
                            \fontsize\sf@size\z@
                            \math@fontsfalse\selectfont
                            A}%
                      \vss}%
        }%
        \kern-.14em
        \TeX}
\makeatother        
\let\TeX=\mtmTeX                                                             
\let\LaTeX=\mtmLaTeX                                                         
\begin{document}
\DocInput{mtpro.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{2386}
%
% \GetFileInfo{mtpro.dtx}
%
% \title{Using the \mtpro fonts\\ with \LaTeX \thanks{This 
%          document refers to version \fileversion\ 
%          of the \Lpack{mtpro} package.
%          Development of
%          this package was commissioned by Y\&Y.}}
%
% \date{\filedate}
% \author{Walter Schmidt}
% \maketitle
% \begin{abstract}
% \noindent 
% This document describes the macro package \Lpack{mtpro},
% which serves for using the \mtpro fonts with \LaTeX.
% The package code was partially adopted from the \Lpack{mathtime} package 
% written by Frank Mittelbach and David Carlisle.
% \end{abstract}
%
% \tableofcontents
%
% \section{The \mtpro fonts}
%
% \mtpro is a set of math fonts particularly designed for 
% use with \TeX{} or \LaTeX.  
% They come with a licensed copy of the corresponding text fonts 
% `Times New Roman' from Monotype.
%
% Separate fonts for text size, superscripts, and
% second order superscripts are provided, allowing quality mathematical
% typesetting that has hitherto been available only with metal
% type or with Knuth's CM and Euler fonts.  Furthermore, \mtpro
% includes individually designed delimiters and roots for sizes
% up to 4~inches and extrawide mathematical accents.
% 
% For a detailed discussion of the \mtpro fonts see the document
% `Brief Guide to the New \mtpro Fonts', file 
% \texttt{mtpguide.pdf}.\footnote{Sections \ref{sec:large} and 
% \ref{sec:accents} were partially adopted from that document.}
%
% \section{The \Lopt{mtpro} package}
%
% Basically, 
% loading the macro package \Lpack{mtpro}
% \begin{quote}
%   |\usepackage|\oarg{options}|{mtpro}|
% \end{quote}
% makes \LaTeX{} use Times~NRMT and \mtpro in place of
% the default Computer Modern fonts.
% The following sections describe the
% particular features of the package and the additional options that
% control its behavior.
%
% \subsection{Text fonts}
% Loading the \Lpack{mtpro} package changes \LaTeX's  default roman
% font family to \texttt{mtm}, i.e., Monotype Times New Roman (Times~NRMT),
% since the \mtpro fonts were particularly designed to blend
% with this one.
%
% The font family \texttt{mtm} is available with LY1, OT1, T1 and TS1 encoding.
% In NFSS terms, the series \texttt{m} (regular) and \texttt{b} (bold)
% and the shapes \texttt{n} (normal) and \texttt{it} (italic) are 
% available.   
%
% The \mtpro fonts can be used in conjunction with other
% text font families than Times~NRMT, too.  This is accomplished by
% changing the default roman font family, i.e., the
% macro \cmd{\rmdefault}, from its default value \texttt{cmr} 
% \emph{before} loading the \Lpack{mtpro} package; as a result, the
% package will not alter it once again.  For instance,
% \begin{verse}
% |\renewcommand{\rmdefault}{pttx}|\\
% |\usepackage{mtpro}|
% \end{verse}
% will use TimesTen (with real smallcaps) for text and \mtpro for math.
% 
% The \Lpack{mtpro} package does not change the default sans~serif and
% typewriter font families.  At least Computer Modern Sans does, 
% however, not blend well with Times.
% If you are restricted to the fonts that are available with
% any \LaTeX\ system, you may use Helvetica instead:
% \begin{verse}
% |\usepackage[scaled=0.93]{helvet}|\\
% |\usepackage{mtpro}|
% \end{verse}
% Note that Helvetica should be scaled down to $90\dots95\,\%$ of its
% `natural' size so as to match Times~NRMT.\footnote{%
% This requires at least PSNFSS~8.1,
% as distributed with \LaTeX{} since June 2000.}
%
% \subsection{Text fonts in math}
% 
% The default roman text font, as indicated by the value of \cmd{\rmdefault},
% is used for the math alphabet \cmd{\mathrm}; function names, too,
% are typeset using that font.
%
% The math alphabets \cmd{\mathsf}, \cmd{\mathit} and \cmd{\mathtt} 
% are mapped to the default sans~serif, italic and typewriter text fonts
% by evaluating the macros \cmd{\sfdefault}, \cmd{\itdefault} and \cmd{\ttdefault} 
% when \Lpack{mtpro} gets loaded.
% Thus, if you redefine the default text fonts 
% this should be done \emph{before} loading \Lpack{mtpro}---see the 
% previous section.
%
% The above-mentioned math alphabets 
% are used with the default text font encoding, which is determined
% from the meaning of the macro \cmd{\encodingdefault}
% when \Lpack{mtpro} gets loaded.
% Alternatively, one can force \Lpack{mtpro} to use one of
% LY1, T1 or OT1 by specifying it as a package option, 
% e.g.:
% \begin{verse}
%  |\usepackage[T1]{mtpro}|
% \end{verse}
% Doing so may be useful, if you change the encoding for the
% text fonts \emph{after} loading of \Lpack{mtpro}, in order to
% prevent \LaTeX{} from accessing the default CM fonts with an encoding
% that is possibly not available with CM.
%
% \subsection{Numbers and punctuation in math mode}
% 
% \LaTeX's  default behavior is to typeset numbers and punctuation 
% in math mode using the \cmd{\mathrm} alphabet, which normally equals
% the default text font.
%
% With the \Lpack{mtpro} package, in contrast, numerals and punctuation 
% characters are---in math mode---taken from the \mtpro fonts.
% These numerals are somewhat smaller than those from
% Times~NRMT and seem to be more appropriate for use in formulas.
% Entering
% |$1.23$| will, however, yield a different result than |1.23| then, 
% and you will in each case have to decide whether an input fragment 
% is a math or a non-math entity.
% 
% \subsection{Greek letters}
%
% With \TeX{} or \LaTeX{} uppercase Greek letters in math mode 
% are usually typeset as upright, despite they are usually meant to designate
% variables.  This violates clearly the
% International Standards ISO31-0:1992 to ISO31-13:1992.
%
% The \Lpack{mtpro} package provides an option \Lopt{slantedGreek}, which
% causes uppercase Greek to be typeset as slanted.  
% Regardless of the option, the commands \cmd{\upDelta} and \cmd{\upOmega} 
% will always produce an upright $\upDelta$ and $\upOmega$, because these
% symbols might be required in upright shape, too.
%
% \subsection{Calligraphic and script alphabets}
%
% The \mtpro fonts don't include a calligraphic alphabet, so
% \cmd{\mathcal} defaults to the calligraphic font of the 
% Computer Modern family.
%
% The calligraphic fonts from the \mtplus or Lucida families are
% a better choice---provided that you have actually got these fonts!
% Specifying the package options \Lopt{mtpluscal} or \Lopt{lucidacal}
% makes \cmd{\mathcal} use these instead of CM.
% Alternatively, the package options \Lopt{mtplusscr} or \Lopt{lucidascr}
% define them as \cmd{\mathscr} rather than \cmd{\mathcal}.
%
% \subsection{Blackboard bold}
% \label{sec:bb}
%
% Loading the  \Lpack{mtpro} package with the option \Lopt{amsbb}
% makes the AMS symbol font `msbm' available as a `blackboard bold'
% math alphabet \cmd{\mathbb}.  
% This may be useful, because the  \Lpack{amsfonts} or
% \Lpack{amssymb} macro packages cannot be loaded in conjunction with 
% \Lpack{mtpro}---see section~\ref{sec:problems}.
%
% Of course, other blackboard bold fonts can be used alternatively,
% through loading of the related packages; do not select the 
% \Lopt{amsbb} option then.
%
% \subsection{Bold math fonts}
% The command \cmd{\boldmath}, which is normally used to darken complete
% formulas, has no effect when the \Lpack{mtpro} package is used, 
% because the \mtpro font set does not include the required 
% bold math fonts.  One may think of using the bold \mtplus fonts or even 
% Computer Modern instead, but this will not work, due to the different
% font layout:  One would end up with, e.g., Greek letters in place of 
% numerals!
% However, the \Lpack{mtpro} package provides a sophisticated choice of 
% bold math alphabets, which are perhaps of much more use:
% \begin{itemize}
% \item 
%   \cmd{\mathbf} is the {\bfseries bold upright} Latin math alphabet.
%   In contrast to
%   \LaTeX's normal behavior, \Lpack{mtpro} doesn't simply use the
%   bold variant of the text font here; instead, a modified version
%   of bold Times is used, 
%   with the spacing and the letter shapes particularly adapted 
%   to math typesetting.
% \item
%   \cmd{\mathbold} is a {\bfseries\itshape bold italic} 
%   math alphabet---something
%   that isn't easily available with standard \LaTeX.  
%   \cmd{\mathbold} acts on both Latin and Greek letters.
%   
%   By default, the bold italic math font from Computer Modern will be used
%   for \cmd{\mathbold}.  If you have got the \mtplus font set, you should
%   load the \Lpack{mtpro} package with the option \Lopt{mtbold}, thus
%   using the font MTMIB instead, which suits the other Times 
%   fonts.\footnote{Of course, \cmd{\mathbold} acts only on symbols,
%   which are \emph{not} affected by the different encoding of the bold
%   \mtplus fonts!}
%
% \item
%    In addition to \cmd{\mathcal} there is also a bold variant \cmd{\mathbcal}.
% \item
%    When a \cmd{\mathscr} alphabet is set up through the options 
%    \Lopt{mtplusscr} or \Lopt{lucidascr}, a corresponding bold
%    \cmd{\mathbscr} is defined, too.
% \end{itemize}
%
% \subsection{Positioning of subscripts}
%
% The appearance of subscripts can be improved by loading the package
% with the option \Lopt{subscriptcorrection}.  When certain letters, like
% $f$ or $j$, occur as a subscript, the positioning will be automatically
% adjusted.  In the following example, the left sum was typeset with
% subscript correction, the right one without:
% \enablesubscriptcorrection
% \begin{displaymath}
% C_f + C_j + X_A \qquad
% \disablesubscriptcorrection
% C_f + C_j + X_A
% \end{displaymath}
% \disablesubscriptcorrection ^^A  Just to make sure... 
%
% Subscript correction can also be be turned on and off within the
% document using the commands\\
% \cmd{\enablesubscriptcorrection} and
% \cmd{\disablesubscriptcorrection}.
%
% No guarantee is made as to the proper functioning of the
% automatic subscript correction in conjunction with any additional 
% macro package, because the underscore character |_| is made active.
%
% \subsection{Large delimiters and roots}
% \label{sec:large}
%
% The \mtpro font set includes individually designed parentheses and other
% delimiters with sizes up to 4~inches high
%
% The large parentheses are used through the command |\PARENS{...}|;
% just compare the left matrix with the output obtained from the ordinary 
% \cmd{\left(} and \cmd{\right(} macros:
% \begin{displaymath}
%   \PARENS{ \begin{array}{ccc}
%   x_{11} & x_{12} & \ldots \\
%   x_{21} & x_{22} & \ldots \\
%   x_{31} & x_{32} & \ldots \\
%   \vdots & \vdots & \ddots
%   \end{array} }
%   \qquad
%   \left( \begin{array}{ccc}
%   x_{11} & x_{12} & \ldots \\
%   x_{21} & x_{22} & \ldots \\
%   x_{31} & x_{32} & \ldots \\
%   \vdots & \vdots & \ddots
%   \end{array} \right)
% \end{displaymath}
%
% You can nest \cmd{\PARENS}
% though of course that shouldn't be needed very often.  
% Note that \cmd{\PARENS} ends up typesetting its argument
% more than once, in order to find out the right size of the delimiters,
% so nesting slows \TeX\ down exponentially and may also exhaust its
% capacity.
%
% Basically, |\PARENS{...}| is just an abbreviation for
% |\LEFTRIGHT(){...}|.
% In general, 
% you can use \cmd{\LEFTRIGHT} directly with any two delimiters, including
% the period for an empty delimiter.  In addition to parentheses,
% you can get |/|, |\backslash|, |<| (or |\langle|), and
% |>| (or |\rangle|), all up to 4~inches high.
% 
% A combination like 
% |\LEFTRIGHT(]| is also possible; the $]$ just
% gets extended in the usual way.  At large sizes, however, the $($ might end up
% slightly larger than the $]$, since the $]$ grows at the same (6\,pt) rate, no
% matter how large the argument, while the parentheses grow faster for larger
% formulas.  So in such cases it might be desirable to add a `strut'
% (i.e. a construction  of the form |\rule{0pt}|\marg{height})
% to the formula to force a larger $]$ symbol.
%
% In addition to the \cmd{\sqrt} command, which uses an  
% `extensible' symbol, \Lpack{mtpro} provides \cmd{\SQRT}, with the same syntax.
% It produces individually designed root signs up to 4~inches high:
% In the example below, 
% the left root was typeset using \cmd{\SQRT}, the right one results
% from the ordinary \cmd{\sqrt} command.
% \begin{displaymath}
%   \SQRT[3]{\sum_{i=1}^n (y^i -x^i )^3 }
%   \qquad
%   \sqrt[3]{\sum_{i=1}^n (y^i -x^i )^3 }
% \end{displaymath}
% 
% The positioning of the root index can be adjusted through the commands
% \cmd{\LEFTROOT} and \cmd{\UPROOT}.  They are to be issued in
% math mode, they are valid inside the current formula only, and they
% act only on roots produced from
% \cmd{\SQRT}.\footnote{Caution: The syntax differs both from the
% \Lpack{amsmath} package and \texttt{mtp.tex}\,!}
% Positive arguments to these commands will move the root index to the 
% left and up respectively, while a negative argument will move it
% right and down.  The units of increment are quite small, which is useful
% for such adjustments.
% In the example below, the index $\beta$ of the left root is moved
% 2 units to the right and 6 units up by saying 
% |\LEFTROOT{-2}| |\UPROOT{6}| |\SQRT...|\,; the right root shows the
% default appearance:
% \begin{displaymath}
%  \LEFTROOT{-2}\UPROOT{6}
%  \SQRT[\beta]{k} \qquad 
%  \sqrt[\beta]{k}
% \end{displaymath}
%
% \subsection{Accents in math}
% \label{sec:accents}
%
% In addition to |\widehat| and |\widetilde|, there is now |\widecheck|.
% The |\widehat|, |\widecheck|, and |\widetilde| accents are extended
% in a similar fashion than the large delimiters and roots (see above);
% in each case you can get accents up to 4~inches wide:
% \begin{displaymath}
%   \widehat{a+b} + \widehat{a+b+c} + \widehat{a+b+c+d} + \widehat{a+b+c+d+e}
% \end{displaymath}
% 
% In a combination like $\hat A$, the |\hat| accent might look a 
% little small, while |\widehat| produces an accent $\widehat A$
% that looks too large. So there is |\what| to produce a slightly wider 
% hat accent, $\what A$. Similarly, there are 
% |\wtilde|, |\wcheck|, and |\wbar|.
%
% In addition, there are slightly larger |\wwhat|, |\wwcheck|, |\wwtilde|,
% and |\wwbar|. The |\wwhat|, |\wwcheck|, and |\wwtilde| accents are identical
% to the smallest versions of the accents produced by |\widehat| etc.,
% but in some cases it might be preferable
% to force this smallest size instead of relying on the |\wide|\dots{}
% accents themselves. For example, |\widehat M| yields $\widehat M$,
% because the $M$ happens to be just too wide (counting the white space
% on its sides) for the smallest |\widehat| accent, whereas |\wwhat M| 
% will result in $\wwhat M$.
%
% The |\wwbar| accent is what used to be called |\widebar| in the
% \mathtime fonts, but that really wasn't a very good name, since
% |\overline| is what actually corresponds to the |\wide|\dots{} accents.
% 
% In situations like $\dot \Gamma$ and $\ddot \gamma$,
% the |\dot| and |\ddot| accents might look better 
% if they were moved up a bit. So there are |\dotup| and |\ddotup|,
% to produce $\dotup \Gamma$ and $\ddotup \gamma$.
%
% \subsection{Additional symbols}
%
% The \Lpack{mtpro} package provides a few additional math symbols, 
% which are not defined with standard \LaTeX:
% \begin{center}
% \begin{tabular}{ll@{\qquad}ll@{\qquad}ll@{\qquad}}
% $\cupprod$ & \cmd{\cupprod} & $\comp$     & \cmd{\comp}     & $\setdif$ & \cmd{\setdif}\\
% $\capprod$ & \cmd{\capprod} & $\varkappa$ & \cmd{\varkappa}
% \end{tabular}
% \end{center}
% These are binary operators, except for \cmd{\varkappa} which is
% of type `mathalpha'.
%
% \subsection{Symbols missing from the \mtpro fonts}
% The \mtpro fonts do not include the symbols
% \dag{}, \ddag{}, \P{} and \S.
% As a workaround, the \Lpack{mtpro} package will redefine the related
% commands so as to use the text companion fonts (i.e., TS1 encoding), 
% unless you are using the LY1 encoding, which \emph{does} provide 
% the symbols in question. This affects both text and math mode.
%
% Loading the package with the option \Lopt{noTS1} suppresses that behavior.
% Doing so may be useful, if your text fonts are not available with
% TS1 encoding anyway, or if you don't want to waste one of the 16 
% math symbol fonts just for these symbols.  
%
% \subsection{Known problems}
% \label{sec:problems}
% 
% \begin{itemize}
% \item
% The macro package \Lpack{amsmath}, formerly known as \AmS-\LaTeX,
% applies a lot of changes to \LaTeX's math typesetting facilities.
% Unfortunately, these changes rely partially on the characteristics of the
% Computer Modern math fonts.  As a result, the \cmd{\boldsymbol} command 
% will not work with the \mtpro fonts.
% \item
% The packages \Lpack{amssymb} and \Lpack{amsfonts} cannot be used in
% conjunction with \Lpack{mtpro}.  Note, however, that you may still
% load the \Lpack{eufrak} and \Lpack{eucal} packages to use 
% the Euler Fraktur and script fonts.  As to the blackboard bold alphabet
% see section~\ref{sec:bb}.
% \end{itemize}
%
% \StopEventually{%
% \appendix
% \section{Option summary}
% This section lists all options of the \Lpack{mtpro} package.
% Options that correspond to the default behavior of the package are
% marked by an asterisk and need normally not to be specified.
%
% \begin{description}
% \item[\Lopt{uprightGreek}*] Makes the uppercase Greek letters upright.
% \item[\Lopt{slantedGreek}] Makes the uppercase Greek letters slanted.
% \item[\Lopt{subscriptcorrection}]
%   Redefines the underscore character so that it automatically corrects 
%   the spacing of subscripts.
% \item[\Lopt{nosubscriptcorrection}*]
%   Disables the subscript correction.
% \item[\Lopt{cmcal}*]
%   Uses the Computer Modern calligraphic alphabet
%   for \cmd{\mathcal}.
% \item[\Lopt{lucidacal}] Sets up \cmd{\mathcal} and \cmd{\mathbcal} 
%   to use  the Lucida calligraphic fonts
% \item[\Lopt{lucidascr}] Like \Lopt{lucidacal}, but puts the fonts into
%   \cmd{\mathscr} and \cmd{\mathbscr}.
% \item[\Lopt{mtplusscr}] Sets up \cmd{\mathscr} and \cmd{\mathbscr}
%   to use the  Math Time Plus script fonts.
% \item[\Lopt{mtpluscal}] Like \Lopt{mtplusscr}, but puts the fonts into the
%   \cmd{\mathcal} and \cmd{\mathbcal} alphabets.
% \item[\Lopt{mtbold}] Uses the bold italics from the \mtplus fonts
%   for the \cmd{\mathbold} alphabet.
%  \item[\Lopt{cmbold}*] Like \Lopt{mtbold}, but uses the bold
%   math italic font from Computer Modern. 
%  \item[\Lopt{amsbb}] Defines \cmd{\mathbb} to refer to the blackboard bold 
%   math alphabet from the AMS fonts.
% \item[\Lopt{noTS1}] Stops the package from using any text companion
%   fonts for missing math symbols.
% \item[\Lopt{OT1}] Uses OT1 encoding for the operators font.
% \item[\Lopt{T1}] Uses T1 encoding for the operators font.
% \item[\Lopt{LY1}] Uses LY1 (Y\&Y's `locally' defined texnansi encoding)
%   in the operators font.  This option includes also the effect of
%   \Lopt{noTS1}, since the symbols in question are provided in the 
%   LY1 encoding; you need not specify \Lopt{noTS1}  additionally.
% \end{description}
%
% This package makes a lot of font re-assignments. Normally these
% generate warning messages on the terminal, however getting so many
% messages would be distracting, so a further three options control the
% font tracing. Even more control may be obtained by loading the
% \Lpack{tracefnt} package.
% \begin{description}
% \item[\Lopt{errorshow}*] Only show font \emph{errors} on the terminal.
%   Warnings are just sent to the log file. 
% \item[\Lopt{warningshow}] Show font warnings on the terminal. This
%   corresponds to the usual \LaTeX\ behavior.
% \item[\Lopt{nofontinfo}] Suppress all font warnings, even from the log file.
% \end{description}
%
% Not all options can be used together, e.g., one can at most select one
% of the options setting up \cmd{\mathcal}.  If both options are given
% \Lopt{mtpluscal} will win over \Lopt{luciadcal} and in case of
% \cmd{\mathscr},
% \Lopt{lucidascr} will be the winner over \Lopt{mtplusscr}.
% }
%
%
%
% \section{The implementation of \Lpack{mtpro}}
%
% \subsection{Options}
%
% We start with declaring the options. For the un/slanted Greek we take
% |\Gamma| as a marker,  since it will be redefined anyway.
%    \begin{macrocode}
%<*mtpro>
\DeclareOption{slantedGreek}{\let\Gamma=s}
\DeclareOption{uprightGreek}{\let\Gamma=u}
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand\enablesubscriptcorrection {\catcode`\_=12\relax}
\newcommand\disablesubscriptcorrection{\catcode`\_=8\relax}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareOption{nosubscriptcorrection}{\disablesubscriptcorrection}
\DeclareOption{subscriptcorrection}  {\enablesubscriptcorrection}
%    \end{macrocode}
%
% We signal that we want Lucida calligraphic by defining |\mathcal|
% to be the letter |l|. In a similar fashion we handle |\mathscr|.
%    \begin{macrocode}
\DeclareOption{cmcal}    {\let\mathcal=c}
\DeclareOption{lucidacal}{\let\mathcal=l}
\DeclareOption{mtplusscr}{\let\mathscr=s}
\DeclareOption{mtpluscal}{\let\mathcal=s}
\DeclareOption{lucidascr}{\let\mathscr=l}
%    \end{macrocode}
%
%
% The use of the mtpro fonts with text fonts encoded in the standard
% OT1 or T1 encodings leaves a few symbols (section and paragraph marks,
% and dagger symbols) undefined. By default the TS1 `text companion
% encoding' will be used to access these symbols, but this option
% suppresses that.
%    \begin{macrocode}
\DeclareOption{noTS1}    {\let\symtextcomp\relax}
%    \end{macrocode}
%
% The next few options control the encoding used for the `operators'
% font. When using Computer Modern Math fonts, an OT1 font must be used
% even if an alternative encoding, such as T1, is used for the text
% fonts. This is due to the fact that the default math setup assumes
% that certain symbols (such as uppercase Greek) are available from the
% text font used for the operators symbol font. With this package
% this restriction is not needed as all symbols are accessed from the
% mtpro fonts.
%
% By default use the current text encoding.
%    \begin{macrocode}
\let\operator@encoding\encodingdefault
%    \end{macrocode}
%
% Use OT1 encoded `operators' font.
%    \begin{macrocode}
\DeclareOption{OT1}{\def\operator@encoding{OT1}}
%    \end{macrocode}
%
% Use T1 encoded `operators' font.
%    \begin{macrocode}
\DeclareOption{T1}{\def\operator@encoding{T1}}
%    \end{macrocode}
%
% Use LY1 (Y\&Y's local `texnansi' encoding)
% encoded `operators' font. This option implies also to not make use of the
% text companion encoding.
%    \begin{macrocode}
\DeclareOption{LY1}{\def\operator@encoding{LY1}\let\symtextcomp\relax}
%    \end{macrocode}
%
% The following options control how a bold 
% math alphabet will be set up:
%    \begin{macrocode}
\DeclareOption{mtbold}{\let\mathbold=m}
\DeclareOption{cmbold}{\let\mathbold=c}
%    \end{macrocode}
% 
% Finally, there is an option for setting up a \cmd{\mathbb} alphabet
% using the AMS Symbols~B font.  This is necessary, because the 
% \Lpack{amsfonts} package cannot be used in conjunction with \Lpack{mtpro}.
%    \begin{macrocode}
\DeclareOption{amsbb}{\let\mathbb=y}
%    \end{macrocode}
%
% This package makes a lot of redefinitions. The warnings can be rather
% annoying so some package options control whether the information
% is printed to the terminal or log file. More control can be obtained
% by loading the \textsf{tracefnt} package.
%
% Just show font errors; Warning and info to the log file.
% The default for this package.
%    \begin{macrocode}
\DeclareOption{errorshow}{%
   \def\@font@info#1{%
         \GenericInfo{(Font)\@spaces\@spaces\@spaces\space\space}%
                     {LaTeX Font Info: \space\space\space#1}}%
    \def\@font@warning#1{%
         \GenericInfo{(Font)\@spaces\@spaces\@spaces\space\space}%
                        {LaTeX Font Warning: #1}}}
%    \end{macrocode}
%
% The normal \LaTeX\ default, Font Info to the log file and Font
% Warning to the terminal.
%    \begin{macrocode}
\DeclareOption{warningshow}{%
   \def\@font@info#1{%
         \GenericInfo{(Font)\@spaces\@spaces\@spaces\space\space}%
                     {LaTeX Font Info: \space\space\space#1}}%
    \def\@font@warning#1{%
         \GenericWarning{(Font)\@spaces\@spaces\@spaces\space\space}%
                        {LaTeX Font Warning: #1}}}
%    \end{macrocode}
%
% On some machines writing all the log info may slow things down
% so extra option not to log font changes at all.
%    \begin{macrocode}
\DeclareOption{nofontinfo}{%
   \let\@font@info\@gobble
   \let\@font@warning\@gobble}
%    \end{macrocode}
%
% The defaults:
%    \begin{macrocode}
\ExecuteOptions{%
  uprightGreek,nosubscriptcorrection,cmcal,cmbold,errorshow}
%    \end{macrocode}
%
%    \begin{macrocode}
\ProcessOptions
%    \end{macrocode}
%
% \subsection{Text fonts}
% 
% If the text font default for roman is \texttt{cmr}, we switch to Times,
% otherwise we assume that the user has already changed it as desired.  
% Only the roman font family will be touched.
%    \begin{macrocode}
\edef\@tempa{\rmdefault}
\def\@tempb {cmr}
\ifx\@tempa\@tempb
  \renewcommand*\rmdefault{mtm}
  \renewcommand*\bfdefault{b}
%    \end{macrocode}
% Switch to |\normalfont|.  This makes the changed values of em and ex
% come into effect.
%    \begin{macrocode}
  \normalfont
\fi
%    \end{macrocode}
%
%
% \subsection{Math font declarations}
%
% As the \mtpro fonts unfortunately do come with their 
% private encodings we need to make those encodings known to \LaTeX.
%    \begin{macrocode}
\DeclareFontEncoding{MPY1}{}{}
\DeclareFontEncoding{MPY2}{}{}
\DeclareFontEncoding{MPY3}{}{}
\DeclareFontSubstitution{MPY1}{mtt}{m}{it}
\DeclareFontSubstitution{MPY2}{mtt}{m}{n}
\DeclareFontSubstitution{MPY3}{mtt}{m}{n}
%    \end{macrocode}
%
% The main four symbol fonts:
%    \begin{macrocode}
\DeclareSymbolFont{operators}   {\operator@encoding}{\rmdefault}{m}{n}
\DeclareSymbolFont{letters}     {MPY1}{mtt}{m}{it}
\DeclareSymbolFont{symbols}     {MPY2}{mtt}{m}{n}
\DeclareSymbolFont{largesymbols}{MPY3}{mtt}{m}{n}
%    \end{macrocode}
%
% As explained above, we cannot set up a bold mathversion, due to lack
% of appropriate fonts. Yet we do \emph{not} remove `bold' from the 
% internal list of math versions, as this might break other packages.
% The macro \cmd{\boldmath} will simply generate a warning and `destroy'
% itself then.
%    \begin{macrocode}
\renewcommand{\boldmath}{%
   \PackageWarning{mtpro}%
   {There are no bold math fonts}%
   \global\let\boldmath=\relax
}
%    \end{macrocode}
%
% The fonts named \cmd{\MTEXA@}, \cmd{\MTEXE@}, \cmd{\MTEXF@}, and \cmd{\MTEXG@}
% are used for the large roots, delimiters and accents.
% They are to be loaded at $1\times$, $2\times$, $3\times$ and 
% $4\times$ \cmd{\normalsize}
% and will be selected directly, bypassing the NFSS:
%    \begin{macrocode}
\normalsize
\dimen@\f@size pt
\font\MTEXA@=mtexa at \the\dimen@
\multiply\dimen@\tw@
\font\MTEXE@=mtexe at \the\dimen@
\multiply\dimen@\tw@
\font\MTEXF@=mtexf at \the\dimen@
\multiply\dimen@\tw@
\font\MTEXG@=mtexg at \the\dimen@
%    \end{macrocode}
% 
% \subsection{Math alphabet declarations}
%
% \subsubsection{The standard alphabets}
%    \begin{macrocode}
\DeclareMathAlphabet{\mathrm}{\encodingdefault}{\rmdefault}{m}{n}
\DeclareMathAlphabet{\mathbf}{U}{mtt}{b}{n}
\DeclareMathAlphabet{\mathit}{\encodingdefault}{\rmdefault}{m}{it}
\DeclareMathAlphabet{\mathsf}{\encodingdefault}{\sfdefault}{m}{n}
\DeclareMathAlphabet{\mathtt}{\encodingdefault}{\ttdefault}{m}{n}
%    \end{macrocode}
%
% \subsubsection{Script alphabets}
% If the \Lopt{mtplusscr} option was selected
% we make \cmd{\mathscr} and \cmd{\mathbscr} point to Spivak's script fonts:
%
%    \begin{macrocode}
\ifx\mathscr s
  \let\mathscr\relax
  \DeclareMathAlphabet{\mathscr} {U}{mtms}{m}{n}
  \DeclareMathAlphabet{\mathbscr}{U}{mtms}{b}{n}
\fi
%    \end{macrocode}
%
% If \Lopt{lucidascr} was selected we put the Lucida calligraphic
% font in \cmd{\mathscr}.  
%    \begin{macrocode}
\ifx\mathscr l
  \let\mathscr\relax
  \DeclareMathAlphabet{\mathscr} {OMS}{lby}{m}{n}
  \DeclareMathAlphabet{\mathbscr}{OMS}{lby}{b}{n}
\fi
%    \end{macrocode}
%
% \subsubsection{Calligraphic alphabets}
%
% If the \texttt{lucidacal} option was selected we set up |\mathcal|.
%    \begin{macrocode}
\ifx\mathcal l
  \let\mathcal\relax
  \DeclareMathAlphabet{\mathcal} {OMS}{lby}{m}{n}
  \DeclareMathAlphabet{\mathbcal}{OMS}{lby}{b}{n}
\fi
%    \end{macrocode}
%
% The code below refers to the \Lopt{mtpluscal} option:
%    \begin{macrocode}
\ifx\mathcal s
  \let\mathcal\relax
  \DeclareMathAlphabet{\mathcal} {U}{mtms}{m}{n}
  \DeclareMathAlphabet{\mathbcal}{U}{mtms}{b}{n}
\fi
%    \end{macrocode}
%
% Use CM for |\mathcal|; this is the default behavior, since
% the \mtpro fonts don't contain any calligraphic math alphabet.
%    \begin{macrocode}
\ifx\mathcal c
  \let\mathcal\relax
  \DeclareMathAlphabet{\mathcal} {OMS}{cmsy}{m}{n}
  \DeclareMathAlphabet{\mathbcal}{OMS}{cmsy}{b}{n}
\fi
%    \end{macrocode}
%
% \subsubsection{Bold math alphabet}
% We set up a bold math alphabet according to the related option:
%    \begin{macrocode}
\ifx\mathbold c
  \let\mathbold\relax
  \DeclareMathAlphabet{\mathbold}{OML}{cmm}{b}{it}
\fi
\ifx\mathbold m
  \let\mathbold\relax
  \DeclareMathAlphabet{\mathbold}{MPY1}{mtt}{b}{it}
\fi
%    \end{macrocode}
% Note that the idea of having a bold italic math alphabet is not new;
% it can already be found in the \Lpack{mathpple}, \Lpack{eulervm} or
% \Lpack{fixmath} packages.
%
% \subsubsection{Blackboard Bold alphabet}
% Optionally, we set up a `blackboard bold' alphabet, too.
%    \begin{macrocode}
\ifx\mathbb y
  \let\mathbb\relax
  \DeclareFontFamily{U}{msb}{}%
  \DeclareFontShape{U}{msb}{m}{n}{<-7>msbm5<7-9>msbm7<9->msbm10}{}%
  \DeclareMathAlphabet{\mathbb}{U}{msb}{m}{n}
\fi
%    \end{macrocode}
%
%
% \subsection{Math symbol declarations}
% Definitions which are unchanged from standard \LaTeX{} are commented out.
% \smallskip
%
% \noindent All digits and punctuation characters are taken from the `letters' 
% and `symbols' fonts now:
%    \begin{macrocode}
\DeclareMathSymbol{0}{\mathalpha}{letters}{"30}
\DeclareMathSymbol{1}{\mathalpha}{letters}{"31}
\DeclareMathSymbol{2}{\mathalpha}{letters}{"32}
\DeclareMathSymbol{3}{\mathalpha}{letters}{"33}
\DeclareMathSymbol{4}{\mathalpha}{letters}{"34}
\DeclareMathSymbol{5}{\mathalpha}{letters}{"35}
\DeclareMathSymbol{6}{\mathalpha}{letters}{"36}
\DeclareMathSymbol{7}{\mathalpha}{letters}{"37}
\DeclareMathSymbol{8}{\mathalpha}{letters}{"38}
\DeclareMathSymbol{9}{\mathalpha}{letters}{"39}
\DeclareMathSymbol{!}{\mathclose}{letters}{"8A}
% \DeclareMathSymbol{*}{\mathbin}{symbols}{"03} % \ast
\DeclareMathSymbol{+}{\mathbin}{symbols}{67}
% \DeclareMathSymbol{,}{\mathpunct}{letters}{"3B}
% \DeclareMathSymbol{-}{\mathbin}{symbols}{"00}
% \DeclareMathSymbol{.}{\mathord}{letters}{"3A}
\DeclareMathSymbol{:}{\mathrel}{symbols}{"57}
\DeclareMathSymbol{;}{\mathpunct}{symbols}{"49}
\DeclareMathSymbol{?}{\mathclose}{letters}{"8B}
\DeclareMathSymbol{=}{\mathrel}{symbols}{"44}
%    \end{macrocode}
% All delimiters that are normally taken from the `operators' font
% are mapped to `symbols' or `letters' now:
%    \begin{macrocode}
\DeclareMathDelimiter{(}{\mathopen}{letters}{46}{largesymbols}{0}
\DeclareMathDelimiter{)}{\mathclose}{letters}{47}{largesymbols}{1}
\DeclareMathDelimiter{[}{\mathopen} {letters}{140}{largesymbols}{"02}
\DeclareMathDelimiter{]}{\mathclose}{letters}{141}{largesymbols}{"03}
% \DeclareMathDelimiter{<}{\mathopen}{symbols}{"68}{largesymbols}{"0A}
% \DeclareMathDelimiter{>}{\mathclose}{symbols}{"69}{largesymbols}{"0B}
% \DeclareMathSymbol{<}{\mathrel}{letters}{"3C}
% \DeclareMathSymbol{>}{\mathrel}{letters}{"3E}
\DeclareMathDelimiter{/}{\mathord}{letters}{"3D}{largesymbols}{"0E}
% \DeclareMathSymbol{/}{\mathord}{letters}{"3D}
% \DeclareMathDelimiter{|}{\mathord}{symbols}{"6A}{largesymbols}{"0C}
% \expandafter\DeclareMathDelimiter\@backslashchar
%                         {\mathord}{symbols}{"6E}{largesymbols}{"0F}
%    \end{macrocode}
% The lowercase Greek letters are made `mathalpha',
% so that \cmd{\mathbold} will act on them:
%    \begin{macrocode}
\DeclareMathSymbol{\alpha}{\mathalpha}{letters}{"0B}
\DeclareMathSymbol{\beta}{\mathalpha}{letters}{"0C}
\DeclareMathSymbol{\gamma}{\mathalpha}{letters}{"0D}
\DeclareMathSymbol{\delta}{\mathalpha}{letters}{"0E}
\DeclareMathSymbol{\epsilon}{\mathalpha}{letters}{"0F}
\DeclareMathSymbol{\zeta}{\mathalpha}{letters}{"10}
\DeclareMathSymbol{\eta}{\mathalpha}{letters}{"11}
\DeclareMathSymbol{\theta}{\mathalpha}{letters}{"12}
\DeclareMathSymbol{\iota}{\mathalpha}{letters}{"13}
\DeclareMathSymbol{\kappa}{\mathalpha}{letters}{"14}
\DeclareMathSymbol{\lambda}{\mathalpha}{letters}{"15}
\DeclareMathSymbol{\mu}{\mathalpha}{letters}{"16}
\DeclareMathSymbol{\nu}{\mathalpha}{letters}{"17}
\DeclareMathSymbol{\xi}{\mathalpha}{letters}{"18}
\DeclareMathSymbol{\pi}{\mathalpha}{letters}{"19}
\DeclareMathSymbol{\rho}{\mathalpha}{letters}{"1A}
\DeclareMathSymbol{\sigma}{\mathalpha}{letters}{"1B}
\DeclareMathSymbol{\tau}{\mathalpha}{letters}{"1C}
\DeclareMathSymbol{\upsilon}{\mathalpha}{letters}{"1D}
\DeclareMathSymbol{\phi}{\mathalpha}{letters}{"1E}
\DeclareMathSymbol{\chi}{\mathalpha}{letters}{"1F}
\DeclareMathSymbol{\psi}{\mathalpha}{letters}{"20}
\DeclareMathSymbol{\omega}{\mathalpha}{letters}{"21}
\DeclareMathSymbol{\varepsilon}{\mathalpha}{letters}{"22}
\DeclareMathSymbol{\vartheta}{\mathalpha}{letters}{"23}
\DeclareMathSymbol{\varpi}{\mathalpha}{letters}{"24}
\DeclareMathSymbol{\varrho}{\mathalpha}{letters}{"25}
\DeclareMathSymbol{\varsigma}{\mathalpha}{letters}{"26}
\DeclareMathSymbol{\varphi}{\mathalpha}{letters}{"27}
%    \end{macrocode}
% With ordinary \LaTeX{} uppercase Greek is always upright---why?
% The options \Lopt{uprightGreek} and \Lopt{slantedGreek} control,
% how uppercase Greek letters are to appear.
% See also the \Lpack{fixmath} and \Lpack{mathpple}
% packages, where this idea was introduced first.
%    \begin{macrocode}
\ifx\Gamma s
\let\Gamma\@undefined
\DeclareMathSymbol{\Gamma}{\mathalpha}{letters}{"00}
\DeclareMathSymbol{\Delta}{\mathalpha}{letters}{"01}
\DeclareMathSymbol{\Theta}{\mathalpha}{letters}{"02}
\DeclareMathSymbol{\Lambda}{\mathalpha}{letters}{"03}
\DeclareMathSymbol{\Xi}{\mathalpha}{letters}{"04}
\DeclareMathSymbol{\Pi}{\mathalpha}{letters}{"05}
\DeclareMathSymbol{\Sigma}{\mathalpha}{letters}{"06}
\DeclareMathSymbol{\Upsilon}{\mathalpha}{letters}{"07}
\DeclareMathSymbol{\Phi}{\mathalpha}{letters}{"08}
\DeclareMathSymbol{\Psi}{\mathalpha}{letters}{"09}
\DeclareMathSymbol{\Omega}{\mathalpha}{letters}{"0A}
\DeclareMathSymbol{\upDelta}{\mathord}{letters}{"81}
\DeclareMathSymbol{\upOmega}{\mathalpha}{letters}{"7F}
\else
\let\Gamma\@undefined
\DeclareMathSymbol{\Gamma}{\mathord}{letters}{"80}
\DeclareMathSymbol{\Delta}{\mathord}{letters}{"81}
\DeclareMathSymbol{\Theta}{\mathord}{letters}{"82}
\DeclareMathSymbol{\Lambda}{\mathord}{letters}{"83}
\DeclareMathSymbol{\Xi}{\mathord}{letters}{"84}
\DeclareMathSymbol{\Pi}{\mathord}{letters}{"85}
\DeclareMathSymbol{\Sigma}{\mathord}{letters}{"86}
\DeclareMathSymbol{\Upsilon}{\mathord}{letters}{"87}
\DeclareMathSymbol{\Phi}{\mathord}{letters}{"88}
\DeclareMathSymbol{\Psi}{\mathord}{letters}{"89}
\DeclareMathSymbol{\Omega}{\mathord}{letters}{"7F}
\let\upDelta\Delta
\let\upOmega\Omega
\fi
% \DeclareMathSymbol{\aleph}{\mathord}{symbols}{"40}
%    \end{macrocode}
% Awful many tokens are wasted for generating the horizontal bar in
% |\hbar|. The definition below uses \={} from the symbol font to
% avoid problems with different text encodings in the operators
% font.
%    \begin{macrocode}
\DeclareRobustCommand\hbar{{%
 \dimen@.12em%
 \dimen@ii.1em%
 \def\@tempa##1##2{{%
   \lower##1\dimen@\rlap{\kern##1\dimen@ii\the##2\tw@\char78}}}%
 \mathchoice\@tempa\@ne\textfont
            \@tempa\@ne\textfont
            \@tempa\defaultscriptratio\scriptfont
            \@tempa\defaultscriptscriptratio\scriptscriptfont
  h}}
%    \end{macrocode}
%    \begin{macrocode}
% \DeclareMathSymbol{\imath}{\mathord}{letters}{"7B}
% \DeclareMathSymbol{\jmath}{\mathord}{letters}{"7C}
% \DeclareMathSymbol{\ell}{\mathord}{letters}{"60}
% \DeclareMathSymbol{\wp}{\mathord}{letters}{"7D}
% \DeclareMathSymbol{\Re}{\mathord}{symbols}{"3C}
% \DeclareMathSymbol{\Im}{\mathord}{symbols}{"3D}
% \DeclareMathSymbol{\partial}{\mathord}{letters}{"40}
% \DeclareMathSymbol{\infty}{\mathord}{symbols}{"31}
% \DeclareMathSymbol{\prime}{\mathord}{symbols}{"30}
% \DeclareMathSymbol{\emptyset}{\mathord}{symbols}{"3B}
% \DeclareMathSymbol{\nabla}{\mathord}{symbols}{"72}
% \def\surd{{\mathchar"1270}}
% \DeclareMathSymbol{\top}{\mathord}{symbols}{"3E}
% \DeclareMathSymbol{\bot}{\mathord}{symbols}{"3F}
%    \end{macrocode}
% |\angle| needs a thicker horizontal rule (what a mess):
%    \begin{macrocode}
\def\angle{{\vbox{\ialign{$\m@th\scriptstyle##$\crcr
      \not\mathrel{\mkern14mu}\crcr
      \noalign{\nointerlineskip}%
      \mkern2.5mu%
      \leaders\hrule\@height.48\p@\hfill\mkern2.5mu\crcr}}}}
%    \end{macrocode}
%    \begin{macrocode}
% \DeclareMathSymbol{\triangle}{\mathord}{symbols}{"34}
% \DeclareMathSymbol{\forall}{\mathord}{symbols}{"38}
% \DeclareMathSymbol{\exists}{\mathord}{symbols}{"39}
% \DeclareMathSymbol{\neg}{\mathord}{symbols}{"3A}
%     \let\lnot=\neg
% \DeclareMathSymbol{\flat}{\mathord}{letters}{"5B}
% \DeclareMathSymbol{\natural}{\mathord}{letters}{"5C}
% \DeclareMathSymbol{\sharp}{\mathord}{letters}{"5D}
% \DeclareMathSymbol{\clubsuit}{\mathord}{symbols}{"7C}
% \DeclareMathSymbol{\diamondsuit}{\mathord}{symbols}{"7D}
% \DeclareMathSymbol{\heartsuit}{\mathord}{symbols}{"7E}
% \DeclareMathSymbol{\spadesuit}{\mathord}{symbols}{"7F}
% \DeclareMathSymbol{\coprod}{\mathop}{largesymbols}{"60}
% \DeclareMathSymbol{\bigvee}{\mathop}{largesymbols}{"57}
% \DeclareMathSymbol{\bigwedge}{\mathop}{largesymbols}{"56}
% \DeclareMathSymbol{\biguplus}{\mathop}{largesymbols}{"55}
% \DeclareMathSymbol{\bigcap}{\mathop}{largesymbols}{"54}
% \DeclareMathSymbol{\bigcup}{\mathop}{largesymbols}{"53}
% \DeclareMathSymbol{\intop}{\mathop}{largesymbols}{"52}
%     \def\int{\intop\nolimits}
% \DeclareMathSymbol{\prod}{\mathop}{largesymbols}{"51}
% \DeclareMathSymbol{\sum}{\mathop}{largesymbols}{"50}
% \DeclareMathSymbol{\bigotimes}{\mathop}{largesymbols}{"4E}
% \DeclareMathSymbol{\bigoplus}{\mathop}{largesymbols}{"4C}
% \DeclareMathSymbol{\bigodot}{\mathop}{largesymbols}{"4A}
% \DeclareMathSymbol{\ointop}{\mathop}{largesymbols}{"48}
%     \def\oint{\ointop\nolimits}
% \DeclareMathSymbol{\bigsqcup}{\mathop}{largesymbols}{"46}
% \DeclareMathSymbol{\smallint}{\mathop}{symbols}{"73}
\DeclareMathSymbol{\triangleleft}{\mathbin}{symbols}{"47}
\DeclareMathSymbol{\triangleright}{\mathbin}{symbols}{"46}
% \DeclareMathSymbol{\bigtriangleup}{\mathbin}{symbols}{"34}
% \DeclareMathSymbol{\bigtriangledown}{\mathbin}{symbols}{"35}
% \DeclareMathSymbol{\wedge}{\mathbin}{symbols}{"5E}
%    \let\land=\wedge
% \DeclareMathSymbol{\vee}{\mathbin}{symbols}{"5F}
%    \let\lor=\vee
% \DeclareMathSymbol{\cap}{\mathbin}{symbols}{"5C}
% \DeclareMathSymbol{\cup}{\mathbin}{symbols}{"5B}
% \DeclareMathSymbol{\sqcap}{\mathbin}{symbols}{"75}
% \DeclareMathSymbol{\sqcup}{\mathbin}{symbols}{"74}
% \DeclareMathSymbol{\uplus}{\mathbin}{symbols}{"5D}
% \DeclareMathSymbol{\amalg}{\mathbin}{symbols}{"71}
% \DeclareMathSymbol{\diamond}{\mathbin}{symbols}{"05}
% \DeclareMathSymbol{\bullet}{\mathbin}{symbols}{"0F}
% \DeclareMathSymbol{\wr}{\mathbin}{symbols}{"6F}
% \DeclareMathSymbol{\div}{\mathbin}{symbols}{"04}
% \DeclareMathSymbol{\odot}{\mathbin}{symbols}{"0C}
% \DeclareMathSymbol{\oslash}{\mathbin}{symbols}{"0B}
% \DeclareMathSymbol{\otimes}{\mathbin}{symbols}{"0A}
% \DeclareMathSymbol{\ominus}{\mathbin}{symbols}{"09}
% \DeclareMathSymbol{\oplus}{\mathbin}{symbols}{"08}
% \DeclareMathSymbol{\mp}{\mathbin}{symbols}{"07}
% \DeclareMathSymbol{\pm}{\mathbin}{symbols}{"06}
% \DeclareMathSymbol{\circ}{\mathbin}{symbols}{"0E}
% \DeclareMathSymbol{\bigcirc}{\mathbin}{symbols}{"0D}
% \DeclareMathSymbol{\setminus}{\mathbin}{symbols}{"6E}
% \DeclareMathSymbol{\cdot}{\mathbin}{symbols}{"01}
% \DeclareMathSymbol{\ast}{\mathbin}{symbols}{"03}
% \DeclareMathSymbol{\times}{\mathbin}{symbols}{"02}
% \DeclareMathSymbol{\star}{\mathbin}{letters}{"3F}
% \DeclareMathSymbol{\propto}{\mathrel}{symbols}{"2F}
% \DeclareMathSymbol{\sqsubseteq}{\mathrel}{symbols}{"76}
% \DeclareMathSymbol{\sqsupseteq}{\mathrel}{symbols}{"77}
% \DeclareMathSymbol{\parallel}{\mathrel}{symbols}{"6B}
% \DeclareMathSymbol{\mid}{\mathrel}{symbols}{"6A}
% \DeclareMathSymbol{\dashv}{\mathrel}{symbols}{"61}
% \DeclareMathSymbol{\vdash}{\mathrel}{symbols}{"60}
% \DeclareMathSymbol{\nearrow}{\mathrel}{symbols}{"25}
% \DeclareMathSymbol{\searrow}{\mathrel}{symbols}{"26}
% \DeclareMathSymbol{\nwarrow}{\mathrel}{symbols}{"2D}
% \DeclareMathSymbol{\swarrow}{\mathrel}{symbols}{"2E}
% \DeclareMathSymbol{\Leftrightarrow}{\mathrel}{symbols}{"2C}
% \DeclareMathSymbol{\Leftarrow}{\mathrel}{symbols}{"28}
% \DeclareMathSymbol{\Rightarrow}{\mathrel}{symbols}{"29}
% \def\neq{\not=} \let\ne=\neq
% \DeclareMathSymbol{\leq}{\mathrel}{symbols}{"14}
%    \let\le=\leq
% \DeclareMathSymbol{\geq}{\mathrel}{symbols}{"15}
%    \let\ge=\geq
% \DeclareMathSymbol{\succ}{\mathrel}{symbols}{"1F}
% \DeclareMathSymbol{\prec}{\mathrel}{symbols}{"1E}
% \DeclareMathSymbol{\approx}{\mathrel}{symbols}{"19}
% \DeclareMathSymbol{\succeq}{\mathrel}{symbols}{"17}
% \DeclareMathSymbol{\preceq}{\mathrel}{symbols}{"16}
% \DeclareMathSymbol{\supset}{\mathrel}{symbols}{"1B}
% \DeclareMathSymbol{\subset}{\mathrel}{symbols}{"1A}
% \DeclareMathSymbol{\supseteq}{\mathrel}{symbols}{"13}
% \DeclareMathSymbol{\subseteq}{\mathrel}{symbols}{"12}
% \DeclareMathSymbol{\in}{\mathrel}{symbols}{"32}
% \DeclareMathSymbol{\ni}{\mathrel}{symbols}{"33}
%     \let\owns=\ni
% \DeclareMathSymbol{\gg}{\mathrel}{symbols}{"1D}
% \DeclareMathSymbol{\ll}{\mathrel}{symbols}{"1C}
% \DeclareMathSymbol{\not}{\mathrel}{symbols}{"36}
% \DeclareMathSymbol{\leftrightarrow}{\mathrel}{symbols}{"24}
% \DeclareMathSymbol{\leftarrow}{\mathrel}{symbols}{"20}
%    \let\gets=\leftarrow
% \DeclareMathSymbol{\rightarrow}{\mathrel}{symbols}{"21}
%    \let\to=\rightarrow
% \DeclareMathSymbol{\mapstochar}{\mathrel}{symbols}{"37}
%    \def\mapsto{\mapstochar\rightarrow}
% \DeclareMathSymbol{\sim}{\mathrel}{symbols}{"18}
% \DeclareMathSymbol{\simeq}{\mathrel}{symbols}{"27}
% \DeclareMathSymbol{\perp}{\mathrel}{symbols}{"3F}
% \DeclareMathSymbol{\equiv}{\mathrel}{symbols}{"11}
% \DeclareMathSymbol{\asymp}{\mathrel}{symbols}{"10}
% \DeclareMathSymbol{\smile}{\mathrel}{letters}{"5E}
% \DeclareMathSymbol{\frown}{\mathrel}{letters}{"5F}
% \DeclareMathSymbol{\leftharpoonup}{\mathrel}{letters}{"28}
% \DeclareMathSymbol{\leftharpoondown}{\mathrel}{letters}{"29}
% \DeclareMathSymbol{\rightharpoonup}{\mathrel}{letters}{"2A}
% \DeclareMathSymbol{\rightharpoondown}{\mathrel}{letters}{"2B}
% \def\cong{\mathrel{\mathpalette\@vereq\sim}} % congruence sign
% \def\@vereq#1#2{\lower.5\p@\vbox{\lineskiplimit\maxdimen\lineskip-.5\p@
%     \ialign{$\m@th#1\hfil##\hfil$\crcr#2\crcr=\crcr}}}
% \def\notin{\mathrel{\m@th\mathpalette\c@ncel\in}}
% \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}}
% \def\rightleftharpoons{\mathrel{\mathpalette\rlh@{}}}
% \def\rlh@#1{\vcenter{\m@th\hbox{\ooalign{\raise2pt
%           \hbox{$#1\rightharpoonup$}\crcr
%         $#1\leftharpoondown$}}}}
% \def\doteq{\buildrel\textstyle.\over=}
% \def\joinrel{\mathrel{\mkern-3mu}}
% \def\relbar{\mathrel{\smash-}}
\let\Relbar\@undefined
\DeclareMathSymbol{\Relbar}{\mathrel}{symbols}{"48}
% \DeclareMathSymbol{\lhook}{\mathrel}{letters}{"2C}
%    \def\hookrightarrow{\lhook\joinrel\rightarrow}
% \DeclareMathSymbol{\rhook}{\mathrel}{letters}{"2D}
%    \def\hookleftarrow{\leftarrow\joinrel\rhook}
% \def\bowtie{\mathrel\triangleright\joinrel\mathrel\triangleleft}
% \def\models{\mathrel|\joinrel=}
% \def\Longrightarrow{\Relbar\joinrel\Rightarrow}
% \DeclareRobustCommand\longrightarrow
%      {\relbar\joinrel\rightarrow}
% \DeclareRobustCommand\longleftarrow
%      {\leftarrow\joinrel\relbar}
% \def\Longleftarrow{\Leftarrow\joinrel\Relbar}
% \def\longmapsto{\mapstochar\longrightarrow}
% \def\longleftrightarrow{\leftarrow\joinrel\rightarrow}
% \def\Longleftrightarrow{\Leftarrow\joinrel\Rightarrow}
% \def\iff{\;\Longleftrightarrow\;}
\DeclareMathSymbol{\ldotp}{\mathpunct}{letters}{"3A}
% \DeclareMathSymbol{\cdotp}{\mathpunct}{symbols}{"01}
\let\colon\@undefined % care for amsmath!
\DeclareMathSymbol{\colon}{\mathpunct}{symbols}{"57}
% \def\cdots{\mathinner{\cdotp\cdotp\cdotp}}
%    \end{macrocode}
% Let |\vdots| and |\ddots| take their ``dots'' from the math fonts.
% In fact this is something that should be corrected in base format
% of \LaTeX{} as well.
%    \begin{macrocode}
\newcommand\hb@xmdot{\hbox{$\m@th.$}}
\def\vdots{\vbox{\baselineskip4\p@ \lineskiplimit\z@
  \kern6\p@\hb@xmdot\hb@xmdot\hb@xmdot}}
\def\ddots{\mathinner{\mkern1mu\raise7\p@\vbox{\kern7\p@
  \hb@xmdot}\mkern2mu
  \raise4\p@\hb@xmdot\mkern2mu\raise\p@\hb@xmdot\mkern1mu}}
%    \end{macrocode}
% We make all accents |\mathord|; as they are placed in strange
% positions it is really not feasible to support changing them.
%    \begin{macrocode}
\DeclareMathAccent{\vec}{\mathord}{symbols}{69}
\DeclareMathAccent{\grave}{\mathord}{symbols}{74}
\DeclareMathAccent{\acute}{\mathord}{symbols}{75}
\DeclareMathAccent{\check}{\mathord}{symbols}{76}
\DeclareMathAccent{\breve}{\mathord}{symbols}{77}
\DeclareMathAccent{\bar}{\mathord}{symbols}{78}
\DeclareMathAccent{\hat}{\mathord}{symbols}{79}
\DeclareMathAccent{\dot}{\mathord}{symbols}{80}
\DeclareMathAccent{\tilde}{\mathord}{symbols}{81}
\DeclareMathAccent{\ddot}{\mathord}{symbols}{82}
%    \end{macrocode}
% The wide math accents will later be defined as macros:
%    \begin{macrocode}
% \DeclareMathAccent{\widetilde}{\mathord}{largesymbols}{"65}
% \DeclareMathAccent{\widehat}{\mathord}{largesymbols}{"62}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareMathAccent{\mathring}{\mathord}{symbols}{86}
\DeclareMathAccent{\dotup}{\mathord}{symbols}{"54}
\DeclareMathAccent{\ddotup}{\mathord}{symbols}{"55 }
%    \end{macrocode}
%    \begin{macrocode}
% \DeclareMathRadical{\sqrtsign}{symbols}{"70}{largesymbols}{"70}
% \def\overrightarrow#1{\vbox{\m@th\ialign{##\crcr
%       \rightarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}
%       $\hfil\displaystyle{#1}\hfil$\crcr}}}
% \def\overleftarrow#1{\vbox{\m@th\ialign{##\crcr
%       \leftarrowfill\crcr\noalign{\kern-\p@\nointerlineskip}%
%       $\hfil\displaystyle{#1}\hfil$\crcr}}}
% \def\overbrace#1{\mathop{\vbox{\m@th\ialign{##\crcr\noalign{\kern3\p@}%
%       \downbracefill\crcr\noalign{\kern3\p@\nointerlineskip}%
%       $\hfil\displaystyle{#1}\hfil$\crcr}}}\limits}
% \def\underbrace#1{\mathop{\vtop{\m@th\ialign{##\crcr
%    $\hfil\displaystyle{#1}\hfil$\crcr
%    \noalign{\kern3\p@\nointerlineskip}%
%    \upbracefill\crcr\noalign{\kern3\p@}}}}\limits}
% \def\skew#1#2#3{{\muskip\z@#1mu\divide\muskip\z@\tw@ \mkern\muskip\z@
%     #2{\mkern-\muskip\z@{#3}\mkern\muskip\z@}\mkern-\muskip\z@}{}}
% \def\rightarrowfill{$\m@th\smash-\mkern-7mu%
%   \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
%   \mkern-7mu\mathord\rightarrow$}
% \def\leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu%
%   \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
%   \mkern-7mu\smash-$}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareMathSymbol{\braceld}{\mathord}{largesymbols}{"82}
\DeclareMathSymbol{\bracerd}{\mathord}{largesymbols}{"83}
\DeclareMathSymbol{\bracelu}{\mathord}{largesymbols}{"84}
\DeclareMathSymbol{\braceru}{\mathord}{largesymbols}{"85}
% \def\downbracefill{$\m@th \setbox\z@\hbox{$\braceld$}%
%   \braceld\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru
%   \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\bracerd$}
% \def\upbracefill{$\m@th \setbox\z@\hbox{$\braceld$}%
%   \bracelu\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\bracerd
%   \braceld\leaders\vrule \@height\ht\z@ \@depth\z@\hfill\braceru$}
% \DeclareMathDelimiter{\lmoustache}   % top from (, bottom from )
%    {\mathopen}{largesymbols}{"7A}{largesymbols}{"40}
% \DeclareMathDelimiter{\rmoustache}   % top from ), bottom from (
%    {\mathclose}{largesymbols}{"7B}{largesymbols}{"41}
% \DeclareMathDelimiter{\arrowvert}    % arrow without arrowheads
%    {\mathord}{symbols}{"6A}{largesymbols}{"3C}
% \DeclareMathDelimiter{\Arrowvert}    % double arrow without arrowheads
%    {\mathord}{symbols}{"6B}{largesymbols}{"3D}
% \DeclareMathDelimiter{\Vert}
%    {\mathord}{symbols}{"6B}{largesymbols}{"0D}
% \let\|=\Vert
% \DeclareMathDelimiter{\vert}
%    {\mathord}{symbols}{"6A}{largesymbols}{"0C}
% \DeclareMathDelimiter{\uparrow}
%    {\mathrel}{symbols}{"22}{largesymbols}{"78}
% \DeclareMathDelimiter{\downarrow}
%    {\mathrel}{symbols}{"23}{largesymbols}{"79}
% \DeclareMathDelimiter{\updownarrow}
%    {\mathrel}{symbols}{"6C}{largesymbols}{"3F}
% \DeclareMathDelimiter{\Uparrow}
%    {\mathrel}{symbols}{"2A}{largesymbols}{"7E}
% \DeclareMathDelimiter{\Downarrow}
%    {\mathrel}{symbols}{"2B}{largesymbols}{"7F}
% \DeclareMathDelimiter{\Updownarrow}
%    {\mathrel}{symbols}{"6D}{largesymbols}{"77}
% \DeclareMathDelimiter{\backslash}    % for double coset G\backslash H
%    {\mathord}{symbols}{"6E}{largesymbols}{"0F}
% \DeclareMathDelimiter{\rangle}
%    {\mathclose}{symbols}{"69}{largesymbols}{"0B}
% \DeclareMathDelimiter{\langle}
%    {\mathopen}{symbols}{"68}{largesymbols}{"0A}
% \DeclareMathDelimiter{\rbrace}
%   {\mathclose}{symbols}{"67}{largesymbols}{"09}
% \DeclareMathDelimiter{\lbrace}
%    {\mathopen}{symbols}{"66}{largesymbols}{"08}
% \DeclareMathDelimiter{\rceil}
%    {\mathclose}{symbols}{"65}{largesymbols}{"07}
% \DeclareMathDelimiter{\lceil}
%    {\mathopen}{symbols}{"64}{largesymbols}{"06}
% \DeclareMathDelimiter{\rfloor}
%    {\mathclose}{symbols}{"63}{largesymbols}{"05}
% \DeclareMathDelimiter{\lfloor}
%    {\mathopen}{symbols}{"62}{largesymbols}{"04}
% \DeclareMathDelimiter{\lgroup} % extensible ( with sharper tips
%      {\mathopen}{largesymbols}{"3A}{largesymbols}{"3A}
% \DeclareMathDelimiter{\rgroup} % extensible ) with sharper tips
%      {\mathclose}{largesymbols}{"3B}{largesymbols}{"3B}
% \DeclareMathDelimiter{\bracevert} % the vertical bar that extends braces
%      {\mathord}{largesymbols}{"3E}{largesymbols}{"3E}
%    \end{macrocode}
% New symbols:
%    \begin{macrocode}
\DeclareMathSymbol{\comp}{\mathbin}{symbols}{66}
\DeclareMathSymbol{\setdif}{\mathbin}{symbols}{88}
\DeclareMathSymbol{\cupprod}{\mathbin}{symbols}{89}
\DeclareMathSymbol{\capprod}{\mathbin}{symbols}{90}
\DeclareMathSymbol{\varkappa}{\mathalpha}{letters}{126}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareMathAccent{\what}  {\mathord}{symbols}{"79}
\DeclareMathAccent{\wtilde}{\mathord}{symbols}{"7A}
\DeclareMathAccent{\wcheck}{\mathord}{symbols}{"7B}
\DeclareMathAccent{\wbar}  {\mathord}{symbols}{"78}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareMathAccent{\wwhat}  {\mathord}{largesymbols}{"80}
\DeclareMathAccent{\wwtilde}{\mathord}{largesymbols}{"81}
\DeclareMathAccent{\wwcheck}{\mathord}{largesymbols}{"7D}
\DeclareMathAccent{\wwbar}  {\mathord}{symbols}     {"53}
%    \end{macrocode}
% In case \Lpack{amsmath} is loaded additionally, we have to repeat 
% our definition of |\Relbar|, and we have to make sure that
% things like |\mathrm{\hat{A}}| don't result in garbage:
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{amsmath}{%
     \let\Relbar\undefined
     \DeclareMathSymbol{\Relbar}{\mathrel}{symbols}{"48}
     \def\accentclass@{0}
  }{}%
}
%    \end{macrocode}
%
% \subsection{Large delimiters, accents and roots}
% The below code is a slightly updated version (M.~Spivak, 2001-01-11)
% of the macros from the plain~\TeX{} package \texttt{mtp.tex}.
% \smallskip
%
% Large delimiters:
%    \begin{macrocode}
\newbox\prePbox@
\newbox\Pbox@
\newif\ifPEX@
\def\PEX@#1{\setbox\Pbox@\vbox{$$\left.\vcenter{\copy\prePbox@}\right)$$}%
\setbox\Pbox@\vbox{\unvbox\Pbox@\unskip\unpenalty
\setbox\Pbox@\lastbox
\setbox\Pbox@\hbox{\unhbox\Pbox@\setbox\Pbox@\lastbox
\setbox\Pbox@\hbox{\unhbox\Pbox@\setbox\Pbox@\lastbox
\setbox0\hbox{#1}%
\ifdim\dp\Pbox@>\dp0\global\PEX@true\else
\global\PEX@false\fi}}}}
%    \end{macrocode}
%    \begin{macrocode}
\def\EXtest@#1{\setbox\prePbox@\hbox{$\displaystyle#1$}%
\PEX@{\MTEXA@\char32}%
\ifPEX@
{\textfont3=\MTEXE@\PEX@{\MTEXE@\char12}}%
\ifPEX@
{\textfont3=\MTEXF@\PEX@{\MTEXF@\char12}}%
\ifPEX@
\def\EXtest@@{\textfont3=\MTEXG@}%
\else
\def\EXtest@@{\textfont3=\MTEXF@}%
\fi
\else
\def\EXtest@@{\textfont3=\MTEXE@}%
\fi
\else
\def\EXtest@@{\textfont3=\MTEXA@}%
\fi}
%    \end{macrocode}
%    \begin{macrocode}
\newbox\LRbox@
\def\LEFTRIGHT@#1#2#3{\setbox\LRbox@\hbox{$\displaystyle#3$}%
 \EXtest@{#3}%
 \vcenter{\hbox{\EXtest@@$\displaystyle\left#1\box\LRbox@\right#2$}}}%
%    \end{macrocode}
%    \begin{macrocode}
\def\PARENS#1{\LEFTRIGHT@(){#1}}%
%    \end{macrocode}
%    \begin{macrocode}
\newif\ifspecdelim@
\def\specdelim@#1{\ifx#1(\specdelim@true
\else\ifx#1)\specdelim@true
\else\ifx#1<\specdelim@true
\else\ifx#1\langle\specdelim@true
\else\ifx#1>\specdelim@true
\else\ifx#1\rangle\specdelim@true
\else\ifx#1/\specdelim@true
\else\ifx#1\backslash\specdelim@true
\else\specdelim@false\fi\fi\fi\fi\fi\fi\fi\fi}
%    \end{macrocode}
%    \begin{macrocode}
\def\LEFTRIGHT#1#2#3{\specdelim@#1%
\ifspecdelim@\LEFTRIGHT@#1.{#3}\else\left#1{#3}\right.\fi
\kern-2\nulldelimiterspace\mskip-\thinmuskip
\specdelim@#2%
\ifspecdelim@\LEFTRIGHT@.#2{\vphantom{#3}}\else
\left.\vphantom{#3}\right#2\fi}%
%    \end{macrocode}
%
% Wide `hat' accents:
%    \begin{macrocode}
\newbox\HATbox@
\def\widehat#1{\setbox\HATbox@\hbox{$\displaystyle{#1}$}%
\setbox0\hbox{\MTEXF@;}%
\ifdim\wd\HATbox@>\wd0
\def\HAT@{\textfont3=\MTEXG@}%
\else
\setbox0\hbox{\MTEXE@9}%
\ifdim\wd\HATbox@>\wd0
\def\HAT@{\textfont3=\MTEXF@}%
\else
\setbox0\hbox{\MTEXA@ d}%
\ifdim\wd\HATbox@>\wd0
\def\HAT@{\textfont3=\MTEXE@}%
\else
\def\HAT@{\textfont3=\MTEXA@}%
\fi
\fi
\fi
\hbox{\HAT@$\mathaccent"0362 {#1}$}}
%    \end{macrocode}
%
% Wide tilde accents:
%    \begin{macrocode}
\newbox\TDbox@
\def\widetilde#1{\setbox\TDbox@\hbox{$\displaystyle{#1}$}%
\setbox0\hbox{\MTEXF@ K}%
\ifdim\wd\TDbox@>\wd0
\def\TD@{\textfont3=\MTEXG@}%
\else
\setbox0\hbox{\MTEXE@ I}%
\ifdim\wd\TDbox@>\wd0
\def\TD@{\textfont3=\MTEXF@}%
\else
\setbox0\hbox{\MTEXA@ d}%
\ifdim\wd\TDbox@>\wd0
\def\TD@{\textfont3=\MTEXE@}%
\else
\def\TD@{\textfont3=\MTEXA@}%
\fi
\fi
\fi
\hbox{\TD@$\mathaccent"0365 {#1}$}}
%    \end{macrocode}
%
% Wide `check' accents:
%    \begin{macrocode}
\newbox\CHbox@
\def\widecheck#1{\setbox\CHbox@\hbox{$\displaystyle{#1}$}%
\setbox0\hbox{\MTEXF@[}%
\ifdim\wd\CHbox@>\wd0
\def\CHECK@{\textfont3=\MTEXG@}%
\else
\setbox0\hbox{\MTEXE@ Y}%
\ifdim\wd\CHbox@>\wd0
\def\CHECK@{\textfont3=\MTEXF@}%
\else
\setbox0\hbox{\MTEXA@ z}%
\ifdim\wd\CHbox@>\wd0
\def\CHECK@{\textfont3=\MTEXE@}%
\else
\def\CHECK@{\textfont3=\MTEXA@}%
\fi
\fi
\fi
\hbox{\CHECK@$\mathaccent"037A {#1}$}}%
%    \end{macrocode}
%
% Large roots:
% The command \cmd{\SQRT} from the plain \TeX{} package \texttt{mtp.tex} 
% is named \cmd{\SQR@@T} here.
%    \begin{macrocode}
\newbox\preSbox@
\newbox\Sbox@
\newif\ifSQEX@
\def\SQEX@#1{\setbox\Sbox@\vbox{$$\radical"270370{\copy\preSbox@}$$}%
\setbox\Sbox@\vbox{\unvbox\Sbox@\unskip\unpenalty
\setbox\Sbox@\lastbox\setbox\Sbox@\hbox{\unhbox\Sbox@\setbox\Sbox@\lastbox
\setbox\Sbox@\hbox{\unhbox\Sbox@\setbox\Sbox@\lastbox\setbox\Sbox@\lastbox
\setbox0\hbox{#1}%
\ifdim\dp\Sbox@>\dp0\global\SQEX@true\else
\global\SQEX@false\fi}}}}
%    \end{macrocode}
%    \begin{macrocode}
\newcount\SQcount@
\def\SQtest@#1{\setbox\preSbox@\hbox{$\displaystyle#1$}%
\SQEX@{\MTEXA@ s}%
\ifSQEX@
{\textfont3=\MTEXE@\SQEX@{\MTEXE@ u}}%
\ifSQEX@
{\textfont3=\MTEXF@\SQEX@{\MTEXF@ u}}%
\ifSQEX@
\def\SQtest@@{\textfont3=\MTEXG@}\global\SQcount@3
\else
\def\SQtest@@{\textfont3=\MTEXF@}\global\SQcount@2
\fi
\else
\def\SQtest@@{\textfont3=\MTEXE@}\global\SQcount@1
\fi
\else
\def\SQtest@@{\textfont3=\MTEXA@}\global\SQcount@0
\fi}
\newbox\SQRTbox@
\def\SQR@@T#1{\setbox\SQRTbox@\hbox{$\displaystyle#1$}%
\SQtest@{#1}%
\hbox{\SQtest@@$\displaystyle\radical"270370{\box\SQRTbox@}$}}
%    \end{macrocode}
% The names of the counters \cmd{\leftroot@} and \cmd{\uproot@} 
% and the related commands \cmd{\leftroot} and \cmd{\uproot} 
% had to be changed to uppercase,
% so as not to clash with the \Lpack{amsmath} package. 
% The syntax differs from \Lpack{amsmath}, anyway.
%    \begin{macrocode}
\newcount\UPROOT@
\newcount\LEFTROOT@
\def\LEFTROOT#1{\relax
  \ifmmode\LEFTROOT@#1\relax
  \else\PackageError{mtpro}
         {\protect\LEFTROOT\space allowed only in math mode}
         {Type <return> to proceed; the command will be ignored.}
  \fi}
\def\UPROOT#1{\relax
  \ifmmode\UPROOT@#1\relax
  \else\PackageError{mtpro}
         {\protect\UPROOT\space allowed only in math mode}
         {Type <return> to proceed; the command will be ignored.}
  \fi}
\def\ROOT#1\OF#2{\setbox\rootbox\hbox{$\m@th\scriptscriptstyle{#1}$}%
\mathpalette\R@@T{#2}}
\def\R@@T#1#2{\setbox\z@\hbox{$\UPROOT@\z@\LEFTROOT@\z@\m@th#1\SQR@@T{#2}$}%
\dimen@\ht\z@\advance\dimen@-\dp\z@
\dimen@ii\dimen@
\setbox\tw@\hbox{$\m@th#1\mskip\UPROOT@ mu$}\advance\dimen@ii by1.667\wd\tw@
\setbox\tw@\hbox{$\m@th#1\mskip10mu$}%
\ifcase\SQcount@\advance\dimen@3\wd\tw@\or\advance\dimen@1.5\wd\tw@\or
\advance\dimen@\wd\tw@\fi
\mkern1mu\kern.13\dimen@\mkern-\LEFTROOT@ mu
\raise.5\dimen@ii\copy\rootbox % was .44
\mkern-1mu\kern-.13\dimen@\mkern\LEFTROOT@ mu\box\z@\kern-\wd\rootbox
\LEFTROOT\z@\UPROOT\z@}
%    \end{macrocode}
%
% Finally the roots are given a more \LaTeX-like syntax, 
% so that one can say,  e.g., 
% |\SQRT[3]{...} | instead of |\ROOT 3 \OF ... |.
%    \begin{macrocode}
\DeclareRobustCommand\SQRT{\@ifnextchar[\SQRT@\SQR@@T}
\def\SQRT@[#1]{\ROOT #1\OF}
%    \end{macrocode}
%
%
% \subsection{Math font sizes}
%
% \mtpro, unlike most other Type~1 font families,
% has several design sizes.  As a result, we can 
% make the subscripts and superscripts (almost) as small as 
% with standard \TeX.
%    \begin{macrocode}
\def\defaultscriptratio{.7}
\def\defaultscriptscriptratio{.55}
\DeclareMathSizes{5}{5}{5}{5}
\DeclareMathSizes{6}{6}{5}{5}
\DeclareMathSizes{7}{7}{5}{5}
\DeclareMathSizes{8}{8}{6}{5}
\DeclareMathSizes{9}{9}{7}{5.5}
\DeclareMathSizes{\@xpt}{\@xpt}{7}{5.5}
\DeclareMathSizes{\@xipt}{\@xipt}{8}{6}
\DeclareMathSizes{\@xiipt}{\@xiipt}{8}{6}
\DeclareMathSizes{\@xivpt}{\@xivpt}{\@xpt}{7}
\DeclareMathSizes{\@xviipt}{\@xviipt}{\@xiipt}{\@xpt}
\DeclareMathSizes{\@xxpt}{\@xxpt}{\@xivpt}{\@xiipt}
\DeclareMathSizes{\@xxvpt}{\@xxvpt}{\@xxpt}{\@xviipt}
%    \end{macrocode}
%
%
% \subsection{Encoding-specific text commands}
%
% Some encoding-specific commands default to the OML or OMS encoding.
% As these encodings are not used with Times~NRMT or 
% \mtpro, we need to change the defaults, if possible.
%
% These ones used to default to OML:
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textless}{MPY1}
\DeclareTextSymbolDefault{\textgreater}{MPY1}
\DeclareTextAccentDefault{\t}{MPY2}
%    \end{macrocode}
%
% After re-declaring the default encoding we must not forget to
% declare the very symbol, otherwise calling the command will
% generate a loop. Or to quote David:
% \begin{quote}
%  Hmm, otherwise you waste an hour or two staring at |\tracingall|
%     output trying to work out what the heck is happening.
% \end{quote}
%
%    \begin{macrocode}
\DeclareTextSymbol{\textless}{MPY1}{`\<}
\DeclareTextSymbol{\textgreater}{MPY1}{`\>}
\DeclareTextAccent{\t}{MPY2}{65}
%    \end{macrocode}
%
% These ones used to default to OMS:
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textasteriskcentered}{MPY2}
\DeclareTextSymbolDefault{\textbackslash}{MPY2}
\DeclareTextSymbolDefault{\textbar}{MPY2}
\DeclareTextSymbolDefault{\textbraceleft}{MPY2}
\DeclareTextSymbolDefault{\textbraceright}{MPY2}
\DeclareTextSymbolDefault{\textbullet}{MPY2}
\DeclareTextSymbolDefault{\textperiodcentered}{MPY2}
\DeclareTextAccentDefault{\textcircled}{MPY2}
\DeclareTextSymbol{\textasteriskcentered}{MPY2}{3}
\DeclareTextSymbol{\textbackslash}{MPY2}{110}
\DeclareTextSymbol{\textbar}{MPY2}{106}
\DeclareTextSymbol{\textbraceleft}{MPY2}{102}
\DeclareTextSymbol{\textbraceright}{MPY2}{103}
\DeclareTextSymbol{\textbullet}{MPY2}{15}
\DeclareTextSymbol{\textperiodcentered}{MPY2}{1}
\DeclareTextCommand{\textcircled}{MPY2}[1]{{%
   \ooalign{%
      \hfil \raise .07ex\hbox {\upshape#1}\hfil \crcr
      \char13}}}
%    \end{macrocode}
%
% The following symbols also normally default to OMS, but are not available
% in MPY1 or MPY2, so we take them from the TS1 encoded fonts, unless
% the options \Lopt{noTS1} or \Lopt{LY1} were selected.
% As to \Lopt{LY1}, this is---at least---questionable, but
% the \Lpack{mathtime} package would exhibit the same behavior,
% and I do not dare to change it, for the time being.
%    \begin{macrocode}
\ifx\symtextcomp\relax % no TS1
\else % use TS1
  \DeclareFontEncoding{TS1}{}{}
  \DeclareTextSymbolDefault{\textdagger}{TS1}
  \DeclareTextSymbolDefault{\textdaggerdbl}{TS1}
  \DeclareTextSymbolDefault{\textsection}{TS1}
  \DeclareTextSymbolDefault{\textparagraph}{TS1}
  \DeclareTextSymbol{\textdagger}{TS1}{132}
  \DeclareTextSymbol{\textdaggerdbl}{TS1}{133}
  \DeclareTextSymbol{\textsection}{TS1}{167}
  \DeclareTextSymbol{\textparagraph}{TS1}{182}
\fi
%    \end{macrocode}
% 
%
% \subsection{Strange math commands}
%
% Wasting a full symbol font just to have |\dagger| and friends. Here
% we pay part of the price for fact that the \mtpro fonts
% have their own encoding incompatible with the CM fonts.
% We have to care for the symbols 
% \cmd{\dagger}, \cmd{\ddagger},\cmd{\mathsection} and \cmd{\mathparagraph},
% which are not available in our math fonts.
% Furthermore, the definitions of \cmd{\mathstarling} and \cmd{\mathunderscore} 
% may need to be changed, according to the encoding of the `operators'
% font.  The default definitions supplied by \LaTeX{} match OT1.
% Note that we require a format as of 1997/06/01 or later, so that 
% the encoding of the footnote symbols may be changed freely.
%
% We start with checking the `operators' font encoding:
% If this is LY1, either by default or through the \Lopt{LY1} option, 
% the missing math symbols, the pounds sign and the underscore
% can all be taken from that font.
%    \begin{macrocode}
\def\@tempa{LY1}
\ifx\operator@encoding\@tempa
    \DeclareMathSymbol{\dagger}{\mathbin}{operators}{134}
    \DeclareMathSymbol{\ddagger}{\mathbin}{operators}{135}
    \DeclareMathSymbol{\mathsection}{\mathord}{operators}{'247}
    \DeclareMathSymbol{\mathparagraph}{\mathord}{operators}{'266}
    \DeclareMathSymbol{\mathsterling}{\mathord}{operators}{163}
    \let\mathunderscore\@undefined
    \DeclareMathSymbol{\mathunderscore}{\mathord}{operators}{95}
%    \end{macrocode}
% Otherwise, we fix the pounds sign and the underscore wrt/ T1:
%    \begin{macrocode}
\else
  \def\@tempa{T1}
  \ifx\operator@encoding\@tempa
    \DeclareMathSymbol\mathsterling{\mathord}{operators}{191}
    \let\mathunderscore\@undefined
    \DeclareMathSymbol\mathunderscore{\mathord}{operators}{95}
  \fi
%    \end{macrocode}
% As to the remaining symbols, we follow the \Lopt{noTS1} option.
% If it was selected,
% we just leave \cmd{\dagger} \&{} friends improperly defined!
%    \begin{macrocode}
  \ifx\symtextcomp\relax % no TS1
%    \end{macrocode}
% Otherwise we take the symbols from TS1; the encoding was
% already declared above.
%    \begin{macrocode}
  \else % use TS1
    \DeclareSymbolFont{textcomp}{TS1}{mtm}{m}{n}
    \DeclareMathSymbol{\dagger}{\mathbin}{textcomp}{'204}
    \DeclareMathSymbol{\ddagger}{\mathbin}{textcomp}{'205}
    \DeclareMathSymbol{\mathsection}{\mathord}{textcomp}{'247}
    \DeclareMathSymbol{\mathparagraph}{\mathord}{textcomp}{'266}
  \fi
\fi
%    \end{macrocode}
%
%
% \subsection{Subscript correction}
%
% We provide a definition for |_| as active character. This definition
% in itself is not changing \LaTeX's behavior, as by default |_| has
% catcode 8, i.e., subscript character. Only if we change this catcode
% or if we change the |\mathcode| of |_| \TeX{} is going to look at it.
%    \begin{macrocode}
\begingroup
 \catcode`\_=13
 \gdef_#1{\sb{\test@sb#1}}
\endgroup
%    \end{macrocode}
%
% The |\test@sb| gets passed the argument of a subscript and tests with
% |\@ifnextchar| if the first non-space token  is a \texttt{f}.
% If not it will look at |\@let@token| (set by |\@ifnextchar|) to see
% if it is perhaps \texttt{j}, \texttt{p}, \texttt{t} etc.\ In each case 
% it will add an appropriate kern.  The kerning values were adopted
% from \texttt{mtp.sty}.
%
% Note that this will fail if an old \LaTeX{} is used as the old
% definition of |\@ifnextchar| does not use |\@let@token| but
% |\@tempa|.
% However, the worst that would happen is that the kern is not inserted,
% and we request a \LaTeX{} not older than 1997/06/01, anyway.
%    \begin{macrocode}
\def\test@sb{%
  \@ifnextchar f%
    {\mkern-\thr@@ mu}%
    {\ifx\@let@token j\mkern-\tw@ mu\else
      \ifx\@let@token p\mkern-\tw@ mu\else
      \ifx\@let@token t\mkern\@ne mu\else
      \ifx\@let@token y\mkern-\@ne mu\else
      \ifx\@let@token A\mkern-\tw@ mu\else
      \ifx\@let@token B\mkern-\@ne mu\else
      \ifx\@let@token D\mkern-\@ne mu\else
      \ifx\@let@token H\mkern-\@ne mu\else
      \ifx\@let@token I\mkern-\@ne mu\else
      \ifx\@let@token K\mkern-\@ne mu\else
      \ifx\@let@token L\mkern-\@ne mu\else
      \ifx\@let@token M\mkern-\@ne mu\else
      \ifx\@let@token P\mkern-\@ne mu\else
      \ifx\@let@token X\mkern-\tw@ mu\else
     \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
     \fi}}
%    \end{macrocode}
%
% Finally we set the |\mathcode| of |_| to ``active''. However, as long
% as its |\catcode| is not changed, this |\mathcode| is never looked at;
% in other words: we can now turn the feature on and off by changing the
% |\catcode| to |12|, which is done in the options code above.
%    \begin{macrocode}
\mathcode`\_=\string"8000
%    \end{macrocode}
%
%    \begin{macrocode}
%</mtpro>
%    \end{macrocode}
%
%
% 
% \section{The \texttt{.fd} files for \mtpro}
%
% The |MPY1| encoding is similar to the |OML| encoding.
% Since there is no bold
% variant yet, we substitute it with the corresponding font from
% the \mtplus bundle---despite the different character set!
% The \cmd{\mathbold} alphabet should, however, come out as expected.
% Note that the \cmd{\skewchar} matches, too. 
%    \begin{macrocode}
%<*MPY1mtt>
\DeclareFontFamily{MPY1}{mtt}{\skewchar\font45}
\DeclareFontShape{MPY1}{mtt}{m}{it}{<-7> mtmif <7-9> mtmis <9-> mtmit}{}
\DeclareFontShape{MPY1}{mtt}{b}{it}{<-> ssubf * mtmib}{}
%</MPY1mtt>
%    \end{macrocode}
%
% The |MPY2| encoding corresponds to the |OMS| encoding,
% except for a small number of slots.  
%    \begin{macrocode}
%<*MPY2mtt>
\DeclareFontFamily{MPY2}{mtt}{\skewchar\font48}
\DeclareFontShape{MPY2}{mtt}{m}{n}{<-7> mtsyf <7-9> mtsys <9-> mtsyt}{}
%</MPY2mtt>
%    \end{macrocode}
%
% The `extension symbol' font is similar to the Computer Modern \texttt{cmex} 
% font; however, it contains additional symbols.
% One more encoding just for this reason:
%    \begin{macrocode}
%<*MPY3mtt>
\DeclareFontFamily{MPY3}{mtt}{}
\DeclareFontShape{MPY3}{mtt}{m}{n}{<->mtexa}{}
%</MPY3mtt>
%    \end{macrocode}
%
% There is also a bold upright font, which is used for the |\mathbf|
% alphabet.  It contains letters and digits only, so we assign `U'
% as the encoding.
%    \begin{macrocode}
%<*Umtt>
\DeclareFontFamily{U}{mtt}{\skewchar\font32}
\DeclareFontShape{U}{mtt}{b}{n}{<-7> mtmbf <7-9> mtmbs <9-> mtmbt}{}
%</Umtt>
%    \end{macrocode}
%
%
%
% \section{The \texttt{.fd} file for LucidaNewMath-Symbols}
% The \texttt{.fd} file generated here should equal the one
% from FMi's \Lpack{mathtime} bundle.
%
% We may have to adjust the size of the 
% \texttt{lbms} and \texttt{lbmsd} fonts, 
% when they are used in conjunction with Times.
%    \begin{macrocode}
%<*OMSlby>
\@ifundefined{LucidaScale}{\def\LucidaScale{0.9}}{}
\DeclareFontFamily{OMS}{lby}{\skewchar\font48}
\DeclareFontShape{OMS}{lby}{m}{n}{<->s * [\LucidaScale]lbms}{}
\DeclareFontShape{OMS}{lby}{b}{n}{<->s * [\LucidaScale]lbmsd}{}
%</OMSlby>
%    \end{macrocode}
%
%
%
% \section{The \texttt{.fd} file for \mtplus Script}
% The script alphabet from the \mtplus font set
% may be useful in conjunction with \mtpro, too.
% The \texttt{.fd} file generated here should equal the one
% from FMi's \Lpack{mathtime} bundle; however, I have changed the
% \texttt{.tfm} names to lowercase now.
%    \begin{macrocode}
%<*Umtms>
\DeclareFontFamily{U}{mtms}{\skewchar\font42}
\DeclareFontShape{U}{mtms}{m}{n}{<->mtms}{}
\DeclareFontShape{U}{mtms}{b}{n}{<->mtmsb}{}
%</Umtms>
%    \end{macrocode}
% 
%
% \Finale
%
