% \iffalse meta-comment
%    File `mathastext.dtx'
%    
%    Copyright (C) 2011 by Jean-Francois Burnol
%   
%    Please report errors to jfbu at free dot fr
%    Documentation is also in `mathastext-doc.pdf' 
%    available at
%        http://jf.burnol.free.fr/mathastext.html
%    
%    This file be distributed and/or modified under the
%    conditions of the LaTeX Project Public License,
%    either version 1.3 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.3 or later is part of all distributions of
%    LaTeX version 2003/12/01 or later.  
% \fi 
% \iffalse
%<*dtx>    
\ProvidesFile{mathastext.dtx}
             [2011/01/25 1.0 use text font also in math]
%</dtx>
% \changes{1.0}{2011/01/25}{Initial version.}
% 
%<*driver>
\documentclass[a4paper]{ltxdoc}
\setlength{\topmargin}{0pt} 
\setlength{\headsep}{12pt}
\setlength{\headheight}{10pt}
\setlength{\textheight}{600pt}
\setlength{\footskip}{34pt}
\setlength{\textwidth}{360pt}
\setlength{\oddsidemargin}{46pt}
\setlength{\marginparwidth}{100pt}
\begin{document}
 \DocInput{mathastext.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{mathastext.dtx}
%
% \begin{center}
%   {\Large The \texttt{mathastext} package}\\
%   Jean-Fran\c cois \textsc{Burnol}\\
%   \texttt{jfbu at free dot fr}
% \end{center}
%
%  \begin{abstract}
%    The |mathastext| package\footnote{The file {\filename}
%    has version number \fileversion\ and was last revised on
%    \filedate.} propagates the document {\em text} font to
%    {\em mathematical} mode, for the letters of the Latin
%    alphabet and, optionally, some further ASCII-127
%    characters. The idea is to produce handouts or research
%    papers with a less book-like typography than what is
%    typical of standard \TeX\ with the Computer Modern
%    fonts. Hopefully, this will force the reader to
%    concentrate more on the contents ;-). It also makes it
%    possible (for a document with simple mathematics) to use
%    a quite arbitrary font without worrying too much that it
%    does not have specially designed accompanying math
%    fonts. Also, |mathastext| provides a simple mechanism in
%    order to use many different choices of (text hence, now,
%    math) fonts in the same document (not that we recommend
%    it!).  A final aspect is that |mathastext| helps produce
%    smaller PDF files.
% 
%  \begin{center}
%    Further documentation is available here:\\
%    |http://jf.burnol.free.fr/mathastext.html|
%  \end{center}
%  \end{abstract}
%
%  \section{Introduction}
%
%    |mathastext| was conceived as a result of frustration of
%    distributing to students \TeX-crafted mathematical handouts with
%    a subsequent realization that not much had made it to a
%    semi-permanent brain location. So, I forced \LaTeX\ to produce
%    material as if written on a primitive typewriter, a little bit
%    like the good old seminar notes of the Cartan and Grothendieck
%    days. Don't ask me if this helped, I have long since opted for a
%    positive attitude in life.
%    
%    The package |mathastext| is less extreme, but retains the idea of
%    using inside mathematics the same font as is used for text for
%    the letters of the Latin alphabet and the digits. By default
%    the text font will also be used for:\\
%    \centerline{!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
%    \$\,\%\,\&}
%    and with option |alldelims| also for:\\
%    \DeleteShortVerb{\|}
%    \centerline{$\mathord{<}\,\mathord{>}\,\mathord{|}$\,\{\,\} and
%    $\backslash$} 
%    \MakeShortVerb{\|} Introducing this option was made
%    necessary by the absence in OT1-encoded fonts of these characters
%    (except for mono-width fonts). It is suitable for most other text
%    font encodings, such as T1.
%
%    If one wants to use Greek letters, then the default ones from
%    Computer Modern are slanted, and do not mix well with the
%    (typically) upright shape of the main document font (also they
%    will generally look much lighter, in comparison). So there are
%    options to take these glyphs either from the Euler font
%    (|mathastext| does not load the package |eulervm| but uses the
%    font definition file |uzeur.fd| from this package) or from the
%    Postscript Symbol font (included in the basic \LaTeXe{}
%    distribution). A command is provided to scale the chosen font by
%    an arbitrary factor. Of course, it is also possible to access
%    upright Greek letters via loading first specific packages
%    providing math fonts, for example the |fourier| package (with
%    option `upright'). One just has to make sure to load |mathastext|
%    as the last of the font-related packages.
%
%    As a convenience, |mathastext| provides an easy mechanism to use
%    further `math versions' than the default `normal' and `bold' from
%    the standard \LaTeX. A command is provided to declare arbitrarily
%    many fonts in the preamble, to be used later in the
%    document. Switching the `math version' in the document is now
%    done with a command which allows an optional argument in order to
%    also specify the new font to be used for the text.
%
%    A poor man \cs{pmvec} command is provided as the default \cs{vec}
%    looks ugly on upright letters. Further, by default, this \cs{vec}
%    accent from Computer Modern is overwritten with the one coming
%    from the mathematics font of the |fourier| package.
%
%    With the option |symbolmax|, besides the Greek letters, also the
%    characters which have been contaminated by |mathastext| (others
%    than letters and digits) will be taken from the Symbol font, and
%    use will be made of quite a number of further glyphs available
%    from this font, including some basic mathematical arrows, as well
%    as the sum and product signs. For documents with very simple
%    needs in mathematical symbols, the options |symbolmax| and
%    |alldelims| may give in the end a quite smaller PDF file, as the
%    Computer Modern fonts, or whatever mathematical fonts initially
%    loaded by packages for use in the document, may well be avoided
%    altogether.
%
%  \section{Commands}    
%    
%    \subsection{Preamble-only commands}
%    Nothing is necessary besides loading |mathastext|, possibly with
%    some customizing options (described next). The following commands
%    provide enhancements to the basic use of the package.
%    \begin{itemize}
%    \item |\Mathastext|: reinitializes |mathastext| according to the current
%      defaults of encoding, family, series and shape. It can also be preceded
%      optionally by one or more of |\Mathastextencoding|\marg{enc},
%      |\Mathastextfamily|\marg{fam}, |\Mathastextseries|\marg{ser},
%      |\Mathastextshape|\marg{sh}.
%    \item |\MathastextWillUse|\marg{enc}\marg{fam}\marg{ser}\marg{sh}: tells
%      |mathastext| to use the font with the specified encoding, family,
%      series, and shape for the letters and digits (and all other afflicted
%      characters) in math mode.
%    \item
%      |\MathastextDeclareVersion|\marg{name}\marg{enc}\marg{fam}\marg{ser}\marg{sh}:
%      declares that the document will have access to the font with the
%      specified characteristics, under the version name
%      \meta{name}. To be used in
%      combination with the body command
%      |\MathastextVersion|\oarg{nametext}\marg{namemath}.
%    \item |\Mathastextboldvariant|\marg{var}: when used before |\Mathastext|,
%    specifies which bold
%      (|b|,|sb|,|bx|,\dots) to be used by \cs{mathbf} (and
%      \cs{boldmath}). Default is the \cs{bfdefault} at the time of
%      loading |mathastext|. When used before the declaration
%      of a version, decides the way \cs{mathbf} will act in this version.
%    \item |\MathastextEulerScale|\marg{factor}: scales the Euler font by
%      \meta{factor}.
%    \item |\MathastextSymbolScale|\marg{factor}: scales the Symbol font by
%      \meta{factor}.
%    \end{itemize}
%
%    \subsection{Body commands}
%
%    \begin{itemize}
%    \item |\MathastextVersion|\oarg{nametext}\marg{namemath}: changes the
%      math font, and optionally also the text font. To be used like the
%      \LaTeXe{} command \cs{mathversion}, outside of mathematics mode. All
%      further commands described here are math-only.
%    \item |\pmvec|: this provides a poor man \cs{vec} accent command,
%      suitable for upright characters. By default the original \cs{vec} is
%      also replaced by a version using the arrow from the Fourier font.
%    \item |\Mathnormal|, |\Mathrm|, |\Mathbf|: suitable modifications of the
%      original \cs{mathnormal}, \cs{mathrm}, \cs{mathbf}. By default, the
%      originals are also overwritten by the new commands.
%    \item |\inodot|, |\jnodot|: the corresponding glyphs in the
%    chosen font. By default, will overwrite |\imath| and |\jmath|.
%    \item |\omicron|: provides access to the omicron glyph.
%    \item |\MathastextEuler|\marg{}: math alphabet to access all the glyphs
%      of the Euler font, if option |eulergreek| (or |eulerdigits|) was passed
%      to the package.
%    \item |\MathastextSymbol|\marg{}: math alphabet to access all the glyphs
%      of the Symbol font, if loaded by one of the related options.
%    \item see the documentation file mathastext-doc.pdf for the character
%      commands made available when the Symbol font has been requested by one
%      of the related options.
%    \end{itemize}
%
%  \section{Options}
%
%  \begin{itemize}
%  \item |basic|: only mathastextify letters and digits.
%  \item |alldelims|: \DeleteShortVerb{\|} besides the default
%    !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,\$\,\%\,\& treat also
%    $\mathord{<}\,\mathord{>}\,\mathord{|}$\, \{\,\} and $\backslash$.\MakeShortVerb{\|} Not suitable for
%    OT1-encoding.
%  \item excluding options: |noexclam|\ !\,?\ |noasterisk|\ *\ |nopunct|\
%    ,\,.\,:\,;\ |noplusnominus|\ +\,- |noequal|\ =\ |noparenthesis|\,
%    (\,)\,[\,]\,/ \ |nospecials|\ \#\,\$\,\%\,\& and |nodigits|.
%  \item |symbolgreek|, |symboldigits|: to let Greek letters (digits) use the
%    Symbol font.
%  \item |eulergreek|, |eulerdigits|: to let Greek letters (digits) use the
%    Euler font.
%  \item |selfGreek|: this is for a font which has the capital Greek
%    letters at the OT1 slot positions.
%  \item |mathaccents|: use the text font  also for the math accents.
%  \item |symbolre|: replaces \cs{Re} and \cs{Im} by Symbol glyphs and defines a
%    \cs{DotTriangle} command.
%  \item |symbolmisc|: takes quite a few glyphs, including logical arrows,
%    product and sum signs from Symbol. You may consider
%     \cs{renewcommand}|{\int}{\smallint}| to maximize still more the
%     use of the Symbol font.
%  \item |symbol|: combines |symbolgreek|, |symbolre|, and |symbolmisc|.
%  \item |symbolmax|: same as |symbol| and furthermore the characters listed
%    above are also taken from the Symbol font.
%  \item |defaultrm|, |defaultbf|, |defaulnormal|, |defaultimath|:
%    self-explanatory.
%  \item |defaultmathsizes|: |mathastext| opts for quite big subscripts (and,
%    copied from the |moresize| package, redefines \cs{Huge} and defines
%    \cs{HUGE}). Use this option to prevent it from doing so.
%  \end{itemize}
%
% \StopEventually{}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{mathastext.sty}[2011/01/25 1.0 use text font also in math]
%    \end{macrocode}
% We turn off the official loggings as we intend to write our owns
%    \begin{macrocode}
\def\mt@font@info@off{
\let\m@stext@info\@font@info
\let\m@stext@warning\@font@warning
\let\@font@info\@gobble
\let\@font@warning\@gobble}
\def\mt@font@info@on{
\let\@font@info\m@stext@info
\let\@font@warning\m@stext@warning}
\mt@font@info@off
%    \end{macrocode}
% A number of ifs for treating (some among) the options
%    \begin{macrocode}
\newif\ifmt@need@euler\mt@need@eulerfalse
\newif\ifmt@need@symbol\mt@need@symbolfalse
\newif\ifmt@defaultvec\mt@defaultvecfalse
\newif\ifmt@defaultnormal\mt@defaultnormalfalse
\newif\ifmt@defaultrm\mt@defaultrmfalse
\newif\ifmt@defaultbf\mt@defaultbffalse
\newif\ifmt@defaultsizes\mt@defaultsizesfalse
\newif\ifmt@twelve\mt@twelvefalse
\newif\ifall@OTone
\newif\ifall@Tone
%    \end{macrocode}
% The options:
%    \begin{macrocode}
\DeclareOption{noparenthesis}{\let\mt@noparen\@empty}
\DeclareOption{nopunctuation}{\let\mt@nopunct\@empty}
\DeclareOption{noplusnominus}{\let\mt@noplusnominus\@empty}
\DeclareOption{noequal}{\let\mt@noequal\@empty}
\DeclareOption{noexclam}{\let\mt@noexclam\@empty}
\DeclareOption{noasterisk}{\let\mt@noast\@empty}
\DeclareOption{nospecials}{\let\mt@nospecials\@empty}
\DeclareOption{basic}{\ExecuteOptions{noparenthesis,%
nopunctuation,noplusnominus,noequal,noexclam,nospecials}}
\DeclareOption{nodigits}{\let\mt@nodigits\@empty}
\DeclareOption{defaultimath}{\let\mt@defaultimath\@empty}
\DeclareOption{alldelims}{\let\mt@alldelims\@empty}
\DeclareOption{mathaccents}{\let\mt@mathaccents\@empty}
\DeclareOption{selfGreek}{\let\mt@selfGreek\@empty}
\DeclareOption{selfgreek}{\let\mt@selfGreek\@empty}
\DeclareOption{symboldigits}{\mt@need@symboltrue
    \let\mt@symboldigits\@empty}
\DeclareOption{symbolgreek}{\mt@need@symboltrue
    \let\mt@symbolgreek\@empty}
\DeclareOption{symbolre}{\mt@need@symboltrue
    \let\mt@symbolre\@empty}
\DeclareOption{symbolmisc}{\mt@need@symboltrue
    \let\mt@symbolmisc\@empty}
\DeclareOption{symbol}{\ExecuteOptions{symbolgreek,symbolmisc,symbolre}}
\DeclareOption{symbolmax}{\ExecuteOptions{symbolgreek,symbolmisc,symbolre}
    \let\mt@symbolmax\@empty}
\DeclareOption{eulerdigits}{\mt@need@eulertrue\let\mt@eulerdigits\@empty}
\DeclareOption{eulergreek}{\mt@need@eulertrue\let\mt@eulergreek\@empty}
\DeclareOption{defaultnormal}{\mt@defaultnormaltrue}
\DeclareOption{defaultrm}{\mt@defaultrmtrue}
\DeclareOption{defaultbf}{\mt@defaultbftrue}
%    \end{macrocode}
% We will change the default script and scriptscript sizes, and also we will
% declare a \cs{HUGE} size and modify the \cs{Huge} one at 12pt (taken from
% the |moresize| package.)
%    \begin{macrocode}
\DeclareOption{defaultmathsizes}{\mt@defaultsizestrue}
\DeclareOption{12pt}{\mt@twelvetrue}
\DeclareOption{defaultvec}{\mt@defaultvectrue}
\DeclareOption*{\PackageWarning{mathastext}{Unknown option `\CurrentOption'}}
\ProcessOptions\relax
%    \end{macrocode}
% \begin{macro}{\pmvec}
% Definition of a poor man version of the \cs{vec} accent
%    \begin{macrocode}
\DeclareRobustCommand\pmvec[1]{\mathord{\stackrel{\raisebox{-.5ex}%
{\tiny\boldmath$\mathord{\rightarrow}$}}{{}#1}}}
%    \end{macrocode}
% \end{macro}
% By default we pick a up the replacement for \cs{vec} from the Fourier font
% of Michel~\textsc{Bovani}.
%    \begin{macrocode}
\ifmt@defaultvec\else
  \DeclareFontEncoding{FML}{}{}
  \DeclareFontSubstitution{FML}{futm}{m}{it}
  \DeclareSymbolFont{justepourvec}{FML}{futm}{m}{it}
  \SetSymbolFont{justepourvec}{bold}{FML}{futm}{b}{it}
  \DeclareMathAccent{\vec}{\mathord}{justepourvec}{"7E}
\fi
%    \end{macrocode}
% Internal variables and associated public macros.
%    \begin{macrocode}
  \edef\m@stextenc{\encodingdefault}
  \edef\m@stextfam{\familydefault}
  \edef\m@stextser{\seriesdefault}
  \edef\m@stextsh{\shapedefault}
  \edef\m@stextbold{\bfdefault}
\DeclareRobustCommand\Mathastextencoding[1]{\edef\m@stextenc{#1}}
\DeclareRobustCommand\Mathastextfamily[1]{\edef\m@stextfam{#1}}
\DeclareRobustCommand\Mathastextseries[1]{\edef\m@stextser{#1}}
\DeclareRobustCommand\Mathastextshape[1]{\edef\m@stextsh{#1}}
\DeclareRobustCommand\Mathastextboldvariant[1]{\edef\m@stextbold{#1}}
%    \end{macrocode}
% In case we need the Euler font, we declare it here. It will use
% |uzeur.fd| from the |eulervm| package of Walter~\textsc{Schmidt}
%    \begin{macrocode}
\ifmt@need@euler
\DeclareSymbolFont{mteulervm}{U}{zeur}{m}{n}
%% \SetSymbolFont{mteulervm}{bold}{U}{zeur}{\m@stextbold}{n}
%    \end{macrocode}
% In the end, I moved the above line to \cs{Mathastext} as the user may want
% his choice of |boldvariant| to have effect on the Euler font, but anyhow
% |b=bx| for |uzeur.fd|, so this is pour la beaut\'e de l'Art (well it is
% also possible to use \cs{Mathastextboldvariant} to specify |m| for
% example). Also I do not see an easy way to have \cs{mathbf} act correctly
% simultaneously on the now two distinct fonts for a-Z and for
% \cs{alpha}-\cs{omega}. I know of a way (which would be to change mathcodes
% on the fly see my post
% |http://tug.org/pipermail/texhax/2011-January/016605.html|) but this is a
% lot of work for a minuscule interest. If we had followed that route we
% would have had to also keep track of the choice of bold variant in the
% mechanism of \cs{MathastextVersion}, defined later in this code.
%    \begin{macrocode}
\DeclareSymbolFontAlphabet{\MathastextEuler}{mteulervm}
\fi
\newcommand\MathastextEulerScale[1]{\edef\zeu@Scale{#1}}
%    \end{macrocode}
% In case we need the Symbol font, we declare it here. The macro
% \cs{psy@scale} will be used to scale the font (see at the
% very end of this file).
%    \begin{macrocode}
\ifmt@need@symbol
 \def\psy@scale{1}
 \DeclareSymbolFont{mtpsymbol}{U}{psy}{m}{n}
%% \SetSymbolFont{mtpsymbol}{bold}{U}{psy}{\m@stextbold}{n} 
%    \end{macrocode}
% We move the above line to \cs{Mathastext} in case the user has used
% \cs{Mathastextboldvariant}, but in fact there is no bold for the
% postscript Symbol font distributed with the \LaTeXe{} package
% |psnffs|. So, this is again pour la beaut\'e de l'Art.
%    \begin{macrocode}
 \DeclareSymbolFontAlphabet{\MathastextSymbol}{mtpsymbol}
\fi
\newcommand\MathastextSymbolScale[1]{\edef\psy@scale{#1}}
%    \end{macrocode}
% Declaration of the current default font as our math font.
%    \begin{macrocode}
\DeclareSymbolFont{mtcurrentfont}
    {\m@stextenc}{\m@stextfam}{\m@stextser}{\m@stextsh}
\DeclareSymbolFontAlphabet{\Mathnormal}{mtcurrentfont}
%    \end{macrocode}
%  \begin{macro}{\MathastextWillUse}
%    \begin{macrocode}
\DeclareRobustCommand\MathastextWillUse[4]{
  \Mathastextencoding{#1}
  \Mathastextfamily{#2}
  \Mathastextseries{#3}
  \Mathastextshape{#4}
  \Mathastext}
%    \end{macrocode}
% \end{macro}
%  \begin{macro}{\Mathastext}
% The command \cs{Mathastext} can be called by the user anywhere in the
% preamble and any number of time, the last one is the one that counts.
%    \begin{macrocode}
\DeclareRobustCommand\Mathastext{
  \mt@font@info@off
  \def\tmp@a{OT1}
  \def\tmp@b{T1}
  \ifx\tmp@a\m@stextenc
    \all@OTonetrue\else\all@OTonefalse\fi 
  \ifx\tmp@b\m@stextenc
    \all@Tonetrue\else\all@Tonefalse\fi
  \edef\mt@encoding@normal{\m@stextenc}
  \edef\mt@family@normal{\m@stextfam}
  \edef\mt@series@normal{\m@stextser}
  \edef\mt@shape@normal{\m@stextsh}
  \edef\mt@boldvariant@normal{\m@stextbold}
  \edef\mt@encoding@bold{\m@stextenc}
  \edef\mt@family@bold{\m@stextfam}
  \edef\mt@series@bold{\m@stextbold}
  \edef\mt@shape@bold{\m@stextsh}
  \edef\mt@boldvariant@bold{\m@stextbold}
  \SetSymbolFont{mtcurrentfont}{normal}{\mt@encoding@normal}
                                       {\mt@family@normal}
                                       {\mt@series@normal}
                                       {\mt@shape@normal}
  \SetSymbolFont{mtcurrentfont}{bold}  {\mt@encoding@bold}
                                       {\mt@family@bold}
                                       {\mt@series@bold}
                                       {\mt@shape@bold}
  \DeclareMathAlphabet{\Mathbf}  {\mt@encoding@bold}
                                 {\mt@family@bold}
                                 {\mt@series@bold}
                                 {\mt@shape@bold}
 \ifmt@need@euler\SetSymbolFont{mteulervm}{bold}{U}{zeur}{\m@stextbold}{n}\fi
 \ifmt@need@symbol\SetSymbolFont{mtpsymbol}{bold}{U}{psy}{\m@stextbold}{n}\fi
  \typeout{** Latin letters in math versions normal (resp. bold) are now^^J%
    ** set up to use fonts 
\mt@encoding@normal/\mt@family@normal/\mt@series@normal(\m@stextbold)/\mt@shape@normal} 
  \mt@font@info@on
}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\operator@font}
% We modify this \LaTeX{} internal variable in order for the predefined 
% \cs{cos}, \cs{sin}, etc\dots to be typeset with the |mathastext| font.
% This will also work for things declared through the |amsmath| package
% command \cs{DeclareMathOperator}. The alternative would have been to
% redefine the `operators' Math Symbol Font. Obviously people who expect
% that \cs{operator@font} will always refer to the `operators' font might
% be in for a surprise\dots{} well, we'll see.
%    \begin{macrocode}
\def\operator@font{\mathgroup\symmtcurrentfont}
%    \end{macrocode}
% \end{macro}
% Initialization call:
%    \begin{macrocode}
\Mathastext
\newcommand{\Mathrm}{\Mathnormal}
%    \end{macrocode}
% We will access by default the \cs{omicron} via \cs{mathnormal}. So we save
% it for future use
%    \begin{macrocode}
\let\mt@saved@mathnormal\mathnormal 
%    \end{macrocode}
% But unfortunately the Fourier package with the upright option does not have
% an upright omicron obtainable by simply typing \cs{mathnormal}|{o}|. So in
% this case we shall use \cs{mathrm} and not \cs{mathnormal}.
%    \begin{macrocode}
\@ifpackageloaded{fourier}{\ifsloped\else\let\mt@saved@mathnormal\mathrm\fi}{}
%    \end{macrocode}
% By default we redefine the normal, rm and bf alphabets.
%    \begin{macrocode}
\ifmt@defaultnormal\else\renewcommand{\mathnormal}{\Mathnormal}\fi
\ifmt@defaultrm\else\renewcommand{\mathrm}{\Mathrm}\fi
\ifmt@defaultbf\else\renewcommand{\mathbf}{\Mathbf}\fi
%    \end{macrocode}
% We write appropriate messages to the terminal and the log.
%    \begin{macrocode}
\ifx\mt@symbolgreek\@empty
\typeout{** Greek letters will use the PostScript Symbol font. Use^^J%
** \protect\MathastextSymbolScale{factor} to scale the font by <factor>.}
\fi
\ifx\mt@eulergreek\@empty
\typeout{** Greek letters will use the Euler font. Use^^J%
** \protect\MathastextEulerScale{factor} to scale the font by <factor>.}
\fi
\ifx\mt@selfGreek\@empty
\typeout{** Capital Greek letters from the fonts declared for latin letters:^^J% 
** only for OT1 or compatible encodings; glyphs may be unavailable.}
\fi
%    \end{macrocode}
% The \cs{MathastextDeclareVersion} command is to be used in the preamble to
% declare a math version. I refrained from providing a more complicated one
% which would also specify a choice of series for the Euler and Symbol font:
% anyhow Symbol only has the medium series, and Euler has medium and bold, so
% what is lacking is the possibility to create a version with a bold
% Euler. There is already one such version: the default |bold| one. And there
% is always the possibility to add to the preamble a suitable
% \cs{SetSymbolFont}|{mteulervm}||{name_of_version}||{U}{zeur}{bx}{n}|
%    \begin{macrocode}
\DeclareRobustCommand\MathastextDeclareVersion[5]{
  \mt@font@info@off
  \update@the@ifs{#2} 
  \DeclareMathVersion{#1}
  \SetSymbolFont{mtcurrentfont}{#1}{#2}{#3}{#4}{#5}
  \SetMathAlphabet{\Mathbf}{#1}{#2}{#3}{\m@stextbold}{#5}
  \edef\mt@tmp{@#1}
  \expandafter\edef\csname mt@encoding\mt@tmp\endcsname{#2}
  \expandafter\edef\csname mt@family\mt@tmp\endcsname{#3}
  \expandafter\edef\csname mt@series\mt@tmp\endcsname{#4}
  \expandafter\edef\csname mt@shape\mt@tmp\endcsname{#5}
  \expandafter\edef\csname mt@boldvariant\mt@tmp\endcsname{\m@stextbold}
  \typeout{** Latin letters in math version `#1' will use fonts
    #2/#3/#4(\m@stextbold)/#5}
  \mt@font@info@on
}
%    \end{macrocode}
% \begin{macro}{\MathastextVersion}
% This is a wrapper around \LaTeX{}'s \cs{mathversion}: here we have an
% optional argument allowing a quick and easy change of the text font.
%    \begin{macrocode}
\DeclareRobustCommand\MathastextVersion[2][\@empty]{%
    \mathversion{#2}%
    \edef\mt@tmp{@#1}%
    \ifx\@empty#1\else%
    \usefont{\csname mt@encoding\mt@tmp\endcsname}%
        {\csname mt@family\mt@tmp\endcsname}%
        {\csname mt@series\mt@tmp\endcsname}%
        {\csname mt@shape\mt@tmp\endcsname}%
    \edef\mt@@encoding{\csname mt@encoding\mt@tmp\endcsname}%
\renewcommand{\encodingdefault}{\mt@@encoding}%
    \edef\mt@@family{\csname mt@family\mt@tmp\endcsname}%
\renewcommand{\rmdefault}{\mt@@family}%
    \edef\mt@@series{\csname mt@series\mt@tmp\endcsname}%
\renewcommand{\mddefault}{\mt@@series}%
    \edef\mt@@shape{\csname mt@shape\mt@tmp\endcsname}%
\renewcommand{\updefault}{\mt@@shape}%
    \edef\mt@@boldvariant{\csname mt@boldvariant\mt@tmp\endcsname}%
\renewcommand{\bfdefault}{\mt@@boldvariant}%
%    \end{macrocode}
%    \begin{macrocode}
\fi}
%    \end{macrocode}
% \end{macro}
% We try to keep tracks of the font encodings, as it affects choices of
% character slots for the math accents, \cs{imath}, and the capital Greek
% letters (in case the option selfGreek was passed)
%    \begin{macrocode}
\newcommand\update@the@ifs[1]{
  \edef\tmp@enc{#1}
  \def\tmp@a{OT1}\ifall@OTone\ifx\tmp@a\tmp@enc\else\all@OTonefalse\fi\fi
  \def\tmp@b{T1}\ifall@Tone\ifx\tmp@b\tmp@enc\else\all@Tonefalse\fi\fi
}
%    \end{macrocode}
% At last we now switch font for the letters of the latin alphabet. The font
% mtcurrentfont will be reaffected by any \cs{MathastextVersion} call after
% \cs{begin{document}} 
%    \begin{macrocode}
\DeclareMathSymbol{a}{\mathalpha}{mtcurrentfont}{`a}
\DeclareMathSymbol{b}{\mathalpha}{mtcurrentfont}{`b}
\DeclareMathSymbol{c}{\mathalpha}{mtcurrentfont}{`c}
\DeclareMathSymbol{d}{\mathalpha}{mtcurrentfont}{`d}
\DeclareMathSymbol{e}{\mathalpha}{mtcurrentfont}{`e}
\DeclareMathSymbol{f}{\mathalpha}{mtcurrentfont}{`f}
\DeclareMathSymbol{g}{\mathalpha}{mtcurrentfont}{`g}
\DeclareMathSymbol{h}{\mathalpha}{mtcurrentfont}{`h}
\DeclareMathSymbol{i}{\mathalpha}{mtcurrentfont}{`i}
\DeclareMathSymbol{j}{\mathalpha}{mtcurrentfont}{`j}
\DeclareMathSymbol{k}{\mathalpha}{mtcurrentfont}{`k}
\DeclareMathSymbol{l}{\mathalpha}{mtcurrentfont}{`l}
\DeclareMathSymbol{m}{\mathalpha}{mtcurrentfont}{`m}
\DeclareMathSymbol{n}{\mathalpha}{mtcurrentfont}{`n}
\DeclareMathSymbol{o}{\mathalpha}{mtcurrentfont}{`o}
\DeclareMathSymbol{p}{\mathalpha}{mtcurrentfont}{`p}
\DeclareMathSymbol{q}{\mathalpha}{mtcurrentfont}{`q}
\DeclareMathSymbol{r}{\mathalpha}{mtcurrentfont}{`r}
\DeclareMathSymbol{s}{\mathalpha}{mtcurrentfont}{`s}
\DeclareMathSymbol{t}{\mathalpha}{mtcurrentfont}{`t}
\DeclareMathSymbol{u}{\mathalpha}{mtcurrentfont}{`u}
\DeclareMathSymbol{v}{\mathalpha}{mtcurrentfont}{`v}
\DeclareMathSymbol{w}{\mathalpha}{mtcurrentfont}{`w}
\DeclareMathSymbol{x}{\mathalpha}{mtcurrentfont}{`x}
\DeclareMathSymbol{y}{\mathalpha}{mtcurrentfont}{`y}
\DeclareMathSymbol{z}{\mathalpha}{mtcurrentfont}{`z}
\DeclareMathSymbol{A}{\mathalpha}{mtcurrentfont}{`A}
\DeclareMathSymbol{B}{\mathalpha}{mtcurrentfont}{`B}
\DeclareMathSymbol{C}{\mathalpha}{mtcurrentfont}{`C}
\DeclareMathSymbol{D}{\mathalpha}{mtcurrentfont}{`D}
\DeclareMathSymbol{E}{\mathalpha}{mtcurrentfont}{`E}
\DeclareMathSymbol{F}{\mathalpha}{mtcurrentfont}{`F}
\DeclareMathSymbol{G}{\mathalpha}{mtcurrentfont}{`G}
\DeclareMathSymbol{H}{\mathalpha}{mtcurrentfont}{`H}
\DeclareMathSymbol{I}{\mathalpha}{mtcurrentfont}{`I}
\DeclareMathSymbol{J}{\mathalpha}{mtcurrentfont}{`J}
\DeclareMathSymbol{K}{\mathalpha}{mtcurrentfont}{`K}
\DeclareMathSymbol{L}{\mathalpha}{mtcurrentfont}{`L}
\DeclareMathSymbol{M}{\mathalpha}{mtcurrentfont}{`M}
\DeclareMathSymbol{N}{\mathalpha}{mtcurrentfont}{`N}
\DeclareMathSymbol{O}{\mathalpha}{mtcurrentfont}{`O}
\DeclareMathSymbol{P}{\mathalpha}{mtcurrentfont}{`P}
\DeclareMathSymbol{Q}{\mathalpha}{mtcurrentfont}{`Q}
\DeclareMathSymbol{R}{\mathalpha}{mtcurrentfont}{`R}
\DeclareMathSymbol{S}{\mathalpha}{mtcurrentfont}{`S}
\DeclareMathSymbol{T}{\mathalpha}{mtcurrentfont}{`T}
\DeclareMathSymbol{U}{\mathalpha}{mtcurrentfont}{`U}
\DeclareMathSymbol{V}{\mathalpha}{mtcurrentfont}{`V}
\DeclareMathSymbol{W}{\mathalpha}{mtcurrentfont}{`W}
\DeclareMathSymbol{X}{\mathalpha}{mtcurrentfont}{`X}
\DeclareMathSymbol{Y}{\mathalpha}{mtcurrentfont}{`Y}
\DeclareMathSymbol{Z}{\mathalpha}{mtcurrentfont}{`Z}
\ifx\mt@nodigits\@empty\else
\def\mt@font@tbu{mtcurrentfont}
%    \end{macrocode}
% In fact, I think I should have changed the types of the digits to
% |mathord| when they are not picked from |mtcurrentfont|. Well let's leave
% it this way for today.
%    \begin{macrocode}
\ifx\mt@symboldigits\@empty \def\mt@font@tbu{mtpsymbol} \fi
\ifx\mt@eulerdigits\@empty \def\mt@font@tbu{mteulervm} \fi
\DeclareMathSymbol{0}{\mathalpha}{\mt@font@tbu}{`0}
\DeclareMathSymbol{1}{\mathalpha}{\mt@font@tbu}{`1}
\DeclareMathSymbol{2}{\mathalpha}{\mt@font@tbu}{`2}
\DeclareMathSymbol{3}{\mathalpha}{\mt@font@tbu}{`3}
\DeclareMathSymbol{4}{\mathalpha}{\mt@font@tbu}{`4}
\DeclareMathSymbol{5}{\mathalpha}{\mt@font@tbu}{`5}
\DeclareMathSymbol{6}{\mathalpha}{\mt@font@tbu}{`6}
\DeclareMathSymbol{7}{\mathalpha}{\mt@font@tbu}{`7}
\DeclareMathSymbol{8}{\mathalpha}{\mt@font@tbu}{`8}
\DeclareMathSymbol{9}{\mathalpha}{\mt@font@tbu}{`9}
\fi
%    \end{macrocode}
% When |symbolmax| is passed as an option, we use the Symbol font also for the
% typographical characters
%    \begin{macrocode}
\ifx\mt@symbolmax\@empty 
\def\mt@font@tbu{mtpsymbol}
\else
\def\mt@font@tbu{mtcurrentfont}
\fi
\ifx\mt@noexclam\@empty\else
\DeclareMathSymbol{!}{\mathclose}{\mt@font@tbu}{"21}
\DeclareMathSymbol{?}{\mathclose}{\mt@font@tbu}{"3F}
\fi
\ifx\mt@noast\@empty\else
\DeclareMathSymbol{*}{\mathalpha}{\mt@font@tbu}{"2A} 
\fi
%    \end{macrocode}
% We completely renounced to try to do things with all the various dots, they
% are defined in too many different ways, and there is the amsmath also. Better
% to leave the user use the |mathdots| package and accept that we can not
% avoid the default fonts in that case. So here I just treat |.|
%    \begin{macrocode}
\ifx\mt@nopunct\@empty\else
\DeclareMathSymbol{,}{\mathpunct}{\mt@font@tbu}{"2C}
\DeclareMathSymbol{.}{\mathord}{\mt@font@tbu}{"2E}
\DeclareMathSymbol{:}{\mathrel}{\mt@font@tbu}{"3A}
\@ifpackageloaded{amsmath}
    {}
    {\let\colon\undefined
    \DeclareMathSymbol{\colon}{\mathpunct}{\mt@font@tbu}{"3A}}
\DeclareMathSymbol{;}{\mathpunct}{\mt@font@tbu}{"3B}
\fi
%    \end{macrocode}
% The slot assignments here are for OT1. They will perhaps be changed to T1
% when we reach AtBeginDocument.
%    \begin{macrocode}
\DeclareMathSymbol{\inodot}{\mathord}{mtcurrentfont}{"10} 
\DeclareMathSymbol{\jnodot}{\mathord}{mtcurrentfont}{"11} 
\ifx\mt@defaultimath\@empty\else
    \renewcommand{\imath}{\inodot}
    \renewcommand{\jmath}{\jnodot} 
\fi
%    \end{macrocode}
% \begin{macro}{\relbar}
% \begin{macro}{\Relbar}
% Due to the way = and - are used by \LaTeX{} in arrows, we
% have to redefine \cs{Relbar} and \cs{relbar} in order for 
% them to preserve their original meanings.
%    \begin{macrocode}
\ifx\mt@noplusnominus\@empty\else
\edef\mt@minus@sign{\mathord{\expandafter\mathchar\number\mathcode`\-}}
\def\relbar{\mathrel{\smash\mt@minus@sign}}
\def\rightarrowfill{$\m@th\mt@minus@sign\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\mt@minus@sign\mkern-2mu$}\hfill
  \mkern-7mu\mathord\rightarrow$}
\def\leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\mt@minus@sign\mkern-2mu$}\hfill
  \mkern-7mu\smash\mt@minus@sign$}
\DeclareMathSymbol{+}{\mathbin}{\mt@font@tbu}{"2B}
\DeclareMathSymbol{-}{\mathbin}{\mt@font@tbu}{"2D}
\fi
\ifx\mt@noequal\@empty\else
\edef\mt@equal@sign{{\expandafter\mathchar\number\mathcode`\=}}
\DeclareRobustCommand\Relbar{\mathrel{\mt@equal@sign}}
\DeclareMathSymbol{=}{\mathrel}{\mt@font@tbu}{"3D}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\ifx\mt@noparen\@empty\else
\DeclareMathDelimiter{(}{\mathopen} {\mt@font@tbu}{"28}{largesymbols}{"00}
\DeclareMathDelimiter{)}{\mathclose}{\mt@font@tbu}{"29}{largesymbols}{"01}
\DeclareMathDelimiter{[}{\mathopen} {\mt@font@tbu}{"5B}{largesymbols}{"02}
\DeclareMathDelimiter{]}{\mathclose}{\mt@font@tbu}{"5D}{largesymbols}{"03}
\DeclareMathDelimiter{/}{\mathord}{\mt@font@tbu}{"2F}{largesymbols}{"0E}
\DeclareMathSymbol{/}{\mathord}{\mt@font@tbu}{"2F}
\fi
\ifx\mt@alldelims\@empty
\DeclareMathDelimiter{<}{\mathopen}{\mt@font@tbu}{"3C}{largesymbols}{"0A}
\DeclareMathDelimiter{>}{\mathclose}{\mt@font@tbu}{"3E}{largesymbols}{"0B}
\DeclareMathSymbol{<}{\mathrel}{\mt@font@tbu}{"3C}
\DeclareMathSymbol{>}{\mathrel}{\mt@font@tbu}{"3E}
%    \end{macrocode}
% There is no backslash in the Symbol font
%    \begin{macrocode}
\expandafter\DeclareMathDelimiter\@backslashchar
                        {\mathord}{mtcurrentfont}{"5C}{largesymbols}{"0F}
\DeclareMathDelimiter{\backslash}   
    {\mathord}{mtcurrentfont}{"5C}{largesymbols}{"0F}
\DeclareMathSymbol\setminus\mathbin{mtcurrentfont}{"5C}
\DeclareMathSymbol{|}\mathord{\mt@font@tbu}{"7C}
\DeclareMathDelimiter{|}{\mt@font@tbu}{"7C}{largesymbols}{"0C}
%    \end{macrocode}
% I stopped short of redeclaring also \cs{Vert}!
%    \begin{macrocode}
\DeclareMathDelimiter\vert
                 \mathord{\mt@font@tbu}{"7C}{largesymbols}{"0C}
\DeclareMathSymbol\mid\mathrel{\mt@font@tbu}{"7C}
\DeclareMathDelimiter{\lbrace}
   {\mathopen}{\mt@font@tbu}{"7B}{largesymbols}{"08}
\DeclareMathDelimiter{\rbrace}
   {\mathclose}{\mt@font@tbu}{"7D}{largesymbols}{"09}
\fi
%    \end{macrocode}
% We never take the specials from the Symbol (Adobe) font, as they are not all
% available there.
%    \begin{macrocode}
\ifx\mt@nospecials\@empty\else
\renewcommand{\#}{\ifmmode\edef\ms@tmp{7\the\symmtcurrentfont23}%
\mathchar\expandafter"\ms@tmp\relax\else\char"23\relax\fi}
\renewcommand{\$}{\ifmmode\edef\ms@tmp{7\the\symmtcurrentfont24}%
\mathchar\expandafter"\ms@tmp\relax\else\char"24\relax\fi}
\renewcommand{\%}{\ifmmode\edef\ms@tmp{7\the\symmtcurrentfont25}%
\mathchar\expandafter"\ms@tmp\relax\else\char"25\relax\fi}
\renewcommand{\&}{\ifmmode\edef\ms@tmp{7\the\symmtcurrentfont26}%
\mathchar\expandafter"\ms@tmp\relax\else\char"26\relax\fi}
\fi
%    \end{macrocode}
% We construct (with some effort) some longarrows from the Symbol glyphs, of
% almost the same lengths as the standard ones. By the way, I always found the
% \cs{iff} to be too wide, but I follow here the default. Also, although
% there is a \cs{longmapsto} in standard \LaTeX{}, if I am not mistaken, there
% is no \cs{longto}. So I define one here. I could not construct in the same
% manner \cs{Longrightarrow} etc\dots{} as the = sign from Symbol does not
% combine easily with the logical arrows, well, I could have done some box
% manipulations, but well, life is finite.
%    \begin{macrocode}
\ifx\mt@symbolmisc\@empty   
\let\prod\undefined
\DeclareMathSymbol{\prod}{\mathop}{mtpsymbol}{213}
\let\sum\undefined
\DeclareMathSymbol{\sum}{\mathop}{mtpsymbol}{229}
\DeclareMathSymbol{\mt@implies}{\mathrel}{mtpsymbol}{222}
\DeclareRobustCommand{\implies}{\;\mt@implies\;}
\DeclareMathSymbol{\mt@impliedby}{\mathrel}{mtpsymbol}{220}
\DeclareRobustCommand{\impliedby}{\;\mt@impliedby\;}
\DeclareRobustCommand{\iff}{\;\mt@impliedby\mathrel{\mkern-3mu}\mt@implies\;}
\DeclareMathSymbol{\mt@iff}{\mathrel}{mtpsymbol}{219}
\DeclareRobustCommand{\shortiff}{\;\mt@iff\;}
\DeclareMathSymbol{\mt@to}{\mathrel}{mtpsymbol}{174}
\DeclareMathSymbol{\mt@trait}{\mathrel}{mtpsymbol}{190}
\DeclareRobustCommand\to{\mt@to}
\DeclareRobustCommand\longto{\mkern2mu\mt@trait\mathrel{\mkern-10mu}\mt@to}
\DeclareRobustCommand\mapsto{\mapstochar\mathrel{\mkern0.2mu}\mt@to}
\DeclareRobustCommand\longmapsto{%
\mapstochar\mathrel{\mkern2mu}\mt@trait\mathrel{\mkern-10mu}\mt@to}
\DeclareMathSymbol{\aleph}{\mathord}{mtpsymbol}{192}
\DeclareMathSymbol{\inftypsy}{\mathord}{mtpsymbol}{165} 
\DeclareMathSymbol{\emptyset}{\mathord}{mtpsymbol}{198}
\let\varnothing\emptyset
\DeclareMathSymbol{\nabla}{\mathord}{mtpsymbol}{209}
\DeclareMathSymbol{\surd}{\mathop}{mtpsymbol}{214}
\let\angle\undefined
\DeclareMathSymbol{\angle}{\mathord}{mtpsymbol}{208}
\DeclareMathSymbol{\forall}{\mathord}{mtpsymbol}{34}
\DeclareMathSymbol{\exists}{\mathord}{mtpsymbol}{36}
\DeclareMathSymbol{\neg}{\mathord}{mtpsymbol}{216}
\DeclareMathSymbol{\clubsuit}{\mathord}{mtpsymbol}{167}
\DeclareMathSymbol{\diamondsuit}{\mathord}{mtpsymbol}{168}
\DeclareMathSymbol{\heartsuit}{\mathord}{mtpsymbol}{169}
\DeclareMathSymbol{\spadesuit}{\mathord}{mtpsymbol}{170}
\DeclareMathSymbol{\smallint}{\mathop}{mtpsymbol}{242}
\DeclareMathSymbol{\wedge}{\mathbin}{mtpsymbol}{217}
\DeclareMathSymbol{\vee}{\mathbin}{mtpsymbol}{218}
\DeclareMathSymbol{\cap}{\mathbin}{mtpsymbol}{199}
\DeclareMathSymbol{\cup}{\mathbin}{mtpsymbol}{200}
\DeclareMathSymbol{\bullet}{\mathbin}{mtpsymbol}{183}
\DeclareMathSymbol{\div}{\mathbin}{mtpsymbol}{184}
\DeclareMathSymbol{\otimes}{\mathbin}{mtpsymbol}{196}
\DeclareMathSymbol{\oplus}{\mathbin}{mtpsymbol}{197}
\DeclareMathSymbol{\pm}{\mathbin}{mtpsymbol}{177}
\DeclareMathSymbol{*}{\mathbin}{mtpsymbol}{42} 
\DeclareMathSymbol{\ast}{\mathbin}{mtpsymbol}{42}
\DeclareMathSymbol{\times}{\mathbin}{mtpsymbol}{180}
\DeclareMathSymbol{\proptopsy}{\mathrel}{mtpsymbol}{181}
\DeclareMathSymbol{\mid}{\mathrel}{mtpsymbol}{124} 
\DeclareMathSymbol{\leq}{\mathrel}{mtpsymbol}{163}
\DeclareMathSymbol{\geq}{\mathrel}{mtpsymbol}{179}
\DeclareMathSymbol{\approx}{\mathrel}{mtpsymbol}{187}
\DeclareMathSymbol{\supset}{\mathrel}{mtpsymbol}{201}
\DeclareMathSymbol{\subset}{\mathrel}{mtpsymbol}{204}
\DeclareMathSymbol{\supseteq}{\mathrel}{mtpsymbol}{202}
\DeclareMathSymbol{\subseteq}{\mathrel}{mtpsymbol}{205}
\DeclareMathSymbol{\in}{\mathrel}{mtpsymbol}{206}
\DeclareMathSymbol{\sim}{\mathrel}{mtpsymbol}{126}
\let\cong\undefined
\DeclareMathSymbol{\cong}{\mathrel}{mtpsymbol}{64} 
\DeclareMathSymbol{\perp}{\mathrel}{mtpsymbol}{94}
\DeclareMathSymbol{\equiv}{\mathrel}{mtpsymbol}{186}
\let\notin\undefined
\DeclareMathSymbol{\notin}{\mathrel}{mtpsymbol}{207}
\DeclareMathDelimiter{\rangle}
   {\mathclose}{mtpsymbol}{241}{largesymbols}{"0B}
\DeclareMathDelimiter{\langle}
   {\mathopen}{mtpsymbol}{225}{largesymbols}{"0A}
\fi
%    \end{macrocode}
% I like the \cs{Re} and \cs{Im} from Symbol, so I overwrite the CM ones.
%    \begin{macrocode}
\ifx\mt@symbolre\@empty
\DeclareMathSymbol{\Re}{\mathord}{mtpsymbol}{"C2}
\DeclareMathSymbol{\Im}{\mathord}{mtpsymbol}{"C1}
\DeclareMathSymbol{\DotTriangle}{\mathord}{mtpsymbol}{92}
\fi
%    \end{macrocode}
% selfGreek $>$ eulergreek $>$ symbolgreek
%    \begin{macrocode}
\ifx\mt@selfGreek\@empty
\DeclareMathSymbol{\Gamma}{\mathalpha}{mtcurrentfont}{"00}
\DeclareMathSymbol{\Delta}{\mathalpha}{mtcurrentfont}{"01}
\DeclareMathSymbol{\Theta}{\mathalpha}{mtcurrentfont}{"02}
\DeclareMathSymbol{\Lambda}{\mathalpha}{mtcurrentfont}{"03}
\DeclareMathSymbol{\Xi}{\mathalpha}{mtcurrentfont}{"04}
\DeclareMathSymbol{\Pi}{\mathalpha}{mtcurrentfont}{"05}
\DeclareMathSymbol{\Sigma}{\mathalpha}{mtcurrentfont}{"06}
\DeclareMathSymbol{\Upsilon}{\mathalpha}{mtcurrentfont}{"07}
\DeclareMathSymbol{\Phi}{\mathalpha}{mtcurrentfont}{"08}
\DeclareMathSymbol{\Psi}{\mathalpha}{mtcurrentfont}{"09}
\DeclareMathSymbol{\Omega}{\mathalpha}{mtcurrentfont}{"0A}
\else
\ifx\mt@eulergreek\@empty
\DeclareMathSymbol\Gamma    {\mathord}{mteulervm}{"00}
\DeclareMathSymbol\Delta    {\mathord}{mteulervm}{"01}
\DeclareMathSymbol\Theta    {\mathord}{mteulervm}{"02}
\DeclareMathSymbol\Lambda   {\mathord}{mteulervm}{"03}
\DeclareMathSymbol\Xi       {\mathord}{mteulervm}{"04}
\DeclareMathSymbol\Pi       {\mathord}{mteulervm}{"05}
\DeclareMathSymbol\Sigma    {\mathord}{mteulervm}{"06}
\DeclareMathSymbol\Upsilon  {\mathord}{mteulervm}{"07}
\DeclareMathSymbol\Phi      {\mathord}{mteulervm}{"08}
\DeclareMathSymbol\Psi      {\mathord}{mteulervm}{"09}
\DeclareMathSymbol\Omega    {\mathord}{mteulervm}{"0A}
\else
\ifx\mt@symbolgreek\@empty
\DeclareMathSymbol{\Gamma}{\mathord}{mtpsymbol}{"47}
\DeclareMathSymbol{\Delta}{\mathord}{mtpsymbol}{"44}
\DeclareMathSymbol{\Theta}{\mathord}{mtpsymbol}{"51}
\DeclareMathSymbol{\Lambda}{\mathord}{mtpsymbol}{"4C}
\DeclareMathSymbol{\Xi}{\mathord}{mtpsymbol}{"59}
\DeclareMathSymbol{\Pi}{\mathord}{mtpsymbol}{"50}
\DeclareMathSymbol{\Sigma}{\mathord}{mtpsymbol}{"53}
\DeclareMathSymbol{\Upsilon}{\mathord}{mtpsymbol}{"A1}
\DeclareMathSymbol{\Phi}{\mathord}{mtpsymbol}{"46}
\DeclareMathSymbol{\Psi}{\mathord}{mtpsymbol}{"59}
\DeclareMathSymbol{\Omega}{\mathord}{mtpsymbol}{"57}
\fi\fi\fi
%    \end{macrocode} 
% The omicron requires special treatment. By default we pick it from the
% (unmodified) normal alphabet, with the special adjustment if |fourier| was
% loaded in |upright| variant.
% 
% There is a slight difference regarding Euler and Symbol with respect to the
% available var-letters. We include one or two things like the |wp| and the
% |partial|.  
%
% It would not make sense to declare the Greek letters to be |mathalpha| as
% the alphabet changing commands like \cs{mathbf} can not at the same time
% use the bold variant of |mtcurrentfont| and the bold variant of the font
% for these letters. So, I think it is better to let them be of type
% |mathord|.
%    \begin{macrocode}
\let\omicron\undefined
\newcommand\omicron{\mt@saved@mathnormal{o}}
\ifx\mt@eulergreek\@empty
\DeclareMathSymbol{\alpha}  {\mathord}{mteulervm}{"0B}
\DeclareMathSymbol{\beta}   {\mathord}{mteulervm}{"0C}
\DeclareMathSymbol{\gamma}  {\mathord}{mteulervm}{"0D}
\DeclareMathSymbol{\delta}  {\mathord}{mteulervm}{"0E}
\DeclareMathSymbol{\epsilon}{\mathord}{mteulervm}{"0F}
\DeclareMathSymbol{\zeta}   {\mathord}{mteulervm}{"10}
\DeclareMathSymbol{\eta}    {\mathord}{mteulervm}{"11}
\DeclareMathSymbol{\theta}  {\mathord}{mteulervm}{"12}
\DeclareMathSymbol{\iota}   {\mathord}{mteulervm}{"13}
\DeclareMathSymbol{\kappa}  {\mathord}{mteulervm}{"14}
\DeclareMathSymbol{\lambda} {\mathord}{mteulervm}{"15}
\DeclareMathSymbol{\mu}     {\mathord}{mteulervm}{"16}
\DeclareMathSymbol{\nu}     {\mathord}{mteulervm}{"17}
\DeclareMathSymbol{\xi}     {\mathord}{mteulervm}{"18}
\renewcommand\omicron{\mathord{\MathastextEuler{o}}}
\DeclareMathSymbol{\pi}     {\mathord}{mteulervm}{"19}
\DeclareMathSymbol{\rho}    {\mathord}{mteulervm}{"1A}
\DeclareMathSymbol{\sigma}  {\mathord}{mteulervm}{"1B}
\DeclareMathSymbol{\tau}    {\mathord}{mteulervm}{"1C}
\DeclareMathSymbol{\upsilon}{\mathord}{mteulervm}{"1D}
\DeclareMathSymbol{\phi}    {\mathord}{mteulervm}{"1E}
\DeclareMathSymbol{\chi}    {\mathord}{mteulervm}{"1F}
\DeclareMathSymbol{\psi}    {\mathord}{mteulervm}{"20}
\DeclareMathSymbol{\omega}  {\mathord}{mteulervm}{"21}
\DeclareMathSymbol{\varepsilon}{\mathord}{mteulervm}{"22}
\DeclareMathSymbol{\vartheta}{\mathord}{mteulervm}{"23}
\DeclareMathSymbol{\varpi}  {\mathord}{mteulervm}{"24}
\let\varrho=\rho
\let\varsigma=\sigma
\DeclareMathSymbol{\varphi} {\mathord}{mteulervm}{"27}
\DeclareMathSymbol{\partial}{\mathord}{mteulervm}{"40}
\DeclareMathSymbol{\wp}{\mathord}{mteulervm}{"7D}
\DeclareMathSymbol{\ell}{\mathord}{mteulervm}{"60}
\else
\ifx\mt@symbolgreek\@empty
\DeclareMathSymbol{\alpha}{\mathord}{mtpsymbol}{"61}
\DeclareMathSymbol{\beta}{\mathord}{mtpsymbol}{"62}
\DeclareMathSymbol{\gamma}{\mathord}{mtpsymbol}{"67}
\DeclareMathSymbol{\delta}{\mathord}{mtpsymbol}{"64}
\DeclareMathSymbol{\epsilon}{\mathord}{mtpsymbol}{"65}
\DeclareMathSymbol{\zeta}{\mathord}{mtpsymbol}{"7A}
\DeclareMathSymbol{\eta}{\mathord}{mtpsymbol}{"68}
\DeclareMathSymbol{\theta}{\mathord}{mtpsymbol}{"71}
\DeclareMathSymbol{\iota}{\mathord}{mtpsymbol}{"69}
\DeclareMathSymbol{\kappa}{\mathord}{mtpsymbol}{"6B}
\DeclareMathSymbol{\lambda}{\mathord}{mtpsymbol}{"6C}
\DeclareMathSymbol{\mu}{\mathord}{mtpsymbol}{"6D}
\DeclareMathSymbol{\nu}{\mathord}{mtpsymbol}{"6E}
\DeclareMathSymbol{\xi}{\mathord}{mtpsymbol}{"78}
\renewcommand\omicron{\mathord{\MathastextSymbol{o}}}
\DeclareMathSymbol{\pi}{\mathord}{mtpsymbol}{"70}
\DeclareMathSymbol{\rho}{\mathord}{mtpsymbol}{"72}
\DeclareMathSymbol{\sigma}{\mathord}{mtpsymbol}{"73}
\DeclareMathSymbol{\tau}{\mathord}{mtpsymbol}{"74}
\DeclareMathSymbol{\upsilon}{\mathord}{mtpsymbol}{"75}
\DeclareMathSymbol{\phi}{\mathord}{mtpsymbol}{"66}
\DeclareMathSymbol{\chi}{\mathord}{mtpsymbol}{"63}
\DeclareMathSymbol{\psi}{\mathord}{mtpsymbol}{"79}
\DeclareMathSymbol{\omega}{\mathord}{mtpsymbol}{"77}
\let\varepsilon=\epsilon 
\DeclareMathSymbol{\vartheta}{\mathord}{mtpsymbol}{"4A}
\DeclareMathSymbol{\varpi}{\mathord}{mtpsymbol}{"76}
\let\varrho=\rho 
\DeclareMathSymbol{\varsigma}{\mathord}{mtpsymbol}{"56}
\DeclareMathSymbol{\varphi}{\mathord}{mtpsymbol}{"6A}
\DeclareMathSymbol{\partial}{\mathord}{mtpsymbol}{"B6}
\DeclareMathSymbol{\wp}{\mathord}{mtpsymbol}{"C3}
\fi\fi
%    \end{macrocode}
% I took the code for \cs{Huge} and \cs{HUGE} from the |moresize| package of
% Christian~\textsc{Cornelssen}
%    \begin{macrocode}
\ifmt@defaultsizes\else
\providecommand\@xxxpt{29.86}
\providecommand\@xxxvipt{35.83}
\ifmt@twelve  
  \def\Huge{\@setfontsize\Huge\@xxxpt{36}}
  \def\HUGE{\@setfontsize\HUGE\@xxxvipt{43}}
\typeout{** \protect\Huge\space and \protect\HUGE\space have been (re)-defined.}
\else 
  \def\HUGE{\@setfontsize\HUGE\@xxxpt{36}}
\typeout{** \protect\HUGE\space has been (re)-defined.} 
\fi
%    \end{macrocode}
% I choose rather big subscripts.
%    \begin{macrocode}
\def\defaultscriptratio{.8333}
\def\defaultscriptscriptratio{.7}
\DeclareMathSizes{9}{9}{7}{5}
\DeclareMathSizes{\@xpt}{\@xpt}{8}{6}
\DeclareMathSizes{\@xipt}{\@xipt}{9}{7}
\DeclareMathSizes{\@xiipt}{\@xiipt}{10}{8}
\DeclareMathSizes{\@xivpt}{\@xivpt}{\@xiipt}{10}
\DeclareMathSizes{\@xviipt}{\@xviipt}{\@xivpt}{\@xiipt}
\DeclareMathSizes{\@xxpt}{\@xxpt}{\@xviipt}{\@xivpt}
\DeclareMathSizes{\@xxvpt}{\@xxvpt}{\@xxpt}{\@xviipt}
\DeclareMathSizes{\@xxxpt}{\@xxxpt}{\@xxvpt}{\@xxpt}
\DeclareMathSizes{\@xxxvipt}{\@xxxvipt}{\@xxxpt}{\@xxvpt}
\typeout{** mathastext has declared larger sizes for subscripts.^^J%
** To keep LaTeX defaults, use option `defaultmathsizes'.}
\fi
%    \end{macrocode}
% At begin document, we make a few announcements depending on whether
% everything was in OT1 or T1 or otherwise, and we make a choice of the slot
% locations of mathaccents and of \cs{imath} and \cs{jmath}.
%    \begin{macrocode}
\AtBeginDocument{
\ifx\mt@alldelims\@empty
\ifx\mt@symbolmax\@empty\else
\ifall@OTone
\typeout{** mathastext: option `alldelims', and OT1 encodings; characters
  <,>,{,},| ^^J%
** will display correctly only for the fixed-width fonts.}
\else
\ifall@Tone\else
\typeout{** mathastext: option `alldelims';  <,>,{,},| have been assumed 
  to be located^^J%
** as in T1 (or OT1 fixed-width) fonts.)}
\fi\fi\fi\fi
\ifall@OTone\else
\DeclareMathSymbol{\inodot}{\mathord}{mtcurrentfont}{"19} 
\DeclareMathSymbol{\jnodot}{\mathord}{mtcurrentfont}{"1A} 
\fi
}
\AtBeginDocument{
\ifx\mt@mathaccents\@empty 
\ifall@OTone 
\DeclareMathAccent{\acute}{\mathalpha}{mtcurrentfont}{"13}
\DeclareMathAccent{\grave}{\mathalpha}{mtcurrentfont}{"12}
\DeclareMathAccent{\ddot}{\mathalpha}{mtcurrentfont}{"7F}
\DeclareMathAccent{\tilde}{\mathalpha}{mtcurrentfont}{"7E}
\DeclareMathAccent{\bar}{\mathalpha}{mtcurrentfont}{"16}
\DeclareMathAccent{\breve}{\mathalpha}{mtcurrentfont}{"15}
\DeclareMathAccent{\check}{\mathalpha}{mtcurrentfont}{"14}
\DeclareMathAccent{\hat}{\mathalpha}{mtcurrentfont}{"5E}
\DeclareMathAccent{\dot}{\mathalpha}{mtcurrentfont}{"5F}
\DeclareMathAccent{\mathring}{\mathalpha}{mtcurrentfont}{"17}
\else 
\DeclareMathAccent{\acute}{\mathalpha}{mtcurrentfont}{"01}
\DeclareMathAccent{\grave}{\mathalpha}{mtcurrentfont}{"00}
\DeclareMathAccent{\ddot}{\mathalpha}{mtcurrentfont}{"04}
\DeclareMathAccent{\tilde}{\mathalpha}{mtcurrentfont}{"03}
\DeclareMathAccent{\bar}{\mathalpha}{mtcurrentfont}{"09}
\DeclareMathAccent{\breve}{\mathalpha}{mtcurrentfont}{"08}
\DeclareMathAccent{\check}{\mathalpha}{mtcurrentfont}{"07}
\DeclareMathAccent{\hat}{\mathalpha}{mtcurrentfont}{"02}
\DeclareMathAccent{\dot}{\mathalpha}{mtcurrentfont}{"0A}
\DeclareMathAccent{\mathring}{\mathalpha}{mtcurrentfont}{"06}
\ifall@Tone 
\else\typeout{** mathastext: option `mathaccents'; accents have been assumed
  to be^^J%
  ** as in T1 encoding but one of the math versions has a non-T1 encoding.}
\fi 
\fi 
\fi 
}
%    \end{macrocode}
% Scaling mechanism for the Symbol font.
%    \begin{macrocode}
\AtBeginDocument{
  \ifmt@need@symbol
  \DeclareFontFamily{U}{psy}{}
  \DeclareFontShape{U}{psy}{m}{n}{<->s*[\psy@scale] psyr}{}
  \fi
}
%    \end{macrocode}
% Time to reactivate the standard font infos and warnings and we are done.
%    \begin{macrocode}
\mt@font@info@on
\endinput
%    \end{macrocode}
% \iffalse
%</code>
%<*dtx>
% \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         \~}
%
% \iffalse
%</dtx>
% \fi
%
% \CheckSum{1691}
% \Finale
\endinput