% \iffalse meta-comment
%
% Copyright (C) 1997-2003 by Michael J. Downes
% Copyright (C) 2007-2008 by Morten Hoegholm
% Copyright (C) 2007-2014 by Lars Madsen
% Copyright (C) 2007-2014 by Will Robertson
%
% This work may 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 2005/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% This Current Maintainer of this work is Will Robertson.
%
% This work consists of the main source file flexisym.dtx
% and the derived files
%    flexisym.sty, flexisym.pdf, flexisym.ins,
%    cmbase.sym, mathpazo.sym, mathptmx.sym, msabm.sym.
%
% Distribution:
%    CTAN:macros/latex/contrib/mh/flexisym.dtx
%    CTAN:macros/latex/contrib/mh/flexisym.pdf
%
% Unpacking:
%    (a) If flexisym.ins is present:
%           tex flexisym.ins
%    (b) Without flexisym.ins:
%           tex flexisym.dtx
%    (c) If you insist on using LaTeX
%           latex \let\install=y\input{flexisym.dtx}
%        (quote the arguments according to the demands of your shell)
%
% Documentation:
%    The class ltxdoc loads the configuration file ltxdoc.cfg
%    if available. Here you can specify further options, e.g.
%    use A4 as paper format:
%       \PassOptionsToClass{a4paper}{article}
%
%    Programm calls to get the documentation (example):
%       pdflatex flexisym.dtx
%       makeindex -s gind.ist flexisym.idx
%       pdflatex flexisym.dtx
%       makeindex -s gind.ist flexisym.idx
%       pdflatex flexisym.dtx
%
% Installation:
%    TDS:tex/latex/breqn/flexisym.sty
%    TDS:tex/latex/breqn/cmbase.sym
%    TDS:tex/latex/breqn/mathpazo.sym
%    TDS:tex/latex/breqn/mathptmx.sym
%    TDS:tex/latex/breqn/msabm.sym
%    TDS:doc/latex/breqn/flexisym.pdf
%    TDS:source/latex/breqn/flexisym.dtx
%
%<*ignore>
\begingroup
  \def\x{LaTeX2e}
\expandafter\endgroup
\ifcase 0\ifx\install y1\fi\expandafter
         \ifx\csname processbatchFile\endcsname\relax\else1\fi
         \ifx\fmtname\x\else 1\fi\relax
\else\csname fi\endcsname
%</ignore>
%<*install>
\input docstrip.tex
\Msg{************************************************************************}
\Msg{* Installation}
\Msg{* Package: flexisym 2014/06/10 v0.97c Flexisym (MH)}
\Msg{************************************************************************}

\keepsilent
\askforoverwritefalse

\preamble

This is a generated file.

Copyright (C) 1997-2003 by Michael J. Downes
Copyright (C) 2007-2010 by Morten Hoegholm
Copyright (C) 2007-2014 by Lars Madsen
Copyright (C) 2007-2014 by Will Robertson

This work may 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 2005/12/01 or later.

This work has the LPPL maintenance status "maintained".

The Current Maintainer of this work is Will Robertson.

This work consists of the main source file flexisym.dtx
and the derived files
   flexisym.sty, flexisym.pdf, flexisym.ins,
   cmbase.sym, mathpazo.sym, mathptmx.sym, msabm.sym.

\endpreamble

\generate{%
  \file{flexisym.ins}{\from{flexisym.dtx}{install}}%
  \usedir{tex/latex/breqn}%
  \file{flexisym.sty}{\from{flexisym.dtx}{package}}%
  \file{cmbase.sym}{\from{flexisym.dtx}{cmbase}}%
  \file{mathpazo.sym}{\from{flexisym.dtx}{mathpazo}}%
  \file{mathptmx.sym}{\from{flexisym.dtx}{mathptmx}}%
  \file{msabm.sym}{\from{flexisym.dtx}{msabm}}%
}

\obeyspaces
\Msg{************************************************************************}
\Msg{*}
\Msg{* To finish the installation you have to move the following}
\Msg{* files into a directory searched by TeX:}
\Msg{*}
\Msg{*     flexisym.sty, cmbase.sym, mathpazo.sym, mathptmx.sym, msabm.sym}
\Msg{*}
\Msg{* Happy TeXing!}
\Msg{*}
\Msg{************************************************************************}

\endbatchfile
%</install>
%<*ignore>
\fi
%</ignore>
%<*driver>
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{flexisym.drv}%
  [2014/06/10 v0.97c flexisym (MH)]
\documentclass{ltxdoc}
\CodelineIndex
\EnableCrossrefs
\setcounter{IndexColumns}{2}
%\providecommand*\meta[1]{\ensuremath\langle\textit{#1}\ensuremath\rangle}
\providecommand*\pkg[1]{\textsf{#1}}
\providecommand*\cls[1]{\textsf{#1}}
\providecommand*\opt[1]{\texttt{#1}}
\providecommand*\env[1]{\texttt{#1}}
\providecommand*\fn[1]{\texttt{#1}}
\makeatletter
\providecommand{\AmS}{{\protect\AmSfont
  A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}
\providecommand{\AmSfont}{%
  \usefont{OMS}{cmsy}{\if\expandafter\@car\f@series\@nil bb\else m\fi}{n}}
\makeatother
\newenvironment{aside}{\begin{quote}\bfseries}{\end{quote}}
\begin{document}
  \DocInput{flexisym.dtx}
\end{document}
%</driver>
% \fi
%
% \title{The \textsf{flexisym} package}
% \date{2008/08/08 v0.97a}
% \author{Author: Morten H\o gholm\\ Inactively maintained by Will Robertson\\ Feedback: \texttt{https://github.com/wspr/breqn/issues}}
%
% \maketitle
%
% \part*{User's guide}
%
% For now, the user's guide is in breqn.
%
% \StopEventually{}
% \part*{Implementation}
% 
% \section{flexisym}
%
%    \begin{macrocode}
%<*package>
\RequirePackage{expl3}[2009/08/05]
\ProvidesExplPackage{flexisym}{2013/03/16}{0.97c}{Make math characters macros}

\edef\do{%
  \noexpand\AtEndOfPackage{%
    \catcode\number`\"=\number\catcode`\"
    \relax
  }%
}
\do \let\do\relax
\catcode`\"=12
\let\@sym\@gobble
\DeclareOption{robust}{%
  \def\@sym#1{%
    \ifx\protect\@typeset@protect \else\protect#1\exp_after:wN\use_none:nnnn\fi
  }%
}
%    \end{macrocode}
% The math groups (mg) here relate to |\textfont|$n$.
%    \begin{macrocode}
\def\mg@bin{2}% binary operators
\def\mg@rel{2}% relations
%%\def\mg@nre{B}% negated relations
\def\mg@del{3}% delimiters
%%\def\mg@arr{B}% arrows
\def\mg@acc{0}% accents
\def\mg@cop{3}% cumulative operators (sum, int)
\def\mg@latin{1}% (Latin) letters
\def\mg@greek{1}% (lowercase) Greek
\def\mg@Greek{0}% (capital) Greek
%%\def\mg@bflatin{4}% bold upright Latin letters ?
%%\def\mg@Bbb{B}% blackboard bold
\def\mg@cal{2}% script/calligraphic
%%\def\mg@frak{5}% Fraktur letters
\def\mg@digit{0}% decimal digits % 1 = oldstyle, 0 = capital
%    \end{macrocode}
% This is how we insert mathchars. The command has three arguments:
% class, fam and slot postion and so it is always given as
% hexadecimal.  This way of separating things should make it easier
% to get this to work with XeTeX et al.\ which have many more slot
% positions
%    \begin{macrocode}
\cs_set_protected:Nn \math_char:NNn {
  \tex_mathchar:D \__int_eval:w " #1#2#3 \__int_eval_end:
}
%    \end{macrocode}
% Delimiters and radicals are similar except here we have both small
% and large variant. Radicals have no class.
%    \begin{macrocode}
\cs_set_protected:Nn \math_delimiter:NNnNn {
  \tex_delimiter:D \__int_eval:w " #1#2#3#4#5 \__int_eval_end:
}
\cs_set_protected:Nn \math_radical:NnNn {
  \tex_radical:D  \__int_eval:w " #1#2#3#4 \__int_eval_end:
}
\cs_set_protected:Nn \math_accent:NNnn {
  \tex_mathaccent:D \__int_eval:w " #1 #2 #3 \__int_eval_end: {#4}
}

\let\sumlimits\displaylimits
\let\intlimits\nolimits
\let\namelimits\displaylimits
%    \end{macrocode}
% \TeX\ defines  eight types of atoms.
% \begin{enumerate}\addtocounter{enumi}{-1}
% \item Ordinary
% \item Operators
% \item Binary
% \item Relation
% \item Open
% \item Close
% \item Punctuation
% \item Inner
% \end{enumerate}
% \TeX\ defines  eight math classes.
% \begin{enumerate}\addtocounter{enumi}{-1}
% \item Ordinary
% \item Operators
% \item Binary
% \item Relation
% \item Open
% \item Close
% \item Punctuation
% \item Variable family
% \end{enumerate}
% flexisym/breqn extends this to  types of classes.
% \begin{enumerate}\addtocounter{enumi}{-1}
% \item Ordinary: (Ord), Bidirectional delimiters (DeB), Radicals
%   (Rad), Accented items (Acc)
% \item Operators: Cumulative Operators sum-like (COs), Cumulative
%   Operators integral-like (COi)
% \item Binary: (Bin)
% \item Relation: (Rel), Arrow delimiters (DeA)
% \item Open: (DeL)
% \item Close (DeR)
% \item Punctuation: (Pun)
% \item Variable family: (Var)
% \end{enumerate}
%
% Here's an overview of what we are about to do. Math chars of each
% type as defined by us need a basic operation for inserting it. We
% will call that function |\math_bsym_|\meta{type}|:Nn|. Next there
% are compund symbols for each type which we name
% |\math_bcsym_|\meta{type}|:Nn|. Also, there is inline mode and
% display mode which are different. We will call them for
% |\math_isym_|\meta{type}|:Nn| |\math_icsym_|\meta{type}|:Nn| for
% inline mode and |\math_dsym_|\meta{type}|:Nn| and
% |\math_dcsym_|\meta{type}|:Nn|. The code uses the terms
% |\math_sym_|\meta{type}|:Nn| and |\math_csym_|\meta{type}|:Nn| for
% the current meaning of things.  First up the basic definitions. |#1|
% is the math group it is from and |#2| is the slot position.
%    \begin{macrocode}
\cs_new:Npn \math_bsym_Ord:Nn {\math_char:NNn 0 }% \m@Ord
\cs_new:Npn \math_bsym_Var:Nn {\math_char:NNn 7 }% \m@Var
\cs_new:Npn \math_bsym_Bin:Nn {\math_char:NNn 2 }% \m@Bin
\cs_new:Npn \math_bsym_Rel:Nn {\math_char:NNn 3 }% \m@Bin
\cs_new:Npn \math_bsym_Pun:Nn {\math_char:NNn 6 }% \m@Pun
\cs_new:Nn  \math_bsym_COs:Nn { \math_char:NNn 1 #1 {#2} \sumlimits }% \m@COs
\cs_new:Nn  \math_bsym_COi:Nn { \math_char:NNn 1 #1 {#2} \intlimits }% \m@COi
\cs_new:Nn  \math_bsym_DeL:Nn { \math_sd_del_aux:Nnn 4 #1{#2} }% \m@DeL
\cs_new:Nn  \math_bsym_DeR:Nn { \math_sd_del_aux:Nnn 5 #1{#2} }% \m@DeR
\cs_new:Nn  \math_bsym_DeB:Nn { \math_sd_del_aux:Nnn 0 #1{#2} }% \m@DeB
\cs_new:Nn  \math_bsym_DeA:Nn { \math_sd_del_aux:Nnn 3 #1{#2} }% \m@DeA
\cs_new:Nn  \math_bsym_Rad:Nn { \math_sd_rad_aux:Nn #1{#2} }% \m@Rad
\cs_new:Npn \math_bsym_Acc:Nn #1#2#3#4 {\math_accent:NNnn #1#2{#3}{#4}}% name is wrong

%    \end{macrocode}
% Next is somewhat complicated internally. The way it is done is that
% delimiters and radicals need information about the smallest version
% of the symbol.  If this smallest delimiter (SD) is defined, then use
% it. We have these functions to help us return the number. Extract
% the numbers to use and stick a function in front of it.
%
% Code changed because now we require the smallest delimiter to be
% defined (it may be the same, no problem in that). So the two
% arguments present in |\math_bsym_DeL:Nn| are the location of
% extensible version (where the font will do the rest for us
% automatically). For each delimiter, a pointer is defined using the
% extensible characters family and slot as name and value equal to
% family and position of the smallest version. For |(| in standard
% \LaTeX\ this is |{del}{00}| and |{OT1}{28}| respectively. Hence,
% |\math_bsym_DeL:Nn \mg@del {00}| must expand to
% |\math_delimiter:NNnNn 4 \mg@OT1 {28}\mg@del{00}|. So first expand
% away to get to the smallest version. Then call next function which
% shuffles the arguments around.
%    \begin{macrocode}
\cs_set:Npn \math_sd_del_aux:Nnn #1#2#3{
  \exp_args:Nf \math_sd_del_auxi:nN {\use:c{sd@#2#3}} #1 #2{#3}
}
\cs_set:Npn \math_sd_del_auxi:nN #1#2{ \math_delimiter:NNnNn #2 #1 }
%    \end{macrocode}
% Same for radicals.
%    \begin{macrocode}
\cs_set:Npn \math_sd_rad_aux:Nn #1#2{
  \exp_args:Nf \math_sd_rad_auxi:n {\use:c{sd@#1#2}} #1 {#2}
}
\cs_set:Npn \math_sd_rad_auxi:n #1{ \math_radical:NnNn #1 }


% \cs_set:Npn \math_sd_aux:nn  #1#2 {
%   %\exp_args:Nnf \use:nn { #1}  { \math_sd_auxi:Nn #2 }
%   \exp_args:Nnf \use:nn { #1}  { \use:c{sd@\use:nn#2} }
% }
% \cs_set:Npn \math_sd_auxi:Nn #1#2 {
%    \cs_if_free:cTF {sd@#1#2}
%   {   #1{#2}  }
%   {   \use:c{sd@#1#2}  }
% }
%    \end{macrocode}
% compound symbols here
%    \begin{macrocode}
\cs_set_protected:Npn \math_bcsym_Ord:Nn #1#2 { \@symtype \mathord   { \OrdSymbol {#2} } }%\@symOrd
\cs_set_protected:Npn \math_bcsym_Var:Nn #1#2 { \@symtype \mathord   { \OrdSymbol {#2} } }%\@symVar
\cs_set_protected:Npn \math_bcsym_Bin:Nn #1#2 { \@symtype \mathbin   { \OrdSymbol {#2} } }%\@symBin
\cs_set_protected:Npn \math_bcsym_Rel:Nn #1#2 { \@symtype \mathrel   { \OrdSymbol {#2} } }%\@symRel
\cs_set_protected:Npn \math_bcsym_Pun:Nn #1#2 { \@symtype \mathpunct { \OrdSymbol {#2} } }%\@symPun
\cs_set_protected:Npn \math_bcsym_COi:Nn #1#2 { \@symtype \mathop    { \OrdSymbol {#2} \intlimits } }%\@symCOi
\cs_set_protected:Npn \math_bcsym_COs:Nn #1#2 { \@symtype \mathop    { \OrdSymbol {#2} \sumlimits } }%\@symCOs
\cs_set_protected:Npn \math_bcsym_DeL:Nn #1#2 { \@symtype \mathopen  { \OrdSymbol {#2} } }%\@symDeL
\cs_set_protected:Npn \math_bcsym_DeR:Nn #1#2 { \@symtype \mathclose { \OrdSymbol {#2} } }%\@symDeR
\cs_set_protected:Npn \math_bcsym_DeB:Nn #1#2 { \@symtype \mathord   { \OrdSymbol {#2} } }%\@symDeB
\cs_set_protected:Npn \math_bcsym_DeA:Nn #1#2 { \@symtype \mathrel   { \OrdSymbol {#2} } }%\@symDeA
\cs_set_protected:Npn \math_bcsym_Acc:Nn {\@sym}%\@symAcc FIX!
% These three?
\cs_set_protected:Npn \math_bcsym_Ope:Nn #1#2{\@symtype\mathopen{\OrdSymbol{#2}}}%\@symVar
\cs_set_protected:Npn \math_bcsym_Clo:Nn #1#2{\@symtype\mathclose{\OrdSymbol{#2}}}%\@symVar
\cs_set_protected:Npn \math_bcsym_Inn:Nn #1#2{\@symtype\mathinner{\OrdSymbol{#2}}}%\@symVar

\let\@symtype\@firstofone
\let\sym@global\global
%    \end{macrocode}
%
%
%
%
% The inline variants, using the basic operations. Currently we do not
% do anything to inline math.
%    \begin{macrocode}
\cs_new:Npn \math_isym_Ord:Nn { \math_bsym_Ord:Nn }% \m@Ord
\cs_new:Npn \math_isym_Var:Nn { \math_bsym_Var:Nn }% \m@Var
\cs_new:Npn \math_isym_Bin:Nn { \math_bsym_Bin:Nn }% \m@Bin
\cs_new:Npn \math_isym_Rel:Nn { \math_bsym_Rel:Nn }% \m@Bin
\cs_new:Npn \math_isym_Pun:Nn { \math_bsym_Pun:Nn }% \m@Pun
\cs_new:Npn \math_isym_COs:Nn { \math_bsym_COs:Nn }% \m@COs
\cs_new:Npn \math_isym_COi:Nn { \math_bsym_COi:Nn }% \m@COi
\cs_new:Npn \math_isym_DeL:Nn { \math_bsym_DeL:Nn }% \m@DeL
\cs_new:Npn \math_isym_DeR:Nn { \math_bsym_DeR:Nn }% \m@DeR
\cs_new:Npn \math_isym_DeB:Nn { \math_bsym_DeB:Nn }% \m@DeB
\cs_new:Npn \math_isym_DeA:Nn { \math_bsym_DeA:Nn }% \m@DeA
\cs_new:Npn \math_isym_Rad:Nn { \math_bsym_Rad:Nn }% \m@Rad
\cs_new:Npn \math_isym_Acc:Nn { \math_bsym_DeL:Nn }% name is wrong
% inline compound
\cs_set_protected:Npn \math_icsym_Ord:Nn { \math_bcsym_Ord:Nn }
\cs_set_protected:Npn \math_icsym_Var:Nn { \math_bcsym_Var:Nn }
\cs_set_protected:Npn \math_icsym_Bin:Nn { \math_bcsym_Bin:Nn }
\cs_set_protected:Npn \math_icsym_Rel:Nn { \math_bcsym_Rel:Nn }
\cs_set_protected:Npn \math_icsym_Pun:Nn { \math_bcsym_Pun:Nn }
\cs_set_protected:Npn \math_icsym_COi:Nn { \math_bcsym_COi:Nn }
\cs_set_protected:Npn \math_icsym_COs:Nn { \math_bcsym_COs:Nn }
\cs_set_protected:Npn \math_icsym_DeL:Nn { \math_bcsym_DeL:Nn }
\cs_set_protected:Npn \math_icsym_DeR:Nn { \math_bcsym_DeR:Nn }
\cs_set_protected:Npn \math_icsym_DeB:Nn { \math_bcsym_DeB:Nn }
\cs_set_protected:Npn \math_icsym_DeA:Nn { \math_bcsym_DeA:Nn }
\cs_set_protected:Npn \math_icsym_Acc:Nn { \math_bcsym_Acc:Nn }
\cs_set_protected:Npn \math_icsym_Ope:Nn { \math_bcsym_Ope:Nn }
\cs_set_protected:Npn \math_icsym_Clo:Nn { \math_bcsym_Clo:Nn }
\cs_set_protected:Npn \math_icsym_Inn:Nn { \math_bcsym_Inn:Nn }
%    \end{macrocode}
%
% The display variants, using the basic operations. Currently we do
% not do anything to inline math.
%    \begin{macrocode}
\cs_new:Npn \math_dsym_Ord:Nn { \math_bsym_Ord:Nn }
\cs_new:Npn \math_dsym_Var:Nn { \math_bsym_Var:Nn }
\cs_new:Npn \math_dsym_Bin:Nn { \math_bsym_Bin:Nn }
\cs_new:Npn \math_dsym_Rel:Nn { \math_bsym_Rel:Nn }
\cs_new:Npn \math_dsym_Pun:Nn { \math_bsym_Pun:Nn }
\cs_new:Npn \math_dsym_COs:Nn { \math_bsym_COs:Nn }
\cs_new:Npn \math_dsym_COi:Nn { \math_bsym_COi:Nn }
\cs_new:Npn \math_dsym_DeL:Nn { \math_bsym_DeL:Nn }
\cs_new:Npn \math_dsym_DeR:Nn { \math_bsym_DeR:Nn }
\cs_new:Npn \math_dsym_DeB:Nn { \math_bsym_DeB:Nn }
\cs_new:Npn \math_dsym_DeA:Nn { \math_bsym_DeA:Nn }
\cs_new:Npn \math_dsym_Rad:Nn { \math_bsym_Rad:Nn }
\cs_new:Npn \math_dsym_Acc:Nn { \math_bsym_DeL:Nn }
% inline compound
\cs_set_protected:Npn \math_dcsym_Ord:Nn { \math_bcsym_Ord:Nn }
\cs_set_protected:Npn \math_dcsym_Var:Nn { \math_bcsym_Var:Nn }
\cs_set_protected:Npn \math_dcsym_Bin:Nn { \math_bcsym_Bin:Nn }
\cs_set_protected:Npn \math_dcsym_Rel:Nn { \math_bcsym_Rel:Nn }
\cs_set_protected:Npn \math_dcsym_Pun:Nn { \math_bcsym_Pun:Nn }
\cs_set_protected:Npn \math_dcsym_COi:Nn { \math_bcsym_COi:Nn }
\cs_set_protected:Npn \math_dcsym_COs:Nn { \math_bcsym_COs:Nn }
\cs_set_protected:Npn \math_dcsym_DeL:Nn { \math_bcsym_DeL:Nn }
\cs_set_protected:Npn \math_dcsym_DeR:Nn { \math_bcsym_DeR:Nn }
\cs_set_protected:Npn \math_dcsym_DeB:Nn { \math_bcsym_DeB:Nn }
\cs_set_protected:Npn \math_dcsym_DeA:Nn { \math_bcsym_DeA:Nn }
\cs_set_protected:Npn \math_dcsym_Acc:Nn { \math_bcsym_Acc:Nn }
\cs_set_protected:Npn \math_dcsym_Ope:Nn { \math_bcsym_Ope:Nn }
\cs_set_protected:Npn \math_dcsym_Clo:Nn { \math_bcsym_Clo:Nn }
\cs_set_protected:Npn \math_dcsym_Inn:Nn { \math_bcsym_Inn:Nn }
%    \end{macrocode}
% Almost ready now! Now just need two commands to initialize these
% settings.
%
%    \begin{macrocode}
\cs_set:Npn \math_setup_inline_symbols:
 {
  \cs_set_eq:NN \math_sym_Ord:Nn  \math_isym_Ord:Nn
  \cs_set_eq:NN \math_sym_Var:Nn  \math_isym_Var:Nn
  \cs_set_eq:NN \math_sym_Bin:Nn  \math_isym_Bin:Nn
  \cs_set_eq:NN \math_sym_Rel:Nn  \math_isym_Rel:Nn
  \cs_set_eq:NN \math_sym_Pun:Nn  \math_isym_Pun:Nn
  \cs_set_eq:NN \math_sym_COs:Nn  \math_isym_COs:Nn
  \cs_set_eq:NN \math_sym_COi:Nn  \math_isym_COi:Nn
  \cs_set_eq:NN \math_sym_DeL:Nn  \math_isym_DeL:Nn
  \cs_set_eq:NN \math_sym_DeR:Nn  \math_isym_DeR:Nn
  \cs_set_eq:NN \math_sym_DeB:Nn  \math_isym_DeL:Nn
  \cs_set_eq:NN \math_sym_DeA:Nn  \math_isym_DeA:Nn
  \cs_set_eq:NN \math_sym_Rad:Nn  \math_isym_Rad:Nn
  \cs_set_eq:NN \math_sym_Acc:Nn  \math_isym_DeL:Nn
  \cs_set_eq:NN \math_csym_Ord:Nn \math_icsym_Ord:Nn
  \cs_set_eq:NN \math_csym_Var:Nn \math_icsym_Var:Nn
  \cs_set_eq:NN \math_csym_Bin:Nn \math_icsym_Bin:Nn
  \cs_set_eq:NN \math_csym_Rel:Nn \math_icsym_Rel:Nn
  \cs_set_eq:NN \math_csym_Pun:Nn \math_icsym_Pun:Nn
  \cs_set_eq:NN \math_csym_COi:Nn \math_icsym_COi:Nn
  \cs_set_eq:NN \math_csym_COs:Nn \math_icsym_COs:Nn
  \cs_set_eq:NN \math_csym_DeL:Nn \math_icsym_DeL:Nn
  \cs_set_eq:NN \math_csym_DeR:Nn \math_icsym_DeR:Nn
  \cs_set_eq:NN \math_csym_DeB:Nn \math_icsym_DeB:Nn
  \cs_set_eq:NN \math_csym_DeA:Nn \math_icsym_DeA:Nn
  \cs_set_eq:NN \math_csym_Acc:Nn \math_icsym_Acc:Nn
  \cs_set_eq:NN \math_csym_Ope:Nn \math_icsym_Ope:Nn
  \cs_set_eq:NN \math_csym_Clo:Nn \math_icsym_Clo:Nn
  \cs_set_eq:NN \math_csym_Inn:Nn \math_icsym_Inn:Nn
 }

\cs_set:Npn \math_setup_display_symbols:
 {
  \cs_set_eq:NN \math_sym_Ord:Nn  \math_dsym_Ord:Nn
  \cs_set_eq:NN \math_sym_Var:Nn  \math_dsym_Var:Nn
  \cs_set_eq:NN \math_sym_Bin:Nn  \math_dsym_Bin:Nn
  \cs_set_eq:NN \math_sym_Rel:Nn  \math_dsym_Rel:Nn
  \cs_set_eq:NN \math_sym_Pun:Nn  \math_dsym_Pun:Nn
  \cs_set_eq:NN \math_sym_COs:Nn  \math_dsym_COs:Nn
  \cs_set_eq:NN \math_sym_COi:Nn  \math_dsym_COi:Nn
  \cs_set_eq:NN \math_sym_DeL:Nn  \math_dsym_DeL:Nn
  \cs_set_eq:NN \math_sym_DeR:Nn  \math_dsym_DeR:Nn
  \cs_set_eq:NN \math_sym_DeB:Nn  \math_dsym_DeL:Nn
  \cs_set_eq:NN \math_sym_DeA:Nn  \math_dsym_DeA:Nn
  \cs_set_eq:NN \math_sym_Rad:Nn  \math_dsym_Rad:Nn
  \cs_set_eq:NN \math_sym_Acc:Nn  \math_dsym_DeL:Nn
  \cs_set_eq:NN \math_csym_Ord:Nn \math_dcsym_Ord:Nn
  \cs_set_eq:NN \math_csym_Var:Nn \math_dcsym_Var:Nn
  \cs_set_eq:NN \math_csym_Bin:Nn \math_dcsym_Bin:Nn
  \cs_set_eq:NN \math_csym_Rel:Nn \math_dcsym_Rel:Nn
  \cs_set_eq:NN \math_csym_Pun:Nn \math_dcsym_Pun:Nn
  \cs_set_eq:NN \math_csym_COi:Nn \math_dcsym_COi:Nn
  \cs_set_eq:NN \math_csym_COs:Nn \math_dcsym_COs:Nn
  \cs_set_eq:NN \math_csym_DeL:Nn \math_dcsym_DeL:Nn
  \cs_set_eq:NN \math_csym_DeR:Nn \math_dcsym_DeR:Nn
  \cs_set_eq:NN \math_csym_DeB:Nn \math_dcsym_DeB:Nn
  \cs_set_eq:NN \math_csym_DeA:Nn \math_dcsym_DeA:Nn
  \cs_set_eq:NN \math_csym_Acc:Nn \math_dcsym_Acc:Nn
  \cs_set_eq:NN \math_csym_Ope:Nn \math_dcsym_Ope:Nn
  \cs_set_eq:NN \math_csym_Clo:Nn \math_dcsym_Clo:Nn
  \cs_set_eq:NN \math_csym_Inn:Nn \math_dcsym_Inn:Nn
 }
%    \end{macrocode}
% Phew, that was it.
%
% Well, almost. We need to set them up for use properly. Should they
% be added to |\everymath|? Probably, for math within
% displays. However, this is a lot of extra processing which we could
% tackle in the display setup.
%    \begin{macrocode}
\math_setup_inline_symbols:
%    \end{macrocode}
%
% Need an active character for a second. Don't rely on |~| being
% active!
%    \begin{macrocode}
\edef\tmp{\catcode\z@=\the\catcode\z@}
\catcode\z@=\active
\def\DeclareFlexSymbol#1#2#3#4{%
  \begingroup
  \cs_set_protected:Npx\@tempb{
    \exp_not:N\@sym\exp_not:N#1\exp_not:c{math_sym_#2:Nn}
        \exp_not:c{mg@#3}{#4}
  }
  \ifcat\exp_not:N#1\relax
    \sym@global\let#1\@tempb
  \else
    \sym@global\mathcode`#1="8000\relax
    \lccode\z@=`#1\relax
    \lowercase{\sym@global\let^^@\@tempb}% zero char
  \fi
  \endgroup
}
\tmp % restore catcode
\cs_set:Npn \DeclareFlexDelimiter #1#2#3#4#5#6{
  \DeclareFlexSymbol{#1}{#2}{#3}{#4}
  \cs_gset:cpx{sd@\use:c{mg@#3}#4}{\exp_not:c{mg@#5}{#6}}
}

%    \end{macrocode}
% |\DeclareFlexCompoundSymbol{\cdots}{Inn}{\cdotp\cdotp\cdotp}|
% |\def\@symInn#1#2{\@symtype\mathinner{\OrdSymbol{#2}}}|
% |\@symtype \mathinner{\OrdSymbol{\cdtop\cdotp\cdotp}}|
%    \begin{macrocode}
\def\DeclareFlexCompoundSymbol#1#2#3{%
  \exp_args:NNo \DeclareRobustCommand#1{\csname math_csym_#2:Nn\endcsname#1{#3}}%
  \sym@global\let#1#1\relax
}
\DeclareRobustCommand\textchar{\text@char\textfont}
\DeclareRobustCommand\scriptchar{\text@char\scriptfont}%
%    \end{macrocode}
% Simplified the next bit because now the slot is read as one argument
% so no afterassignment and what have you. Just drop the char
% directly.
%    \begin{macrocode}
\def\text@char@sym#1#2#3#4{% #3=fam, #4=slot
  \begingroup
    \cs_set_eq:NN \@sym \prg_do_nothing: % defense against infinite loops
%    \end{macrocode}
% the next line will result in |\scriptfont|\meta{num}, where |#3|
% provides the \meta{num}.
%    \begin{macrocode}
   \the\text@script@char#3%
   \char"#4\endgroup
}
\edef\tmp{\catcode\z@=\the\catcode\z@}
\catcode\z@=\active
\def\text@char#1#2{\begingroup
  \check@mathfonts
  \cs_set_eq:NN \text@script@char #1
  \cs_set_eq:NN \@sym \text@char@sym
  \cs_set_eq:NN \@symtype \use_ii:nn 
  \cs_set_eq:NN \OrdSymbol \use:n
  \cs_set_eq:NN \ifmmode \iftrue 
  \everymath{$\use_none:n}%$
  \def\mkern{\muskip\z@}
  \cs_set_eq:NN\mskip\mkern
  \ifcat\relax\noexpand#2% true if #2 is a cs.
    #2%  
  \else
    \lccode\z@=\expandafter`\string#2\relax
    \lowercase{^^@}%
  \fi
  \endgroup
}
\tmp % restore catcode
\providecommand\textprime{}
\DeclareRobustCommand\textprime{\leavevmode
  \raise.8ex\hbox{\text@char\scriptfont\prime}%
}
\@ifundefined{resetMathstrut@}{}{%
  \def\resetMathstrut@{%
    \setbox\z@\hbox{\textchar\vert}%
    \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@
  }%
}
%    \end{macrocode}
% Arrow fills. changed to 7mu as in amsmath
%    \begin{macrocode}
\@ifundefined{rightarrowfill@}{}{%
  \def\rightarrowfill@#1{\m@th\setboxz@h{$#1\relbar$}\ht\z@\z@
    $#1\copy\z@\mkern-7mu\cleaders
    \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill
    \mkern-6mu\OrdSymbol{\rightarrow}$}
  \def\leftarrowfill@#1{\m@th\setboxz@h{$#1\relbar$}\ht\z@\z@
    $#1\OrdSymbol{\leftarrow}\mkern-6mu\cleaders
    \hbox{$#1\mkern-2mu\copy\z@\mkern-2mu$}\hfill
    \mkern-7mu\box\z@$}
  \def\leftrightarrowfill@#1{\m@th\setboxz@h{$#1\relbar$}\ht\z@\z@
    $#1\OrdSymbol{\leftarrow}\mkern-6mu\cleaders
    \hbox{$#1\mkern-2mu\box\z@\mkern-2mu$}\hfill
    \mkern-6mu\OrdSymbol{\rightarrow}$}
}
%    \end{macrocode}
% hey, this looks like a simple case switch...
%    \begin{macrocode}
\def\binrel@sym#1#2#3#4{%
  \xdef\binrel@@##1{%
    \ifx\math_sym_Ord:Nn #2 \math_csym_Ord:Nn 
    \else\ifx\math_sym_Var:Nn#2 \math_csym_Var:Nn 
    \else\ifx\math_sym_COs:Nn#2 \math_csym_COs:Nn 
    \else\ifx\math_sym_COi:Nn#2 \math_csym_COi:Nn 
    \else\ifx\math_sym_Bin:Nn#2 \math_csym_Bin:Nn
    \else\ifx\math_sym_Rel:Nn#2 \math_csym_Rel:Nn 
    \else\ifx\math_sym_Pun:Nn#2 \math_csym_Pun:Nn 
    \else\exp_not:N\@symErr \fi\fi\fi\fi\fi\fi\fi
  ?{\exp_not:N\OrdSymbol{##1}}}%
}

\def\binrel@a{%
  \def\math_sym_Ord:Nn##1##2{\gdef\binrel@@####1{\math_sym_Ord:Nn##1{\OrdSymbol{####1}}}}%
  \def\math_sym_Var:Nn##1##2{\gdef\binrel@@####1{\math_sym_Var:Nn##1{\OrdSymbol{####1}}}}%
  \def\math_sym_COs:Nn##1##2{\gdef\binrel@@####1{\math_sym_COs:Nn##1{\OrdSymbol{####1}}}}%
  \def\math_sym_COi:Nn##1##2{\gdef\binrel@@####1{\math_sym_COi:Nn##1{\OrdSymbol{####1}}}}%
  \def\math_sym_Bin:Nn##1##2{\gdef\binrel@@####1{\math_sym_Bin:Nn##1{\OrdSymbol{####1}}}}%
  \def\math_sym_Rel:Nn##1##2{\gdef\binrel@@####1{\math_sym_Rel:Nn##1{\OrdSymbol{####1}}}}%
  \def\math_sym_Pun:Nn##1##2{\gdef\binrel@@####1{\math_sym_Pun:Nn##1{\OrdSymbol{####1}}}}%
}
\def\binrel@#1{%
  \setbox\z@\hbox{$%
    \let\mathchoice\@gobblethree
    \let\@sym\binrel@sym \binrel@a
    #1$}%
}
\def\@symextension{sym}
\newcommand\usesymbols[1]{%
  \clist_map_variable:nNn{#1}\@tempb{%
    \exp_args:No\@onefilewithoptions{\@tempb}[][]\@symextension
  }%
}
% Need to introduce \ProvidesExplFile somehow
\newcommand\ProvidesSymbols[1]{\ProvidesFile{#1.sym}}
\DeclareRobustCommand{\not}[1]{\math_csym_Rel:Nn\not{\OrdSymbol{\notRel#1}}}
\DeclareRobustCommand{\OrdSymbol}[1]{%
  \begingroup\mathchars@reset#1\endgroup
}
\def\mathchars@reset{\let\@sym\@sym@ord \let\@symtype\@symtype@ord
  \let\OrdSymbol\relax}
\def\@symtype@ord#1#{}% a strange sort of \@gobble
\def\@sym@ord#1#2{\exp_after:wN\@sym@ord@a\string#2\@nil}%
%    \end{macrocode}
% Read delimited argument here. We want to find first character of
% DeA, Bin, etc. and the control sequence checked agains is |\m@DeL|,
% |\m@Pun|, etc.  The lccode trick makes the . into an @ with catcode
% 12. This is what results when the code is called with
% |\string|. Beware of this when we change internal names for math
% groups! If a Delimiter is found, insert it with class 0 but use the
% smallest version available. Otherwise just insert math char of class
% 0. The code here is not pretty and it indicates it should be tackled
% differently!
%    \begin{macrocode}
\begingroup
\lccode`\.=`\_ \lowercase{\endgroup
\def\@sym@ord@a#1.#2.}#3#4\@nil#5#6{%
  \if D#3
     %\math_ord_delim_aux:Nn #5{#6} 
     \math_sd_del_aux:Nnn 0 #5{#6}% check if this works!
  \else
    \math_char:NNn 0 #5{#6}
  \fi 
}
\cs_set:Nn \math_ord_delim_aux:Nn {
  \math_sd_aux:nn { \math_char:NNn 0 } {#1{#2}} 
}
%    \end{macrocode}
%
%
% Before declaring any math characters active, we have to take care of
% a small problem with \pkg{amsmath} v2.x, if it is loaded before
% \pkg{flexisym}. \cs{std@minus} and \cs{std@equal} are defined as
% \begin{verbatim}
% \mathchardef\std@minus\mathcode`\-\relax
% \mathchardef\std@equal\mathcode`\=\relax
% \end{verbatim}
% in \fn{amsmath.sty} and again \cs{AtBeginDocument}. The
% latter is because
% \begin{quote}
%   In case some alternative math fonts are loaded
%   later. [\fn{amsmath.dtx}]
% \end{quote}
% The problem arises because \pkg{flexisym} sets the mathcode of all
% symbols to $32768$ which is illegal for a \cs{mathchardef}. 
%
% We have to remove the assignments from the \cs{AtBeginDocument} hook
% as they will cause an error there.
%    \begin{macrocode}
\@ifpackageloaded{amsmath}{%
  \begingroup
%    \end{macrocode}
% Split the contents of \cs{@begindocumenthook} by reading what we
% search for as a delimited argument and ensure these two assignments
% do not take place. It is questionable if anything reasonable can be
% done to them. In the case of a package such as \pkg{mathpazo} which defines
% \begin{verbatim}
%\DeclareMathSymbol{=}{\mathrel}{upright}{"3D}
% \end{verbatim}
% the \cs{Relbar} will look wrong if we don't use the correct
% symbol. The way to solve this is define additional \fn{.sym} files
% which contain the definition of \cs{relbar} and \cs{Relbar}
% needed. We need those additional files anyway for things like
% \cs{joinord}.
%    \begin{macrocode}
  \long\def\next#1\mathchardef\std@minus\mathcode`\-\relax
                  \mathchardef\std@equal\mathcode`\=\relax#2\flexi@stop{%
    \toks@{#1#2}%
    \xdef\@begindocumenthook{\the\toks@}%
  }%
  \expandafter\next\@begindocumenthook\flexi@stop
  \endgroup
}{}
%    \end{macrocode}
%
% There is problem when using \cs{DeclareMathOperator} as the
% operators defined call a command \cs{newmcodes@} which relies on the
% mathcode of \texttt{-} being less than 32768. We delay the
% definition \cs{AtBeginDocument} in case \pkg{amssymb} hasn't been
% loaded yet.
%    \begin{macrocode}
\AtBeginDocument{%
\def\newmcodes@{%
  \mathcode `\'39\space
  \mathcode `\*42\space
  \mathcode `\."613A\space
  \ifnum\mathcode`\-=45\space
  \else
%    \end{macrocode}
% The extra check. Don't do anything if \texttt{-} is math active.
%    \begin{macrocode}
    \ifnum\mathcode`\-=32768\space
    \else 
      \mathchardef \std@minus \mathcode `\-\relax
    \fi
  \fi
  \mathcode `\-45\space 
  \mathcode `\/47\space
  \mathcode `\:"603A\space\relax 
}%
}
%    \end{macrocode}
%
% And we then continue with the options.
%    \begin{macrocode}
\DeclareOption{mathstyleoff}{%
  \PassOptionsToPackage{noactivechars}{mathstyle}}
\DeclareOption{cmbase}{\usesymbols{cmbase}}
\DeclareOption{mathpazo}{\usesymbols{mathpazo}}
\DeclareOption{mathptmx}{\usesymbols{mathptmx}}
\ExecuteOptions{cmbase}
\ProcessOptions\relax
\renewcommand{\lnot}{\neg}
\renewcommand{\land}{\wedge}
\renewcommand{\lor}{\vee}
\renewcommand{\le}{\leq}
\renewcommand{\ge}{\geq}
\renewcommand{\ne}{\neq}
\renewcommand{\owns}{\ni}
\renewcommand{\gets}{\leftarrow}
\renewcommand{\to}{\rightarrow}
\renewcommand{\|}{\Vert}
\RequirePackage{mathstyle}
%</package>\endinput
%    \end{macrocode}
%
% \section{cmbase, mathpazo, mathptmx}
%
%
% For each math font package we define a corresponding symbol file
% with extension \fn{sym}. The Computer Modern base is called
% \opt{cmbase} and \opt{mathpazo} and \opt{mathptmx} corresponds to
% the packages. The definitions are almost identical as they mostly
% concern the positions in the math font encodings. Look for
% differences in \cs{joinord}, \cs{relbar} and \cs{Relbar}. If you
% inspect the source code, you'll see that the support for
% \pkg{mathptmx} didn't require any work but I thought it better to
% create a \fn{sym} file to maintain a uniform interface.
%
% \begin{aside}
% Open question on \verb"!" and \verb"?": maybe they
% should have type `Pun' instead of `DeR'.    Need to
% search for uses in math in AMS archives.    Or, maybe add a special
% `Clo' type for them: non-extensible closing delimiter.   
% \end{aside}
% 
% 
% 
% Default mathgroup setup.   
% \changes{v0.3}{2010/07/11}{fixed bugs regarding capital greek
% letters in mathpazo and mathptmx}
%    \begin{macrocode}
%<*cmbase|mathpazo|mathptmx>
%<cmbase>\ProvidesSymbols{cmbase}[2007/12/19 v0.92]
%<mathpazo>\ProvidesSymbols{mathpazo}[2010/07/11 v0.3]
%<mathptmx>\ProvidesSymbols{mathptmx}[2010/07/11 v0.3]
\ExplSyntaxOn
\cs_gset:cpx {mg@OT1}  {\hexnumber@\symoperators}
\cs_gset:cpx {mg@OML}  {\hexnumber@\symletters}
\cs_gset:cpx {mg@OMS}  {\hexnumber@\symsymbols}
\cs_gset:cpx {mg@OMX}  {\hexnumber@\symlargesymbols}
\cs_gset:Npx \mg@bin   {\mg@OMS}
\cs_gset:Npx \mg@del   {\mg@OMX}
\cs_gset:Npx \mg@digit {\exp_not:c{mg@OT1}}
\cs_gset:Npn \mg@latin {\mg@OML}
\cs_gset_eq:NN \mg@Latin \mg@latin
\cs_gset_eq:NN \mg@greek \mg@latin
%<cmbase|mathptmx>\cs_gset_eq:NN\mg@Greek\mg@digit
%    \end{macrocode}
% Mathpazo takes the upper case greeks from the letter font if
% slantedGreek is in effect, but from \emph{upright} if not. Mathptmx
% also takes the slanted greek from the letter font.
%    \begin{macrocode}
%<mathpazo>\@ifpackagewith{mathpazo}{slantedGreek}{%
%<mathpazo>  \cs_gset_eq:NN\mg@Greek\mg@latin
%<mathpazo>}{%
%<mathpazo>  \cs_gset:cpx{mg@Greek}{\hexnumber@\symupright}
%<mathpazo>}
%<mathptmx>\@ifpackagewith{mathptmx}{slantedGreek}{%
%<mathptmx>   \cs_gset_eq:NN\mg@Greek\mg@latin
%<mathptmx>}{}
\cs_gset_eq:NN \mg@rel \mg@bin
\cs_gset_eq:NN \mg@ord \mg@bin
\cs_gset_eq:NN \mg@cop \mg@del
%    \end{macrocode}
% 
% 
% Symbols from the 128-character \fn{cmr} encoding.   
% Paren and square bracket delimiters from this encoding are covered
% by the definitions in the \fn{cmex} section, however.   
%    \begin{macrocode}
\DeclareFlexSymbol{!}     {Pun}{OT1}{21}
\DeclareFlexSymbol{+}     {Bin}{OT1}{2B}
\DeclareFlexSymbol{:}     {Rel}{OT1}{3A}
\DeclareFlexSymbol{\colon}{Pun}{OT1}{3A}
\DeclareFlexSymbol{;}     {Pun}{OT1}{3B}
\DeclareFlexSymbol{=}     {Rel}{OT1}{3D}
\DeclareFlexSymbol{?}     {Pun}{OT1}{3F}
%    \end{macrocode}
% \AmS\TeX, and therefore the \pkg{amsmath} package, make the
% uppercase Greek letters class 0 (nonvariable) instead of 7
% (variable), to eliminate the glaring inconsistency with lowercase
% Greek.    (In plain \TeX , \verb"{\bf\Delta}" works, while
% \verb"{\bf\delta}" doesn't.) Let us try to make them both
% variable (fonts permitting) instead of nonvariable.   
%    \begin{macrocode}
\DeclareFlexSymbol{\Gamma}  {Var}{Greek}{00}
\DeclareFlexSymbol{\Delta}  {Var}{Greek}{01}
\DeclareFlexSymbol{\Theta}  {Var}{Greek}{02}
\DeclareFlexSymbol{\Lambda} {Var}{Greek}{03}
\DeclareFlexSymbol{\Xi}     {Var}{Greek}{04}
\DeclareFlexSymbol{\Pi}     {Var}{Greek}{05}
\DeclareFlexSymbol{\Sigma}  {Var}{Greek}{06}
\DeclareFlexSymbol{\Upsilon}{Var}{Greek}{07}
\DeclareFlexSymbol{\Phi}    {Var}{Greek}{08}
\DeclareFlexSymbol{\Psi}    {Var}{Greek}{09}
\DeclareFlexSymbol{\Omega}  {Var}{Greek}{0A}
%    \end{macrocode}
% Decimal digits.   
%    \begin{macrocode}
\DeclareFlexSymbol{0}{Var}{digit}{30}
\DeclareFlexSymbol{1}{Var}{digit}{31}
\DeclareFlexSymbol{2}{Var}{digit}{32}
\DeclareFlexSymbol{3}{Var}{digit}{33}
\DeclareFlexSymbol{4}{Var}{digit}{34}
\DeclareFlexSymbol{5}{Var}{digit}{35}
\DeclareFlexSymbol{6}{Var}{digit}{36}
\DeclareFlexSymbol{7}{Var}{digit}{37}
\DeclareFlexSymbol{8}{Var}{digit}{38}
\DeclareFlexSymbol{9}{Var}{digit}{39}
%    \end{macrocode}
% Symbols from the 128-character \fn{cmmi} encoding.   
%    \begin{macrocode}
\DeclareFlexSymbol{,}{Pun}{OML}{3B}
\DeclareFlexSymbol{.}{Ord}{OML}{3A}
\DeclareFlexSymbol{/}{Ord}{OML}{3D}
\DeclareFlexSymbol{<}{Rel}{OML}{3C}
\DeclareFlexSymbol{>}{Rel}{OML}{3E}
%    \end{macrocode}
% To do: make the Var property of lc Greek work properly.   
%    \begin{macrocode}
\DeclareFlexSymbol{\alpha}     {Var}{greek}{0B}
\DeclareFlexSymbol{\beta}      {Var}{greek}{0C}
\DeclareFlexSymbol{\gamma}     {Var}{greek}{0D}
\DeclareFlexSymbol{\delta}     {Var}{greek}{0E}
\DeclareFlexSymbol{\epsilon}   {Var}{greek}{0F}
\DeclareFlexSymbol{\zeta}      {Var}{greek}{10}
\DeclareFlexSymbol{\eta}       {Var}{greek}{11}
\DeclareFlexSymbol{\theta}     {Var}{greek}{12}
\DeclareFlexSymbol{\iota}      {Var}{greek}{13}
\DeclareFlexSymbol{\kappa}     {Var}{greek}{14}
\DeclareFlexSymbol{\lambda}    {Var}{greek}{15}
\DeclareFlexSymbol{\mu}        {Var}{greek}{16}
\DeclareFlexSymbol{\nu}        {Var}{greek}{17}
\DeclareFlexSymbol{\xi}        {Var}{greek}{18}
\DeclareFlexSymbol{\pi}        {Var}{greek}{19}
\DeclareFlexSymbol{\rho}       {Var}{greek}{1A}
\DeclareFlexSymbol{\sigma}     {Var}{greek}{1B}
\DeclareFlexSymbol{\tau}       {Var}{greek}{1C}
\DeclareFlexSymbol{\upsilon}   {Var}{greek}{1D}
\DeclareFlexSymbol{\phi}       {Var}{greek}{1E}
\DeclareFlexSymbol{\chi}       {Var}{greek}{1F}
\DeclareFlexSymbol{\psi}       {Var}{greek}{20}
\DeclareFlexSymbol{\omega}     {Var}{greek}{21}
\DeclareFlexSymbol{\varepsilon}{Var}{greek}{22}
\DeclareFlexSymbol{\vartheta}  {Var}{greek}{23}
\DeclareFlexSymbol{\varpi}     {Var}{greek}{24}
\DeclareFlexSymbol{\varrho}    {Var}{greek}{25}
\DeclareFlexSymbol{\varsigma}  {Var}{greek}{26}
\DeclareFlexSymbol{\varphi}    {Var}{greek}{27}
%    \end{macrocode}
% Note that in plain \TeX\  \cs{imath} and \cs{jmath} are
% not variable-font.    But if a \verb"j" changes font to, let's
% say, sans serif or calligraphic, a dotless \verb"j" in the same
% context should change font in the same way.   
%    \begin{macrocode}
\DeclareFlexSymbol{\imath}           {Var}{OML}{7B}
\DeclareFlexSymbol{\jmath}           {Var}{OML}{7C}
\DeclareFlexSymbol{\ell}             {Ord}{OML}{60}
\DeclareFlexSymbol{\wp}              {Ord}{OML}{7D}
\DeclareFlexSymbol{\partial}         {Ord}{OML}{40}
\DeclareFlexSymbol{\flat}            {Ord}{OML}{5B}
\DeclareFlexSymbol{\natural}         {Ord}{OML}{5C}
\DeclareFlexSymbol{\sharp}           {Ord}{OML}{5D}
\DeclareFlexSymbol{\triangleleft}    {Bin}{OML}{2F}
\DeclareFlexSymbol{\triangleright}   {Bin}{OML}{2E}
\DeclareFlexSymbol{\star}            {Bin}{OML}{3F}
\DeclareFlexSymbol{\smile}           {Rel}{OML}{5E}
\DeclareFlexSymbol{\frown}           {Rel}{OML}{5F}
\DeclareFlexSymbol{\leftharpoonup}   {Rel}{OML}{28}
\DeclareFlexSymbol{\leftharpoondown} {Rel}{OML}{29}
\DeclareFlexSymbol{\rightharpoonup}  {Rel}{OML}{2A}
\DeclareFlexSymbol{\rightharpoondown}{Rel}{OML}{2B}
%    \end{macrocode}
% Latin
%    \begin{macrocode}
\DeclareFlexSymbol{a}{Var}{latin}{61}
\DeclareFlexSymbol{b}{Var}{latin}{62}
\DeclareFlexSymbol{c}{Var}{latin}{63}
\DeclareFlexSymbol{d}{Var}{latin}{64}
\DeclareFlexSymbol{e}{Var}{latin}{65}
\DeclareFlexSymbol{f}{Var}{latin}{66}
\DeclareFlexSymbol{g}{Var}{latin}{67}
\DeclareFlexSymbol{h}{Var}{latin}{68}
\DeclareFlexSymbol{i}{Var}{latin}{69}
\DeclareFlexSymbol{j}{Var}{latin}{6A}
\DeclareFlexSymbol{k}{Var}{latin}{6B}
\DeclareFlexSymbol{l}{Var}{latin}{6C}
\DeclareFlexSymbol{m}{Var}{latin}{6D}
\DeclareFlexSymbol{n}{Var}{latin}{6E}
\DeclareFlexSymbol{o}{Var}{latin}{6F}
\DeclareFlexSymbol{p}{Var}{latin}{70}
\DeclareFlexSymbol{q}{Var}{latin}{71}
\DeclareFlexSymbol{r}{Var}{latin}{72}
\DeclareFlexSymbol{s}{Var}{latin}{73}
\DeclareFlexSymbol{t}{Var}{latin}{74}
\DeclareFlexSymbol{u}{Var}{latin}{75}
\DeclareFlexSymbol{v}{Var}{latin}{76}
\DeclareFlexSymbol{w}{Var}{latin}{77}
\DeclareFlexSymbol{x}{Var}{latin}{78}
\DeclareFlexSymbol{y}{Var}{latin}{79}
\DeclareFlexSymbol{z}{Var}{latin}{7A}
\DeclareFlexSymbol{A}{Var}{Latin}{41}
\DeclareFlexSymbol{B}{Var}{Latin}{42}
\DeclareFlexSymbol{C}{Var}{Latin}{43}
\DeclareFlexSymbol{D}{Var}{Latin}{44}
\DeclareFlexSymbol{E}{Var}{Latin}{45}
\DeclareFlexSymbol{F}{Var}{Latin}{46}
\DeclareFlexSymbol{G}{Var}{Latin}{47}
\DeclareFlexSymbol{H}{Var}{Latin}{48}
\DeclareFlexSymbol{I}{Var}{Latin}{49}
\DeclareFlexSymbol{J}{Var}{Latin}{4A}
\DeclareFlexSymbol{K}{Var}{Latin}{4B}
\DeclareFlexSymbol{L}{Var}{Latin}{4C}
\DeclareFlexSymbol{M}{Var}{Latin}{4D}
\DeclareFlexSymbol{N}{Var}{Latin}{4E}
\DeclareFlexSymbol{O}{Var}{Latin}{4F}
\DeclareFlexSymbol{P}{Var}{Latin}{50}
\DeclareFlexSymbol{Q}{Var}{Latin}{51}
\DeclareFlexSymbol{R}{Var}{Latin}{52}
\DeclareFlexSymbol{S}{Var}{Latin}{53}
\DeclareFlexSymbol{T}{Var}{Latin}{54}
\DeclareFlexSymbol{U}{Var}{Latin}{55}
\DeclareFlexSymbol{V}{Var}{Latin}{56}
\DeclareFlexSymbol{W}{Var}{Latin}{57}
\DeclareFlexSymbol{X}{Var}{Latin}{58}
\DeclareFlexSymbol{Y}{Var}{Latin}{59}
\DeclareFlexSymbol{Z}{Var}{Latin}{5A}
%    \end{macrocode}
% The \cs{ldotPun} glyph is used in constructing the
% \cs{ldots} symbol.    It is just a period with a different math
% symbol class.    \cs{lhookRel} and \cs{rhookRel} are used
% in a similar way for building hooked arrow symbols.   
%    \begin{macrocode}
\DeclareFlexSymbol{\ldotPun}{Pun}{OML}{3A}
\def\ldotp{\ldotPun}
\DeclareFlexSymbol{\lhookRel}{Rel}{OML}{2C}
\DeclareFlexSymbol{\rhookRel}{Rel}{OML}{2D}
%    \end{macrocode}
% Symbols from the 128-character \fn{cmsy} encoding.   
%    \begin{macrocode}
\DeclareFlexSymbol{*}           {Bin}{bin}{03} % \ast
\DeclareFlexSymbol{-}           {Bin}{bin}{00}
\DeclareFlexSymbol{|}           {Ord}{OMS}{6A}
\DeclareFlexSymbol{\aleph}      {Ord}{ord}{40}
\DeclareFlexSymbol{\Re}         {Ord}{ord}{3C}
\DeclareFlexSymbol{\Im}         {Ord}{ord}{3D}
\DeclareFlexSymbol{\infty}      {Ord}{ord}{31}
\DeclareFlexSymbol{\prime}      {Ord}{ord}{30}
\DeclareFlexSymbol{\emptyset}   {Ord}{ord}{3B}
\DeclareFlexSymbol{\nabla}      {Ord}{ord}{72}
\DeclareFlexSymbol{\top}        {Ord}{ord}{3E}
\DeclareFlexSymbol{\bot}        {Ord}{ord}{3F}
\DeclareFlexSymbol{\triangle}   {Ord}{ord}{34}
\DeclareFlexSymbol{\forall}     {Ord}{ord}{38}
\DeclareFlexSymbol{\exists}     {Ord}{ord}{39}
\DeclareFlexSymbol{\neg}        {Ord}{ord}{3A}
\DeclareFlexSymbol{\clubsuit}   {Ord}{ord}{7C}
\DeclareFlexSymbol{\diamondsuit}{Ord}{ord}{7D}
\DeclareFlexSymbol{\heartsuit}  {Ord}{ord}{7E}
\DeclareFlexSymbol{\spadesuit}  {Ord}{ord}{7F}
\DeclareFlexSymbol{\smallint}   {COs}{OMS}{73}
%    \end{macrocode}
% Binary operators.   
%    \begin{macrocode}
\DeclareFlexSymbol{\bigtriangleup}  {Bin}{bin}{34}
\DeclareFlexSymbol{\bigtriangledown}{Bin}{bin}{35}
\DeclareFlexSymbol{\wedge}          {Bin}{bin}{5E}
\DeclareFlexSymbol{\vee}            {Bin}{bin}{5F}
\DeclareFlexSymbol{\cap}            {Bin}{bin}{5C}
\DeclareFlexSymbol{\cup}            {Bin}{bin}{5B}
\DeclareFlexSymbol{\ddagger}        {Bin}{bin}{7A}
\DeclareFlexSymbol{\dagger}         {Bin}{bin}{79}
\DeclareFlexSymbol{\sqcap}          {Bin}{bin}{75}
\DeclareFlexSymbol{\sqcup}          {Bin}{bin}{74}
\DeclareFlexSymbol{\uplus}          {Bin}{bin}{5D}
\DeclareFlexSymbol{\amalg}          {Bin}{bin}{71}
\DeclareFlexSymbol{\diamond}        {Bin}{bin}{05}
\DeclareFlexSymbol{\bullet}         {Bin}{bin}{0F}
\DeclareFlexSymbol{\wr}             {Bin}{bin}{6F}
\DeclareFlexSymbol{\div}            {Bin}{bin}{04}
\DeclareFlexSymbol{\odot}           {Bin}{bin}{0C}
\DeclareFlexSymbol{\oslash}         {Bin}{bin}{0B}
\DeclareFlexSymbol{\otimes}         {Bin}{bin}{0A}
\DeclareFlexSymbol{\ominus}         {Bin}{bin}{09}
\DeclareFlexSymbol{\oplus}          {Bin}{bin}{08}
\DeclareFlexSymbol{\mp}             {Bin}{bin}{07}
\DeclareFlexSymbol{\pm}             {Bin}{bin}{06}
\DeclareFlexSymbol{\circ}           {Bin}{bin}{0E}
\DeclareFlexSymbol{\bigcirc}        {Bin}{bin}{0D}
\DeclareFlexSymbol{\setminus}       {Bin}{bin}{6E}
\DeclareFlexSymbol{\cdot}           {Bin}{bin}{01}
\DeclareFlexSymbol{\ast}            {Bin}{bin}{03}
\DeclareFlexSymbol{\times}          {Bin}{bin}{02}
%    \end{macrocode}
% Relation symbols.   
%    \begin{macrocode}
\DeclareFlexSymbol{\propto}        {Rel}{rel}{2F}
\DeclareFlexSymbol{\sqsubseteq}    {Rel}{rel}{76}
\DeclareFlexSymbol{\sqsupseteq}    {Rel}{rel}{77}
\DeclareFlexSymbol{\parallel}      {Rel}{rel}{6B}
\DeclareFlexSymbol{\mid}           {Rel}{rel}{6A}
\DeclareFlexSymbol{\dashv}         {Rel}{rel}{61}
\DeclareFlexSymbol{\vdash}         {Rel}{rel}{60}
\DeclareFlexSymbol{\nearrow}       {Rel}{rel}{25}
\DeclareFlexSymbol{\searrow}       {Rel}{rel}{26}
\DeclareFlexSymbol{\nwarrow}       {Rel}{rel}{2D}
\DeclareFlexSymbol{\swarrow}       {Rel}{rel}{2E}
\DeclareFlexSymbol{\Leftrightarrow}{Rel}{rel}{2C}
\DeclareFlexSymbol{\Leftarrow}     {Rel}{rel}{28}
\DeclareFlexSymbol{\Rightarrow}    {Rel}{rel}{29}
\DeclareFlexSymbol{\leq}           {Rel}{rel}{14}
\DeclareFlexSymbol{\geq}           {Rel}{rel}{15}
\DeclareFlexSymbol{\succ}          {Rel}{rel}{1F}
\DeclareFlexSymbol{\prec}          {Rel}{rel}{1E}
\DeclareFlexSymbol{\approx}        {Rel}{rel}{19}
\DeclareFlexSymbol{\succeq}        {Rel}{rel}{17}
\DeclareFlexSymbol{\preceq}        {Rel}{rel}{16}
\DeclareFlexSymbol{\supset}        {Rel}{rel}{1B}
\DeclareFlexSymbol{\subset}        {Rel}{rel}{1A}
\DeclareFlexSymbol{\supseteq}      {Rel}{rel}{13}
\DeclareFlexSymbol{\subseteq}      {Rel}{rel}{12}
\DeclareFlexSymbol{\in}            {Rel}{rel}{32}
\DeclareFlexSymbol{\ni}            {Rel}{rel}{33}
\DeclareFlexSymbol{\gg}            {Rel}{rel}{1D}
\DeclareFlexSymbol{\ll}            {Rel}{rel}{1C}
\DeclareFlexSymbol{\leftrightarrow}{Rel}{rel}{24}
\DeclareFlexSymbol{\leftarrow}     {Rel}{rel}{20}
\DeclareFlexSymbol{\rightarrow}    {Rel}{rel}{21}
\DeclareFlexSymbol{\sim}           {Rel}{rel}{18}
\DeclareFlexSymbol{\simeq}         {Rel}{rel}{27}
\DeclareFlexSymbol{\perp}          {Rel}{rel}{3F}
\DeclareFlexSymbol{\equiv}         {Rel}{rel}{11}
\DeclareFlexSymbol{\asymp}         {Rel}{rel}{10}
%    \end{macrocode}
% The \cs{notRel} glyph is a special zero-width glyph intended only
% for use in constructing negated symbols.    \cs{mapstoRel} and
% \cs{cdotPun} have similar but more restricted applications.   
%    \begin{macrocode}
\DeclareFlexSymbol{\notRel}   {Rel}{rel}{36}
\DeclareFlexSymbol{\mapstoOrd}{Ord}{OMS}{37}
\DeclareFlexSymbol{\cdotOrd}  {Ord}{OMS}{01}
\cs_set:Npn\cdotp{\mathpunct{\cdotOrd}}
%    \end{macrocode}
% Symbols from the 128-character \fn{cmex} encoding.   
% \verb"COs" stands for `cumulative operator
% (sum-like)'.   
% \verb"COi" stands for `cumulative operator
% (integral-like)'.    These typically differ only in the
% default placement of limits.    \verb"cop" stands for
% `cumulative operator math group'.   
%    \begin{macrocode}
\DeclareFlexSymbol{\coprod}   {COs}{cop}{60}
\DeclareFlexSymbol{\bigvee}   {COs}{cop}{57}
\DeclareFlexSymbol{\bigwedge} {COs}{cop}{56}
\DeclareFlexSymbol{\biguplus} {COs}{cop}{55}
\DeclareFlexSymbol{\bigcap}   {COs}{cop}{54}
\DeclareFlexSymbol{\bigcup}   {COs}{cop}{53}
\DeclareFlexSymbol{\int}      {COi}{cop}{52}
\DeclareFlexSymbol{\prod}     {COs}{cop}{51}
\DeclareFlexSymbol{\sum}      {COs}{cop}{50}
\DeclareFlexSymbol{\bigotimes}{COs}{cop}{4E}
\DeclareFlexSymbol{\bigoplus} {COs}{cop}{4C}
\DeclareFlexSymbol{\bigodot}  {COs}{cop}{4A}
\DeclareFlexSymbol{\oint}     {COi}{cop}{48}
\DeclareFlexSymbol{\bigsqcup} {COs}{cop}{46}
%    \end{macrocode}
% Delimiter symbols.   
% \verb"DeL" stands for `delimiter (left)'.   
% \verb"DeR" stands for `delimiter (right)'.   
% \verb"DeB" stands for `delimiter (bidirectional)'.   
% The principal encoding point for an extensible delimiter is the
% first link in the list of linked sizes as specified in the font metric
% information.   
% For a math encoding such as OT1/OML/OMS/OMX where not all sizes of a
% given delimiter reside in a given font, the extra encoding point for the
% smallest delimiter must be supplied by defining
% \begin{verbatim}
% \sd@GXX
% \end{verbatim}
% where G is the mathgroup and XX is the hexadecimal glyph
% position. |\DeclareFlexDelimiter| does that for us.
%    \begin{macrocode}
\DeclareFlexDelimiter{\rangle}{DeR}{del}{0B}{OMS}{69}
\DeclareFlexDelimiter{\langle}{DeL}{del}{0A}{OMS}{68}
\DeclareFlexDelimiter{\rbrace}{DeR}{del}{09}{OMS}{67}
\DeclareFlexDelimiter{\lbrace}{DeL}{del}{08}{OMS}{66}
\DeclareFlexDelimiter{\rceil} {DeR}{del}{07}{OMS}{65}
\DeclareFlexDelimiter{\lceil} {DeL}{del}{06}{OMS}{64}
\DeclareFlexDelimiter{\rfloor}{DeR}{del}{05}{OMS}{63}
\DeclareFlexDelimiter{\lfloor}{DeL}{del}{04}{OMS}{62}
\DeclareFlexDelimiter{(}      {DeL}{del}{00}{OT1}{28}
\DeclareFlexDelimiter{)}      {DeR}{del}{01}{OT1}{29}
\DeclareFlexDelimiter{[}      {DeL}{del}{02}{OT1}{5B}
\DeclareFlexDelimiter{]}      {DeR}{del}{03}{OT1}{5D}
\DeclareFlexDelimiter{\lVert} {DeL}{del}{0D}{OMS}{6B}
\DeclareFlexDelimiter{\rVert} {DeR}{del}{0D}{OMS}{6B}
\DeclareFlexDelimiter{\lvert} {DeL}{del}{0C}{OMS}{6A}
\DeclareFlexDelimiter{\rvert} {DeR}{del}{0C}{OMS}{6A}
\DeclareFlexDelimiter{\Vert}  {DeB}{del}{0D}{OMS}{6B}
\DeclareFlexDelimiter{\vert}  {DeB}{del}{0C}{OMS}{6A}
%    \end{macrocode}
% Maybe make the vert bars mathord instead of delimiter, to discourage
% poor usage.   
%    \begin{macrocode}
\DeclareFlexDelimiter{|}{DeB}{del}{0C}{OMS}{6A}
\DeclareFlexDelimiter{/}{DeB}{del}{0E}{OML}{3D}
%    \end{macrocode}
% 
% 
% These wacky delimiters need to be supported I guess for
% compabitility reasons.   
% The DeA delimiter type is a special case used only for these
% arrows.   
%    \begin{macrocode}
\DeclareFlexDelimiter{\lmoustache} {DeL}{del}{40}{del}{7A}
\DeclareFlexDelimiter{\rmoustache} {DeR}{del}{41}{del}{7B}
\DeclareFlexDelimiter{\lgroup}     {DeL}{del}{3A}{del}{3A}
\DeclareFlexDelimiter{\rgroup}     {DeR}{del}{3B}{del}{3B}
\DeclareFlexDelimiter{\bracevert}  {DeB}{del}{3E}{del}{3E}
\DeclareFlexDelimiter{\arrowvert}  {DeB}{del}{3C}{OMS}{6A}
\DeclareFlexDelimiter{\Arrowvert}  {DeB}{del}{3D}{OMS}{6B}
\DeclareFlexDelimiter{\uparrow}    {DeA}{del}{78}{OMS}{22}
\DeclareFlexDelimiter{\downarrow}  {DeA}{del}{79}{OMS}{23}
\DeclareFlexDelimiter{\updownarrow}{DeA}{del}{3F}{OMS}{6C}
\DeclareFlexDelimiter{\Uparrow}    {DeA}{del}{7E}{OMS}{2A}
\DeclareFlexDelimiter{\Downarrow}  {DeA}{del}{7F}{OMS}{2B}
\DeclareFlexDelimiter{\Updownarrow}{DeA}{del}{77}{OMS}{6D}
\DeclareFlexDelimiter{\backslash}  {DeB}{del}{0F}{OMS}{6E}
%    \end{macrocode}
% 
% 
% 
% 
% \section{Some compound symbols}
% The following symbols are not robust in standard \LaTeX\ 
% because they use \verb"#" or \cs{mathpalette} (which is not
% robust and contains a \verb"#" in its expansion): \cs{angle},
% \cs{cong}, \cs{notin}, \cs{rightleftharpoons}.   
% 
% In this definition of \cs{hbar}, the symbol is cobbled together
% from a math italic h and the cmr overbar accent glyph.   
%    \begin{macrocode}
\DeclareFlexSymbol{\hbarOrd}{Ord}{OT1}{16}
\DeclareFlexCompoundSymbol{\hbar}{Ord}{\hbarOrd\mkern-9mu h}
%    \end{macrocode}
% For \cs{surd}, the interior symbol gets math class 1
% (cumulative operator) to make the glyph vertically centered on the
% math axis, but the desired horizontal spacing is the spacing for a
% mathord.    (Couldn't it just be class mathopen, though?)
%    \begin{macrocode}
\DeclareFlexSymbol{\surdOrd}{Ord}{OMS}{70}
\DeclareFlexCompoundSymbol{\surd}{Ord}{\mathop{\surdOrd}}
%    \end{macrocode}
% As shown in this definition of \cs{angle}, rule dimens are not
% allowed to use math-units, unfortunately.   
%    \begin{macrocode}
\DeclareFlexCompoundSymbol{\angle}{Ord}{%
  \vbox{\ialign{%
      $\m@th\scriptstyle##$\crcr
      \notRel\mathrel{\mkern14mu}\crcr
      \noalign{\nointerlineskip}%
      \mkern2.5mu\leaders\hrule \@height.34pt\hfill\mkern2.5mu\crcr
  }}%
}
%    \end{macrocode}
% The \cs{not} function, which is defined in the \pkg{flexisym}
% package, requires a suitably defined \cs{notRel} symbol.   
%    \begin{macrocode}
\DeclareFlexCompoundSymbol{\neq}{Rel}{\not{=}}
%    \end{macrocode}
% .   
%    \begin{macrocode}
\DeclareFlexCompoundSymbol{\mapsto}{Rel}{\mapstoOrd\rightarrow}
%    \end{macrocode}
% The \cs{@vereq} function ends by centering the whole
% construction on the math axis, unlike \cs{buildrel} where the base
% symbol remains at its normal altitude.    Furthermore,
% \cs{@vereq} leaves the math style of the top symbol as given
% instead of downsizing to scriptstyle.   
%    \begin{macrocode}
\DeclareFlexCompoundSymbol{\cong}{Rel}{\mathpalette\@vereq\sim}
%    \end{macrocode}
% The \cs{m@th} in the \fn{fontmath.ltx} definition of
% \cs{notin} is superfluous unless \cs{c@ncel} doesn't include
% it (which was perhaps true in an older version of
% \fn{plain.tex}?).   
%    \begin{macrocode}
\providecommand*\joinord{}
%<cmbase|mathptmx>\renewcommand*\joinord{\mkern-3mu }
%<mathpazo>\renewcommand*\joinord{\mkern-3.45mu }
\DeclareFlexCompoundSymbol{\notin}{Rel}{\mathpalette\c@ncel\in}
\DeclareFlexCompoundSymbol{\rightleftharpoons}{Rel}{\mathpalette\rlh@{}}
\DeclareFlexCompoundSymbol{\doteq}{Rel}{\buildrel\textstyle.\over=}
\DeclareFlexCompoundSymbol{\hookrightarrow}{Rel}{\lhookRel\joinord\rightarrow}
\DeclareFlexCompoundSymbol{\hookleftarrow}{Rel}{\leftarrow\joinord\rhookRel}
\DeclareFlexCompoundSymbol{\bowtie}{Rel}{\triangleright\joinord\triangleleft}
\DeclareFlexCompoundSymbol{\models}{Rel}{\vert\joinord=}
\DeclareFlexCompoundSymbol{\Longrightarrow}{Rel}{\Relbar\joinord\Rightarrow}
\DeclareFlexCompoundSymbol{\longrightarrow}{Rel}{\relbar\joinord\rightarrow}
\DeclareFlexCompoundSymbol{\Longleftarrow}{Rel}{\Leftarrow\joinord\Relbar}
\DeclareFlexCompoundSymbol{\longleftarrow}{Rel}{\leftarrow\joinord\relbar}
\DeclareFlexCompoundSymbol{\longmapsto}{Rel}{\mapstochar\longrightarrow}
\DeclareFlexCompoundSymbol{\longleftrightarrow}{Rel}{\leftarrow\joinord\rightarrow}
\DeclareFlexCompoundSymbol{\Longleftrightarrow}{Rel}{\Leftarrow\joinord\Rightarrow}
%    \end{macrocode}
% Here is what you get from the old definition of \cs{iff}.   
% \begin{verbatim}
% \glue 2.77771 plus 2.77771
% \glue(\thickmuskip) 2.77771 plus 2.77771
% \OMS/cmsy/m/n/10 (
% \hbox(0.0+0.0)x-1.66663
% .\kern -1.66663
% \OMS/cmsy/m/n/10 )
% \penalty 500
% \glue 2.77771 plus 2.77771
% \glue(\thickmuskip) 2.77771 plus 2.77771
% \end{verbatim}
% Looks like it could be simplified slightly.    But it's not so
% easy as it looks to do it without screwing up the line breaking
% possibilities.   
%    \begin{macrocode}
\renewcommand*\iff{%
  \mskip\thickmuskip\Longleftrightarrow\mskip\thickmuskip
}
%    \end{macrocode}
% Some dotly symbols.   
%    \begin{macrocode}
\DeclareFlexCompoundSymbol{\cdots}{Inn}{\cdotp\cdotp\cdotp}%
\DeclareFlexCompoundSymbol{\vdots}{Ord}{%
  \vbox{\baselineskip4\p@ \lineskiplimit\z@
    \kern6\p@\hbox{.}\hbox{.}\hbox{.}}}
\DeclareFlexCompoundSymbol{\ddots}{Inn}{%
  \mkern1mu\raise7\p@
  \vbox{\kern7\p@\hbox{.}}\mkern2mu%
  \raise4\p@\hbox{.}\mkern2mu\raise\p@\hbox{.}\mkern1mu%
}
%    \end{macrocode}
% .   
%    \begin{macrocode}
\def\relbar{\begingroup \def\smash@{tb}% in case amsmath is loaded
    \mathpalette\mathsm@sh{\mathchar"200 }\endgroup}
%    \end{macrocode}
% For \cs{Relbar} we take an equal sign of class $0$ (Ord) from the
% operator family. For \fn{cmr} and \pkg{mathptmx} we know this is
% family $0$.
%    \begin{macrocode}
%<cmbase|mathptmx>\def\Relbar{\mathchar"3D }
%    \end{macrocode}
% For the \pkg{mathpazo} setup we need to use the equal sign from
% \fn{cmr} and so must insert class $0$ and use the symbol from the
% upright symbols.
%    \begin{macrocode}
%<mathpazo>\edef\Relbar{\mathchar\string"\hexnumber@\symupright3D }
%    \end{macrocode}
% Done.
%    \begin{macrocode}
\ExplSyntaxOff
%</cmbase|mathpazo|mathptmx>
%    \end{macrocode}
% Various synonyms such as \cs{le} for \cs{leq} and
% \cs{to} for \cs{rightarrow} are defined in
% \pkg{flexisym} with \cs{def} instead of \cs{let}, for
% slower execution speed but smaller chance of synchronization
% problems.   
%
%
%
%    \begin{macrocode}
%<*msabm>
\ProvidesSymbols{msabm}[2001/09/08 v0.91]
\ExplSyntaxOn
%    \end{macrocode}
%    \begin{macrocode}
\RequirePackage{amsfonts}\relax
%    \end{macrocode}
%    \begin{macrocode}
\cs_gset:cpx{mg@MSA}{\hexnumber@\symAMSa}%
\cs_gset:cpx{mg@MSB}{\hexnumber@\symAMSb}%
%    \end{macrocode}
%    \begin{macrocode}
\DeclareFlexSymbol{\boxdot}             {Bin}{MSA}{00}
\DeclareFlexSymbol{\boxplus}            {Bin}{MSA}{01}
\DeclareFlexSymbol{\boxtimes}           {Bin}{MSA}{02}
\DeclareFlexSymbol{\square}             {Ord}{MSA}{03}
\DeclareFlexSymbol{\blacksquare}        {Ord}{MSA}{04}
\DeclareFlexSymbol{\centerdot}          {Bin}{MSA}{05}
\DeclareFlexSymbol{\lozenge}            {Ord}{MSA}{06}
\DeclareFlexSymbol{\blacklozenge}       {Ord}{MSA}{07}
\DeclareFlexSymbol{\circlearrowright}   {Rel}{MSA}{08}
\DeclareFlexSymbol{\circlearrowleft}    {Rel}{MSA}{09}
%    \end{macrocode}
% In amsfonts.sty:
%    \begin{macrocode}
%%\DeclareFlexSymbol{\rightleftharpoons}{Rel}{MSA}{0A}
\DeclareFlexSymbol{\leftrightharpoons}  {Rel}{MSA}{0B}
\DeclareFlexSymbol{\boxminus}           {Bin}{MSA}{0C}
\DeclareFlexSymbol{\Vdash}              {Rel}{MSA}{0D}
\DeclareFlexSymbol{\Vvdash}             {Rel}{MSA}{0E}
\DeclareFlexSymbol{\vDash}              {Rel}{MSA}{0F}
\DeclareFlexSymbol{\twoheadrightarrow}  {Rel}{MSA}{10}
\DeclareFlexSymbol{\twoheadleftarrow}   {Rel}{MSA}{11}
\DeclareFlexSymbol{\leftleftarrows}     {Rel}{MSA}{12}
\DeclareFlexSymbol{\rightrightarrows}   {Rel}{MSA}{13}
\DeclareFlexSymbol{\upuparrows}         {Rel}{MSA}{14}
\DeclareFlexSymbol{\downdownarrows}     {Rel}{MSA}{15}
\DeclareFlexSymbol{\upharpoonright}     {Rel}{MSA}{16}
 \let\restriction\upharpoonright
\DeclareFlexSymbol{\downharpoonright}   {Rel}{MSA}{17}
\DeclareFlexSymbol{\upharpoonleft}      {Rel}{MSA}{18}
\DeclareFlexSymbol{\downharpoonleft}    {Rel}{MSA}{19}
\DeclareFlexSymbol{\rightarrowtail}     {Rel}{MSA}{1A}
\DeclareFlexSymbol{\leftarrowtail}      {Rel}{MSA}{1B}
\DeclareFlexSymbol{\leftrightarrows}    {Rel}{MSA}{1C}
\DeclareFlexSymbol{\rightleftarrows}    {Rel}{MSA}{1D}
\DeclareFlexSymbol{\Lsh}                {Rel}{MSA}{1E}
\DeclareFlexSymbol{\Rsh}                {Rel}{MSA}{1F}
\DeclareFlexSymbol{\rightsquigarrow}    {Rel}{MSA}{20}
\DeclareFlexSymbol{\leftrightsquigarrow}{Rel}{MSA}{21}
\DeclareFlexSymbol{\looparrowleft}      {Rel}{MSA}{22}
\DeclareFlexSymbol{\looparrowright}     {Rel}{MSA}{23}
\DeclareFlexSymbol{\circeq}             {Rel}{MSA}{24}
\DeclareFlexSymbol{\succsim}            {Rel}{MSA}{25}
\DeclareFlexSymbol{\gtrsim}             {Rel}{MSA}{26}
\DeclareFlexSymbol{\gtrapprox}          {Rel}{MSA}{27}
\DeclareFlexSymbol{\multimap}           {Rel}{MSA}{28}
\DeclareFlexSymbol{\therefore}          {Rel}{MSA}{29}
\DeclareFlexSymbol{\because}            {Rel}{MSA}{2A}
\DeclareFlexSymbol{\doteqdot}           {Rel}{MSA}{2B}
 \let\Doteq\doteqdot
\DeclareFlexSymbol{\triangleq}          {Rel}{MSA}{2C}
\DeclareFlexSymbol{\precsim}            {Rel}{MSA}{2D}
\DeclareFlexSymbol{\lesssim}            {Rel}{MSA}{2E}
\DeclareFlexSymbol{\lessapprox}         {Rel}{MSA}{2F}
\DeclareFlexSymbol{\eqslantless}        {Rel}{MSA}{30}
\DeclareFlexSymbol{\eqslantgtr}         {Rel}{MSA}{31}
\DeclareFlexSymbol{\curlyeqprec}        {Rel}{MSA}{32}
\DeclareFlexSymbol{\curlyeqsucc}        {Rel}{MSA}{33}
\DeclareFlexSymbol{\preccurlyeq}        {Rel}{MSA}{34}
\DeclareFlexSymbol{\leqq}               {Rel}{MSA}{35}
\DeclareFlexSymbol{\leqslant}           {Rel}{MSA}{36}
\DeclareFlexSymbol{\lessgtr}            {Rel}{MSA}{37}
\DeclareFlexSymbol{\backprime}          {Ord}{MSA}{38}
\DeclareFlexSymbol{\risingdotseq}       {Rel}{MSA}{3A}
\DeclareFlexSymbol{\fallingdotseq}      {Rel}{MSA}{3B}
\DeclareFlexSymbol{\succcurlyeq}        {Rel}{MSA}{3C}
\DeclareFlexSymbol{\geqq}               {Rel}{MSA}{3D}
\DeclareFlexSymbol{\geqslant}           {Rel}{MSA}{3E}
\DeclareFlexSymbol{\gtrless}            {Rel}{MSA}{3F}
%    \end{macrocode}
% in amsfonts.sty
%    \begin{macrocode}
%% \DeclareFlexSymbol{\sqsubset}    {Rel}{MSA}{40}
%% \DeclareFlexSymbol{\sqsupset}    {Rel}{MSA}{41}
\DeclareFlexSymbol{\vartriangleright}   {Rel}{MSA}{42}
\DeclareFlexSymbol{\vartriangleleft}    {Rel}{MSA}{43}
\DeclareFlexSymbol{\trianglerighteq}    {Rel}{MSA}{44}
\DeclareFlexSymbol{\trianglelefteq}     {Rel}{MSA}{45}
\DeclareFlexSymbol{\bigstar}            {Ord}{MSA}{46}
\DeclareFlexSymbol{\between}            {Rel}{MSA}{47}
\DeclareFlexSymbol{\blacktriangledown}  {Ord}{MSA}{48}
\DeclareFlexSymbol{\blacktriangleright} {Rel}{MSA}{49}
\DeclareFlexSymbol{\blacktriangleleft}  {Rel}{MSA}{4A}
\DeclareFlexSymbol{\vartriangle}        {Rel}{MSA}{4D}
\DeclareFlexSymbol{\blacktriangle}      {Ord}{MSA}{4E}
\DeclareFlexSymbol{\triangledown}       {Ord}{MSA}{4F}
\DeclareFlexSymbol{\eqcirc}             {Rel}{MSA}{50}
\DeclareFlexSymbol{\lesseqgtr}          {Rel}{MSA}{51}
\DeclareFlexSymbol{\gtreqless}          {Rel}{MSA}{52}
\DeclareFlexSymbol{\lesseqqgtr}         {Rel}{MSA}{53}
\DeclareFlexSymbol{\gtreqqless}         {Rel}{MSA}{54}
\DeclareFlexSymbol{\Rrightarrow}        {Rel}{MSA}{56}
\DeclareFlexSymbol{\Lleftarrow}         {Rel}{MSA}{57}
\DeclareFlexSymbol{\veebar}             {Bin}{MSA}{59}
\DeclareFlexSymbol{\barwedge}           {Bin}{MSA}{5A}
\DeclareFlexSymbol{\doublebarwedge}     {Bin}{MSA}{5B}
%    \end{macrocode}
% In amsfonts.sty
%    \begin{macrocode}
%%\DeclareFlexSymbol{\angle}         {Ord}{MSA}{5C}
\DeclareFlexSymbol{\measuredangle}   {Ord}{MSA}{5D}
\DeclareFlexSymbol{\sphericalangle}  {Ord}{MSA}{5E}
\DeclareFlexSymbol{\varpropto}       {Rel}{MSA}{5F}
\DeclareFlexSymbol{\smallsmile}      {Rel}{MSA}{60}
\DeclareFlexSymbol{\smallfrown}      {Rel}{MSA}{61}
\DeclareFlexSymbol{\Subset}          {Rel}{MSA}{62}
\DeclareFlexSymbol{\Supset}          {Rel}{MSA}{63}
\DeclareFlexSymbol{\Cup}             {Bin}{MSA}{64}
 \let\doublecup\Cup                  
\DeclareFlexSymbol{\Cap}             {Bin}{MSA}{65}
 \let\doublecap\Cap                  
\DeclareFlexSymbol{\curlywedge}      {Bin}{MSA}{66}
\DeclareFlexSymbol{\curlyvee}        {Bin}{MSA}{67}
\DeclareFlexSymbol{\leftthreetimes}  {Bin}{MSA}{68}
\DeclareFlexSymbol{\rightthreetimes} {Bin}{MSA}{69}
\DeclareFlexSymbol{\subseteqq}       {Rel}{MSA}{6A}
\DeclareFlexSymbol{\supseteqq}       {Rel}{MSA}{6B}
\DeclareFlexSymbol{\bumpeq}          {Rel}{MSA}{6C}
\DeclareFlexSymbol{\Bumpeq}          {Rel}{MSA}{6D}
\DeclareFlexSymbol{\lll}             {Rel}{MSA}{6E}
 \let\llless\lll                     
\DeclareFlexSymbol{\ggg}             {Rel}{MSA}{6F}
 \let\gggtr\ggg                      
\DeclareFlexSymbol{\circledS}        {Ord}{MSA}{73}
\DeclareFlexSymbol{\pitchfork}       {Rel}{MSA}{74}
\DeclareFlexSymbol{\dotplus}         {Bin}{MSA}{75}
\DeclareFlexSymbol{\backsim}         {Rel}{MSA}{76}
\DeclareFlexSymbol{\backsimeq}       {Rel}{MSA}{77}
\DeclareFlexSymbol{\complement}      {Ord}{MSA}{7B}
\DeclareFlexSymbol{\intercal}        {Bin}{MSA}{7C}
\DeclareFlexSymbol{\circledcirc}     {Bin}{MSA}{7D}
\DeclareFlexSymbol{\circledast}      {Bin}{MSA}{7E}
\DeclareFlexSymbol{\circleddash}     {Bin}{MSA}{7F}
%    \end{macrocode}
%   Begin AMSb declarations
%    \begin{macrocode}
\DeclareFlexSymbol{\lvertneqq}       {Rel}{MSB}{00}
\DeclareFlexSymbol{\gvertneqq}       {Rel}{MSB}{01}
\DeclareFlexSymbol{\nleq}            {Rel}{MSB}{02}
\DeclareFlexSymbol{\ngeq}            {Rel}{MSB}{03}
\DeclareFlexSymbol{\nless}           {Rel}{MSB}{04}
\DeclareFlexSymbol{\ngtr}            {Rel}{MSB}{05}
\DeclareFlexSymbol{\nprec}           {Rel}{MSB}{06}
\DeclareFlexSymbol{\nsucc}           {Rel}{MSB}{07}
\DeclareFlexSymbol{\lneqq}           {Rel}{MSB}{08}
\DeclareFlexSymbol{\gneqq}           {Rel}{MSB}{09}
\DeclareFlexSymbol{\nleqslant}       {Rel}{MSB}{0A}
\DeclareFlexSymbol{\ngeqslant}       {Rel}{MSB}{0B}
\DeclareFlexSymbol{\lneq}            {Rel}{MSB}{0C}
\DeclareFlexSymbol{\gneq}            {Rel}{MSB}{0D}
\DeclareFlexSymbol{\npreceq}         {Rel}{MSB}{0E}
\DeclareFlexSymbol{\nsucceq}         {Rel}{MSB}{0F}
\DeclareFlexSymbol{\precnsim}        {Rel}{MSB}{10}
\DeclareFlexSymbol{\succnsim}        {Rel}{MSB}{11}
\DeclareFlexSymbol{\lnsim}           {Rel}{MSB}{12}
\DeclareFlexSymbol{\gnsim}           {Rel}{MSB}{13}
\DeclareFlexSymbol{\nleqq}           {Rel}{MSB}{14}
\DeclareFlexSymbol{\ngeqq}           {Rel}{MSB}{15}
\DeclareFlexSymbol{\precneqq}        {Rel}{MSB}{16}
\DeclareFlexSymbol{\succneqq}        {Rel}{MSB}{17}
\DeclareFlexSymbol{\precnapprox}     {Rel}{MSB}{18}
\DeclareFlexSymbol{\succnapprox}     {Rel}{MSB}{19}
\DeclareFlexSymbol{\lnapprox}        {Rel}{MSB}{1A}
\DeclareFlexSymbol{\gnapprox}        {Rel}{MSB}{1B}
\DeclareFlexSymbol{\nsim}            {Rel}{MSB}{1C}
\DeclareFlexSymbol{\ncong}           {Rel}{MSB}{1D}
\DeclareFlexSymbol{\diagup}          {Ord}{MSB}{1E}
\DeclareFlexSymbol{\diagdown}        {Ord}{MSB}{1F}
\DeclareFlexSymbol{\varsubsetneq}    {Rel}{MSB}{20}
\DeclareFlexSymbol{\varsupsetneq}    {Rel}{MSB}{21}
\DeclareFlexSymbol{\nsubseteqq}      {Rel}{MSB}{22}
\DeclareFlexSymbol{\nsupseteqq}      {Rel}{MSB}{23}
\DeclareFlexSymbol{\subsetneqq}      {Rel}{MSB}{24}
\DeclareFlexSymbol{\supsetneqq}      {Rel}{MSB}{25}
\DeclareFlexSymbol{\varsubsetneqq}   {Rel}{MSB}{26}
\DeclareFlexSymbol{\varsupsetneqq}   {Rel}{MSB}{27}
\DeclareFlexSymbol{\subsetneq}       {Rel}{MSB}{28}
\DeclareFlexSymbol{\supsetneq}       {Rel}{MSB}{29}
\DeclareFlexSymbol{\nsubseteq}       {Rel}{MSB}{2A}
\DeclareFlexSymbol{\nsupseteq}       {Rel}{MSB}{2B}
\DeclareFlexSymbol{\nparallel}       {Rel}{MSB}{2C}
\DeclareFlexSymbol{\nmid}            {Rel}{MSB}{2D}
\DeclareFlexSymbol{\nshortmid}       {Rel}{MSB}{2E}
\DeclareFlexSymbol{\nshortparallel}  {Rel}{MSB}{2F}
\DeclareFlexSymbol{\nvdash}          {Rel}{MSB}{30}
\DeclareFlexSymbol{\nVdash}          {Rel}{MSB}{31}
\DeclareFlexSymbol{\nvDash}          {Rel}{MSB}{32}
\DeclareFlexSymbol{\nVDash}          {Rel}{MSB}{33}
\DeclareFlexSymbol{\ntrianglerighteq}{Rel}{MSB}{34}
\DeclareFlexSymbol{\ntrianglelefteq} {Rel}{MSB}{35}
\DeclareFlexSymbol{\ntriangleleft}   {Rel}{MSB}{36}
\DeclareFlexSymbol{\ntriangleright}  {Rel}{MSB}{37}
\DeclareFlexSymbol{\nleftarrow}      {Rel}{MSB}{38}
\DeclareFlexSymbol{\nrightarrow}     {Rel}{MSB}{39}
\DeclareFlexSymbol{\nLeftarrow}      {Rel}{MSB}{3A}
\DeclareFlexSymbol{\nRightarrow}     {Rel}{MSB}{3B}
\DeclareFlexSymbol{\nLeftrightarrow} {Rel}{MSB}{3C}
\DeclareFlexSymbol{\nleftrightarrow} {Rel}{MSB}{3D}
\DeclareFlexSymbol{\divideontimes}   {Bin}{MSB}{3E}
\DeclareFlexSymbol{\varnothing}      {Ord}{MSB}{3F}
\DeclareFlexSymbol{\nexists}         {Ord}{MSB}{40}
\DeclareFlexSymbol{\Finv}            {Ord}{MSB}{60}
\DeclareFlexSymbol{\Game}            {Ord}{MSB}{61}
%    \end{macrocode}
% In amsfonts.sty:
%    \begin{macrocode}
%%\DeclareFlexSymbol{\mho}           {Ord}{MSB}{66}
\DeclareFlexSymbol{\eth}             {Ord}{MSB}{67}
\DeclareFlexSymbol{\eqsim}           {Rel}{MSB}{68}
\DeclareFlexSymbol{\beth}            {Ord}{MSB}{69}
\DeclareFlexSymbol{\gimel}           {Ord}{MSB}{6A}
\DeclareFlexSymbol{\daleth}          {Ord}{MSB}{6B}
\DeclareFlexSymbol{\lessdot}         {Bin}{MSB}{6C}
\DeclareFlexSymbol{\gtrdot}          {Bin}{MSB}{6D}
\DeclareFlexSymbol{\ltimes}          {Bin}{MSB}{6E}
\DeclareFlexSymbol{\rtimes}          {Bin}{MSB}{6F}
\DeclareFlexSymbol{\shortmid}        {Rel}{MSB}{70}
\DeclareFlexSymbol{\shortparallel}   {Rel}{MSB}{71}
\DeclareFlexSymbol{\smallsetminus}   {Bin}{MSB}{72}
\DeclareFlexSymbol{\thicksim}        {Rel}{MSB}{73}
\DeclareFlexSymbol{\thickapprox}     {Rel}{MSB}{74}
\DeclareFlexSymbol{\approxeq}        {Rel}{MSB}{75}
\DeclareFlexSymbol{\succapprox}      {Rel}{MSB}{76}
\DeclareFlexSymbol{\precapprox}      {Rel}{MSB}{77}
\DeclareFlexSymbol{\curvearrowleft}  {Rel}{MSB}{78}
\DeclareFlexSymbol{\curvearrowright} {Rel}{MSB}{79}
\DeclareFlexSymbol{\digamma}         {Ord}{MSB}{7A}
\DeclareFlexSymbol{\varkappa}        {Ord}{MSB}{7B}
\DeclareFlexSymbol{\Bbbk}            {Ord}{MSB}{7C}
\DeclareFlexSymbol{\hslash}          {Ord}{MSB}{7D}
%    \end{macrocode}
% In amsfonts.sty:
%    \begin{macrocode}
%%\DeclareFlexSymbol{\hbar}          {Ord}{MSB}{7E}
\DeclareFlexSymbol{\backepsilon}     {Rel}{MSB}{7F}
\ExplSyntaxOff
%</msabm>
%    \end{macrocode}
%
% \PrintIndex
%
% \Finale
