% This file loads AMS math fonts by plainTeX macros
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Petr Olsak, 2012

% todo: find bold AMS symbols

\message{FONT: AMS math fonts - 
   \string\mathchardef's prepared, 12 math families preloaded.}
\let\mathpreloaded=A

% After \input ams-math
%
% you can use hundreds characters from AMS math fonts
% (see \mathchardefs below).
% By default: - the fonts are loaded at 10/7/5 sizes.
%             - variables are typeset by \mit (fam1) 
%             - digits and \sin, \cos, etc. are typeset by fam0
%
% You can use the following alphabets:
% \mit ... mathematical variables
% \rm, \it .. text fonts in math
% \bf, \bi .. bold sans fonts (may be different than text fonts)
% \cal    ... normal calligraphics
% \script ... script
% \frak   ... fraktur
% \bbchar ... double stroked letters
%
% You can reload all math family fonts in two shapes:
% \normalmath ... normal shape
% \boldmath ... bold shape at implicit sizes or sizes set by 
% Before reloading the fonts by previous comand you can set the sizes:
% \setmathsizes[text/script/scriptscript]
% Example \setmathsizes[12/8.4/6]\normalmath ... loads fonts at given sizes
%
% You can set typesetting of math variables from current text font
% by the command: \itvariavles. The \mitvariables reverts to the
% default.

\def\normalmath{%
  \loadmathfamily 0 cmr  % CM Roman
  \loadmathfamily 1 cmmi % CM Math Italic
  \loadmathfamily 2 cmsy % CM Standard symbols
  \loadmathfamily 3 cmex % CM extra symbols   
  \loadmathfamily 4 msam % AMS symbols A
  \loadmathfamily 5 msbm % AMS symbols B
  \loadmathfamily 6 rsfs % script
  \loadmathfamily 7 eufm % fractur
  \loadmathfamily 8 bfsans % sans serif bold
  \loadmathfamily 9 bisans % sans serif bold slanted (for vectors)
  \setmathfamily 10 \tenrm
  \setmathfamily 11 \tenit
  \setmathdimens
}
\def\boldmath{%
  \loadmathfamily 0 cmbx  % CM Roman Bold Extended
  \loadmathfamily 1 cmmib % CM Math Italic Bold
  \loadmathfamily 2 cmbsy % CM Standard symbols Bold
  \loadmathfamily 3 cmexb % CM extra symbols Bold   
  \loadmathfamily 4 msam  % AMS symbols A (bold not available?)
  \loadmathfamily 5 msbm  % AMS symbols B (bold not available?)
  \loadmathfamily 6 rsfs  % script (bold not available?)
  \loadmathfamily 7 eufb  % fractur bold
  \loadmathfamily 8 bbfsans % sans serif extra bold
  \loadmathfamily 9 bbisans % sans serif extra bold slanted (for vectors)
  \setmathfamily 10 \tenrm
  \setmathfamily 11 \tenit
  \setmathdimens
}
\count18=11       % families declared by \newfam are 12, 13, ...

\let\normalAMSmath=\normalmath  \let\boldAMSmath=\boldmath

\def\bi{\tenbi \fam\bifam}  % in csplain is done \def\bi{\tenbi} only
\def\bbchar{\fam5 }         % double stroked letters
\def\frak{\fam7 }           % fraktur
\def\script{\fam6 }         % more extensive script than \cal
\chardef\bffam 8            % sans serif bold
\chardef\bifam 9            % sans serif bold slanted
\chardef\rmfam 10           % for \rm (can differ from CM Roman)
\chardef\itfam 11           % normal italic
\let\slfam=\itfam \let\ttfam=\rmfam % for raw similarity with plainTeX

% \regtfm formal-name 0 tfm[1] p[1] tfm[2] p[2] ... tfm[n] *              
%
% Imagine the interval [0,\infty) represented here by [0,*) with internal 
% points p[i]. Between each two points (measured in pt), there is the name 
% of a real tfm metric. The tfm[i] is the result of the expansion-only macro
% \whichtfm{formal-name}  iff \dgsize is in the interval [p[i-1], p[i]).              
% Example of the usage:  \font\foo=\whichtfm{cmr} at\dgsize

\def\regtfm #1 0 #2 *{\expandafter
  \def\csname#1:reg\endcsname{#2 16380 \relax}%
  \def\tmpa{#1}\reversetfm #2 * %
}
\def\reversetfm #1 #2 {% we need this data for \setmathfamily 
   \expandafter\let\csname#1:reg\expandafter\endcsname
   \csname\tmpa:reg\endcsname
   \if*#2\else \expandafter\reversetfm \fi
}

\ifx\font\lmfonts \else  % lmfonts setting has a precedence

% CM text fonts which have the CSfont alternative:
\regtfm cmr 0 csr5 5.5 csr6 6.5 csr7 7.5 csr8 8.5 csr9 9.5
              csr10 11.1 csr12 15 csr17 *
\regtfm cmbx 0 csbx5 5.5 csbx6 6.5 csbx7 7.5 csbx8 8.5 csbx9 9.5 
              csbx10 11.1 csbx12 *
\regtfm cmsl 0 cssl8 8.5 cssl9 9.5 cssl10 11.1 cssl12 *
\regtfm cmtt 0 cstt8 8.5 cstt9 9.5 cstt10 11.1 cstt12 *
\regtfm cmss 0 csss8 8.5 csss9 9.5 csss10 11.1 csss12 15 csss17 *
\regtfm cmssi 0 csssi8 8.5 csssi9 9.5 csssi10 11.1 csssi12 15 csssi17 *
\regtfm cmti 0 csti7 7.5 csti8 8.5 csti9 9.5 csti10 11.1 csti12 *
\regtfm cmbxti 0 csbxti10 *
% CM math fonts
\regtfm cmmi 0 cmmi5 5.5 cmmi6 6.5 cmmi7 7.5 cmmi8 8.5 cmmi9 9.5
              cmmi10 11.1 cmmi12 *
\regtfm cmmib 0 cmmib5 5.5 cmmib6 6.5 cmmib7 7.5 cmmib8 8.5 cmmib9
             9.5 cmmib10 *
\regtfm cmtex 0 cstex8 8.5 cstex9 9.5 cstex10 *
\regtfm cmsy 0 cmsy5 5.5 cmsy6 6.5 cmsy7 7.5 cmsy8 8.5 cmsy9 9.5
              cmsy10 *
\regtfm cmbsy 0 cmbsy5 5.5 cmbsy6 6.5 cmbsy7 7.5 cmbsy8 8.5 cmbsy9 9.5
              cmbsy10 *  
\regtfm cmex 0 cmex7 7.5 cmex8 8.5 cmex9 9.5 cmex10 *
\regtfm cmexb 0 cmexb10 *
% AMS fonts
\regtfm msam 0 msam5 5.5 msam6 6.5 msam7 7.5 msam8 8.5 msam9
             9.5 msam10 *
\regtfm msbm 0 msbm5 5.5 msbm6 6.5 msbm7 7.5 msbm8 8.5 msbm9 
             9.5 msbm10 *
\regtfm eufm 0 eufm5 5.5 eufm6 6.5 eufm7 7.5 eufm8 8.5 eufm9 
             9.5 eufm10 *
\regtfm eufb 0 eufb5 5.5 eufb6 6.5 eufb7 7.5 eufb8 8.5 eufb9 
             9.5 eufb10 *
% other fonts
\regtfm rsfs 0 rsfs5 6 rsfs7 8.5 rsfs10 *
\regtfm bfsans 0 ecsx0500 5.5 ecsx0600 6.5 ecsx0700 7.5 ecsx0800 
             8.5 ecsx0900 9.5 ecsx1000 11.1 ecsx1200 * 
\regtfm bisans 0 ecso0500 5.5 ecso0600 6.5 ecso0700 7.5 ecso0800 
             8.5 ecso0900 9.5 ecso1000 11.1 ecso1200 * 
\regtfm bbfsans 0 ecsx0500 5.5 ecsx0600 6.5 ecsx0700 7.5 ecsx0800 
             8.5 ecsx0900 9.5 ecsx1000 11.1 ecsx1200 * 
\regtfm bbisans 0 ecso0500 5.5 ecso0600 6.5 ecso0700 7.5 ecso0800 
             8.5 ecso0900 9.5 ecso1000 11.1 ecso1200 * 

\ifx\chyph\undefined  % non-csplain format, CM fonts used:

\regtfm cmr 0 cmr5 5.5 cmr6 6.5 cmr7 7.5 cmr8 8.5 cmr9 9.5
              cmr10 11.1 cmr12 15 cmr17 *
\regtfm cmbx 0 cmbx5 5.5 cmbx6 6.5 cmbx7 7.5 cmbx8 8.5 cmbx9 9.5 
              cmbx10 11.1 cmbx12 *
\regtfm cmsl 0 cmsl8 8.5 cmsl9 9.5 cmsl10 11.1 cmsl12 *
\regtfm cmtt 0 cmtt8 8.5 cmtt9 9.5 cmtt10 11.1 cmtt12 *
\regtfm cmss 0 cmss8 8.5 cmss9 9.5 cmss10 11.1 cmss12 15 cmss17 *
\regtfm cmssi 0 cmssi8 8.5 cmssi9 9.5 cmssi10 11.1 cmssi12 15 cmssi17 *
\regtfm cmti 0 cmti7 7.5 cmti8 8.5 cmti9 9.5 cmti10 11.1 cmti12 *
\regtfm cmbxti 0 cmbxti10 *
\regtfm cmtex 0 cmtex8 8.5 cmtex9 9.5 cmtex10 *

\fi\fi

% User can re-register these tfm's mentioned above after \input ams-math.tex 
% if he/she want to load other fonts than these defaults.

\def\corrmsizes{\ptmunit=1\ptunit\relax} % see tx-math for an example of \corrmsizes

%% macros:

\ifx\rfontskipat\undefined \input csfontsm \fi

\def\loadmathfamily #1 #2 {\chardef\tmp#1\corrmsizes
  \let\dgsize=\sizemtext    \font\mF=\whichtfm{#2} at\dgsize \textfont#1=\mF
  \let\dgsize=\sizemscript  \font\mF=\whichtfm{#2} at\dgsize \scriptfont#1=\mF
  \let\dgsize=\sizemsscript \font\mF=\whichtfm{#2} at\dgsize \scriptscriptfont#1=\mF
  \let\dgsize=\undefined
}
\def\setmathfamily #1 #2{\let\mF=#2\chardef\tmp#1\corrmsizes
  \let\dgsize=\sizemtext    \letfont#2=#2 at\dgsize \textfont#1=#2%
  \let\dgsize=\sizemscript  \letfont#2=#2 at\dgsize \scriptfont#1=#2%
  \let\dgsize=\sizemsscript \letfont#2=#2 at\dgsize \scriptscriptfont#1=#2%
  \let\dgsize=\undefined \let#2=\mF
}
\def\itvariables{\def\rm{\fam\rmfam \tenrm}%
  \mathcodechanges A:0-9\mathcodechanges B:A-Z\mathcodechanges B:a-z}
\def\mitvariables{\def\rm{\fam0\tenrm}%
  \mathcodechanges 0:0-9\mathcodechanges 1:A-Z\mathcodechanges 1:a-z}

\def\mathcodechanges#1:#2-#3{\edef\tmp{\count0=\the\count0 \count1=\the\count1 }%
   \count0=`#2  \count1=\count0  \advance\count1 by"7#100
   \loop \mathcode\count0=\count1
         \ifnum\count0<`#3 \advance\count0 by1 \advance\count1 by1 \repeat
   \tmp\relax
}
\def\whichtfm #1{\ifx\dgsize\undefined #1\else
   \expandafter \ifx\csname#1:reg\endcsname\relax
      #1%
   \else
      \expandafter\expandafter\expandafter \dowhichtfm
      \csname #1:reg\expandafter\endcsname
   \fi \fi
}
\def\dowhichtfm #1 #2 {%
   \ifdim\dgsize<#2pt #1\expandafter\ignoretfm\else \expandafter\dowhichtfm
\fi
}
\def\ignoretfm #1\relax{}

\def\setmathdimens{% PlainTeX sets these dimens for 10pt size only:
  \delimitershortfall=0.5\fontdimen6\textfont3
  \nulldelimiterspace=0.12\fontdimen6\textfont3
  \scriptspace=0.05\fontdimen6\textfont3
  \skewchar\textfont1=127 \skewchar\scriptfont1=127
  \skewchar\scriptscriptfont1=127
  \skewchar\textfont2=48  \skewchar\scriptfont2=48 
  \skewchar\scriptscriptfont2=48 
}

% \setmathsizes:

\def\setmathsizes[#1/#2/#3]{%
   \def\sizemtext{#1\ptmunit}\def\sizemscript{#2\ptmunit}% 
   \def\sizemsscript{#3\ptmunit}%
}
\ifx\ptuint\undefined  \def\ptunit{pt}\fi
\ifx\ptmunit\undefined \csname newdimen\endcsname\ptmunit\fi \ptmunit=1\ptunit
\ifx\sizemtext\undefined \setmathsizes[10/7/5]\fi

\ifx\tenbi\undefined \font\tenbi=ptmbi8z \relax \fi
\ifx\normalmathloading\relax\else \normalmath \fi  % load families, normal shape
\mitvariables  % \rm in \fam0 and avriables in math by \mit

%% \mathchardef declarations

\def\amsafam{4} \def\amsbfam{5} 

%% AMSA

\mathchardef \boxdot   "2\amsafam 00
\mathchardef \boxplus   "2\amsafam 01
\mathchardef \boxtimes   "2\amsafam 02
\mathchardef \square   "0\amsafam 03
\mathchardef \blacksquare   "0\amsafam 04
\mathchardef \centerdot   "2\amsafam 05
\mathchardef \lozenge   "0\amsafam 06
\mathchardef \blacklozenge   "0\amsafam 07
\mathchardef \circlearrowright   "3\amsafam 08
\mathchardef \circlearrowleft   "3\amsafam 09
\mathchardef \rightleftharpoons   "3\amsafam 0A
\mathchardef \leftrightharpoons   "3\amsafam 0B
\mathchardef \boxminus   "2\amsafam 0C
\mathchardef \Vdash   "3\amsafam 0D
\mathchardef \Vvdash   "3\amsafam 0E
\mathchardef \vDash   "3\amsafam 0F
\mathchardef \twoheadrightarrow   "3\amsafam 10
\mathchardef \twoheadleftarrow   "3\amsafam 11
\mathchardef \leftleftarrows   "3\amsafam 12
\mathchardef \rightrightarrows   "3\amsafam 13
\mathchardef \upuparrows   "3\amsafam 14
\mathchardef \downdownarrows   "3\amsafam 15
\mathchardef \upharpoonright   "3\amsafam 16
\mathchardef \downharpoonright   "3\amsafam 17
\mathchardef \upharpoonleft   "3\amsafam 18
\mathchardef \downharpoonleft   "3\amsafam 19
\mathchardef \rightarrowtail   "3\amsafam 1A
\mathchardef \leftarrowtail   "3\amsafam 1B
\mathchardef \leftrightarrows   "3\amsafam 1C
\mathchardef \rightleftarrows   "3\amsafam 1D
\mathchardef \Lsh   "3\amsafam 1E
\mathchardef \Rsh   "3\amsafam 1F
\mathchardef \rightsquigarrow   "3\amsafam 20
\mathchardef \leftrightsquigarrow   "3\amsafam 21
\mathchardef \looparrowleft   "3\amsafam 22
\mathchardef \looparrowright   "3\amsafam 23
\mathchardef \circeq   "3\amsafam 24
\mathchardef \succsim   "3\amsafam 25
\mathchardef \gtrsim   "3\amsafam 26
\mathchardef \gtrapprox   "3\amsafam 27
\mathchardef \multimap   "3\amsafam 28
\mathchardef \therefore   "3\amsafam 29
\mathchardef \because   "3\amsafam 2A
\mathchardef \doteqdot   "3\amsafam 2B
\mathchardef \triangleq   "3\amsafam 2C
\mathchardef \precsim   "3\amsafam 2D
\mathchardef \lesssim   "3\amsafam 2E
\mathchardef \lessapprox   "3\amsafam 2F
\mathchardef \eqslantless   "3\amsafam 30
\mathchardef \eqslantgtr   "3\amsafam 31
\mathchardef \curlyeqprec   "3\amsafam 32
\mathchardef \curlyeqsucc   "3\amsafam 33
\mathchardef \preccurlyeq   "3\amsafam 34
\mathchardef \leqq   "3\amsafam 35
\mathchardef \leqslant   "3\amsafam 36
\mathchardef \lessgtr   "3\amsafam 37
\mathchardef \backprime   "0\amsafam 38
\mathchardef \risingdotseq   "3\amsafam 3A
\mathchardef \fallingdotseq   "3\amsafam 3B
\mathchardef \succcurlyeq   "3\amsafam 3C
\mathchardef \geqq   "3\amsafam 3D
\mathchardef \geqslant   "3\amsafam 3E
\mathchardef \gtrless   "3\amsafam 3F
\mathchardef \sqsubset   "3\amsafam 40
\mathchardef \sqsupset   "3\amsafam 41
\mathchardef \vartriangleright   "3\amsafam 42
\mathchardef \vartriangleleft   "3\amsafam 43
\mathchardef \trianglerighteq   "3\amsafam 44
\mathchardef \trianglelefteq   "3\amsafam 45
\mathchardef \bigstar   "0\amsafam 46
\mathchardef \between   "3\amsafam 47
\mathchardef \blacktriangledown   "0\amsafam 48
\mathchardef \blacktriangleright   "3\amsafam 49
\mathchardef \blacktriangleleft   "3\amsafam 4A
\mathchardef \vartriangle   "3\amsafam 4D
\mathchardef \blacktriangle   "0\amsafam 4E
\mathchardef \triangledown   "0\amsafam 4F
\mathchardef \eqcirc   "3\amsafam 50
\mathchardef \lesseqgtr   "3\amsafam 51
\mathchardef \gtreqless   "3\amsafam 52
\mathchardef \lesseqqgtr   "3\amsafam 53
\mathchardef \gtreqqless   "3\amsafam 54
\mathchardef \Rrightarrow   "3\amsafam 56
\mathchardef \Lleftarrow   "3\amsafam 57
\mathchardef \veebar   "2\amsafam 59
\mathchardef \barwedge   "2\amsafam 5A
\mathchardef \doublebarwedge   "2\amsafam 5B
\mathchardef \angle   "0\amsafam 5C
\mathchardef \measuredangle   "0\amsafam 5D
\mathchardef \sphericalangle   "0\amsafam 5E
\mathchardef \varpropto   "3\amsafam 5F
\mathchardef \smallsmile   "3\amsafam 60
\mathchardef \smallfrown   "3\amsafam 61
\mathchardef \Subset   "3\amsafam 62
\mathchardef \Supset   "3\amsafam 63
\mathchardef \Cup   "2\amsafam 64
\mathchardef \Cap   "2\amsafam 65
\mathchardef \curlywedge   "2\amsafam 66
\mathchardef \curlyvee   "2\amsafam 67
\mathchardef \leftthreetimes   "2\amsafam 68
\mathchardef \rightthreetimes   "2\amsafam 69
\mathchardef \subseteqq   "3\amsafam 6A
\mathchardef \supseteqq   "3\amsafam 6B
\mathchardef \bumpeq   "3\amsafam 6C
\mathchardef \Bumpeq   "3\amsafam 6D
\mathchardef \lll   "3\amsafam 6E
\mathchardef \ggg   "3\amsafam 6F
\def \ulcorner {\delimiter"4\amsafam 70\amsafam 70 }
\def \urcorner {\delimiter"5\amsafam 71\amsafam 71 }
\mathchardef \circledS   "0\amsafam 73
\mathchardef \pitchfork   "3\amsafam 74
\mathchardef \dotplus   "2\amsafam 75
\mathchardef \backsim   "3\amsafam 76
\mathchardef \backsimeq   "3\amsafam 77
\def \llcorner {\delimiter"4\amsafam 78\amsafam 78 }
\def \lrcorner {\delimiter"5\amsafam 79\amsafam 79 }
\mathchardef \complement   "0\amsafam 7B
\mathchardef \intercal   "2\amsafam 7C
\mathchardef \circledcirc   "2\amsafam 7D
\mathchardef \circledast   "2\amsafam 7E
\mathchardef \circleddash   "2\amsafam 7F
\mathchardef \rhd   "2\amsafam 42
\mathchardef \lhd   "2\amsafam 43
\mathchardef \unrhd   "2\amsafam 44
\mathchardef \unlhd   "2\amsafam 45

   \let\restriction\upharpoonright
   \let\Doteq\doteqdot
   \let\doublecup\Cup
   \let\doublecap\Cap
   \let\llless\lll
   \let\gggtr\ggg
   \let\Box=\square % LaTeX symbol
   \let\Box=\square % LaTeX symbol

%% AMSB

\mathchardef \lvertneqq   "3\amsbfam 00
\mathchardef \gvertneqq   "3\amsbfam 01
\mathchardef \nleq   "3\amsbfam 02
\mathchardef \ngeq   "3\amsbfam 03
\mathchardef \nless   "3\amsbfam 04
\mathchardef \ngtr   "3\amsbfam 05
\mathchardef \nprec   "3\amsbfam 06
\mathchardef \nsucc   "3\amsbfam 07
\mathchardef \lneqq   "3\amsbfam 08
\mathchardef \gneqq   "3\amsbfam 09
\mathchardef \nleqslant   "3\amsbfam 0A
\mathchardef \ngeqslant   "3\amsbfam 0B
\mathchardef \lneq   "3\amsbfam 0C
\mathchardef \gneq   "3\amsbfam 0D
\mathchardef \npreceq   "3\amsbfam 0E
\mathchardef \nsucceq   "3\amsbfam 0F
\mathchardef \precnsim   "3\amsbfam 10
\mathchardef \succnsim   "3\amsbfam 11
\mathchardef \lnsim   "3\amsbfam 12
\mathchardef \gnsim   "3\amsbfam 13
\mathchardef \nleqq   "3\amsbfam 14
\mathchardef \ngeqq   "3\amsbfam 15
\mathchardef \precneqq   "3\amsbfam 16
\mathchardef \succneqq   "3\amsbfam 17
\mathchardef \precnapprox   "3\amsbfam 18
\mathchardef \succnapprox   "3\amsbfam 19
\mathchardef \lnapprox   "3\amsbfam 1A
\mathchardef \gnapprox   "3\amsbfam 1B
\mathchardef \nsim   "3\amsbfam 1C
\mathchardef \ncong   "3\amsbfam 1D
\mathchardef \diagup   "0\amsbfam 1E
\mathchardef \diagdown   "0\amsbfam 1F
\mathchardef \varsubsetneq   "3\amsbfam 20
\mathchardef \varsupsetneq   "3\amsbfam 21
\mathchardef \nsubseteqq   "3\amsbfam 22
\mathchardef \nsupseteqq   "3\amsbfam 23
\mathchardef \subsetneqq   "3\amsbfam 24
\mathchardef \supsetneqq   "3\amsbfam 25
\mathchardef \varsubsetneqq   "3\amsbfam 26
\mathchardef \varsupsetneqq   "3\amsbfam 27
\mathchardef \subsetneq   "3\amsbfam 28
\mathchardef \supsetneq   "3\amsbfam 29
\mathchardef \nsubseteq   "3\amsbfam 2A
\mathchardef \nsupseteq   "3\amsbfam 2B
\mathchardef \nparallel   "3\amsbfam 2C
\mathchardef \nmid   "3\amsbfam 2D
\mathchardef \nshortmid   "3\amsbfam 2E
\mathchardef \nshortparallel   "3\amsbfam 2F
\mathchardef \nvdash   "3\amsbfam 30
\mathchardef \nVdash   "3\amsbfam 31
\mathchardef \nvDash   "3\amsbfam 32
\mathchardef \nVDash   "3\amsbfam 33
\mathchardef \ntrianglerighteq   "3\amsbfam 34
\mathchardef \ntrianglelefteq   "3\amsbfam 35
\mathchardef \ntriangleleft   "3\amsbfam 36
\mathchardef \ntriangleright   "3\amsbfam 37
\mathchardef \nleftarrow   "3\amsbfam 38
\mathchardef \nrightarrow   "3\amsbfam 39
\mathchardef \nLeftarrow   "3\amsbfam 3A
\mathchardef \nRightarrow   "3\amsbfam 3B
\mathchardef \nLeftrightarrow   "3\amsbfam 3C
\mathchardef \nleftrightarrow   "3\amsbfam 3D
\mathchardef \divideontimes   "2\amsbfam 3E
\mathchardef \varnothing   "0\amsbfam 3F
\mathchardef \nexists   "0\amsbfam 40
\mathchardef \Finv   "0\amsbfam 60
\mathchardef \Game   "0\amsbfam 61
\mathchardef \mho   "0\amsbfam 66
\mathchardef \eth   "0\amsbfam 67
\mathchardef \eqsim   "3\amsbfam 68
\mathchardef \beth   "0\amsbfam 69
\mathchardef \gimel   "0\amsbfam 6A
\mathchardef \daleth   "0\amsbfam 6B
\mathchardef \lessdot   "2\amsbfam 6C
\mathchardef \gtrdot   "2\amsbfam 6D
\mathchardef \ltimes   "2\amsbfam 6E
\mathchardef \rtimes   "2\amsbfam 6F
\mathchardef \shortmid   "3\amsbfam 70
\mathchardef \shortparallel   "3\amsbfam 71
\mathchardef \smallsetminus   "2\amsbfam 72
\mathchardef \thicksim   "3\amsbfam 73
\mathchardef \thickapprox   "3\amsbfam 74
\mathchardef \approxeq   "3\amsbfam 75
\mathchardef \precapprox   "3\amsbfam 76
\mathchardef \succapprox   "3\amsbfam 77
\mathchardef \curvearrowleft   "3\amsbfam 78
\mathchardef \curvearrowright   "3\amsbfam 79
\mathchardef \digamma   "0\amsbfam 7A
\mathchardef \varkappa   "0\amsbfam 7B
\mathchardef \Bbbk   "0\amsbfam 7C
\mathchardef \hslash   "0\amsbfam 7D
\mathchardef \hbar   "0\amsbfam 7E
\mathchardef \backepsilon   "3\amsbfam 7F

%%%  macros

\def\joinrel{\mathrel{\mkern-2.5mu}}  %-3mu in plain TeX

\let\circledplus\oplus
\let\circledminus\ominus
\let\circledtimes\otimes
\let\circledslash\oslash
\let\circleddot\odot

%%% \big, \bigg, etc:

\def\scalebig#1#2{{\left#1\vbox to#2\fontdimen6\textfont3{}%
                   \kern-\nulldelimiterspace\right.}}
\def\big#1{\scalebig{#1}{.85}}  
\def\Big#1{\scalebig{#1}{1.15}} 
\def\bigg#1{\scalebig{#1}{1.45}}
\def\Bigg#1{\scalebig{#1}{1.75}}

%%% \not redefined:
%%%    \not< becomes \nless
%%%    \not> becomes \ngtr
%%%    if \notXXX is defined, \not\XXX becomes \notXXX;
%%%    if \nXXX is defined, \not\XXX becomes \nXXX;
%%%    otherwise, \not\XXX is done in the usual way.

\mathchardef \notchar  "3236

\def\not#1{%
  \ifx\TeX\relax \noexpand\not \else % \let\TeX=\relax in \output routine
  \ifx #1<\nless \else
  \ifx #1>\ngtr \else
  \begingroup\escapechar=-1\xdef\tmpn{\string#1}\endgroup
  \expandafter\ifx \csname not\tmpn\endcsname \relax
     \expandafter\ifx \csname n\tmpn\endcsname \relax
         \mathrel{\mathord{\notchar}\mathord{#1}}%
     \else \csname n\tmpn\endcsname \fi
  \else \csname not\tmpn\endcsname \fi
  \fi\fi\fi}

\endinput

% end of ams-math.tex file

Jul. 2013: \ifx\dgsize\undefined added
Jul. 2013: \def\corrmsizes{} without dependency
Aug. 2013: \mathpreloaded introduced
Aug. 2013: \newdimen\ptmunit only once
Aug. 2013: \tmp -> \mF (the sequence is printed in overfull messages)
           \mF tuned in \setmathfamily
           \corrmsizes without parameter
Sep. 2013: \letfont plus \corrmsizes used in \setmathfamily
           \ptmunit depends on \ptunit now
           \setmathfamily <num><space><font-selector> ... (<space> added)
Nov. 2013  Test of \normalmathloading introduced
Jul. 2014  \bgroup -> \begingroup in \not macro
Jun  2015  \ifx\chyph\undefined added
