%
% \iffalse % meta-comment
%<*package>
%    \begin{macrocode}
%%
%% mt11p.dtx
%% Copyright 1997, 2002 Drahoslav L\'im
%% 
%% 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 following files:
%% 0readme
%% mt11p.dtx (this file)
%% mt11p.ins
%% mt11p.ps (formatted documentation)
%% mt11p.map
%% the binary tfm files:
%%              mtex.tfm mtexb.tfm mtexh.tfm mtgu.tfm
%%              mtgub.tfm mtmi.tfm mtmib.tfm mtmih.tfm
%%              mtms.tfm mtmsb.tfm mtmu.tfm mtmub.tfm
%%              mtmuh.tfm mtsyb.tfm mtsyh.tfm mtsyn.tfm
%%              rmtmi.tfm rmtmib.tfm rmtmih.tfm rmtmub.tfm
%%              rmtmuh.tfm
%% 
%% the binary vf files:
%%              mtmi.vf mtmib.vf mtmih.vf mtmu.vf
%%              mtmub.vf mtmuh.vf
%%
%% Use at your own risk.
%%
%% Send bug reports to DrahoslavL@seznam.cz
%%
%%
%    \end{macrocode}
%
% QUICK INSTALLATION GUIDE:
%
% Run LaTeX on this dtx file to generate the documentation.
%
% Run TeX on mt11p.ins to generate the style file mt11p.sty.
% Run latex on mt11p.drv to get documentation with commented source code.
%
% Copy mt11p.sty to the TeX input file area.
%
% Copy the PFA or PFB files from the Y&Y distribution
% diskettes to the appropriate area on your system.
% Edit mt11p.map, and/or rename/convert the Type1 font
% files so that the data in the map file and the actual file names
% are consistent. 
% 
% Copy the TFMs and VFs into the appropriate areas on your system.
% Pass the information in mt11p.map to your dvi driver, e.g.,
% append it to psfonts.map. Note that the TFM files are not
% identical to the ones on the Y&Y floppies.
%
% NOTE: The VFs assume the 8r-base version of PSNFSS is available, the
% style files check whether files called 
% ``\encodingdefault\[rm|sf|tt]default.fd'' (e.g., T1ptm.fd or t1ptm.fd)
% exist, and if the metric file ``ptmr8r.tfm'' is available.
%
% \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         \~}
%
\def\fileversion{0.4a}% corected minor typos in documentation; code not touched
\def\filedate{1997/01/27}
\def\docdate {2002/04/05}
%
% \iffalse
%</package>
%
%<*driver>\ProvidesFile{mt11p.drv}
%    \begin{macrocode}
%        [\filedate: setup\space for\space Times\space
%         +\space MathTime\space +\space MathTimePlus]
%    \end{macrocode}
%
\NeedsTeXFormat{LaTeX2e}
\documentclass{ltxdoc}
%</driver>
%<*!driver>
%<*!package>
%<*!demo>
\OnlyDescription
\message{^^JRun LaTeX on mt11p.drv to get the full docs.^^J^^J}
%</!demo>
%</!package>
%</!driver>
%<*driver>
\begin{document}
 \GetFileInfo{mt11p.dtx}
 \DocInput{mt11p.dtx}
\end{document}
%</driver>
%
%<*package>
% \fi
%
% \CheckSum{2389}
% \providecommand{\pkg}[1]{\texttt{#1}}
% \providecommand{\file}[1]{\texttt{#1}}
% \providecommand{\cs}[1]{\texttt{\char`\\#1}}
% \providecommand{\AmS}{{\fontencoding{OMS}\fontfamily{cmsy}\selectfont
%            \kern-0.06em A\kern-.15em \lower.5ex\hbox{M}\kern-.1em S\kern.07em}}%
% \newcommand{\deit}[1]{\item[{\boldmath$^\ddag$}\texttt{\bfseries#1}]}
% \newcommand{\opit}[1]{\item[\texttt{\bfseries#1}]}
% \newcommand{\brarg}[1]{\texttt\{$\langle\!$\textit{#1}$\rangle\!$\texttt\}}
%
% \title{A package for using the\\
%        MathT\i me and MathT\i me\textsc{plus}
%        fonts\thanks{This file
%        has version number \fileversion, last
%        revised \filedate.
%        This file has no connection with the \pkg{mathtime} package
%        commisioned by Y\&Y\@.}}
% \author{Drahoslav L\'\i m\\\texttt{DrahoslavL@seznam.cz}}
% \date{\docdate}
% \maketitle
% \begin{abstract}
% \pkg{mt11p} is a package to relatively painlessly
% get access to everything
% available in the MathT\i me and MathT\i me\textsc{plus} commercial
% math fonts in \LaTeXe. It is compatible with the \AmS{} packages.
% This package is self-contained and only
% the Type\,1 font programs need to be copied off of the distribution media.
% \end{abstract}
%
% \begin{multicols}{2}
% \tableofcontents
% \end{multicols}
%
% \section{Introduction}
% The use of Computer Modern fonts for equations has been
% one of the tell-tale signs indicating a document
% was typeset by \TeX\@. The reasons for this are that
% there are no good freely available substitute fonts, and
% that even if there were,
% changing \TeX's math fonts is a tedious and somewhat cryptic
% exercise. The first problem can be overcome by purchasing
% math fonts such as MathT\i me or Lucida. This package
% is one of the ways overcoming the second, though not the only one.
% It provides everything \emph{except} the fonts themselves.
% (You have shell out money and buy those,~\textsc{sorry}).
%
% It is assumed you are running \TeX\,3.x and a recent
% release of \LaTeX\@, and that you have the standard
% `resident' \textsc{Post\-Script} fonts installed for
% use as text fonts in~\TeX~(``PSNFSS'')\@.
% 
% \section{Installation}
%
% This package is useless unless you buy the fonts called
% \emph{MathT\i me} and \textit{MathT\i me{\footnotesize PLUS\/}}
% from~Y\&Y; the address is listed in~Sec.\,\ref{ack}.
%
% \paragraph{Prerequisites}
% The ``\texttt{8r}-based'' version of~PSNFSS must be
% installed on your system to use this package, because the
% \texttt{VF}s~refer to the \texttt{8r}~``raw'' fonts.
% Search on CTAN for the string ``\textsf{psnfss}'',
% consult the \textit{\LaTeX{} Companion}, and/or the \LaTeXe{}
% distribution
% on how to do this. You can check if your system already has
% the relevant files by searching for the \TeX~metric
% file ``\file{ptmr8r.tfm}'' in the \file{tfm} file area,
% and for the file ``\file{T1ptm.fd}'' (or
% maybe~``\file{t1ptm.fd}'') in the \TeX~input
% file area; if both are present you are probably
% \textsc{ok} and everything will work.
%
% \bigskip
%
% This \file{dtx}~file should have come with several
% sets of accompanying files, whose installation
% should be routine:
%
% Run \TeX~on \file{mt11p.ins}\@; that will generate
% the package ``style'' file,~\file{mt11p.sty}\@.
% Copy that file to the \TeX~input file area.
% Run \LaTeX~on \file{mt11p.drv}~to get commented source code
% (that's what you're reading now).
%
% The \textbf{\texttt{.tfm}~metric files} should be copied to the area
% where \TeX{} and the \texttt{dvi}~driver program search for
% font metrics.
% The \textbf{\texttt{.vf}~definition files} should be copied to
% the area where the \texttt{dvi}~driver program searches for virtual font
% definitions. Note that the metric files supplied are \emph{not} identical to the
% ones distributed with the MathT\i me fonts.
%
% The file~\file{mt11p.map} should be
% ``passed'' to the \texttt{dvi}~driver program to tell it that the
% MathT\i me fonts are downloadable \textsc{Post\-Script} fonts
% and what the relevant invocation commands are, or perhaps the file
% should be passed to
% a \textsc{Post\-Script} rasterizer (``PS--to--PK'')
% program if the \texttt{dvi}~driver must use \texttt{PK}~bitmaps.
% For Rokicki's \textsf{dvips}~driver, the contents
% of~\file{mt11p.map} can be appended to the
% ``\file{psfonts.map}''~file.
%
% Copy the Type\,1~font ``programs''---files
% with extension \file{pfa} or \file{pfb}---from Y\&Y's distribution
% media to the area where your \texttt{dvi}~driver or rasterizer
% searches for downloadable fonts.
% Some fonts may be provided in both \file{pfa} and \file{pfb}
% formats; just pick one, most systems can deal with either.
% (The \file{pfb}~format is more compact, albeit binary.
% The \texttt{dvi}~driver can probably
% convert
% \file{.pfb} to~\file{.pfa} ``on the fly''.)
% There are two versions of the normal weight symbol font,
% \file{mtsy} and~\file{mtsyn}. The difference is minor,
% but you might as well use the newer~\file{mtsyn}.
% See the paragraph called ``Symbols'' in the documented
% source code.\footnote{Run \LaTeX{} on the
% file~\file{mt11p.drv} to get the commented source code;
% it follows after~Sec.\,5.}
% 
% The names and types (\file{pfa}/\file{pfb})
% of the downloadable files
% in~\file{mt11p.map} should be made consistent with the actual names
% and types under
% which the Type\,1 font programs are stored on your system.
% Either rename and/or convert the Type\,1 fonts, or simply edit
% the contents of~\file{mt11p.map}; beware of case sensitivity.
%
% The \texttt{dvi}~driver program will probably not need the
% \file{afm}~files from the distribution medea, but a 
% ``PS--to--PK'' rasterizer might; consult the rasterizer
% documentation. Note that \file{afm}~files are \textsc{ascii}~files,
% convert line endings as appropriate.
%
% At least for this package, no other files from the distribution medea
% are required.
%
% \subsection{Previewing}
% Whether or not you can preview \file{dvi}~files which use
% MathT\i me fonts depends on your setup. If you can preview
% \file{dvi}~files containing other \textsc{Post\-Script}
% fonts, chances are you can preview with MathT\i me as well,
% perhaps after running some utility to generate bitmaps, resolve
% \texttt{VF}~references, etc.
% Otherwise, it is possible to view the final \textsc{Post\-Script}
% output of the \file{dvi}~driver on practically all platforms
% using viewers based on the \textsc{Ghost\-Script}
% rasterizer, or perhaps using Display\textsc{Post\-Script}.
%
% \section{Usage \& Package Options}
% To switch to Times text and math, it should suffice
% to say~|\usepackage{mt11p}| in the preamble. The oder
% of packages should not matter, with one exception:
% \pkg{mt11p} should be loaded after \AmS{} math packages.
% Any reasonably cleanly written \LaTeX{} input
% file will then be typeset with MathT\i me being used
% for all standard mathematical symbols that would have
% otherwise been typeset in Computer Modern.
% There are two notable exceptions, see~Sec.\,\ref{varGamma}.
%
% Expect a few dozen lines of warnings as this package is being read,
% and a notice about substituted fonts at the end of the run.
% I think it is better to live with these NFSS warnings rather than
% do some hacks to turn them off.
%
% At the end of the run expect a warning about size substitutions
% if the \texttt{resize}~option was in effect (it is by default).
% They are are due to the Computer Modern fonts usually having
% a set of sizes available rather than being declared scalable in the
% \file{.fd}~file, i.e., a \cs{DeclareFontShape}
% argument of something like |<10><10.95><12><14.4>|
% rather than~|<->|.
% Whether or not something should be done about this depends on
% what Computer Modern glyphs were used. It may be the case
% that, in fact, none were---the warnings come from NFSS having
% loaded fonts for. e.g., \cs{oldstylenums}
% for math, eventhough you never actually used them.
% You can change the \file{.fd}~files if you system is
% capable of generating bitmaps on-the-fly or if you're using
% \textsc{Post\-Script} versions of the Computer Modern fonts.
% Consult the \emph{\LaTeX~Companion} or the standard
% documentation file~\file{fntguide.tex}.
%
% \subsection{List of options}
% This packages has lots of options controlling
% some detailed aspects of font and math character handling.
% In general, use the defaults, unless you have some
% idea of what the implications of a particular option
% are.
%
% Options in effect by default are indicated by
% a double dagger~($\ddag$).
%
% \begin{itemize}
% \deit{T1} reset the \cs{encodingdefault} (applicable to text fonts and
%           some math operators, symbols and accents) to~\texttt{T1}.
% \opit{OT1} reset the \cs{encodingdefault} to the archaic
%            \texttt{OT1}~encoding; upper case Greek letters are never
%            taken from the text font, so the only reasons to
%            do this are human inertia and legacy code.
% \opit{noenc} assume the current \cs{encodingdefault} is the desired one;
%           see the commented source
%           code if you use something other than \texttt{T1}
%           or~\texttt{OT1}.
% \bigskip\par
% \deit{opsafe} use symbols and accents from the
%           \texttt{operators} math family only when it is
%           safe to do so.
% \opit{opnone} do not use the \texttt{operators}~math
%           family for accents or symbols, except when
%           this can't be helped;
%           if \cs{encodingdefault} is
%           not recognized, this option is auto-invoked.
% \opit{opmax} take as much from the \texttt{operators}~math
%           family as possible.
%           Doing so can produce problematic
%           output in some circumstances, but it will make the
%           maximum use of printer resident fonts;
%           don't use this option
%           unless you know why you are doing so. See
%           the paragraph ``Symbols from either
%           \texttt{operators} or from elsewhere'' in the documented
%           source code.
% \bigskip\par
% \deit{opaccents} take math accents from the \texttt{operators}
%           math family, and make them follow math alphabet
%           changes where possible; see~Sec.\,\ref{ACCs}.
% \opit{symaccents} take math accents from the a fixed (within a
%           math version) font; if \cs{encodingdefault} is not
%           recognized, this option is auto-invoked;
%           see~Sec.\,\ref{ACCs}.
% \bigskip\par
% \deit{mtcal} make the MathT\i me script font the
%          math alphabet \cs{mathcal} and make
%          \cs{mathscr} and synonym of~\cs{mathcal};
%          see~Sec.\,\ref{Script}.
% \opit{cmcal} make the MathT\i me script font the math alphabet
%          \cs{mathscr} and the Computer Modern symbol
%          font the \cs{mathcal}~alphabet;
%          see~Sec.\,\ref{Script}.
% \opit{nomtms} use the Computer Modern symbol
%          font as the \cs{mathcal}~alphabet and do not
%          load the MathT\i me script font
%          at all; see~Sec.\,\ref{Script}.
% \bigskip\par
% \deit{dohbar} overwrite any existing definition of the
%          \cs{hbar}~($\hbar$)~symbol with one synthesized from
%          an~``$h$'' and a bar accent. The
%          definition here is actually rather decent, unlike the simple
%          one usually used. (At least try it before resorting
%          to the glyph in the \AmS~fonts\ldots)
% \opit{nohbar} do nothing with the \cs{hbar} definition,
%          retain the existing one (if any); e.g.,
%          the \AmS~fonts
%          have~\cs{hbar} as a single Computer Modern-like glyph.
% \bigskip\par
% \deit{subs} the \texttt{bold} and \texttt{heavy}
%          math versions in principle need some
%          `ultra' and `poster' weight fonts; usually
%          no such fonts are available, so define
%          substitutes.
% \opit{nosubs} assume suitable fonts are available
%          and will be loaded, e.g., using a configuration
%          file \file{mt11p.cfg}; do not declare
%          any font substitutions. If should be apparent from
%          the commented source code or from \file{mt11p.sty} what
%          \textit{family}/\textit{series}/\textit{shape}~NFSS
%          declaration the extra fonts should get.
%          Search for the string ``\textsf{SUBS}''
%          in the \file{.dtx} or \file{.sty}~file.
% \deit{do8r} use the raw \texttt{8r}~fonts for the
%          four symbols \S, \P, \dag, \ddag. The math italic
%          fonts use the italic \texttt{8r}~raw fonts, so
%          it's not unreasonable to assume the upright
%          ones are also available; no support for using
%          the \texttt{8r}~encoding need be installed on the system,
%          though we make use of it if it is. \texttt{8r}~is
%          not used for anything other than these four symbols;
%          see~Sec.\,\ref{8R}.
% \opit{no8r} do not use the raw fonts, and take the four
%          symbols \S, \P, \dag, \ddag\, from a Computer Modern font;
%          see~Sec.\,\ref{8R}.
% \opit{nodag} don't touch the definitions of \S, \P, \dag, \ddag{}
%          at all; assume suitable definitions have been or will be
%          supplied, e.g., as part of a \texttt{TS1} setup.
%          See~Sec.\,\ref{8R}.
% \bigskip\par
% \deit{bsy} load the \AmS~packages needed to define
%          the \cs{boldsymbol}~macro, and define analogous
%          \cs{heavysymbol} and \cs{normalsymbols}~macros.
% \opit{nobsy} don't load the \AmS~packages for \cs{boldsymbol}
%          and define \cs{boldsymbol}~and \cs{heavysymbol} to produce
%          messages and behave as no-ops.
% \bigskip\par
% \deit{mathgr} get upright Greek letters as the math alphabet
%          \cs{mathgr}; see~Sec.\,\ref{par:mathgr}.
% \opit{nomathgr} do not load the math alphabet \cs{mathgr};
%          this is only useful if you are running out of
%          math families, in which case you can use
%          \cs{greekshape} in an \cs{hbox} with the
%          obvious limitations. See~ec.\,\ref{par:mathgr}.
% \bigskip\par
% \deit{mathOS} get oldstyle digits as a math alphabet;
%          Computer Modern oldstyle digits are always available
%          in text.
% \opit{nomathOS} do not load Computer Modern oldstyle digits
%          as a math alphabet. See the \texttt{nomathgr} option.
% \bigskip\par
% \deit{resize} change the subscript and text font sizing
%          to better account for the
%          fact that we are using linearly (not optically) scaled fonts.
% \opit{noresize} don't touch the math subscript and text font sizing.
% \bigskip\par
% \deit{activesb} to improve the spacing in certain subscript
%          situations, the subscript character ``|_|'' (an
%          underscore) is made active; this \emph{might} break
%          some macros; see~Sec.\,\ref{SB}
% \opit{noactivesb} don't do anything with the underscore.
% \bigskip\par
% \deit{times} assume the package (style file) which changes the
%          roman, sans and typewriter text families to
%          ``Times\,\&\,Helvetica\,\&\,Courier'' is
%          called~``\file{times.sty}''; this package
%          is loaded via \cs{RequirePackage}.
% \item[\textbf*] any other option will be interpreted as the
%          name of the style file to use instead of~%
%          \pkg{times}; e.g., the option ``\texttt{btdutch}''
%          will attempt to `require' the \pkg{btdutch}~package
%          instead of the \pkg{times}~package.
% \end{itemize}
%
% \subsection{Interaction with \AmS~macros and other math packages}
% \label{varGamma}
% This package does nothing terribly anti-social and can co-exist with
% \AmS~packages, e.g., \pkg{amsmath}, \pkg{amsfonts}, etc., provided
% those packages are read \emph{before} (i.e., prior~to) reading this package.
% Some types of macros are hardwired to Computer Modern fonts,
% e.g., the ``\kern-.08em\AmS\kern.02em''~logo and would
% have to be redefined.
% The fonts~\texttt{msam} and~\texttt{msbm} will, or course, still be used
% for the more uncommon math symbols.
% See below about math accents.
%
% The default \TeX~math setup treats upper case Greek letters
% as mathematical ``letters'' and lower case Greek letters
% as mathematical ``symbols''. Hence |\mathbf{\Gamma\gamma}|
% produces a bold upper case~$\mathbf\Gamma$, but 
% does not affect the lower case~$\gamma$; similarly for~\cs{mathit}.
% This package uses the same conventions as the \AmS~macros:
% names like ``\cs{varGamma}'' are used
% for italic upper case Greek~($\mathit{\Gamma}$), and math version
% switching is needed (\cs{boldsymbol}) to get bold Greek.
% The `legacy' input code
% |\mathbf{\Delta}\mathit{\Gamma}|~(``$\mathbf{\Delta}\mathit{\Gamma}\,$'')
% \emph{does not work} with the \AmS~\LaTeX~macros nor with this package.
% See~Sec.\,\ref{ACCs} about accents in math.
%
% It is likely that other math font related packages can
% co-exist with~\pkg{mt11p}, particularly if they merely add
% a math alphabet or symbol font, e.g., \pkg{mathbbol},
% \pkg{stmaryrd} or~\pkg{wasysym}. The chances of running out
% of math symbol font families are slim unless you also
% load the \pkg{oldlfont}~package. Note that
% the \AmS{} symbol packages need two math families.
% Of course it makes no
% sense to use \pkg{mt11p}~together with another
% complete math setup package like~\pkg{euler}.
%
% One package that \emph{will} clash with~\pkg{mt11p} is~\pkg{yhmath}.
% If you load that package after~\pkg{mt11p}, all \texttt{largesymbols}
% in all math versions
% will be taken from the fixed size font~\texttt{yhcmex10};
% loading~\pkg{yhmath} before~\pkg{mt11p} will break~\pkg{yhmath}'s
% wide math accents. If you only need the extra-wide accents,
% change all instances of the word ``\textsf{largesymbols}'' in the
% file~\file{yhmath.sty}
% to something else, e.g.,~\textsf{YHlargesymbols}, and input that altered
% file. If you want the extra delimiter sizes, you're on your own, but
% see the paragraph ``Declaring additional math delimiters'' towards the end
% of the commented source code.
%
% \subsection{Math Accents}\label{ACCs}
%
% MathT\i me provides an additional accent called
% \cs{widebar} or~\cs{overbar}. It's about~$1\mathrm{em}$~long.
% If the \AmS{} macros \cs{Hat}, etc., are defined, we also
% define the similar \cs{Overbar} and~\cs{Widebar}.
%
% The Computer Modern layout causes some encoding-related
% problems with math accents and math alphabets.
% NFSS~has hooks to fix the problems, but does not actually
% do it; the \AmS{} package~\pkg{amsmath}
% does fix them by redefining most math accents.
%
% \pkg{mt11p}~incorporates fixes similar to the \AmS~ones,
% and overwrites any existing math accent
% definitions (it pretty much has to), so that
% any combination of math alphabets and accents
% (and accents options: \texttt{opaccents} or~\texttt{symaccents})
% will output the expected glyphs. Some curious combinations
% will, however, lead to odd-looking accent positioning.
% In a construct such as |\mathit{\hat{x}}|
% the accent positioning will always be ``wrong'', because
% the accent is a \emph{text} accent---the (text) italic font
% implied by \cs{mathit} doesn't have the appropriate font metrics
% because it's assumed that \cs{mathit} will be used when a
% group of letters (a~`word') is to be treated as
% a math symbol, e.g., $x_{\mathit{initial}}$
% or~$\widehat{\mathit{final}}$.
% However, ``$x$''~is a mathematical symbol by itself. If you want
% an italic hat on the symbol~$x$ you have to say
% |\mathit{\hat{\mathnormal{x}}|
% (assuming it's a big deal to have an italic~\cs{hat}\ldots).
% Even then the spacing will not be optimal and
% will usually require some fiddling with the \cs{skew} macro.
%
% \subsection{Script and calligraphy math fonts}\label{Script}
% This package makes the distinction between two
% ``calligraphy'' math alphabets: \emph{calligraphy} and
% \textit{script}. This is necessitated by the fact that
% the Computer Modern fonts only have upper case
% ``calligraphy'' letters, and that you perhaps may not like
% the MathT\i me \texttt{mtms}*~fonts or that you
% may want to use letters from both fonts.
%
% Irrespective of the options in use, the two math alphabet
% commands \cs{mathcal} and \cs{mathscr} will be defined.
% (The old ``\cs{mit}''~is not defined.)
%
% The default (\texttt{mtcal})~is to make both alphabets
% refer to a \texttt{mtms}*~font. The variant
% forms of some letters are available with the commands
% \cs{varA}, \cs{varE}, \cs{varG}, \cs{varvarG}, \cs{varI}, \cs{varL},
% \cs{varQ}, \cs{varS}, \cs{varr}, \cs{varz},
% \cs{iscript} and~\cs{jscript}. (\cs{i}~and \cs{j}~are
% invalid in math mode and \cs{imath} and~\cs{jmath}
% cannot be redefined.) Both upper and lower case letters
% will work in~\cs{mathcal}.
%
% Another possibility, \texttt{cmcal}, is to
% have both Computer Modern and
% MathT\i me fonts available; \cs{mathscr}~will 
% be the latter, and \cs{mathcal} the former.
% \cs{mathcal} will then not have lower case letters.
%
% A third setting, \texttt{nomtms},~avoids using the
% MathT\i me \texttt{mtms}*~fonts entirely.
% \cs{mathcal}~is then the Computer Modern symbols font,
% and \cs{mathscr} gives a warning before calling~\cs{mathcal}.
%
% A certain amount of ``reasonableness'' is assumed with respect
% to the usage of ``calligraphic'' alphabets.
% The \texttt{mtcal}~option does not give any warning
% about the fact that \cs{mathcal} and \cs{mathscr}
% are identical. With the \texttt{cmcal} or \texttt{nomtms}
% options in effect you will get warnings if you try to use
% a~\cs{var}\kern-.035em\textit{X\/} letter in~\cs{mathcal}, but
% \cs{mathcal} will never try to check its argument
% to verify that it consists of \emph{upper} case letters only, even
% when no font with ``calligraphy'' lower case letters
% is available. Consider using \cs{mathcal} when the argument
% is known to contain nothing but upper case letters and
% use \cs{mathscr} when using lower case letters as well;
% that way you will at least get a warning pertaining to
% script math alphabets if the options are
% set to avoid the use of~\texttt{mtms}* or if
% the document is reset without MathT\i me fonts.
% 
% 
% The MathT\i me manuals describe a \cs{script} macro;
% \pkg{mt11p}~defines an equivalent macro. Note that
% \cs{script} should only be followed by white space, an 
% optional~``\texttt*'', and then a single letter,
% with no space between the asterisk and the letter, e.g.,
% \verb*+\script *AB+ is equivalent to
% |\mathscr{\varA}B|, \emph{not}~|\mathscr{AB}|,
% and \verb*+\script* AB+ is an error.
%
% \subsection{The symbols \dag, \ddag, \S, and \P}\label{8R}
% The standard \LaTeX~setup takes these symbols, in both text and math
% from the Computer Modern symbols font. The MathT\i me symbols
% font does not have these glyphs, so something must be done
% to have them available for footnote markers,~etc.
%
% There is a fairly standard \textsc{Post\-Script} text
% symbol font setup, which uses the \texttt{TS1}~encoding,
% but it seems to not (yet) be in general use.
%
% This package offers three relevant options. The option
% \texttt{nodag}~does absolutly nothing with the four symbols,
% but this can only be used if they've already been or are about to be
% redefined (perhaps in the \file{mt11p.cfg} file),
% because the default definitions assume the use
% of Computer Modern fonts and \emph{will} produce incorrect glyphs
% after switching to MathT\i me. 
%
% The default option \texttt{do8r} 
% takes these four symbols (and \emph{only}
% these four symbols) from the ``raw'' \texttt{8r}~encoded
% fonts, upon which the virtual \texttt{T1} and \texttt{OT1}
% \textsc{Post\-Script} fonts are built. If \file{.fd}~files
% or an~\file{8r.sty} are available, we use them; if they're not, we supply
% just enough code to be able to use the symbols in NFSS\@.
% It is not unreasonable to do so, because the \texttt{8r}~metric
% file~\file{ptmri8r.tfm} must be on the system (the 
% \file{mtmi.vf} virtual font uses it), so the
% upright font~\file{ptmr8r.tfm} is probably available too.
% Note that \texttt{8r}~is an ``unsupported'' encoding.
%
% The option \texttt{no8r} overwrites any existing definition
% and forces the use of Computer Modern for these four symbols 
% (without affecting anything else) and avoids the direct use of
% \texttt{8r}~raw fonts.
%
% \subsection{``New'' symbols}
% {\sloppy
% MathT\i me has a few mathematical symbols that aren't available
% in Computer Modern. Here is the list, with alternate names
% in parentheses:
% \cs{overbar}~(\cs{widebar}),
% \cs{openclubsuit},
% \cs{shadedclubsuit},
% \cs{openspadesuit},
% \cs{shadedspadesuit},
% \cs{triangleleft},
% \cs{triangleright},
% \cs{cupprod},
% \cs{capprod},
% \cs{varcirc}~(\cs{comp}).}
%
% \subsection{Avoiding the use of bitmap fonts}
% Often the point of buying the MathT\i me fonts is not
% just to get something other than Computer Modern math, but also
% to avoid the use of bitmap (Type\,3) fonts and
% use scalable (Type\,1) fonts nstead. The default option are
% set so that this condition is satisfied, as long as you
% don't use glyphs that are not available
% in either the resident fonts nor in MathT\i me, i.e.,
% oldstyle digits, or you force the use of
% Computer Modern or other \textsc{Meta\-Font}
% fonts in some situations (the \texttt{cmcal},
% \texttt{nomtms}, or~\texttt{no8r} options, \AmS~packages, etc.) and
% you do not have substitute outline fonts. See the
% MathT\i me licence agreement about ``exporting''
% files containing outline fonts.
%
% \subsection{Subscript spacing}\label{SB}
% The sidebearings of math italic letters with descenders
% are such that a spacing adjustment is required
% in certain contexts, in particular in the very common
% case of~$j$ subscripts. The MathT\i me
% distribution suggests using an active subscript character,
% which checks if the first thing in a subscript is
% one of the letters \texttt{f}, \texttt{j} or~\texttt{p},
% and inserts a small negative kern if is it.
% The macro \cs{jadjust} can be used if the correction
% needs to be done by hand; see Appendix~B.2 of the
% MathT\i me \textit{Reference Manual}.
%
% Changing category codes is akin to Russian roulette: we can
% try to make the magazine larger, but it will still hold
% a bullet \textit{somewhere}. It is unreasonable to
% assume that other people's packages will
% take steps to work even when the \texttt{underscore}
% is a macro. \texttt{underscore}s can crop up
% in font names or reference labels, for example.
%
% The macro we use is slightly different from the original one
% in the MathT\i me distribution. The \cs{catcode} of
% the \texttt{underscore} ends up being~$12$, i.e., ``other''
% rather than~$13$~(``active''), which is much more forgiving.
% We rely on the fact that the
% \texttt{underscore}'s \cs{mathcode} is \texttt{"8000}
% to get subscripts in math mode. This seems to be~\textsc{ok}
% when used in most contexts. In text mode this will
% produce whatever the current font has in slot~|`\_|, but
% you shouldn't be using a `naked'
% \texttt{underscore} in text anyway\ldots{}
%
% Nothing is done with the \texttt{underscore} unless
% its \cs{catcode} is ``subscript''~($8$),
% \emph{and} its \cs{mathcode} is~\texttt{"8000}; if
% both conditions are not fulfilled, someone has
% presumably already fiddled with the \texttt{underscore},
% so we don't touch it.
%
% The option~\texttt{noactivesb} keeps the underscore as it was,
% in order to quickly ascertain whether the active
% \texttt{underscore} is braking some macros. Reports of
% such cases are welcome.
%
% \subsection{Upright Greek lower case letters}
% \label{par:mathgr}
% MathT\i me contains an upright Greek letters (text)
% which are used in some disciplines to designate
% units or particles. Such letters are normally not used
% as math \textit{symbols}. We provide three relevant commands:
% \textbf{\cs{greekshape}},~which is a font switch like~\cs{itshape}),
% \textbf{\cs{textgr}},~which takes an argument similarly to~\cs{textit},
% and the math alphabet command~\textbf{\cs{mathgr}}.
%
% Alternate forms of some letters can be obtained as
% ligatures---see Section~8 of the \textit{MathT\i me\/}\textsc{plus}
% reference manual. However, in math (\cs{mathgr})
% it is not possible to use
% the ligatures with the asterisk character~(\texttt*) suggested
% in the manual, because the asterisk will not be interpreted as
% a character from the same font as the Greek letters.
% The TFM~metric files accompanying this package contain extra ligatures
% which produce the variants: in lieu of~\texttt{O*} or~\texttt{o*},
% write~\texttt{vO} or~\texttt{vo}, respectively; in place
% of~\texttt{e*} write~\texttt{vev}.
%
% This package does not define any \cs{gr}~font switch. \cs{greekshape}
% performs the same function in text; use the \cs{mathgr}~form
% in math.
%
% MathT\i me\textsc{plus} comes with two ``hybrid'' fonts,
% \texttt{mtmub} and \texttt{mtmuh}, which
% are math~\texttt{letters} fonts with upright
% (instead of sloping) lower case Greek letters. The
% two fonts contain both upright and italic \emph{upper case}
% Greek letter. For reasons listed in the reference
% manual, there is no font~\file{mtmu}. This package comes with
% a \file{mtmu}~font,  created as a~\file{VF} using 
% \file{mtmi} and~\file{mtgu}, in case you decide to
% use such a font after all.
%
% See the commented source
% about declaring upright Greek letters
% as math \textit{symbols} and about using~\file{mtgu}.
%
% \subsection{Oldstyle Digits}\label{OSdig}
% None of the ``standard\,35'' \textsc{Post\-Script}
% fonts has oldstyle digits (\oldstylenums{1234567890})
% and neither do any of the MathT\i me fonts.
% The standard \TeX~math \texttt{letters}~font
% has such digits, and some packages make use of the glyphs.
% \pkg{mt11p}~defines an
% \cs{oldstylenums}~macro which is essentially equivalent to the
% one provided in \LaTeX, but note that the Computer Modern
% oldstyle digits don't go well with Times text fonts.
% A \file{mt11p.cfg}~file or a subsequent package could redefine
% the macro to use a more suitable font.
%
% \subsection{Mixing math versions}
% Like both the standard \TeX{} math setup and the \AmS~math
% setup, we assume that it will be relatively rare to require
% bold~(unbold) \emph{symbols}\footnote{%
% The arguments of \cs{mathbf} are not
% considered `symbols'. The input text \cs{mathbf\{a\}}
% produces a bold \emph{upright}~``$\mathbf a$'' not
% the bold math symbol~``{\boldmath$a$}''.}
% in a formula set in the unbold~(bold) math version.
% We load the \AmS~\pkg{amsbsy} package which defines
% a \cs{boldsymbol}~macro, that sets its argument
% using the bold math version, and define corresponding
% corresponding \cs{heavysymbol} and
% \cs{normalsymbol}~macros.
%
% However, it's awkward
% to use the \cs{boldsymbol}, etc., macros in situations
% where alignment is critical (accents) or for
% large delimiters. For those cases one could declare
% additional symbol fonts and define things like
% \cs{boldalpha}, \cs{boldhat} or \cs{Lheavybrace}, and then
% an input text like
% \begin{center}
% |\[\left\Lheavybrace 2\boldalpha|%
% $\langle\!\hbox{\itshape some big formula}\rangle$%
% |\right\Rheavybrace\]|
% \end{center}
% would do what would otherwise
% take unreadable input code (\cs{vphantom} constructs) to produce.
% This requires some knowledge of the
% details of \TeX's math workings, but nothing
% too esoteric. For a simple example
% the commented source code. Such a setup could be placed
% in~\file{mt11p.cfg}. Consult also the standard \LaTeX{}
% documentation file~\file{fntguide.tex}. Note that
% the \AmS~macros do not provide such a setup, because
% it's somewhat rare to actually need it, but it can be done.
%
% \subsection{Local Configuration}
% After setting everything up but before `undefining'
% internal auxiliary macros and flags,
% and before changing the subscript
% sizing this package inputs the file~\file{mt11p.cfg}, if
% it can find one. Further definitions (bold or
% upright Greek letters as symbols, etc.\@) could be placed in
% such a file.
%
% \section{Bugs}
% Any reports about bugs, suspected bugs or package
% clashes are welcome provided you also send just enough
% \TeX~code to reproduce the bug and your \TeX{}
% \file{.log}~file---use the e-mail
% address given on the title page of this document and
% at various places in the files.
% Report of \emph{usage} are also welcome\texttt{\small;-)}.
%
% \section{Acknowledgment \&{} Misc.}\label{ack}
%
% {
% \setlength{\parindent}{0pt}
% \setlength{\parskip}{1.0ex plus 0.5ex minus 0.5ex}
% \raggedright
% This section has been put here, in case you don't print out the
% commented source code.
%
% Thanks to the authors and maintainers of \LaTeX, and particularly
% to the authors of NFSS\@. 
%
% Portions of this package were stolen from the \pkg{mathtimy}~package
% by Aloysius Helminck, and from the \TeX~files provided with the
% MathT\i me distribution.
%
% The ``operative'' part of this package was written before
% the release of the \pkg{mathtime} package by Y\&Y\@.
%
% \small
% MathT\i me is a trademark of Publish or Perish, Inc.
%
% A bunch of other names are trademarks or
% registered trademarks, as everybody knows\ldots
%
% The contact address for Y\&Y is\\
% \begin{quote}
% Y\&Y, Inc.\\
% 106 Indian Hill\\
% Carlisle, MA 01741\\
% USA\\
% \texttt{http://www.yandy.com}
% \end{quote}
%
% This software is provided ``\textsc{as-is}'', with no warranty
% of any kind; the user assumes all responsibility for its use.
% }
%
% \noindent The author has no association with Y\&Y,\,Inc., other than
% having purchased the MathT\i me fonts.
%
% \StopEventually{}
% \bigskip
% \hrule height0.6pt\relax
%
% \section{Implementation}
% We start by the usual identifications. We need a few commands
% not present in early versions of~NFSS\,2, so check for the date.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{mt11p}%
        [\filedate: setup\space for\space Times\space
         +\space MathTime\space +\space MathTimePlus]
%    \end{macrocode}
% Before we do anything real,
% check the catcodes of a few characters in case some fanatic
% changed them already. These are the characters I've
% seen activated in various packages.
% 
% We hope the the single left quote wasn't\ldots
%    \begin{macrocode}
\chardef\mt@quotedbl   \catcode`\"
\chardef\mt@quotesinglr\catcode`\'
\chardef\mt@colon      \catcode`\:
\chardef\mt@question   \catcode`\?
\chardef\mt@semicolon  \catcode`\;
\chardef\mt@exclam     \catcode`\!
\@makeother\"
\@makeother\'
\@makeother\:
\@makeother\?
\@makeother\;
\@makeother\!
%    \end{macrocode}
% 
% \subsection{Option Declarations}
% We will need the option setting in conditionals at various points,
% so use integers (\cs{chardef}s) as flags.
%
% There are three options relevant to text font encodings:
% either make the default \texttt{T1},
% or make the default~\texttt{OT1},
% or don't touch \cs{encodingdefault}. The upright
% ``roman'' (\cs{rmdefault}) is used for
% the \texttt{operators}~math family, so the choice
% of text encoding has implications for math.
% This package can handle (in as much as it needs to) with
% any of the following: \texttt{T1}, \texttt{OT1} or a superset thereof,
% \texttt{8r} and~\texttt{8a}. See the commented source
% code if you need more information,~Sec.\,\ref{fromops}.
%    \begin{macrocode}
\DeclareOption{T1}{\def\mt@enc{\def\encodingdefault{T1}}}
\DeclareOption{OT1}{\def\mt@enc{\def\encodingdefault{OT1}}}
\DeclareOption{noenc}{\let\mt@enc\relax}
%    \end{macrocode}
%
% Next the options for dealing with what math symbols to
% take from the \texttt{operator} family.
% Either take everything from elsewhere,
% or take `safe' things from \texttt{operators},
% or take as much as possible from \texttt{operators}, which could be
% dangerous in some circumstances; see~Sec.\,\ref{fromops}\@.
%    \begin{macrocode*}
\DeclareOption{opnone}{\chardef\mt@ops0 }
\DeclareOption{opsafe}{\chardef\mt@ops1 }
\DeclareOption{opmax}{\chardef\mt@ops2 }
%    \end{macrocode*}
%
% Accents can either come from \texttt{operators} and follow
% math alphabets (usual case),
% or be always taken from \texttt{symbols}.
%    \begin{macrocode*}
\DeclareOption{opaccents}{\chardef\mt@accs0 }
\DeclareOption{symaccents}{\chardef\mt@accs1 }
%    \end{macrocode*}
%
% We need options to control the handling of 
% script/calligraphy fonts.
%    \begin{macrocode*}
\DeclareOption{mtcal}{\chardef\mt@cal0 }
\DeclareOption{cmcal}{\chardef\mt@cal1 }
\DeclareOption{nomtms}{\chardef\mt@cal2 }
%    \end{macrocode*}
% 
% In order to cooperate with \AmS~macros,
% we provide a switch to \emph{not} define~\cs{hbar},
% i.e., retain the present definition~(if~any).
% You may want to use this to keep~\cs{hbar}
% pointing to the glyph in the \texttt{msbm}~fonts,
% rather than use the faked one we define here,
% though then you'll have a Computer Modern~``$h$''
% which looks too light among Times, and the one provided
% herein isn't too shabby\ldots
%    \begin{macrocode*}
\DeclareOption{dohbar}{\chardef\mt@hbar1 }
\DeclareOption{nohbar}{\chardef\mt@hbar0 }
%    \end{macrocode*}
%
% The \texttt{bold} and \texttt{heavy} math versions
% will probably need some font substitutions, but if you
% have the additional fonts, you can skip the substitutions
% contained herein.
%    \begin{macrocode*}
\DeclareOption{subs}{\chardef\mt@sub1 }
\DeclareOption{nosubs}{\chardef\mt@sub0 }
%    \end{macrocode*}
%
% For historical reasons the~\cs{dag}\@, \cs{ddag}\@,
% \cs{S}~and \cs{P}~symbols have to be dealt with.
% The \texttt{mtmi} virtual fonts use \texttt{ptmi8r}
% raw fonts, so at least
% the TFM~files should be available, and we include just enough
% code to use them for these four symbols.
% Provide an option to explicitly avoid using \texttt{8r}~for
% these symbols; in that case we'll have to use \texttt{OMS}\@.
% A subsequent package could redefine them to use
% the \texttt{TS1}~encoding or something.
% Also provide an option that does nothing at all
% with any of the relevant definitions.
%    \begin{macrocode*}
\DeclareOption{no8r}{\chardef\mt@eightR0 }
\DeclareOption{do8r}{\chardef\mt@eightR1 }
\DeclareOption{nodag}{\chardef\mt@eightR2 }
%    \end{macrocode*}
%
% It may be convenient to get the \cs{boldsymbol}
% macro from the \AmS~style files.
%    \begin{macrocode*}
\DeclareOption{nobsy}{\chardef\mt@bsy0 }
\DeclareOption{bsy}{\chardef\mt@bsy1 }
%    \end{macrocode*}
%
% Before exiting this package should reset the
% subscript sizing, because we're using linearly scaled fonts.
% Provide an option to switch that off.
%    \begin{macrocode}
\DeclareOption{resize}{\def\mt@exit{\MathTimeSizes}}
\DeclareOption{noresize}{\let\mt@exit\relax}
%    \end{macrocode}
%
% This is mainly to test if the active underscore
% is causing any problems.
%    \begin{macrocode*}
\DeclareOption{activesb}{\chardef\mt@sb1 }
\DeclareOption{noactivesb}{\chardef\mt@sb0 }
%    \end{macrocode*}
%
% Now a few options to save math families. The default leaves room
% for four, which may be too little if you also load \AmS, etc.
%    \begin{macrocode*}
\DeclareOption{nomathgr}{\chardef\mt@mgr0 }
\DeclareOption{mathgr}{\chardef\mt@mgr1 }
\DeclareOption{nomathOS}{\chardef\mt@osdg0 }
\DeclareOption{mathOS}{\chardef\mt@osdg1 }
%    \end{macrocode*}
%
% The package to get ``Times/Helvetica/Courier'' might
% have some wiered name:
%    \begin{macrocode}
\DeclareOption{times}{\def\times@style{times}}
\DeclareOption*{\edef\times@style{\CurrentOption}}
%    \end{macrocode}
%
% The defaults are
% \begin{itemize}
% \item \texttt{T1} encoding;
% \item assume the text font package is called \file{times.sty};
% \item use \texttt{operators} for safe glyphs and accents;
% \item use \texttt{mtms} as the \cs{mathcal} font;
% \item declare substitutions for the bold and heavy math versions;
% \item overwrite any existing definition of \cs{hbar};
% \item use \texttt{8r} for \cs{dag}\@, etc.;
% \item fetch the \cs{boldsymbol} \AmS~macro;
% \item get upright Greek and oldstyle digits;
% \item switch to different subscript sizing; and
% \item use the active underscore character.
% \end{itemize}
% Then read the option list.
%    \begin{macrocode}
\ExecuteOptions{T1,times,opsafe,opaccents,mtcal,%
                dohbar,subs,do8r,bsy,resize,mathgr,mathOS,activesb}
\ProcessOptions*
%    \end{macrocode}
%
% \subsection{Text Encoding}
% We have to know that the text \cs{encodingdefault} is, because accents in math mode
% may get taken from the \texttt{operators} font. We make \cs{encodingdefault}
% either \texttt{T1} (default, and preferred), or \texttt{OT1}\@, or
% do nothing with \cs{encodingdefault}\@.
%    \begin{macrocode}
\mt@enc
%    \end{macrocode}
%
% \subsection{Text font setup}
% Here we fetch ``Times +~Helvetica +~Courier'' using the \pkg{times} package,
% or whatever we were told to use, or just do it by hand. On exit
% \cs{rmdefault}\@, \cs{sfdefault} and \cs{ttdefault}
% should be~\textsc{ok}.
%    \begin{macrocode}
\IfFileExists{\times@style.sty}%
        {\RequirePackage{\times@style}}%
        {\PackageWarning{mt11p}{No file `\times@style.sty' found.%
                                \MessageBreak
                                Guessing what the text
                                font familes \MessageBreak
                                are called}
         \renewcommand{\sfdefault}{phv}
         \renewcommand{\rmdefault}{ptm}
         \renewcommand{\ttdefault}{pcr}
         \renewcommand{\bfdefault}{b}}
%    \end{macrocode}
%
% \subsection{Font Sizing} The documentation accompanying MathT\i me
% suggests different subscript sizing. We do it the same way
% the \pkg{mathtimy} package does it, by redefining things like
% \cs{@ixpt} to actually be something other than what the name implies.
% Then we reset all math sizes, from \cs{tiny} to \cs{Huge}\@.
% This is the sizing used in \pkg{mathtimy}\@, which appeares to be
% taken from the files in the MathT\i me distribution. This macro
% gets called just before we exit. Switching between MathT\i me~sizing
% and the default Computer Modern~sizing on the fly makes little sense,
% so we don't try to preserve the original settings.
% The standard sizes are, in sequence, 5, 6, 7, 8, 9, 10, 10.95,
% 12, 14.4, 17.28, 20.74~and 24.88~points, i.e., we decrease the
% `spread' somewhat.
%    \begin{macrocode}
\def\MathTimeSizes{%
  \def\@vpt{6.0}%
  \def\@vipt{6.8}%
  \def\@viipt{7.6}%
  \def\@viiipt{8.4}%
  \def\@ixpt{9.2}%
  \def\@xpt{10.0}%
  \def\@xipt{10.8}%
  \def\@xiipt{11.6}%
  \def\@xivpt{13.2}%
  \def\@xviipt{15.6}%
  \def\@xxpt{18.0}%
  \def\@xxvpt{22.0}%
  \DeclareMathSizes\@vpt   \@vpt   \@vpt   \@vpt
  \DeclareMathSizes\@vipt  \@vipt  \@vpt   \@vpt
  \DeclareMathSizes\@viipt \@viipt \@vpt   \@vpt
  \DeclareMathSizes\@viiipt\@viiipt\@vipt  \@vpt
  \DeclareMathSizes\@ixpt  \@ixpt  \@vipt  \@vpt
  \DeclareMathSizes\@xpt   \@xpt   \@viipt \@vpt
  \DeclareMathSizes\@xipt  \@xipt  \@viipt \@vpt
  \DeclareMathSizes\@xiipt \@xiipt \@viiipt\@vipt
  \DeclareMathSizes\@xivpt \@xivpt \@xpt   \@viipt
  \DeclareMathSizes\@xviipt\@xviipt\@xiipt \@xpt
  \DeclareMathSizes\@xxpt  \@xxpt  \@xivpt \@xiipt
  \DeclareMathSizes\@xxvpt \@xxvpt \@xxpt  \@xviipt
  \PackageInfo{mt11p}{Adjusting math subscript sizing}}
%    \end{macrocode}
%
% \subsection{Fetch the MathT\i me and MathT\i me\textsc{plus} fonts.}
% We don't create \texttt{.fd}~files,
% since the fonts are not for general use.
% We declare them as separate encodings, called \texttt{Lmt}*,
% because they differ quite
% a bit from the \texttt{OM}* encodings, which might lead to trouble if,
% e.g., someone assumed the \texttt{letters}
% font has oldstyle digits or that the \texttt{symbols}
% font has calligraphic letters.
%
% There will be a \emph{heavy} series for some fonts, which we denote by
% the macro \cs{hvdefault}, and an upright italic
% shape, \cs{uidefault}. For the bold and heavy math versions
% we would need additional bold, \emph{ultra}~(\cs{uldefault}) and
% \emph{poster}~(\cs{psdefault}) weight fonts;
% pretend they exist, and then define substitutes.
% For the off chance that these are already
% defined, we ``provide'' them, rather than define them.
% Only the macros are used in the rest of this file, i.e.,
% ``|{ui}|'' never appears again, so no font designations are
% hardwired into this file (except those for common Computer Modern fonts).
%    \begin{macrocode}
\providecommand{\hvdefault}{h}
\providecommand{\uidefault}{ui}
\providecommand{\uldefault}{u}
\providecommand{\psdefault}{p}
%    \end{macrocode}
%
% \paragraph{Letters} Declare the \texttt{letters} fonts.
% Include \cs{noaccents@} so math accents don't break in
% \cs{mathnormal}.
%    \begin{macrocode*}
\DeclareFontEncoding{LmtL}{}{\noaccents@}
\DeclareFontFamily{LmtL}{mtl}{\skewchar\font=45 }
\DeclareFontShape{LmtL}{mtl}{\mddefault}{\itdefault}{<->mtmi}{}
\DeclareFontShape{LmtL}{mtl}{\bfdefault}{\itdefault}{<->mtmib}{}
%    \end{macrocode*}
%    \begin{macrocode}
\DeclareFontShape{LmtL}{mtl}{\hvdefault}{\itdefault}{<->mtmih}{}% see dtx SUBS
%    \end{macrocode}
% Note that the font~\texttt{mtmih} is a virtual font that
% uses~\texttt{ptmbi8r}, so even if you have a ``heavy''
% weight Times italic font, you can't use it as a math
% \texttt{letters} font unless you know how to
% create a suitable raw font and change~\file{mtmih.vf}
% and~\file{mtmih.vf}. The same applies to~\file{mtmuh}.
%
% Declare the \texttt{letters} font with upright lower case Greek letters too; we won't
% do anything with them, but we will describe how to set them up, if someone
% wants to use them as symbols~(Sec.\,\ref{unused}).
%    \begin{macrocode}
\DeclareFontShape{LmtL}{mtl}{\mddefault}{\uidefault}{<->mtmu}{}
\DeclareFontShape{LmtL}{mtl}{\bfdefault}{\uidefault}{<->mtmub}{}
\DeclareFontShape{LmtL}{mtl}{\hvdefault}{\uidefault}{<->mtmuh}{}
%    \end{macrocode}
%
% \paragraph{Symbols} Now the \texttt{symbols} font:
%    \begin{macrocode}
\DeclareFontEncoding{LmtS}{}{\no@accents}%
\DeclareFontFamily{LmtS}{mts}{}% the fonts have no skewkerns
%    \end{macrocode}
% Why do we say \cs{no@accents} when this is the \emph{one} font that
% \emph{will} have accents if we don't find any elsewhere?---because
% they are in non-standard slots. There is no ``\cs{mathsy}''
% alphabet, but someone could try to be clever and define
% one. Since we said \cs{noaccents@}, we might as well do the following
% re-declarations (\AmS~does them too).
%    \begin{macrocode}
\DeclareFontEncoding{OML}{}{\noaccents@}
\DeclareFontEncoding{OMS}{}{\noaccents@}
%    \end{macrocode}
% \texttt{mtsyn} and the older \texttt{mtsy} differ only in the
% \texttt{radical1}~glyph
% (\texttt{C132},~$\mathit{'204}$), which is a surd/radical
% at the baseline (as opposed to below it),
% otherwise identical to the other radical sign
% at~$\mathit{'160}$; see~Sec.\,\ref{realunused}.
%    \begin{macrocode}
\DeclareFontShape{LmtS}{mts}{\mddefault}{\updefault}{<->mtsyn}{}
\DeclareFontShape{LmtS}{mts}{\bfdefault}{\updefault}{<->mtsyb}{}
\DeclareFontShape{LmtS}{mts}{\hvdefault}{\updefault}{<->mtsyh}{}
%    \end{macrocode}
% 
% \paragraph{Script Letters} The letters-only \texttt{mtms}* fonts, which
% we use for \cs{mathcal} and/or~\cs{mathscr}.
%    \begin{macrocode*}
\DeclareFontEncoding{LmtW}{}{\noaccents@}
\DeclareFontFamily{LmtW}{mtw}{\skewchar\font=42 \hyphenchar\font=-1 }
\DeclareFontShape{LmtW}{mtw}{\mddefault}{\updefault}{<->mtms}{}
\DeclareFontShape{LmtW}{mtw}{\bfdefault}{\updefault}{<->mtmsb}{}
%    \end{macrocode*}
%
% \paragraph{Math Extention}
% The \texttt{largesymbols} and math extension fonts \texttt{mtex}*
% are compatible with \texttt{OMX}; the only difference is an extra radical
% in slot~$\mathit{'237}$, which we don't use, because it is identical
% to the one in the \texttt{symbols} font~($\mathit{'160}$).
%    \begin{macrocode}
\DeclareFontFamily{OMX}{mtx}{}% this really is OMX, thank you
\DeclareFontShape{OMX}{mtx}{\mddefault}{\updefault}{<->mtex}{}
\DeclareFontShape{OMX}{mtx}{\bfdefault}{\updefault}{<->mtexb}{}
\DeclareFontShape{OMX}{mtx}{\hvdefault}{\updefault}{<->mtexh}{}
%    \end{macrocode}
%
% \paragraph{Greek Text} MathT\i me includes a font with
% upright Greek letters, upper and lower case, meant for
% use as \emph{letters} (as opposed to \textit{symbols})\@.
% The fonts have ligatures with empty slots to get
% alternate forms---see Section~8 of the
% \textit{MathT\i me\/}\textsc{plus} reference manual.
%    \begin{macrocode}
\DeclareFontEncoding{LmtG}{}{\noaccents@}
\DeclareFontFamily{LmtG}{mtg}{}
\DeclareFontShape{LmtG}{mtg}{\mddefault}{\updefault}{<->mtgu}{}
\DeclareFontShape{LmtG}{mtg}{\bfdefault}{\updefault}{<->mtgub}{}
%    \end{macrocode}
%
% Lastly, declare default for the new encodings, so NFSS~is happy.
%    \begin{macrocode}
\DeclareFontSubstitution{LmtL}{mtl}{\mddefault}{\itdefault}
\DeclareFontSubstitution{LmtS}{mts}{\mddefault}{\updefault}
\DeclareFontSubstitution{LmtW}{mtw}{\mddefault}{\updefault}
\DeclareFontSubstitution{LmtG}{mtg}{\mddefault}{\updefault}
%    \end{macrocode}
%
% \subsection{Math declarations}
% We assume the usual math setup was loaded into
% the format and change things around to use MathT\i me.
% If for some reason you don't read a standard math setup
% into the format, you'll have to read the setup in before
% loading this package. Note that it is not necessary to
% ``preload'' the standard Computer Modern
% font metrics, if font memory is a problem.
%
% \paragraph{Math Versions}
% We use three math versions, \textit{normal}\@,
% \textit{bold}\@, and \textit{heavy}\@, and keep everything separate,
% as if there really were three sets of fonts available for everything. Actually,
% they're not, but one could use the hooks to supply such fonts if one had them.
%
% Give a notice so people don't freak when they see all the warnings
% messages NFSS~emits.
%    \begin{macrocode}
\PackageWarning{mt11p-Font}{Expect LOTS of NFSS warnings}
%    \end{macrocode}
%
% Some of the code that follows is redundant.
%    \begin{macrocode}
\DeclareMathVersion{normal}
\DeclareMathVersion{bold}
\DeclareMathVersion{heavy}
\def\normalmath{\@nomath\normalmath\mathversion{normal}}
\def\boldmath{\@nomath\boldmath\mathversion{bold}}
\def\heavymath{\@nomath\heavymath\mathversion{heavy}}
\def\unboldmath{\normalmath}
\let\unheavymath\unboldmath
%    \end{macrocode}
% This is a private joke\ldots
%    \begin{macrocode}
\let\unnormalmath\relax
%    \end{macrocode}
%
% \paragraph{Declare Math Font Families}
% The following does not depend on any options:
%    \begin{macrocode}
\DeclareSymbolFont{operators}{\encodingdefault}%
                             {\rmdefault}{\mddefault}{\updefault}
\DeclareSymbolFont{letters}{LmtL}%
                           {mtl}{\mddefault}{\itdefault}
\DeclareSymbolFont{symbols}{LmtS}%
                           {mts}{\mddefault}{\updefault}
\DeclareSymbolFont{largesymbols}{OMX}%
                                {mtx}{\mddefault}{\updefault}
\DeclareSymbolFontAlphabet \mathnormal {letters}
\DeclareSymbolFontAlphabet \mathrm     {operators}
\DeclareMathAlphabet \mathbf {\encodingdefault}%
                             {\rmdefault}{\bfdefault}{\updefault}
\DeclareMathAlphabet \mathsf {\encodingdefault}%
                             {\sfdefault}{\mddefault}{\updefault}
\DeclareMathAlphabet \mathit {\encodingdefault}%
                             {\rmdefault}{\mddefault}{\itdefault}
\DeclareMathAlphabet \mathtt {\encodingdefault}%
                             {\ttdefault}{\mddefault}{\updefault}
%    \end{macrocode}
%
% The calligraphy stuff depends on what `\texttt{cal}' option is being used;
% we either
%    use \texttt{mtms} as the \cs{mathcal} font,
% \textsc{or}
%    we make \texttt{cmsy} the \cs{mathcal} font
%    and make \texttt{mtms} a ``script'' font~\cs{mathscr}\@,
% \textsc{or}
%    we make \texttt{cmsy} the \cs{mathcal} font
%    and don't use \texttt{mtms} for anything.
%    \begin{macrocode}
\ifcase\mt@cal % case 0
   \DeclareMathAlphabet \mathcal {LmtW}{mtw}{\mddefault}{\updefault}
\or            % case 1
   \DeclareMathAlphabet \mathscr {LmtW}{mtw}{\mddefault}{\updefault}
   \DeclareMathAlphabet \mathcal {OMS}{cmsy}{m}{n}
\or            % case 2
   \DeclareMathAlphabet \mathcal {OMS}{cmsy}{m}{n}
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@cal}%
                {The \string\mathcal/\string\mathscr setup is hosed.}
\fi
%    \end{macrocode}
% We'll have to deal with more \cs{mathcal}-related stuff later.
%
% Note that things 
% defined via \cs{DeclareSymbolFontAlphabet} switch math versions
% automatically with \cs{SetSymbolFont}; these include \cs{mathnormal}
% and \cs{mathrm}.
%
% \paragraph{Normal Math Version} This is largely redundant.
%    \begin{macrocode}
\SetSymbolFont{operators}{normal}{\encodingdefault}%
                                 {\rmdefault}{\mddefault}{\updefault}
\SetSymbolFont{letters}{normal}{LmtL}%
                               {mtl}{\mddefault}{\itdefault}
\SetSymbolFont{symbols}{normal}{LmtS}%
                               {mts}{\mddefault}{\updefault}
\SetSymbolFont{largesymbols}{normal}{OMX}%
                                    {mtx}{\mddefault}{\updefault}
\SetMathAlphabet \mathsf {normal}%
                {\encodingdefault}{\sfdefault}{\mddefault}{\updefault}
\SetMathAlphabet \mathtt {normal}%
                {\encodingdefault}{\ttdefault}{\mddefault}{\updefault}
\SetMathAlphabet \mathit {normal}%
                {\encodingdefault}{\rmdefault}{\mddefault}{\itdefault}
\SetMathAlphabet \mathbf {normal}%
                {\encodingdefault}{\rmdefault}{\hvdefault}{\updefault}
%    \end{macrocode}
% \cs{mathcal} and \cs{mathscr} have several cases.
%    \begin{macrocode}
\ifcase\mt@cal % case 0
   \SetMathAlphabet \mathcal {normal}{LmtW}{mtw}{\mddefault}{\updefault}
\or            % case 1
   \SetMathAlphabet \mathscr {normal}{LmtW}{mtw}{\mddefault}{\updefault}
   \SetMathAlphabet \mathcal {normal}{OMS}{cmsy}{m}{n}
\or            % case 2
   \SetMathAlphabet \mathcal {normal}{OMS}{cmsy}{m}{n}
\fi
%    \end{macrocode}
%
% \paragraph{Bold Math Version} Same story as above.
%    \begin{macrocode}
\SetSymbolFont{operators}{bold}{\encodingdefault}%
                               {\rmdefault}{\bfdefault}{\updefault}
\SetSymbolFont{letters}{bold}{LmtL}%
                             {mtl}{\bfdefault}{\itdefault}
\SetSymbolFont{symbols}{bold}{LmtS}%
                             {mts}{\bfdefault}{\updefault}
\SetSymbolFont{largesymbols}{bold}{OMX}%
                                  {mtx}{\bfdefault}{\updefault}
\SetMathAlphabet \mathsf {bold}{\encodingdefault}%
                               {\sfdefault}{\bfdefault}{\updefault}
\SetMathAlphabet \mathtt {bold}{\encodingdefault}%
                               {\ttdefault}{\bfdefault}{\updefault}
\SetMathAlphabet \mathit {bold}{\encodingdefault}%
                               {\rmdefault}{\bfdefault}{\itdefault}
\SetMathAlphabet \mathbf {bold}{\encodingdefault}%
                               {\rmdefault}{\uldefault}{\updefault}
%    \end{macrocode}
% And the cases
%    \begin{macrocode}
\ifcase\mt@cal % case 0
   \SetMathAlphabet \mathcal {bold}{LmtW}{mtw}{\bfdefault}{\updefault}
\or            % case 1
   \SetMathAlphabet \mathscr {bold}{LmtW}{mtw}{\bfdefault}{\updefault}
   \SetMathAlphabet \mathcal {bold}{OMS}{cmsy}{b}{n}
\or            % case 2
   \SetMathAlphabet \mathcal {bold}{OMS}{cmsy}{b}{n}
\fi
%    \end{macrocode}
%
% \paragraph{Heavy Math Version} Still more of the same.
%    \begin{macrocode}
\SetSymbolFont{operators}{heavy}{\encodingdefault}%
                                {\rmdefault}{\hvdefault}{\updefault}
\SetSymbolFont{letters}  {heavy}{LmtL}%
                                {mtl}{\hvdefault}{\itdefault}
\SetSymbolFont{symbols}  {heavy}{LmtS}%
                                {mts}{\hvdefault}{\updefault}
\SetSymbolFont{largesymbols}{heavy}{OMX}%
                                   {mtx}{\hvdefault}{\updefault}
\SetMathAlphabet \mathsf {heavy}{\encodingdefault}%
                                {\sfdefault}{\hvdefault}{\updefault}
\SetMathAlphabet \mathtt {heavy}{\encodingdefault}%
                                {\ttdefault}{\hvdefault}{\updefault}
\SetMathAlphabet \mathit {heavy}{\encodingdefault}%
                                {\rmdefault}{\hvdefault}{\itdefault}
\SetMathAlphabet \mathbf {heavy}{\encodingdefault}%
                                {\rmdefault}{\psdefault}{\updefault}%
%    \end{macrocode}
% And the cases for script,
%    \begin{macrocode}
\ifcase\mt@cal % case 0
   \SetMathAlphabet \mathcal {heavy}{LmtW}{mtw}{\hvdefault}{\updefault}
\or            % case 1
   \SetMathAlphabet \mathscr {heavy}{LmtW}{mtw}{\hvdefault}{\updefault}
   \SetMathAlphabet \mathcal {heavy}{OMS}{cmsy}{\hvdefault}{\updefault}
\or            % case 2
   \SetMathAlphabet \mathcal {heavy}{OMS}{cmsy}{\hvdefault}{\updefault}
\fi
%    \end{macrocode}
%
% \subsection{Bold \& heavy font substitutions}
% We pretended there are all sorts of weights available,
% but, in fact, they're not. Declare substitutions, unless we were told not to.
% NFSS~will complain if we use an as-of-yet undeclared font as a substitute, so
% we explicitly read in the \file{.fd}~files (this happens later
% for other fonts too). No harm will be done if they
% have already been read. Read in even \file{OMScmsy.fd}, in case the
% format has zilch preloaded.
%
%    \begin{macrocode}
\ifcase\mt@sub % case 0
   \PackageWarning{mt11p}{No math font substitutions set}
%    \end{macrocode}
% Check for and read in the files
%   $\langle$\cs{encodingdefault}$\!\rangle %
%    \langle$\texttt{\char`\\}\textit{xy\/}\texttt{default}$
%  \!\rangle$\texttt{.fd} for the three text families.
% Be nice and check for the all-lower case name too.
%    \begin{macrocode}
\or % case 1
   \def\mt@fd@check#1{%
          \edef\reserved@a{\lowercase{\noexpand
                              \InputIfFileExists{\encodingdefault #1.fd}}}%
          \reserved@a\relax{\InputIfFileExists{\encodingdefault #1.fd}\relax
                       {\PackageError{mt11p}%
                         {No file `\encodingdefault#1.fd' found}%
                         {Your text \string#1 setup looks inconsistent.}}}}
   \mt@fd@check\rmdefault
   \mt@fd@check\sfdefault
   \mt@fd@check\ttdefault
   \edef\reserved@a{\lowercase{\noexpand\InputIfFileExists{omscmsy.fd}}}%
   \reserved@a\relax{\InputIfFileExists{OMScmsy.fd}\relax
                {\PackageError{mt11p}{No OMScmsy.fd file}%
                         {Your are missing a basic distribution file. %
                                      Check the LaTeX installation.}}}
   \DeclareFontShape{\encodingdefault}%
                    {\rmdefault}{\hvdefault}{\updefault}% heavy \rm SUBS
                    {<->ssub*\rmdefault/\bfdefault/\updefault}{}
   \DeclareFontShape{\encodingdefault}%
                    {\sfdefault}{\hvdefault}{\updefault}% heavy \sf SUBS
                    {<->ssub*\sfdefault/\bfdefault/\updefault}{}
   \DeclareFontShape{\encodingdefault}%
                    {\ttdefault}{\hvdefault}{\updefault}% heavy \tt SUBS
                    {<->ssub*\ttdefault/\bfdefault/\updefault}{}
   \DeclareFontShape{\encodingdefault}%
                    {\rmdefault}{\psdefault}{\updefault}% poster \rm SUBS
                    {<->ssub*\rmdefault/\bfdefault/\updefault}{}
   \DeclareFontShape{LmtW}%
                    {mtw}{\hvdefault}{\updefault}%      heavy mtms SUBS
                    {<->ssub*mtw/\bfdefault/\updefault}{}
   \DeclareFontShape{OMS}{cmsy}{\hvdefault}{\updefault}%
                    {<->ssub*cmsy/b/n}{}%               heavy cmsy SUBS
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@sub}%
                {No math font substitutions set.}
\fi
%    \end{macrocode}
%
% \subsection{Mathcodes} The MathT\i me fonts are \emph{nearly}
% replacements
% for Computer Modern, but there are a few things to fix up.
% We also make it possible to take some
% symbols and accents from either 
% \texttt{operators} or from elsewhere,
% depending on the options; this will be done later.
%
% \paragraph{\texttt{letters} Font} Upright upper case
% Greek no longer comes from
% the \texttt{operators} font, but from the
% \texttt{letters} font, so
% upper and lower case Greek letters now behave identically,
% namely as math symbols.
% This means that something like
% |$\mathit{\Delta\Gamma}\mathbf{\Xi}$| no longer
% works---upper case Greek letters are not affected by math alphabet changes.
% There is no simple fix.
%
% Upright upper case Greek:
%    \begin{macrocode}
\DeclareMathSymbol\Gamma      {\mathord}{letters}{'060}
\DeclareMathSymbol\Delta      {\mathord}{letters}{'061}
\DeclareMathSymbol\Theta      {\mathord}{letters}{'062}
\DeclareMathSymbol\Lambda     {\mathord}{letters}{'063}
\DeclareMathSymbol\Xi         {\mathord}{letters}{'064}
\DeclareMathSymbol\Pi         {\mathord}{letters}{'065}
\DeclareMathSymbol\Sigma      {\mathord}{letters}{'066}
\DeclareMathSymbol\Upsilon    {\mathord}{letters}{'067}
\DeclareMathSymbol\Phi        {\mathord}{letters}{'070}
\DeclareMathSymbol\Psi        {\mathord}{letters}{'071}
\DeclareMathSymbol\Omega      {\mathord}{letters}{'177}
%    \end{macrocode}
% Italic upper case Greek; \AmS~calls these
% \cs{var}$\langle\!\mathit{Greek\;Letter}\rangle$.
%    \begin{macrocode}
\DeclareMathSymbol\varGamma   {\mathord}{letters}{'000}
\DeclareMathSymbol\varDelta   {\mathord}{letters}{'001}
\DeclareMathSymbol\varTheta   {\mathord}{letters}{'002}
\DeclareMathSymbol\varLambda  {\mathord}{letters}{'003}
\DeclareMathSymbol\varXi      {\mathord}{letters}{'004}
\DeclareMathSymbol\varPi      {\mathord}{letters}{'005}
\DeclareMathSymbol\varSigma   {\mathord}{letters}{'006}
\DeclareMathSymbol\varUpsilon {\mathord}{letters}{'007}
\DeclareMathSymbol\varPhi     {\mathord}{letters}{'010}
\DeclareMathSymbol\varPsi     {\mathord}{letters}{'011}
\DeclareMathSymbol\varOmega   {\mathord}{letters}{'012}
%    \end{macrocode}
% Lower case Greek letters are \textsc{ok}, except for
%    \begin{macrocode}
\DeclareMathSymbol\varkappa   {\mathord}{letters}{'176}
\DeclareMathSymbol\omicron    {\mathord}{letters}{`\o}% for completeness
%    \end{macrocode}
%
% \paragraph{\texttt{symbols} Font}
% There are a few new symbols, and the fonts no longer contain
% calligraphic letters.
% Easy things (those where no alternatives are available) first; the
% new names are those used in the MathT\i me distribution.
%    \begin{macrocode}
\DeclareMathSymbol\openclubsuit   {\mathord}{symbols}{"78}
\DeclareMathSymbol\shadedclubsuit {\mathord}{symbols}{"79}
\DeclareMathSymbol\openspadesuit  {\mathord}{symbols}{"7A}
\DeclareMathSymbol\shadedspadesuit{\mathord}{symbols}{"7B}
\DeclareMathSymbol\triangleleft   {\mathbin}{symbols}{"47}
\DeclareMathSymbol\triangleright  {\mathbin}{symbols}{"46}
\DeclareMathSymbol\cupprod        {\mathbin}{symbols}{"59}
\DeclareMathSymbol\capprod        {\mathbin}{symbols}{"5A}
%    \end{macrocode}
% The \cs{varcirc} symbol is slightly smaller than the `open bullet'.
% \pkg{mathtimy} calls it ``\cs{comp}''.
%    \begin{macrocode}
\DeclareMathSymbol\varcirc{\mathbin}{symbols}{"42}
\let\comp=\varcirc
%    \end{macrocode}
% \cs{vec} used to be in \texttt{letters}, now it's
% in \texttt{symbols}\@.
%    \begin{macrocode}
\DeclareMathAccent\vec    {\mathord}{symbols}{"45}
%    \end{macrocode}
% \texttt{mtsy} has an accent glyph called \texttt{overbar},
% which \pkg{mathtimy} calls \cs{widebar}\@.
%    \begin{macrocode}
\DeclareMathAccent\overbar{\mathord}{symbols}{"53}
\let\widebar\overbar
%    \end{macrocode}
%
% The glyph called \texttt{backslash} in the AFM~file
% of~\texttt{mtsyn} is the one usually used for
% \cs{setminus}\@, and the format file has a definition
% for it (\texttt{symbols},~slot~|"6E|).
% There is a \texttt{setminus} in the AFM~file, but it looks
% somewhat like a tilted minus sign.
% \AmS~packages call that glyph ``\cs{smallsetminus}''.
%    \begin{macrocode}
\DeclareMathSymbol\varsetminus{\mathbin}{symbols}{"58}
\let\smallsetminus\varsetminus
%    \end{macrocode}
%
% \paragraph{Calligraphic letters and their variants}
% Irrespective of the options, both \cs{mathcal}
% and \cs{mathscr} get defined; warn only when
% the \texttt{nomtms}~option is used.
%    \begin{macrocode}
\ifcase\mt@cal % case 0
   \let\mathscr\mathcal % don't warn
\or            % case 1
\or            % case 2
   \def\mathscr#1{\mathcal{#1}%
              \PackageWarning{mt11p}{no \string\mathscr\space available;
                           \MessageBreak using OMScmsy \string\mathcal}}
\fi
%    \end{macrocode}
% We don't try to trap cases like |\mathcal{a}| when
% the \cs{mathcal} alphabet is~\texttt{OMS} (and hence
% has no lowercase letters!). Presumably by
% writing |\mathcal{a}| you know that \cs{mathcal}~is
% \texttt{LmtW}, i.e., the \texttt{mtcal}~option is in effect.
% Writing |\mathscr{a}| when \cs{mathscr} is essentially
% a synonym for~\cs{mathcal} will at least produce a warning.
%
% \texttt{mtms}* has alternate forms of a few letters. We define
% math commands to fetch them, assuming we
% have an \texttt{mtms}*~font as~\cs{mathscr}.
% (The script letters have sidebearings which make them
% unsuitable for text; use math mode for logos and such.)
% The auxiliary macro will be defined later.
%    \begin{macrocode}
\def\varA   {\mt@al@hexsy\mathscr{30}}
\def\varE   {\mt@al@hexsy\mathscr{31}}
\def\varG   {\mt@al@hexsy\mathscr{32}}
\def\varvarG{\mt@al@hexsy\mathscr{33}}
\def\varI   {\mt@al@hexsy\mathscr{34}}
\def\varL   {\mt@al@hexsy\mathscr{35}}
\def\varQ   {\mt@al@hexsy\mathscr{36}}
\def\varS   {\mt@al@hexsy\mathscr{37}}
\def\varr   {\mt@al@hexsy\mathscr{38}}
\def\varz   {\mt@al@hexsy\mathscr{39}}
\def\iscript{\mt@al@hexsy\mathscr{7B}}% can't use \imath
\def\jscript{\mt@al@hexsy\mathscr{7C}}% can't use \jmath
%    \end{macrocode}
% The MathT\i me
% distribution defines the macro~\cs{script}, which is
% supposed to produce the script letter~``A'' and its alternate
% form with~``|\script A|'' and~``|\script*A|'', respectively.
% The argument of~\cs{script} had better be
% a single token (or an asterisk and a single token),
% else we get a mess; in order to
% get the expected output that token should be a
% single~$\mathrm{letter}_{11}$, one of those that have variant forms.
%    \begin{macrocode}
\DeclareRobustCommand\script{\@ifstar\@varscript\@script}
\ifnum\mt@cal<2 % mtms available
   \def\@script#1{\mathscr{#1}}
   \def\@varscript#1{%
               \ifx#1A\varA
          \else\ifx#1E\varE
          \else\ifx#1G\varG
          \else\ifx#1g\varvarG
          \else\ifx#1I\varI
          \else\ifx#1L\varL
          \else\ifx#1Q\varQ
          \else\ifx#1S\varS
          \else\ifx#1r\varr
          \else\ifx#1z\varz
          \else\ifx#1i\iscript
          \else\ifx#1j\jscript
          \else       \PackageWarning{mt11p}{#1: no such variant letter}%
                                    \mathscr{#1}%
          \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi}
\else % OMS only
   \def\@script#1{\mathscr{#1}}
   \def\@varscript#1{\PackageWarning{mt11}%
                             {no variant letters available in OMS}%
                             \@script{#1}}
\fi
%    \end{macrocode}
% The above will produce \emph{two} warnings if you say |$\mathcal{a}$|
% with the \texttt{nomtms}~option in effect.
%
% \paragraph{Symbols from either \texttt{operators} or from elsewhere}
% \label{fromops}
% Many symbols and punctuation marks can be taken from either
% the \texttt{operators} math family, or from
% \texttt{letters}/\texttt{symbols}\@. Most of the glyphs
% are virtually identical in either font. The `optimal' choice
% depends on several things, e.g., do you wish to use as few glyphs from
% the MathT\i me fonts as possible, do you prefer `thinner' symbols, etc.
% The \texttt{opmax} option will take as many things from
% \texttt{operators} as possible, but
% risk, e.g., that the $=$~sign will not line up with double
% arrows,~etc.
% The \texttt{opsafe}~option uses \texttt{operators}
% glyphs only when absolutly nothing can go wrong;
% the \texttt{opnone} option \emph{avoids} \texttt{operators}
% whenever possible and uses MathT\i me glyphs instead.
%
% The \texttt{operators} font is uses the encoding
% \cs{encodingdefault}. We \emph{must} recognize that encoding
% in order to take any symbols from \texttt{operators}.
% The only encodings I know of that someone might possibly be
% using with \LaTeXe{} are
% \texttt{T1}\@, \texttt{OT1}~or a superset thereof, \texttt{8r} and
% \texttt{8a}. It's easy to hack in another encoding, if required,
% as would be the case with a superset or \texttt{OT1}\@.
% If we don't recognize the encoding, stick to using
% \texttt{symbols} and~\texttt{letters}.
%
% NFSS~has a ``\cs{DeclareMathDelimiter}'' but nothing
% to assign \cs{delcode}s. We try to make a general macro
% and insist on saying ``\cs{symletters}'' rather than
% just saying~``\texttt{1}'', eventhough it's pretty
% much out of the question that \cs{symoperators},
% \cs{symletters}, \cs{symsymbols} and \cs{symlargeoperators}
% are something other than 0, 1, 2 and~3, respectively, since
% \TeX~itself checks for extra \texttt{fontdimen}s
% of \cs{fam2} and~\cs{fam3} before it agrees to typeset math.
% (The second and fourth arguments should be hexadecimal numbers
% without the~``\texttt"''.)
%    \begin{macrocode}
\def\mt@assign@del#1#2#3#4#5{%
         \edef\reserved@a{\expandafter\the\csname sym#2\endcsname}%
         \edef\reserved@b{\expandafter\the\csname sym#4\endcsname}%
         \delcode#1="\reserved@a#3\reserved@b#5 \relax}
%    \end{macrocode}
% 
% This code is read once and not stored, so
% we just write the whole thing out case by case.
% \cs{colon}~is defined in some of the \AmS~packages, so
% don't overwrite an existing definition.
%
% Here's the overly conservative option:
%    \begin{macrocode}
\ifcase\mt@ops % case 0
   \DeclareMathSymbol{(}{\mathopen}{letters}{"2E}
   \mt@assign@del{`\(}{letters}{2E}{largesymbols}{00}
   \DeclareMathSymbol{)}{\mathclose}{letters}{"2F}
   \mt@assign@del{`\)}{letters}{2F}{largesymbols}{01}
   \DeclareMathSymbol{+}{\mathbin}{symbols}{"43}
   \DeclareMathSymbol{=}{\mathrel}{symbols}{"44}% identical one at "48
   \DeclareMathSymbol{;}{\mathpunct}{symbols}{"49}
   \DeclareMathSymbol{[}{\mathopen}{symbols}{"54}
   \mt@assign@del{`\[}{symbols}{54}{largesymbols}{02}
   \DeclareMathSymbol{]}{\mathclose}{symbols}{"55}
   \mt@assign@del{`\]}{symbols}{55}{largesymbols}{03}
   \DeclareMathSymbol{:}{\mathrel}{symbols}{"56}
   \ifx\colon\undefined
      \DeclareMathSymbol{\colon}{\mathpunct}{symbols}{"56}
   \fi
   \DeclareMathSymbol{!}{\mathclose}{symbols}{"57}
   \DeclareMathSymbol{.}{\mathord}{letters}{"3A}
   \DeclareMathSymbol{\period}{\mathpunct}{letters}{"3A}
   \DeclareMathSymbol{,}{\mathpunct}{letters}{"3B}
   %\DeclareMathSymbol{<}{\mathrel}{letters}{"3C}% format defaults
   %\DeclareMathSymbol{>}{\mathrel}{letters}{"3E}
   %\DeclareMathSymbol{|}{\mathord}{symbols}{"6A}
   %\DeclareMathSymbol{/}{\mathord}{letters}{"3D}
   %\DeclareMathSymbol{-}{\mathbin}{symbols}{"00}
%    \end{macrocode}
% Now the safe version; the stuff we take from operators
% never gets used in ``synthesized'' or extensible symbols.
%    \begin{macrocode}
\or           % case 1
   \DeclareMathSymbol{(}{\mathopen}{operators}{`\(}
   \mt@assign@del{`\(}{operators}{28}{largesymbols}{00}
   \DeclareMathSymbol{)}{\mathclose}{operators}{`\)}
   \mt@assign@del{`\)}{operators}{29}{largesymbols}{01}
   \DeclareMathSymbol{+}{\mathbin}{symbols}{"43}
   \DeclareMathSymbol{=}{\mathrel}{symbols}{"44}% identical one at "48
   \DeclareMathSymbol{;}{\mathpunct}{operators}{`\;}
   \DeclareMathSymbol{[}{\mathopen}{operators}{`\[}
   \mt@assign@del{`\[}{operators}{5B}{largesymbols}{02}
   \DeclareMathSymbol{]}{\mathclose}{operators}{`\]}
   \mt@assign@del{`\]}{operators}{5D}{largesymbols}{03}
   \DeclareMathSymbol{:}{\mathrel}{operators}{`\:}
   \ifx\colon\undefined % AMS defines it differently; don't overwrite that
      \DeclareMathSymbol{\colon}{\mathpunct}{operators}{`\:}
   \fi
   \DeclareMathSymbol{!}{\mathclose}{operators}{`\!}
   \DeclareMathSymbol{.}{\mathord}{operators}{`\.}
   \DeclareMathSymbol{\period}{\mathpunct}{operators}{`\.}
   \DeclareMathSymbol{,}{\mathpunct}{operators}{`\,}
   %\DeclareMathSymbol{<}{\mathrel}{letters}{"3C}% format defaults
   %\DeclareMathSymbol{>}{\mathrel}{letters}{"3E}
   %\DeclareMathSymbol{|}{\mathord}{symbols}{"6A}
   %\DeclareMathSymbol{/}{\mathord}{letters}{"3D}
   %\DeclareMathSymbol{-}{\mathbin}{symbols}{"00}
%    \end{macrocode}
% Now \texttt{opmax}. This is risky, or more exactly
% some glyphs \emph{will} be flawed, because the minus
% and equal signs won't line up with arrows, etc. On the
% other hand, this will minimize the use of non-resident fonts,
% so it may make the final output marginally smaller if
% you have partial font downloading or if you include
% the MathT\i me fonts as bitmaps.
%    \begin{macrocode}
\or           % case 2
   \PackageWarning{mt11p}{opmax enabled}
   \DeclareMathSymbol{(}{\mathopen}{operators}{`\(}
   \mt@assign@del{`\(}{operators}{28}{largesymbols}{00}
   \DeclareMathSymbol{)}{\mathclose}{operators}{`\)}
   \mt@assign@del{`\)}{operators}{29}{largesymbols}{01}
   \DeclareMathSymbol{+}{\mathbin}{operators}{`\+}
   \DeclareMathSymbol{=}{\mathrel}{operators}{`\=}% dangerous
   \DeclareMathSymbol{;}{\mathpunct}{operators}{`\;}
   \DeclareMathSymbol{[}{\mathopen}{operators}{`\[}
   \mt@assign@del{`\[}{operators}{5B}{largesymbols}{02}
   \DeclareMathSymbol{]}{\mathclose}{operators}{`\]}
   \mt@assign@del{`\]}{operators}{5D}{largesymbols}{03}
   \DeclareMathSymbol{:}{\mathrel}{operators}{`\:}
   \ifx\colon\undefined
      \DeclareMathSymbol{\colon}{\mathpunct}{operators}{`\:}
   \fi
   \DeclareMathSymbol{!}{\mathclose}{operators}{`\!}
   \DeclareMathSymbol{.}{\mathord}{operators}{`\.}
   \DeclareMathSymbol{\period}{\mathpunct}{operators}{`\.}
   \DeclareMathSymbol{,}{\mathpunct}{operators}{`\,}
   \DeclareMathSymbol{/}{\mathord}{operators}{`\/}
   \mt@assign@del{`\/}{operators}{2F}{largesymbols}{0E}
%    \end{macrocode}
% Now we have to be careful: \texttt{<}\@, \texttt{>} and \texttt{\string|}
% can be taken from \texttt{operators}
% if \cs{encodingdefault} is anything \emph{except}~\texttt{OT1}\@.
% We use an \texttt{endash} instead of a hyphen for the minus sign 
% if we recognize the encoding to get at least something close
% to a real minus sign. That's a sloppy kludge,
% but choosing the~\texttt{opmax} option implies you've lowered your
% standards somewhat.
%    \begin{macrocode}
   \def\reserved@a{OT1}\edef\reserved@b{\encodingdefault}
   \ifx\reserved@a\reserved@b % unavailable in OT1...
      %\DeclareMathSymbol{<}{\mathrel}{letters}{"3C}% format defaults
      %\DeclareMathSymbol{>}{\mathrel}{letters}{"3E}
      %\DeclareMathSymbol{|}{\mathord}{symbols}{"6A}
      \DeclareMathSymbol{-}{\mathbin}{operators}{"7B}% dangerous
   \else
      \def\reserved@a{T1}%
      \ifx\reserved@a\reserved@b
         \DeclareMathSymbol{-}{\mathbin}{operators}{"15}% dangerous
      \else
         \def\reserved@a{8r}%
         \ifx\reserved@a\reserved@b
            \DeclareMathSymbol{-}{\mathbin}{operators}{150}% dangerous
         \else
            \def\reserved@a{8a}%
            \ifx\reserved@a\reserved@b
               \DeclareMathSymbol{-}{\mathbin}{operators}{"B1}% dangerous
            \else
               % keep symbols, slot "00
            \fi % 8a
         \fi % 8r
      \fi % T1
      \DeclareMathSymbol{<}{\mathrel}{operators}{`\<}% ascii positions
      \DeclareMathSymbol{>}{\mathrel}{operators}{`\>}
      \DeclareMathSymbol{|}{\mathord}{operators}{`\|}
      \mt@assign@del{`\|}{operators}{7C}%  ascii bar
                      {largesymbols}{0C}
      \DeclareMathDelimiter\backslash\mathord{operators}{"5C}% ascii backslash
                                          {largesymbols}{"0F}
      \DeclareMathDelimiter\lbrace   \mathopen{operators}{`\{}% ascii `{'
                                          {largesymbols}{"08}
      \DeclareMathDelimiter\rbrace   \mathclose{operators}{`\}}% ascii `}'
                                          {largesymbols}{"09}
   \fi
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@ops}%
                {The mathsymbol setup is hosed; expect bad output.}
\fi
%    \end{macrocode}
%
% \paragraph{Math Accents}
% Accents in math can be made to either use a fixed font,
% or to obey math alphabets. In order to have
% accents of the latter type,
% we \emph{must} recognize the \cs{encodingdefault}
% (which the \texttt{operators} math family is in)
% and set the corresponding accent codes up for that encoding.
% If we don't recognize the encoding we have to use fixed accents;
% MathT\i me provides suitable accents in the \texttt{symbols}~font.
%
% For some reason the ring accent~``\aa'' is always
% left out, so we define it, but don't warn if
% we're stuck with \texttt{symbols} accents
% which have no ring accent glyph and just make \cs{ring} a no-op.
%
% The code below is written out long hand style, to keep it
% legible. It does not get stored, it's read only once, and
% most of it is skipped, so it would be only a marginal
% improvement to merge everything.
%
% The \texttt{opaccents} case:
%    \begin{macrocode}
\ifcase\mt@accs % case 0
%    \end{macrocode}
% We do something similar to what \AmS~does, but rather
% simple-mindedly: choose between `fixed' (class~\texttt0)
% or `variable' (class~\texttt7) based on the value of
% \cs{mt@acc@class}, whose value should be either~\texttt0
% or~\texttt7,
% depending on whether the (encoding of the)
% current math alphabet has accents \textit{in the expected positions}.
% We could use the \AmS{} hook (\cs{accentclass@}), but
% we ought to make our own\ldots{} Actually, this is
% slightly naughty; we could have gone
% through the \cs{DeclaterMathAccent}
% command, declare two accents, and have the user-level
% accent command pick the right one based on something
% \cs{noaccents@} says, but that's kind of pointless.
%
% All of this works as long as we recognize the encoding. If we don't,
% use fixed accents from \texttt{symbols} and complain.
% The slot specification must be in hex.
%    \begin{macrocode*}
\def\mt@accent@make#1#2{\def#1{\mathaccent"\mt@acc@class0#2 }}
%    \end{macrocode*}
% Here are the encodings we recognize:
%    \begin{macrocode}
   \edef\reserved@a{\encodingdefault}
   \def\reserved@b{T1}% a.k.a Cork or DC or EC
   \ifx\reserved@a\reserved@b
      \mt@accent@make{\grave}{00}
      \mt@accent@make{\acute}{01}
      \mt@accent@make{\hat}{02}
      \mt@accent@make{\tilde}{03}
      \mt@accent@make{\ddot}{04}
      \mt@accent@make{\ring}{06}
      \mt@accent@make{\check}{07}
      \mt@accent@make{\breve}{08}
      \mt@accent@make{\bar}{09}
      \mt@accent@make{\dot}{0A}
   \else
      \def\reserved@b{OT1}% ``Knuth roman''
      \ifx\reserved@a\reserved@b
        \mt@accent@make{\grave}{12}
        \mt@accent@make{\acute}{13}
        \mt@accent@make{\check}{14}
        \mt@accent@make{\breve}{15}
        \mt@accent@make{\bar}{16}
        \mt@accent@make{\ring}{17}
        \mt@accent@make{\hat}{5E}
        \mt@accent@make{\dot}{5F}
        \mt@accent@make{\tilde}{7E}
        \mt@accent@make{\ddot}{7F}
      \else
         \def\reserved@b{8r}% TeXBase1
         \ifx\reserved@a\reserved@b
            \mt@accent@make{\dot}{01}
            \mt@accent@make{\ring}{09}
            \mt@accent@make{\breve}{0B}}
            \mt@accent@make{\check}{10}
            \mt@accent@make{\grave}{1E}
            \mt@accent@make{\hat}{88}
            \mt@accent@make{\tilde}{98}
            \mt@accent@make{\ddot}{A8}
            \mt@accent@make{\bar}{AF}
            \mt@accent@make{\acute}{B4}
         \else
            \def\reserved@b{8a}% AdobeStandard
            \ifx\reserved@a\reserved@b
               \mt@accent@make{\grave}{C1}
               \mt@accent@make{\acute}{C2}
               \mt@accent@make{\hat}{C3}
               \mt@accent@make{\tilde}{C4}
               \mt@accent@make{\bar}{C5}
               \mt@accent@make{\breve}{C6}
               \mt@accent@make{\dot}{C7}
               \mt@accent@make{\ddot}{C8}
               \mt@accent@make{\ring}{CA}
               \mt@accent@make{\check}{CF}
%    \end{macrocode}
% If we don't recognize the encoding, we have to resort to \texttt{symbols}:
%    \begin{macrocode}
            \else % I give up...
               \DeclareMathAccent\grave{\mathord}{symbols}{"4A}
               \DeclareMathAccent\acute{\mathord}{symbols}{"4B}
               \DeclareMathAccent\check{\mathord}{symbols}{"4C}
               \DeclareMathAccent\breve{\mathord}{symbols}{"4D}
               \DeclareMathAccent\bar  {\mathord}{symbols}{"4E}
               \DeclareMathAccent\hat  {\mathord}{symbols}{"4F}
               \DeclareMathAccent\dot  {\mathord}{symbols}{"50}
               \DeclareMathAccent\tilde{\mathord}{symbols}{"51}
               \DeclareMathAccent\ddot {\mathord}{symbols}{"52}
               \def\ring#1{{#1}} % no \ring in the symbols font
               \PackageError{mt11p}%
                            {Unknown \string\encodingdefault\space
                                     \encodingdefault. \MessageBreak
                             Reverting to fixed accents
                             from symbols font}%
                            {I had to make math accents ignore alphabet
                             changes,\MessageBreak
                             because I don't recognize the
                             `\encodingdefault' encoding.}
            \fi % 8a
         \fi % 8r
      \fi % OT1
   \fi % T1
%    \end{macrocode}
% Add the switch to \cs{noaccents@} (and check that that's defined before
% hand) and initialize the flag.
%    \begin{macrocode}
   \ifx\noaccents@\@undefined\let\noaccents@\@empty\fi % be safe
   \g@addto@macro{\noaccents@}{\def\mt@acc@class{0}}
   \def\mt@acc@class{7}
%    \end{macrocode}
%
% The \texttt{symaccents} case is easy; just make everything fixed,
% and make sure \cs{noaccents@} is defined.
%    \begin{macrocode}
\or % case 1, accents from symbols
   \DeclareMathAccent\grave{\mathord}{symbols}{"4A}
   \DeclareMathAccent\acute{\mathord}{symbols}{"4B}
   \DeclareMathAccent\check{\mathord}{symbols}{"4C}
   \DeclareMathAccent\breve{\mathord}{symbols}{"4D}
   \DeclareMathAccent\bar  {\mathord}{symbols}{"4E}
   \DeclareMathAccent\hat  {\mathord}{symbols}{"4F}
   \DeclareMathAccent\dot  {\mathord}{symbols}{"50}
   \DeclareMathAccent\tilde{\mathord}{symbols}{"51}
   \DeclareMathAccent\ddot {\mathord}{symbols}{"52}
   \def\ring#1{{#1}} % no \ring in the symbols font
   \ifx\noaccents@\@undefined\let\noaccents@\@empty\fi % be safe
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@accs}%
                {The math accent setup is hosed; expect bad output.}
\fi
%    \end{macrocode}
%
% Now another messy part: the \AmS~package \pkg{amsmath}
% has the macros~\cs{Hat}, etc., defined with hard-coded
% accent positions. We redo the definition to work with whatever
% encoding or accents we're using. The code below is basically
% copied from the \AmS~package. We omit this patch unless
% all of the following conditions are satisfied:
% \textit{i\/})~the macro \cs{mathaccent@} exists;
% \textit{iii\/})~the macros \cs{Hat} and~\cs{Check} exist;
% \textit{iii\/})~there exists a macro \cs{accentclass@} whose
% definition is ``7''. If all of that is~\textsc{ok}
% we pretty likely have the \pkg{amsmath}~package and the following
% should be safe. Note that \cs{mathaccent@} is a 
% rather large macro that figures out what skew kern is needed
% to get double accents to line up.
%    \begin{macrocode}
\ifx\mathaccent@\undefine\else % (i)
\ifx\Hat\undefine\else         % (iia)
\ifx\Check\undefine\else       % (iib)
\def\@tempa{7}%
\ifx\@tempa\accentclass@       % (iii)
   \PackageInfo{mt11p}{amsmath detected; redefining double accents}
%    \end{macrocode}
% Define fancy versions of \cs{hat},~etc., called ``\cs{Hat}'',~etc.,
% that perform skew calculations. To get a double accent say
% something like~|\Hat{\Hat{x}}|.
%
% There are two versions of the definition macro: one for
% fixed accents, another for variable ones.
%    \begin{macrocode}
   \def\@tempa#1#2{% variable 7/0
             \def#1{\relax % write it out
                    \ifmmode
                        \def\next@{\mathaccent@{"\accentclass@#2 }}%
                    \else
                        \def\next@{\nonmatherr@{#1}}%
                    \fi
                    \next@}}
   \def\@tempb#1#2{% fixed
             \def#1{\relax % write it out
                    \ifmmode
                        \def\next@{\mathaccent@{"0#2 }}%
                    \else
                        \def\next@{\nonmatherr@{#1}}%
                    \fi
                    \next@}}
%    \end{macrocode}
% These two accents are from the \texttt{symbols} fonts:
%    \begin{macrocode}
   \@tempb\Vec{245}
   \@tempb\Overbar{253}
   \def\Widebar{\Overbar}% synonym
%    \end{macrocode}
% Go through the encodings we know and define the accents again\ldots{}
% The \texttt{symaccents}~option affects this too.
%    \begin{macrocode}
   \ifnum\mt@accs=0 %
      \edef\reserved@a{\encodingdefault}
      \def\reserved@b{T1}% a.k.a Cork or DC or EC
      \ifx\reserved@a\reserved@b
         \@tempa\Hat{002}
         \@tempa\Check{007}
         \@tempa\Tilde{003}
         \@tempa\Acute{001}
         \@tempa\Grave{000}
         \@tempa\Dot{00A}
         \@tempa\Ddot{004}
         \@tempa\Breve{008}
         \@tempa\Bar{009}
      \else
         \def\reserved@b{OT1}% DEK's
         \ifx\reserved@a\reserved@b 
            \@tempa\Grave{012}
            \@tempa\Acute{013}
            \@tempa\Check{014}
            \@tempa\Breve{015}
            \@tempa\Bar{016}
            \@tempa\Hat{05E}
            \@tempa\Dot{05F}
            \@tempa\Tilde{07E}
            \@tempa\Ddot{07F}
         \else
            \def\reserved@b{8r}% TeXBase1
            \ifx\reserved@a\reserved@b 
               \@tempa\Dot{001}
               \@tempa\Breve{00B}
               \@tempa\Check{010}
               \@tempa\Grave{01E}
               \@tempa\Hat{088}
               \@tempa\Tilde{098}
               \@tempa\Ddot{0A8}
               \@tempa\Bar{0AF}
               \@tempa\Acute{0B4}
            \else
               \def\reserved@b{8a}% AdobeStandard
               \ifx\reserved@a\reserved@b 
                  \@tempa\Grave{0C1}
                  \@tempa\Acute{0C2}
                  \@tempa\Hat{0C3}
                  \@tempa\Tilde{0C4}
                  \@tempa\Bar{0C5}
                  \@tempa\Breve{0C6}
                  \@tempa\Dot{0C7}
                  \@tempa\Ddot{0C8}
                  \@tempa\Check{0CF}
               \else % beats me...
%    \end{macrocode}
% If we don't know the encoding use fixed accents from \texttt{symbols}.
% We already gave an error message before, so just warn.
%    \begin{macrocode}
                  \@tempb\Grave{24A}
                  \@tempb\Acute{24B}
                  \@tempb\Check{24C}
                  \@tempb\Breve{24D}
                  \@tempb\Bar{24E}
                  \@tempb\Hat{24F}
                  \@tempb\Dot{250}
                  \@tempb\Tilde{251}
                  \@tempb\Ddot{252}
                  \PackageWarning{mt11p}{using fixed accents for amsmath}
               \fi % 8a
            \fi % 8r
         \fi % OT1
      \fi % T1
   \else % symaccents option
      \@tempb\Grave{24A}
      \@tempb\Acute{24B}
      \@tempb\Check{24C}
      \@tempb\Breve{24D}
      \@tempb\Bar{24E}
      \@tempb\Hat{24F}
      \@tempb\Dot{250}
      \@tempb\Tilde{251}
      \@tempb\Ddot{252}
   \fi
\fi\fi\fi\fi
%    \end{macrocode}
%
% \paragraph{Upright Greek Text}
% The \texttt{mtgu}* fonts are not meant to be used as symbols,
% so we provide only text-type support: text mode font
% changing commands, and a math alphabet.
% Note that this means you \emph{can} use
% the fonts in math with correct subscript sizing, etc.; just
% say something like |\mathgr{m}| for an upright~$\mu$ (Computer
% Modern does not have such a glyph); in text |\textgr{m}| will work.
% Note also that the ligatures involving nonprinting \emph{letters}
% for getting variant forms will work inside of~\cs{mathgr},
%  but \texttt{o*}, \texttt{O*} or~\texttt{e*} will not, which is why we
% added some ligatures to the \file{tfm}~file~(Sec.\,\ref{par:mathgr}).
% The text commands are
% non-fragile, because the components of the macros are robust.
% See~Sec.\,\ref{unused} for making upright Greek letters
% into math \textit{symbols}\@.
% Trap the \texttt{nomathgr} case.
%    \begin{macrocode}
\def\greekshape{\fontencoding{LmtG}\selectfont}%
\DeclareTextFontCommand{\textgr}{\greekshape}
\ifcase\mt@mgr % case 0
   \def\mathgr#1{\PackageError{mt11p}{upright Greek not loaded for math}%
                                     {Don't use the nomathgr option.}%
                 \hbox{\greekshape #1}}% as good as anything else
\or % case 1
   \DeclareMathAlphabet\mathgr {LmtG}{mtg}{\mddefault}{\updefault}
   \SetMathAlphabet    \mathgr {normal}{LmtG}{mtg}{\mddefault}{\updefault}
   \SetMathAlphabet    \mathgr {bold}  {LmtG}{mtg}{\bfdefault}{\updefault}
   \SetMathAlphabet    \mathgr {heavy} {LmtG}{mtg}{\hvdefault}{\updefault}
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@mgr}%
                {The \string\mathgr\space setup is hosed.}
\fi
\ifnum\mt@sub=1 %
   \DeclareFontShape{LmtG}{mtg}{\hvdefault}{\updefault}%
                    {<->ssub*mtg/\bfdefault/\updefault}{}% heavy mtgu SUBS
\fi
%    \end{macrocode}
% The MathT\i me distribution defines the~\cs{gk} font switch macro,
% roughly equivalent to~\cs{greekshape}; we don't.
%
% \paragraph{\cs{hbar}} needs to be defined a bit carefully.
% The plain\TeX{} definition is just a macron (bar)
% accent with an~`$h$' backed up into it:
% |{\mathchar'26\mkern-9muh}|.
% This  is pretty horrible, and doesn't work in Times,
% no matter what \cs{mkern} you use. The definition below
% actually looks rather decent in all math versions.
% We define a private bar accent to be taken from the 
% \texttt{symbols}~math family, since we don't know what the
% \cs{bar} accent is (it might follow math alphabets changes).
% Force the~`\textit h' to be taken from~\texttt{letters}.
%    \begin{macrocode}
\ifnum\mt@hbar=1 %
   \DeclareMathSymbol \mt@hbar@macron {\mathord}{symbols}{"4E}%
   \DeclareMathSymbol \mt@hbar@h      {\mathord}{letters}{`\h}
   \def\hbar@macron#1{\hbox to\z@{\m@th\raisebox{-0.16\height}%
                        {$\csname#1style\endcsname
                            \mkern.65mu\mt@hbar@macron$}\hss}}
   \def\hbar{\mathord{\mathchoice{\hbar@macron{display}}%
                                 {\hbar@macron{text}}%
                                 {\hbar@macron{script}}%
                                 {\hbar@macron{scriptscript}}%
                      \mt@hbar@h}}

\fi
%    \end{macrocode}
%
% \paragraph{\cs{dag}\@, \cs{ddag}\@, \cs{S} and \cs{P}}
% First a comment: the only reason we are dealing with these symbols
% at all is that they historically came from math
% (\texttt{OMS})~fonts;
% it would be easier to use a text symbol font, but 
% such a font is not yet commonly in use,
% so we hack around with~\texttt{8r}. If you do have
% such a setup, the \texttt{nodag}~option will
% skip all of the stuff below and not touch
% these four symbols, but check that the setup you use
% does not assume \cs{fam2}~is~\texttt{OMS}\@.
%
% The default is to fetch the symbols from~\texttt{8r}.
% We do not use anything else from~\texttt{8r},
% in particular we don't touch \cs{textregistered},
% \cs{texttrademark},~etc.
% The \file{8r.sty}~``emulation'' included herein only deals with
% the four symbols.
%
% The format files defines these to use text or math
% versions of the character commands by using definitions similar
% to\footnote{Lines not proceeded by a line number are a part of this
% description and do not wind up in the \file{sty}~file!}
% \begin{verbatim}
% \def\P{\ifmmode\mathparagraph\else\textparagraph\fi}
% \end{verbatim}
% (The actual definition is made robust.) The text versions have
% declared defaults taken from~\texttt{OMS}\@;
% the math versions were
% \cs{mathchar}s pointing to the (\texttt{OMS})~\texttt{symbols}
% math family. We do the text versions first,
% since the handling of the math versions depends on them.
%
% We take the text symbols from \texttt{8r}~fonts, unless we're told
% not to (or unless we're skipping the whole thing).
% The format file makes the default test encoding for these
% four symbols~\texttt{OMS}, so we don't have to do anything.
% \texttt{8r}~fonts.
%    \begin{macrocode}
\ifcase\mt@eightR % case 0
   \PackageInfo{mt11p}{Retaining CM for \string\textdagger, etc}%
%    \end{macrocode}
% We have to be careful here, because the use of
% \texttt{8r}~fonts is ``non-standard''. So check if we have an
% \texttt{8r}~\file{.fd}~file for \cs{rmdefault}\@. If so, check for
% \file{8r.sty}, read that, and (re)declare the four text commands we need.
% If there's no \file{8r.sty}\@, supply just enough to get to the
% four symbols we need. We assume the TFM~files \emph{do exist}
% (they have to, because MathT\i me virtual fonts use them),
% but we try loading the \file{tfm}~file just to make sure.
%    \begin{macrocode}
\or % case 1
   \IfFileExists{8r\rmdefault.fd}%
         {\IfFileExists{8r.sty}%
               {\PackageInfo{mt11p}%
                             {MT math using 8r.sty}%
                \RequirePackage{8r}%
                \DeclareTextSymbol{\textsection}{8r}{167}%   section
                \DeclareTextSymbol{\textparagraph}{8r}{182}% paragraph
                \DeclareTextSymbol{\textdagger}{8r}{134}%    dagger
                \DeclareTextSymbol{\textdaggerdbl}{8r}{135}% daggerdbl
                \DeclareTextSymbolDefault{\textsection}{8r}%
                \DeclareTextSymbolDefault{\textparagraph}{8r}%
                \DeclareTextSymbolDefault{\textdagger}{8r}%
                \DeclareTextSymbolDefault{\textdaggerdbl}{8r}%
               }% using 8r.sty
               {\PackageWarning{mt11p}%
                               {No file 8r.sty found. Winging it}%
                \DeclareFontEncoding{8r}{}{\no@accents}%
                \DeclareFontSubstitution{8r}{\rmdefault}%
                                            {\mddefault}{\updefault}%
                \DeclareTextSymbol{\textsection}{8r}{167}%   section
                \DeclareTextSymbol{\textparagraph}{8r}{182}% paragraph
                \DeclareTextSymbol{\textdagger}{8r}{134}%    dagger
                \DeclareTextSymbol{\textdaggerdbl}{8r}{135}% daggerdbl
                \DeclareTextSymbolDefault{\textsection}{8r}%
                \DeclareTextSymbolDefault{\textparagraph}{8r}%
                \DeclareTextSymbolDefault{\textdagger}{8r}%
                \DeclareTextSymbolDefault{\textdaggerdbl}{8r}%
               }% faked 8r.sty
         \input{8r\rmdefault.fd}%
         }% 8r\rmdefault.fd was available
         {\PackageWarning{mt11p}%
                         {No fd file for 8r-coded \string\rmdefault\space
                              found; guessing TFM file names}% 
%    \end{macrocode}
% If there's no \file{.fd}~file for \cs{rmdefault}
% we have to wing it. Just declare the
% \texttt{8r}~fonts for \cs{rmdefault} text family.
% (That's all you would have with Computer Modern fonts anyway,
% and since we're here, no elaborate setup exists on the system.)
% Hopefully the TFM~files are available and they have the 
% expected names. This will work when someone has the
% \texttt{8r}-based fonts installed,
% but no support for using the raw fonts. To catch the fatal case right now,
% we just load the \texttt{8r}~font by hand and put a somewhat illuminating
% comment on the same line in case \TeX~complains.
%    \begin{macrocode}
     \font\preloaded=\rmdefault r8r\relax % next time try the `no8r' option
          \let\preloaded\undefined
          \DeclareFontEncoding{8r}{}{\no@accents}%
          \DeclareFontFamily{8r}{\rmdefault}{\hyphenchar\font=-1 }%
          \DeclareFontSubstitution{8r}{\rmdefault}{\mddefault}{\updefault}%
          \DeclareFontShape{8r}{\rmdefault}{\mddefault}{\updefault}%
                                           {<->\rmdefault  r8r}{}%
          \DeclareFontShape{8r}{\rmdefault}{\bfdefault}{\updefault}%
                                           {<->\rmdefault  b8r}{}%
          \DeclareFontShape{8r}{\rmdefault}{\mddefault}{\itdefault}%
                                           {<->\rmdefault  ri8r}{}%
          \DeclareFontShape{8r}{\rmdefault}{\bfdefault}{\itdefault}%
                                           {<->\rmdefault  bi8r}{}%
          \DeclareTextSymbol{\textsection}{8r}{167}%   section
          \DeclareTextSymbol{\textparagraph}{8r}{182}% paragraph
          \DeclareTextSymbol{\textdagger}{8r}{134}%    dagger
          \DeclareTextSymbol{\textdaggerdbl}{8r}{135}% daggerdbl
          \DeclareTextSymbolDefault{\textsection}{8r}%
          \DeclareTextSymbolDefault{\textparagraph}{8r}%
          \DeclareTextSymbolDefault{\textdagger}{8r}%
          \DeclareTextSymbolDefault{\textdaggerdbl}{8r}%
         }% no 8r\rmdefault.fd
%    \end{macrocode}
% Perhaps we're skipping this altogether.
%    \begin{macrocode}
\or % case 2
   \PackageInfo{mt11p}{not doing anything with \string\textdagger, etc.}
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@eightR}%
                {\string\dag, \string\ddag, \string\S\space and
                 \string\P\space are probably hosed.}
\fi
%    \end{macrocode}
%
% If we're told not to use \texttt{8r}~fonts
% (\cs{mt@eightR}$\,=0$) and
% if \cs{mt@cal}$\,=0$, we have no choice but to get
% \texttt{OMS}~as a `private' math alphabet
% and fetch the symbols from there. The auxiliary macro
% \cs{mt@al@hexsy} gets defined later.
%    \begin{macrocode}
\ifcase\mt@eightR % 0: avoid 8r
   \ifnum\mt@cal=0 %
      \DeclareMathAlphabet\mt@sy{OMS}{cmsy}{m}{n}
      \SetMathAlphabet    \mt@sy{normal}{OMS}{cmsy}{m}{n}
      \SetMathAlphabet    \mt@sy{bold}  {OMS}{cmsy}{b}{n}
      \SetMathAlphabet    \mt@sy{heavy} {OMS}{cmsy}{\hvdefault}{\updefault}
      \def\mathsection  {\mt@al@hexsy\mt@sy{78}}
      \def\dagger       {\mt@al@hexsy\mt@sy{79}}
      \def\ddagger      {\mt@al@hexsy\mt@sy{7A}}
      \def\mathparagraph{\mt@al@hexsy\mt@sy{7B}}
%    \end{macrocode}
% (Substitutions have already been declared.)
% If \cs{mt@cal}$\,>0$ we just use~\cs{mathcal}, which
% will be~\texttt{OMS}.
%    \begin{macrocode}
   \else % \mt@cal>0
      \def\mathsection  {\mt@al@hexsy\mathcal{78}}
      \def\dagger       {\mt@al@hexsy\mathcal{79}}
      \def\ddagger      {\mt@al@hexsy\mathcal{7A}}
      \def\mathparagraph{\mt@al@hexsy\mathcal{7B}}
   \fi
%    \end{macrocode}
% If it's~\textsc{ok} to use the \texttt{8r}~fonts, make
% them a ``private'' math alphabet.
% Here we do need substitution declarations. The \file{.fd}~file
% has already been read (or the data supplied).
%    \begin{macrocode}
\or % 1: 8r is ok
   \DeclareMathAlphabet\mt@sy{8r}{\rmdefault}{\mddefault}{\updefault}
   \SetMathAlphabet \mt@sy {normal}{8r}%
                             {\rmdefault}{\mddefault}{\updefault}
   \SetMathAlphabet \mt@sy {bold}  {8r}%
                             {\rmdefault}{\bfdefault}{\updefault}
   \SetMathAlphabet \mt@sy {heavy} {8r}%
                             {\rmdefault}{\hvdefault}{\updefault}
   \def\mathparagraph{\mt@al@hexsy\mt@sy{B6}}
   \def\dagger       {\mt@al@hexsy\mt@sy{86}}
   \def\ddagger      {\mt@al@hexsy\mt@sy{87}}
   \def\mathsection  {\mt@al@hexsy\mt@sy{A7}}
   \ifnum\mt@sub=1 %
      \DeclareFontShape{8r}{\rmdefault}{\hvdefault}{\updefault}% heavy \rm in 8r SUBS
                           {<->ssub*\rmdefault/\bfdefault/\updefault}{}
   \fi
%    \end{macrocode}
% Or skip it\ldots
%    \begin{macrocode}
\or % 2: nothing
   \PackageInfo{mt11p}{not doing anything with (math) \string\dagger, etc.}
\fi
%    \end{macrocode}
% Actually, the code above is suboptimal in the sense that is \cs{encodingdefault}
% happens to be~\texttt{8r}, we waste a math family. Hopefully, no heavy
% math user is running~\texttt{8r}\ldots
%
% \subsection{Auxiliary macro}
% In a few instances we need a macro to get
% a specific character from a particular math alphabet,
% i.e., some thing like
% ``\hbox{\cs{math}\textit{alph}\texttt{\char`\{}\cs{char}\relax
% \texttt{"\itshape yy}\texttt{\char`\}}}''. You can't do that
% though, you would get \cs{mathchar"00yy}. The \TeX{} math
% class~\texttt7 and \cs{fam} are used to get letters and digits
% from math alphabets, so we can just say
% \hbox{\cs{math}\textit{alph}\texttt{\char`\{}\cs{mathchar}\relax
% \texttt{"70\itshape yy}\texttt{\char`\}}}.
% The macro below is shorthand for the operation
% ``set character $\langle\mathit{slot}\rangle$ from the font of
% the math alphabet \cs{math}\textit{alph\/}''.
%    \begin{macrocode}
\def\mt@al@hexsy#1#2{#1{\mathchar"70#2}}
%    \end{macrocode}
% where \texttt{\#1}~is the math alphabet macro (e.g.,~\cs{mathcal})
% and \texttt{\#2}~is the hexadecimal number of the slot (no double quote).
%
% \subsection{Assorted Fixes, Odds \&{} Ends}
% Here are a few assorted (sordid\texttt{\small;-)}) fixes.
%
% \paragraph{Active Underscore}
% Make the underscore character
% active so we can kern to
% \texttt j,~\texttt f~and~\texttt p
% in subscripts. This is rather messy
% and probably breaks on occasion. The code
% was basically copied from the MathT\i me distribution.
%    \begin{macrocode}
\ifcase\mt@sb % case 0
   \PackageInfo{mt11p}{not using active underscore}
\or % case 1
   \ifnum\the\catcode`\_=8 %
      \ifnum\the\mathcode`\_=32768 % "8000
         \PackageInfo{mt11p}{redefining the underscore \string\catcode}
         \PackageInfo{mt11p}{\string\catcode\space of underscore made 12 (other)}
         \def\space@.{\futurelet\space@\relax}
         \space@. %
         \let\mt@orig@sb_
         \catcode`\_=\active
         \def_{\ifmmode\expandafter\sb@\else\expandafter\mt@orig@sb\fi}
         \let\sb_
         \def\sb@#1{\mt@orig@sb{\futurelet\next\sb@@#1}}
         \def\sb@@{\ifx\next\space@\def\next@. {\futurelet\next\sb@@}%
                   \else
                      \def\next@.{\ifx\next j\jadjust
                             \else\ifx\next f\jadjust
                             \else\ifx\next p\mkern-\@ne mu%
                                  \fi\fi\fi}%
                   \fi
                   \next@.}
         \@makeother\_
      \else % \the\mathcode`\_<>"8000 !
         \PackageWarning{mt11}{underscore did not have mathcode "8000;
                               \MessageBreak Underscore not made active}
      \fi
   \else % \the\catcode`\_ <>8 !
      \PackageWarning{mt11}{underscore was not of category 8;\MessageBreak
                            Underscore not made active} 
   \fi
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@sb}%
                {Underscore not made active.}
\fi
%    \end{macrocode}
% \cs{jadjust} is just a small negative kern:
%    \begin{macrocode}
\def\jadjust{\mkern-\tw@ mu}
%    \end{macrocode}
%
% \paragraph{\cs{vdots}\@, \cs{ddots} and \cs{angle}}
% might be missing \cs{m@th}s in the \cs{hbox}es.
%    \begin{macrocode}
\def\vdots{\vbox{\baselineskip4\p@\lineskiplimit\z@\kern6\p@
                 \hbox{$\m@th.$}\hbox{$\m@th.$}\hbox{$\m@th.$}}}
\def\ddots{\mathinner{%
           \mkern1mu\raise7\p@\vbox{\kern7\p@\hbox{$\m@th.$}}\mkern2mu
           \raise4\p@\hbox{$\m@th.$}\mkern2mu%
           \raise\p@\hbox{$\m@th.$}\mkern1mu}}
%    \end{macrocode}
%
% The plain\TeX{} definition of~\cs{angle} has an \cs{hrule}~height
% of~$0.34\mathrm{pt}$; the MathT\i me distribution says~``$0.48\mathrm{pt}$''.
% Both of those numbers are suspiciously close to the default rule thickness
% of the (scaled) extention font.
% We define \cs{angle} to use the default rule thickness, i.e.,
% \cs{fontdimen~8} of the appropriate extention (family~\texttt3)
% font. This does not work in \cs{scriptscriptstyle}, but that
% case is unlikely to occur. The \file{.tfm}~files have been
% slightly changed to make \cs{fontdimen~8} really be the rule
% thickness implied, e.g., by the height of the root glyphs.
%    \begin{macrocode}
\def\mt@angle#1#2{{\vbox{\ialign{$\m@th#1##$\crcr
            \not\mathrel{\mkern14mu}\crcr
            \noalign{\nointerlineskip}%
            \mkern2.5mu\leaders\hrule height1.05\fontdimen8#2 3 %
                              \hfill\mkern2.5mu\crcr}}}}
\def\angle{\mathchoice{\mt@angle{\scriptstyle}{\scriptfont}}
                      {\mt@angle{\scriptstyle}{\scriptfont}}
                      {\mt@angle{\scriptscriptstyle}{\scriptscriptfont}}
                      {\mt@angle{\scriptscriptstyle}{\scriptscriptfont}}}
%    \end{macrocode}
%
% \paragraph{The Tie Accent} Usually, the \cs{t}~accent~(\t oo)
% is taken from an~\texttt{OML}~font (position~|"7F|).
% MathT\i me has the tie in \texttt{symbols},
% so we take it from there, and make it the dafault.
%    \begin{macrocode}
\DeclareTextAccent{\t}{LmtS}{"41}
\DeclareTextAccentDefault{\t}{LmtS}
%    \end{macrocode}
%
% \paragraph{\cs{textcircled}} The large-ish circle for
% constructing~\copyright, \textregistered,~etc.,
% is usually taken from~\texttt{OMS}. The \texttt{LmtS}~fonts have
% the same glyph in the same slot, so just redefine
% the default to point to~\texttt{LmtS}.
% A text symbol font might have~\copyright, etc., available as single
% characters, e.g., the raw \texttt{8r}~fonts do, but
% it's not our business to deal with all that.
%    \begin{macrocode}
\DeclareTextAccentDefault{\textcircled}{LmtS}
\DeclareTextCommand{\textcircled}{LmtS}[1]{{%
   \ooalign{\hfil\raise.07ex\hbox{\upshape#1}\hfil\crcr\char13}}}
%    \end{macrocode}
%
% \paragraph{Misc.~text symbols} Some text versions
% of a few symbols (\cs{text}$\langle\!\mathit{symb}\rangle$)
% point to~\texttt{OM}* encodings; change the defaults.
% Those symbols that exists in~\texttt{T1} will
% be taken from~\texttt{T1} in text if that's
% the \cs{encodingdefault}. Try to be nice even if
% \cs{encodingdefault}~is \texttt{OT1} and point
% the defaults to MathT\i me,
% so we don't needlessly resort to Computer Modern.
% Noone uses these definitions directly, but macros might.
%    \begin{macrocode}
\DeclareTextSymbol{\textless}{LmtL}{60}% afm names
\DeclareTextSymbol{\textgreater}{LmtL}{62}
\DeclareTextSymbol{\textperiodcentered}{LmtS}{1}
\DeclareTextSymbol{\textasteriskmath}{LmtS}{3}% centered
\DeclareTextSymbol{\textopenbullet}{LmtS}{14}
\DeclareTextSymbol{\textbullet}{LmtS}{15}
\DeclareTextSymbol{\textbraceleft}{LmtS}{102}
\DeclareTextSymbol{\textbraceright}{LmtS}{103}
\DeclareTextSymbol{\textbar}{LmtS}{106}
\DeclareTextSymbol{\textbackslash}{LmtS}{110}
%    \end{macrocode}
% Make these the default:
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textperiodcentered}{LmtS}
\DeclareTextSymbolDefault{\textasteriskmath}{LmtS}
\DeclareTextSymbolDefault{\textopenbullet}{LmtS}
\DeclareTextSymbolDefault{\textbullet}{LmtS}
\DeclareTextSymbolDefault{\textbraceleft}{LmtS}
\DeclareTextSymbolDefault{\textbraceright}{LmtS}
\DeclareTextSymbolDefault{\textbar}{LmtS}
\DeclareTextSymbolDefault{\textbackslash}{LmtS}
\DeclareTextSymbolDefault{\textless}{LmtL}
\DeclareTextSymbolDefault{\textgreater}{LmtL}
%    \end{macrocode}
%
% \paragraph{Oldstyle Digits} 
% (See~Sec.\,\ref{OSdig}).
% MathT\i me has no oldstyle digits, so we
% grab the ones from~\texttt{OML}\@.
% I'm not sure it's useful to have this command
% in math mode, but we might as well do that too, though not via
% a math family---we define a private \cs{math@OS}~alphabet instead. Read
% the \texttt{.fd}~file, in case the format did no preloading.
% \texttt{nomathOS} disables the math family.
%    \begin{macrocode}
\ifcase\mt@osdg % case 0
   \def\math@OS#1{\PackageError{mt11p}{oldstyle digits not loaded for math}%
                                     {Don't use the nomathOS option.}%
                 {\hbox{\oldstylenums{#1}}}}% as good as anything else
\or % case 1
   \DeclareMathAlphabet\math@OS {OML}{cmm}{m}{it}
   \SetMathAlphabet    \math@OS {normal}{OML}{cmm}{m}{it}
   \SetMathAlphabet    \math@OS {bold}  {OML}{cmm}{b}{it}
   \SetMathAlphabet    \math@OS {heavy} {OML}{cmm}{\hvdefault}{\itdefault}
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@osdg}%
                {Oldsyle digits in math are hosed.}
\fi
\ifnum\mt@sub=1 % 
   \InputIfFileExists{omlcmm.fd}\relax % grrr...
                        {\InputIfFileExists{OMLcmm.fd}\relax
                        {\PackageError{mt11p}{No OMLcmm.fd file}%
                                 {Your are missing a basic distribution file. %
                                              Check the LaTeX installation.}}}
   \DeclareFontShape{OML}{cmm}{\hvdefault}{\itdefault}%
                    {<->ssub*cmm/b/it}{}%      heavy cmmi SUBS
\fi
%    \end{macrocode}
% The \cs{oldstylenums} macro just picks between
% using the \texttt{OML}~font
% as a text font, or the \cs{math@OS} math alphabet. If the argument
% contains things other than digits, the result will be amusing\ldots
%    \begin{macrocode}
\def\oldstylenums#1{%
     \ifmmode
        \math@OS{#1}%
     \else
        {\usefont{OML}{cmm}{\f@series}{it}#1}%
     \fi}
%    \end{macrocode}
%
% \subsection{\cs{boldsymbol}  and \cs{heavysymbol}}
% As mentioned above, we assumed that formul\ae{}
% do not require simultaneous access to fonts in different math versions,
% or, more precisely, that a single math list need not contain
% several weights of, e.g., the \texttt{symbols} fonts.
% In other words, that it is not worth while to
% \emph{simultaneously} have
% several weights of, e.g., the \texttt{symbols} fonts available as
% ``\cs{mathchar}s''. Instead we fetch the \AmS~package
% \pkg{amsbsy}, which defines a ``\cs{boldsymbol}''~macro
% and define a similar ``\cs{heavysymbol}'' macro.
% Don't do it if we're told not to, or if we can't find
% \file{amsbsy.sty} and don't overwrite existing definitions.
%    \begin{macrocode}
\ifcase\mt@bsy % case 0
   \providecommand{\boldsymbol}[1]{\PackageError{mt11p}%
                               {Get or load the package amsbsy
                                to use \string\boldsymbol}{See above.}#1\relax}
   \providecommand{\heavysymbol}[1]{\PackageError{mt11p}%
                               {Get or load the package amsbsy
                                to use \string\heavysymbol}{See above.}#1\relax}
   \providecommand{\normalsymbol}[1]{\PackageError{mt11p}%
                               {Get or load the package amsbsy
                                to use \string\normalsymbol}{See above.}#1\relax}
\or % case 1
   \IfFileExists{amsbsy.sty}%
        {\RequirePackage{amsbsy}%
         \DeclareRobustCommand{\heavysymbol}[1]{%
             \begingroup
             \let\@nomath\@gobble \mathversion{heavy}%
             \math@atom{##1}{%
             \mathchoice
               {\hbox{$\m@th\displaystyle##1$}}%
               {\hbox{$\m@th\textstyle##1$}}%
               {\hbox{$\m@th\scriptstyle##1$}}%
               {\hbox{$\m@th\scriptscriptstyle##1$}}}%
             \endgroup}%
         \DeclareRobustCommand{\normalsymbol}[1]{%
             \begingroup
             \let\@nomath\@gobble \mathversion{normal}%
             \math@atom{##1}{%
             \mathchoice
               {\hbox{$\m@th\displaystyle##1$}}%
               {\hbox{$\m@th\textstyle##1$}}%
               {\hbox{$\m@th\scriptstyle##1$}}%
               {\hbox{$\m@th\scriptscriptstyle##1$}}}%
             \endgroup}%
        }% using amsbsy.sty
        {\PackageError{mt11p}{No file `amsbsy.sty' found}%
                   {Use the `nobsy' option if you don't have or \MessageBreak
                   don't want the AMS \string\boldsymbol\space macro.}
        \let\boldsymbol\@firstofone
        \let\heavysymbol\@firstofone
        \let\normalsymbol\@firstofone
        }% no amsbsy.sty
\else % oops
   \PackageError{mt11p}{PANIC: Unexpected value of \string\mt@bsy}%
                {The \string\boldsymbol\space macro is probably hosed.}
\fi
%    \end{macrocode}
%
% \subsection{Examples of new math symbol definitions}
% \label{unused}
% Note that code in this section, and some of the code in
% the following sections is not included in the package
% \file{.sty}~file. It's meant as an example of things that
% could be put into a \file{mt11p.cfg}~file.
%
% Here follow a few examples of defining more
% math symbols in order to easily and efficiently
% mix symbols normally found in different math versions.
% Note that it is rarely worth it perform such
% definitions---not even the \AmS~document classes
% do it. For more details about NFSS see the
% standard \LaTeX{} documentation file~\file{fntguide.tex}.
%
% \paragraph{Upright lower case Greek letters as symbols.}
% The font set includes a \texttt{letters} font with
% upright lower case Greek letters~(l.c.G.)\@.
% Usually \textit{italic\/} or \textsl{slanted\/} l.c.G.~are used as
% symbols, though
% recently it's possible see the \textsc{Post\-Script}
% \texttt{Symbols}~font
% (upright; noone bothers to skew it)
% used a lot, but that is a more a sign of weak software.
% The upright l.c.G.~letters are made available in both text and
% math (Sec.\,\ref{par:mathgr}).
% It would be possible to make them available as math
% \emph{symbols} by using the code below.
% (The code is not available as an option, because there is no common definition
% for how the symbols should be named; for illustration we call the symbols
% \cs{upalpha}\@, \cs{upbeta}\@, etc.)
%
% First define a math symbol font:
% \begin{verbatim}
% \DeclareSymbolFont{upgreek}{LmtL}{mtl}{\mddefault}{\uidefault}
% \end{verbatim}
% Don't redefine \cs{mathgr} to point to the \texttt{upgreek}~family,
% because the encodings aren't even close.
%
% Next set the math versions:
% \begin{verbatim}
% \SetSymbolFont{upgreek}{normal}{LmtL}{mtl}{\mddefault}{\uidefault}
% \SetSymbolFont{upgreek}{bold}{LmtL}{mtl}{\bfdefault}{\uidefault}
% \SetSymbolFont{upgreek}{heavy}{LmtL}{mtl}{\hvdefault}{\uidefault}
% \end{verbatim}
% If this step is omitted, the \texttt{upgreek} symbol font family
% will be the same in all math versions.
%
% Lastly, make the symbol declarations (choose names that don't conflict with
% existing symbols):
% \begin{verbatim}
% \DeclareMathSymbol{\upalpha}{\mathord}{upgreek}{"0B}
% \DeclareMathSymbol{\upbeta}{\mathord}{upgreek}{"0C}
% \DeclareMathSymbol{\upgamma}{\mathord}{upgreek}{"0D}
% \DeclareMathSymbol{\updelta}{\mathord}{upgreek}{"0E}
% \DeclareMathSymbol{\upepsilon}{\mathord}{upgreek}{"0F}
% \DeclareMathSymbol{\upzeta}{\mathord}{upgreek}{"10}
% \DeclareMathSymbol{\upeta}{\mathord}{upgreek}{"11}
% \DeclareMathSymbol{\uptheta}{\mathord}{upgreek}{"12}
% \DeclareMathSymbol{\upiota}{\mathord}{upgreek}{"13}
% \DeclareMathSymbol{\upkappa}{\mathord}{upgreek}{"14}
% \DeclareMathSymbol{\uplambda}{\mathord}{upgreek}{"15}
% \DeclareMathSymbol{\upmu}{\mathord}{upgreek}{"16}
% \DeclareMathSymbol{\upnu}{\mathord}{upgreek}{"17}
% \DeclareMathSymbol{\upxi}{\mathord}{upgreek}{"18}
% \DeclareMathSymbol{\uppi}{\mathord}{upgreek}{"19}
% \DeclareMathSymbol{\uprho}{\mathord}{upgreek}{"1A}
% \DeclareMathSymbol{\upsigma}{\mathord}{upgreek}{"1B}
% \DeclareMathSymbol{\uptau}{\mathord}{upgreek}{"1C}
% \DeclareMathSymbol{\upupsilon}{\mathord}{upgreek}{"1D}
% \DeclareMathSymbol{\upphi}{\mathord}{upgreek}{"1E}
% \DeclareMathSymbol{\upchi}{\mathord}{upgreek}{"1F}
% \DeclareMathSymbol{\uppsi}{\mathord}{upgreek}{"20}
% \DeclareMathSymbol{\upomega}{\mathord}{upgreek}{"21}
% \DeclareMathSymbol{\upvarepsilon}{\mathord}{upgreek}{"22}
% \DeclareMathSymbol{\upvartheta}{\mathord}{upgreek}{"23}
% \DeclareMathSymbol{\upvarpi}{\mathord}{upgreek}{"24}
% \DeclareMathSymbol{\upvarrho}{\mathord}{upgreek}{"25}
% \DeclareMathSymbol{\upvarsigma}{\mathord}{upgreek}{"26}
% \DeclareMathSymbol{\upvarphi}{\mathord}{upgreek}{"27}
% \DeclareMathSymbol{\upvarkappa}{\mathord}{upgreek}{'176}
% \end{verbatim}
% That is the complete set; of course, you need not define them all.
%
% Additional \textbf{math accents} can be defined
% in an entirely analogous way by using \cs{DeclareMathAccent}.
% NFSS~can define two types of accents:
% \cs{mathord}, which are taken from a fixed font, and
% \cs{mathalpha}, which change with math alphabets.
% A specially declared accent will probably be~\cs{mathord};
% do not use~\cs{mathalpha} unles you know what you're doing.
% An example for
% a math symbol font family called~\texttt{boldsyms}
% which has an accent in slot~\texttt{"52} is
% \begin{verbatim}
% \DeclareMathAccent{\boldddot}{\mathord}{boldsyms}{"52}
% \end{verbatim}
% 
% \paragraph{Declaring additional math delimiters}
% Although any combination of symbols from various
% math versions can be achieved through the use of
% \cs{boldsymbol} and \cs{heavysymbol}, it can be
% inefficient and awkward to have to do so frequently.
% Particularly tedious are delimiters,
% which either require freezing their
% size~(|\boldsymbol{\Bigg(}|), or cryptic constructs
% involving~\cs{vphantom}s.
% In this case it is also possible to define special math symbols
% that work as expected. The procedure is similar to the one
% for declaring upright Greek letters as symbols, an outline follows.
% \TeX's math workings are described in D.\,E.\,Knuth's
% \emph{The \TeX book} and, e.g., in \emph{\TeX~by topic}
% by V.\,Eijkhout.
%
% First declare a new symbol font, e.g.,
% \begin{verbatim}
% \DeclareSymbolFont{hvlargesymbols}{OMX}{mtx}{\hvdefault}{\updefault}
% \end{verbatim}
% Next define the delimiter itself:
% \begin{center}
%     \centerline{\cs{DeclareMathDelimiter}\brarg{cmd}\brarg{math\,type}%
%     \brarg{small}\brarg{small\,slot}\brarg{large}\brarg{large\,slot}}
% \end{center}
% where \brarg{small} and \brarg{large} are two symbol font math families.
% If you're defining a new delimiter from some special font,
% you probably only have one variant (or more precisely one chain
% of linked delimiters).
% This command does not allow making a variant null~(\texttt{000})
% without assuming that \texttt{operators} is math family~\texttt0,
% but it is possible to make sure the small variant ``succeeds''
% in finding a delimiter
% (e.g., an extensible delimiter will always terminate a search),
% so that the large variant is irrelevant.
%
% For example, assuming there is a math symbol font family
% called \texttt{hvlargesymbols} (see above),
% \cs{lbraceHV} and \cs{rbraceHV}
% will produce correctly sized heavy braces:
% \begin{verbatim}
% \DeclareMathDelimiter{\lbraceHV}{\mathopen}{hvlargesymbols}{"08}%
%                                            {hvlargesymbols}{"08}
% \DeclareMathDelimiter{\lbraceHV}{\mathclose}{hvlargesymbols}{"09}%
%                                            {hvlargesymbols}{"09}
% \end{verbatim}
% (The small and large variants are identical, but since the small
% one will always
% succeed---the last delimiter in the chain is extendible---the
% large one never comes into play.)
% \cs{delcode}s are not normally changed.
%
% \paragraph{Running out of math families}
% \TeX{} with NFSS is limited to 16~math font families
% in any single math version, and
% it's not all too difficult
% to run into the limit. With the default options,
% it's possible to load \emph{four} more math symbol fonts/alphabets.
% (A \cs{DeclareSymbolFont} and an accompanying
% \cs{DeclareSymbolFontAlphabet} take up one family.)
% The options \texttt{nomathgr} and \texttt{nomathOS}
% will each cause one less math family to be used.
% The \texttt{cmcal}~option uses one math family more
% than \texttt{mtcal} or~\texttt{nomtms} (as long as \texttt{8r}
% is~\textsc{ok} for the four infamous symbols).
% If you do run out of math families, declare a new math version,
% or define infrequently used symbols as explicit font/character
% references in text mode (in an~\cs{hbox}), possibly
% wrapped in \cs{mathchoice} and an explicit class command,
% e.g.,~\cs{mathbin}. See~\file{fntguide.tex}.
%
% \subsection{Unused glyphs}\label{realunused}
% This package leaves no unique MathT\i me glyphs inaccessible.
% A few glyphs are repeated more than once in a font, or are present
% in more than one font. It makes no difference to \TeX~whether
% a font is taken from \texttt{letters} or~\texttt{symbols}.
%
% It would be possible to take the small square root sign
% from the \texttt{largesymbols}
% font, rather than from the \texttt{symbols} font.
% That \texttt{largesymbols} radical
% (\texttt{"9F}) is, however, completely identical
% to the one in \texttt{symbols}, so it's
% rather pointless. The command would be
% \begin{verbatim}
% \DeclareMathRadical{\sqrtsign}{largesymbols}{"9F}{largesymbols}{"70}
% \end{verbatim}
% The extra root sign in \texttt{mtsyn} (not present
% in~\texttt{mtsy}) is identical to the usual one, except for a
% vertical shift. Since a `radical' sign is normally of
% class~\texttt1~(\cs{mathop}),
% it gets vertically centered anyway. This alternate radical glyph could be
% used by defining something like
% \begin{verbatim}
% \DeclareMathSymbol{\varsurd}{\mathop}{symbols}{"84}
% \end{verbatim}
%
% \subsection{\texttt{muskip} Assignments} A little smaller than for Computer Modern.
% The original setting is
% \begin{verbatim}
% \thinmuskip=3mu
% \medmuskip=4mu plus 2mu minus 4mu
% \thickmuskip=5mu plus 5mu
% \end{verbatim}
% and we'll use
%    \begin{macrocode*}
\thinmuskip=2mu \relax
\medmuskip=2.5mu plus 1mu minus 1mu \relax
\thickmuskip=4mu plus 1.5mu minus 1mu \relax
%    \end{macrocode*}
%
% \subsection{Local Configuration File}
% Provide a hook to load anything important or complicated
% enough to be inappropriate for the main input file.
%    \begin{macrocode}
\InputIfFileExists{mt11p.cfg}%
           {\typeout{**************************************^^J%
                     * Local config file mt11p.cfg loaded *^^J%
                     **************************************}%
            }{}
%    \end{macrocode}
%
% \subsection{Cleanup}
% Do the resizing now:
%    \begin{macrocode}
\mt@exit
%    \end{macrocode}
% Restore any crazy catcodes.
%    \begin{macrocode}
\catcode`\"\mt@quotedbl
\catcode`\'\mt@quotesinglr
\catcode`\:\mt@colon
\catcode`\?\mt@question 
\catcode`\;\mt@semicolon 
\catcode`\!\mt@exclam
%    \end{macrocode}
% Make the various scratch macros, etc., we used \cs{undefined},
% but keep \cs{mt@cal} and \cs{mt@ops}, in case we need to
% decide something based on them. A `real' input file should
% not do such a thing, but a demo document might.
%    \begin{macrocode}
\let\mt@quotedbl  \undefined
\let\mt@quotesinglr\undefined
\let\mt@colon     \undefined
\let\mt@question  \undefined
\let\mt@semicolon \undefined
\let\mt@exclam    \undefined
\let\mt@exit      \undefined
\let\MathTimeSizes\undefine
\let\mt@enc       \undefined
\let\times@style  \undefined
\let\mt@fd@check  \undefined
\let\mt@accs      \undefined
\let\mt@accent@make\undefined
\let\mt@hbar      \undefined
\let\mt@eightR    \undefined
\let\mt@bsy       \undefined
\let\mt@sb        \undefined
\let\mt@mgrs      \undefined
\let\mt@osdg      \undefined
\let\mt@assign@del\undefined
 %\let\mt@cal       \undefined
 %\let\mt@ops       \undefined
%    \end{macrocode}
% \ldots and we're done.
%
% \Finale