% MN.TEX (Computer Modern version)
%
% plain TeX single / double column macros for the
% Monthly Notices of Royal Astronomical Society
%
% v1.6  (mn.tex)  --- released 18th September 1995 (A. Woollatt)
% v1.5      "     --- released 25th August 1994 (M. Reed)
% v1.4      "     --- released 22nd February 1994
% v1.3  (mnd.tex) --- released 28th November 1992
% v1.26     "     --- released  1st August 1992
% v1.25     "     --- released 25th February 1992
%
% Copyright Cambridge University Press
%
% > Incorporating special symbol code from laa.sty v1.1 (25th Feb 1991)
%   used with the permission of Springer Verlag.
% > Incorporating parts of mssymb.tex (8th July 1987).
% > Incorporating NewFont.sty v ALPHA patchlevel 8 (16th August 1994).
% > Add footlines, add footnotes in double column (18th September
%   1995).

\catcode `\@=11 % @ signs are letters

\def\@version{1.6}
\def\@verdate{18th September 1995}


% Fonts: Computer Modern / Monotype Times (CUP only)
%
% Font family sizes available:
%   8pt, 9pt, 10pt, 11pt, 14pt and 17pt.
%
% Faces available:
%   \rm, math italic, symbol, \it, \bf, \sl, \tt, \sc, \sf, \cal, \em,
%   \mit and \oldstyle.

% define the typeface in use

\newif\ifprod@font

\ifx\@typeface\undefined
  \def\@typeface{Comp. Modern}\prod@fontfalse
\else
  \prod@fonttrue % We want Times
\fi

\def\newfam{\alloc@8\fam\chardef\sixt@@n} % made not outer

\ifprod@font
%
\font\fiverm=mtr10 at 5pt
\font\fivebf=mtbx10 at 5pt
\font\fiveit=mtti10 at 5pt
\font\fivesl=mtsl10 at 5pt
\font\fivett=cmtt8 at 5pt     \hyphenchar\fivett=-1
\font\fivecsc=mtcsc10 at 5pt
\font\fivesf=mtss10 at 5pt
\font\fivei=mtmi10 at 5pt      \skewchar\fivei='177
\font\fivesy=mtsy10 at 5pt     \skewchar\fivesy='60

\font\sixrm=mtr10 at 6pt
\font\sixbf=mtbx10 at 6pt
\font\sixit=mtti10 at 6pt
\font\sixsl=mtsl10 at 6pt
\font\sixtt=cmtt8 at 6pt      \hyphenchar\sixtt=-1
\font\sixcsc=mtcsc10 at 6pt
\font\sixsf=mtss10 at 6pt
\font\sixi=mtmi10 at 6pt       \skewchar\sixi='177
\font\sixsy=mtsy10 at 6pt      \skewchar\sixsy='60

\font\sevenrm=mtr10 at 7pt
\font\sevenbf=mtbx10 at 7pt
\font\sevenit=mtti10 at 7pt
\font\sevensl=mtsl10 at 7pt
\font\seventt=cmtt8 at 7pt     \hyphenchar\seventt=-1
\font\sevencsc=mtcsc10 at 7pt
\font\sevensf=mtss10 at 7pt
\font\seveni=mtmi10 at 7pt      \skewchar\seveni='177
\font\sevensy=mtsy10 at 7pt     \skewchar\sevensy='60

\font\eightrm=mtr10 at 8pt
\font\eightbf=mtbx10 at 8pt
\font\eightit=mtti10 at 8pt
\font\eighti=mtmi10 at 8pt      \skewchar\eighti='177
\font\eightsy=mtsy10 at 8pt     \skewchar\eightsy='60
\font\eightsl=mtsl10 at 8pt
\font\eighttt=cmtt8             \hyphenchar\eighttt=-1
\font\eightcsc=mtcsc10 at 8pt
\font\eightsf=mtss10 at 8pt

\font\ninerm=mtr10 at 9pt
\font\ninebf=mtbx10 at 9pt
\font\nineit=mtti10 at 9pt
\font\ninei=mtmi10 at 9pt      \skewchar\ninei='177
\font\ninesy=mtsy10 at 9pt     \skewchar\ninesy='60
\font\ninesl=mtsl10 at 9pt
\font\ninett=cmtt9             \hyphenchar\ninett=-1
\font\ninecsc=mtcsc10 at 9pt
\font\ninesf=mtss10 at 9pt

\font\tenrm=mtr10
\font\tenbf=mtbx10
\font\tenit=mtti10
\font\teni=mtmi10		\skewchar\teni='177
\font\tensy=mtsy10		\skewchar\tensy='60
\font\tenex=cmex10
\font\tensl=mtsl10
\font\tentt=cmtt10		\hyphenchar\tentt=-1
\font\tencsc=mtcsc10
\font\tensf=mtss10

\font\elevenrm=mtr10 at 11pt
\font\elevenbf=mtbx10 at 11pt
\font\elevenit=mtti10 at 11pt
\font\eleveni=mtmi10 at 11pt      \skewchar\eleveni='177
\font\elevensy=mtsy10 at 11pt     \skewchar\elevensy='60
\font\elevensl=mtsl10 at 11pt
\font\eleventt=cmtt10 at 11pt     \hyphenchar\eleventt=-1
\font\elevencsc=mtcsc10 at 11pt
\font\elevensf=mtss10 at 11pt

\font\twelverm=mtr10 at 12pt
\font\twelvebf=mtbx10 at 12pt
\font\twelveit=mtti10 at 12pt
\font\twelvesl=mtsl10 at 12pt
\font\twelvett=cmtt12             \hyphenchar\twelvett=-1
\font\twelvecsc=mtcsc10 at 12pt
\font\twelvesf=mtss10 at 12pt
\font\twelvei=mtmi10 at 12pt      \skewchar\twelvei='177
\font\twelvesy=mtsy10 at 12pt     \skewchar\twelvesy='60

\font\fourteenrm=mtr10 at 14pt
\font\fourteenbf=mtbx10 at 14pt
\font\fourteenit=mtti10 at 14pt
\font\fourteeni=mtmi10 at 14pt      \skewchar\fourteeni='177
\font\fourteensy=mtsy10 at 14pt     \skewchar\fourteensy='60
\font\fourteensl=mtsl10 at 14pt
\font\fourteentt=cmtt12 at 14pt     \hyphenchar\fourteentt=-1
\font\fourteencsc=mtcsc10 at 14pt
\font\fourteensf=mtss10 at 14pt

\font\seventeenrm=mtr10 at 17pt
\font\seventeenbf=mtbx10 at 17pt
\font\seventeenit=mtti10 at 17pt
\font\seventeeni=mtmi10 at 17pt      \skewchar\seventeeni='177
\font\seventeensy=mtsy10 at 17pt     \skewchar\seventeensy='60
\font\seventeensl=mtsl10 at 17pt
\font\seventeentt=cmtt12 at 17pt     \hyphenchar\seventeentt=-1
\font\seventeencsc=mtcsc10 at 17pt
\font\seventeensf=mtss10 at 17pt
%
\else
%
\font\fiverm=cmr5
\font\fivei=cmmi5             \skewchar\fivei='177
\font\fivesy=cmsy5            \skewchar\fivesy='60
\font\fivebf=cmbx5

\font\sixrm=cmr6
\font\sixi=cmmi6             \skewchar\sixi='177
\font\sixsy=cmsy6            \skewchar\sixsy='60
\font\sixbf=cmbx6

\font\sevenrm=cmr7
\font\sevenit=cmti7
\font\seveni=cmmi7             \skewchar\seveni='177
\font\sevensy=cmsy7            \skewchar\sevensy='60
\font\sevenbf=cmbx7

\font\eightrm=cmr8
\font\eightbf=cmbx8
\font\eightit=cmti8
\font\eighti=cmmi8			\skewchar\eighti='177
\font\eightsy=cmsy8			\skewchar\eightsy='60
\font\eightsl=cmsl8
\font\eighttt=cmtt8			\hyphenchar\eighttt=-1
\font\eightcsc=cmcsc10 at 8pt
\font\eightsf=cmss8

\font\ninerm=cmr9
\font\ninebf=cmbx9
\font\nineit=cmti9
\font\ninei=cmmi9			\skewchar\ninei='177
\font\ninesy=cmsy9			\skewchar\ninesy='60
\font\ninesl=cmsl9
\font\ninett=cmtt9			\hyphenchar\ninett=-1
\font\ninecsc=cmcsc10 at 9pt
\font\ninesf=cmss9

\font\tenrm=cmr10
\font\tenbf=cmbx10
\font\tenit=cmti10
\font\teni=cmmi10		\skewchar\teni='177
\font\tensy=cmsy10		\skewchar\tensy='60
\font\tenex=cmex10
\font\tensl=cmsl10
\font\tentt=cmtt10		\hyphenchar\tentt=-1
\font\tencsc=cmcsc10
\font\tensf=cmss10

\font\elevenrm=cmr10 scaled \magstephalf
\font\elevenbf=cmbx10 scaled \magstephalf
\font\elevenit=cmti10 scaled \magstephalf
\font\eleveni=cmmi10 scaled \magstephalf	\skewchar\eleveni='177
\font\elevensy=cmsy10 scaled \magstephalf	\skewchar\elevensy='60
\font\elevensl=cmsl10 scaled \magstephalf
\font\eleventt=cmtt10 scaled \magstephalf	\hyphenchar\eleventt=-1
\font\elevencsc=cmcsc10 scaled \magstephalf
\font\elevensf=cmss10 scaled \magstephalf

\font\twelverm=cmr10 scaled \magstep1
\font\twelvebf=cmbx10 scaled \magstep1
\font\twelvei=cmmi10 scaled \magstep1      \skewchar\twelvei='177
\font\twelvesy=cmsy10 scaled \magstep1     \skewchar\twelvesy='60

\font\fourteenrm=cmr10 scaled \magstep2
\font\fourteenbf=cmbx10 scaled \magstep2
\font\fourteenit=cmti10 scaled \magstep2
\font\fourteeni=cmmi10 scaled \magstep2		\skewchar\fourteeni='177
\font\fourteensy=cmsy10 scaled \magstep2	\skewchar\fourteensy='60
\font\fourteensl=cmsl10 scaled \magstep2
\font\fourteentt=cmtt10 scaled \magstep2	\hyphenchar\fourteentt=-1
\font\fourteencsc=cmcsc10 scaled \magstep2
\font\fourteensf=cmss10 scaled \magstep2

\font\seventeenrm=cmr10 scaled \magstep3
\font\seventeenbf=cmbx10 scaled \magstep3
\font\seventeenit=cmti10 scaled \magstep3
\font\seventeeni=cmmi10 scaled \magstep3	\skewchar\seventeeni='177
\font\seventeensy=cmsy10 scaled \magstep3	\skewchar\seventeensy='60
\font\seventeensl=cmsl10 scaled \magstep3
\font\seventeentt=cmtt10 scaled \magstep3	\hyphenchar\seventeentt=-1
\font\seventeencsc=cmcsc10 scaled \magstep3
\font\seventeensf=cmss10 scaled \magstep3
%
\fi

\def\hexnumber#1{\ifcase#1 0\or1\or2\or3\or4\or5\or6\or7\or8\or9\or
  A\or B\or C\or D\or E\or F\fi}

\def\makestrut{%
  \setbox\strutbox=\hbox{%
    \vrule height.7\baselineskip depth.3\baselineskip width \z@}%
}

\def\baselinestretch{1}
\newskip\tmp@bls

\def\b@ls#1{% set baseline using \baselinestretch as a scale factor
  \tmp@bls=#1\relax
  \baselineskip=#1\relax\makestrut
  \normalbaselineskip=\baselinestretch\tmp@bls
  \normalbaselines
}

\def\nostb@ls#1{% set baseline skip ignoring \baselinestretch
  \normalbaselineskip=#1\relax
  \normalbaselines
  \makestrut
}


% families \itfam, \slfam, \bffam, \ttfam defined in PLAIN.
%
% \itfam is \fam4
% \slfam is \fam5
% \bffam is \fam6
% \ttfam is \fam7

\newfam\scfam  % \fam8
\newfam\sffam  % \fam9

\def\mit{\fam\@ne}
\def\cal{\fam\tw@}
\def\em{\ifdim\fontdimen1\font>\z@ \rm\else\it\fi}

\textfont3=\tenex
\scriptfont3=\tenex
\scriptscriptfont3=\tenex

\setbox0=\hbox{\tenex B} \p@renwd=\wd0 % width of the big left (

\def\eightpoint{% 8^6^5 on 10pt
  \def\rm{\fam0\eightrm}%
  \textfont0=\eightrm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm%
  \textfont1=\eighti  \scriptfont1=\sixi  \scriptscriptfont1=\fivei%
  \textfont2=\eightsy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy%
  \textfont\itfam=\eightit\def\it{\fam\itfam\eightit}%
  \ifprod@font
    \scriptfont\itfam=\sixit
      \scriptscriptfont\itfam=\fiveit
  \else
    \scriptfont\itfam=\eightit
      \scriptscriptfont\itfam=\eightit
  \fi
  \textfont\bffam=\eightbf%
    \scriptfont\bffam=\sixbf%
      \scriptscriptfont\bffam=\fivebf%
  \def\bf{\fam\bffam\eightbf}%
  \textfont\slfam=\eightsl\def\sl{\fam\slfam\eightsl}%
  \ifprod@font
    \scriptfont\slfam=\sixsl
      \scriptscriptfont\slfam=\fivesl
  \else
    \scriptfont\slfam=\eightsl
      \scriptscriptfont\slfam=\eightsl
  \fi
  \textfont\ttfam=\eighttt\def\tt{\fam\ttfam\eighttt}%
  \ifprod@font
    \scriptfont\ttfam=\sixtt
      \scriptscriptfont\ttfam=\fivett
  \else
    \scriptfont\ttfam=\eighttt
      \scriptscriptfont\ttfam=\eighttt
  \fi
  \textfont\scfam=\eightcsc\def\sc{\fam\scfam\eightcsc}%
  \ifprod@font
    \scriptfont\scfam=\sixcsc
      \scriptscriptfont\scfam=\fivecsc
  \else
    \scriptfont\scfam=\eightcsc
      \scriptscriptfont\scfam=\eightcsc
  \fi
  \textfont\sffam=\eightsf\def\sf{\fam\sffam\eightsf}%
  \ifprod@font
    \scriptfont\sffam=\sixsf
      \scriptscriptfont\sffam=\fivesf
  \else
    \scriptfont\sffam=\eightsf
      \scriptscriptfont\sffam=\eightsf
  \fi
  \def\oldstyle{\fam\@ne\eighti}%
  \b@ls{10pt}\rm\@viiipt%
}
\def\@viiipt{}

\def\ninepoint{% 9^6^5 on 11pt (two col) / 12 (single col)
  \def\rm{\fam0\ninerm}%
  \textfont0=\ninerm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm%
  \textfont1=\ninei  \scriptfont1=\sixi  \scriptscriptfont1=\fivei%
  \textfont2=\ninesy \scriptfont2=\sixsy \scriptscriptfont2=\fivesy%
  \textfont\itfam=\nineit\def\it{\fam\itfam\nineit}%
  \ifprod@font
    \scriptfont\itfam=\sixit
      \scriptscriptfont\itfam=\fiveit
  \else
    \scriptfont\itfam=\nineit
      \scriptscriptfont\itfam=\nineit
  \fi
  \textfont\bffam=\ninebf%
    \scriptfont\bffam=\sixbf%
      \scriptscriptfont\bffam=\fivebf%
  \def\bf{\fam\bffam\ninebf}%
  \textfont\slfam=\ninesl\def\sl{\fam\slfam\ninesl}%
  \ifprod@font
    \scriptfont\slfam=\sixsl
      \scriptscriptfont\slfam=\fivesl
  \else
    \scriptfont\slfam=\ninesl
      \scriptscriptfont\slfam=\ninesl
  \fi
  \textfont\ttfam=\ninett\def\tt{\fam\ttfam\ninett}%
  \ifprod@font
    \scriptfont\ttfam=\sixtt
      \scriptscriptfont\ttfam=\fivett
  \else
    \scriptfont\ttfam=\ninett
      \scriptscriptfont\ttfam=\ninett
  \fi
  \textfont\scfam=\ninecsc\def\sc{\fam\scfam\ninecsc}%
  \ifprod@font
    \scriptfont\scfam=\sixcsc
      \scriptscriptfont\scfam=\fivecsc
  \else
    \scriptfont\scfam=\ninecsc
      \scriptscriptfont\scfam=\ninecsc
  \fi
  \textfont\sffam=\ninesf\def\sf{\fam\sffam\ninesf}%
  \ifprod@font
    \scriptfont\sffam=\sixsf
      \scriptscriptfont\sffam=\fivesf
  \else
    \scriptfont\sffam=\ninesf
      \scriptscriptfont\sffam=\ninesf
  \fi
  \def\oldstyle{\fam\@ne\ninei}%
  \b@ls{\TextLeading plus \Feathering}\rm\@ixpt%
}
\def\@ixpt{}

\def\tenpoint{% 10^7^5 on 11pt
  \def\rm{\fam0\tenrm}%
  \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm%
  \textfont1=\teni  \scriptfont1=\seveni  \scriptscriptfont1=\fivei%
  \textfont2=\tensy \scriptfont2=\sevensy \scriptscriptfont2=\fivesy%
  \textfont\itfam=\tenit\def\it{\fam\itfam\tenit}%
  \ifprod@font
    \scriptfont\itfam=\sevenit
      \scriptscriptfont\itfam=\fiveit
  \else
    \scriptfont\itfam=\tenit
      \scriptscriptfont\itfam=\tenit
  \fi
  \textfont\bffam=\tenbf%
    \scriptfont\bffam=\sevenbf%
      \scriptscriptfont\bffam=\fivebf%
  \def\bf{\fam\bffam\tenbf}%
  \textfont\slfam=\tensl\def\sl{\fam\slfam\tensl}%
  \ifprod@font
    \scriptfont\slfam=\sevensl
      \scriptscriptfont\slfam=\fivesl
  \else
    \scriptfont\slfam=\tensl
      \scriptscriptfont\slfam=\tensl
  \fi
  \textfont\ttfam=\tentt\def\tt{\fam\ttfam\tentt}%
  \ifprod@font
    \scriptfont\ttfam=\seventt
      \scriptscriptfont\ttfam=\fivett
  \else
    \scriptfont\ttfam=\tentt
      \scriptscriptfont\ttfam=\tentt
  \fi
  \textfont\scfam=\tencsc\def\sc{\fam\scfam\tencsc}%
  \ifprod@font
    \scriptfont\scfam=\sevencsc
      \scriptscriptfont\scfam=\fivecsc
  \else
    \scriptfont\scfam=\tencsc
      \scriptscriptfont\scfam=\tencsc
  \fi
  \textfont\sffam=\tensf\def\sf{\fam\sffam\tensf}%
  \ifprod@font
    \scriptfont\sffam=\sevensf
      \scriptscriptfont\sffam=\fivesf
  \else
    \scriptfont\sffam=\tensf
      \scriptscriptfont\sffam=\tensf
  \fi
  \def\oldstyle{\fam\@ne\teni}%
  \b@ls{11pt}\rm\@xpt%
}
\def\@xpt{}

\def\elevenpoint{% 11^8^6 on 13pt
  \def\rm{\fam0\elevenrm}%
  \textfont0=\elevenrm \scriptfont0=\eightrm \scriptscriptfont0=\sixrm%
  \textfont1=\eleveni  \scriptfont1=\eighti  \scriptscriptfont1=\sixi%
  \textfont2=\elevensy \scriptfont2=\eightsy \scriptscriptfont2=\sixsy%
  \textfont\itfam=\elevenit\def\it{\fam\itfam\elevenit}%
  \ifprod@font
    \scriptfont\itfam=\eightit
      \scriptscriptfont\itfam=\sixit
  \else
    \scriptfont\itfam=\elevenit
      \scriptscriptfont\itfam=\elevenit
  \fi
  \textfont\bffam=\elevenbf%
    \scriptfont\bffam=\eightbf%
      \scriptscriptfont\bffam=\sixbf%
  \def\bf{\fam\bffam\elevenbf}%
  \textfont\slfam=\elevensl\def\sl{\fam\slfam\elevensl}%
  \ifprod@font
    \scriptfont\slfam=\eightsl
      \scriptscriptfont\slfam=\sixsl
  \else
    \scriptfont\slfam=\elevensl
      \scriptscriptfont\slfam=\elevensl
  \fi
  \textfont\ttfam=\eleventt\def\tt{\fam\ttfam\eleventt}%
  \ifprod@font
    \scriptfont\ttfam=\eighttt
      \scriptscriptfont\ttfam=\sixtt
  \else
    \scriptfont\ttfam=\eleventt
      \scriptscriptfont\ttfam=\eleventt
  \fi
  \textfont\scfam=\elevencsc\def\sc{\fam\scfam\elevencsc}%
  \ifprod@font
    \scriptfont\scfam=\eightcsc
      \scriptscriptfont\scfam=\sixcsc
  \else
    \scriptfont\scfam=\elevencsc
      \scriptscriptfont\scfam=\elevencsc
  \fi
  \textfont\sffam=\elevensf\def\sf{\fam\sffam\elevensf}%
  \ifprod@font
    \scriptfont\sffam=\eightsf
      \scriptscriptfont\sffam=\sixsf
  \else
    \scriptfont\sffam=\elevensf
      \scriptscriptfont\sffam=\elevensf
  \fi
  \def\oldstyle{\fam\@ne\eleveni}%
  \b@ls{13pt}\rm\@xipt%
}
\def\@xipt{}

\def\fourteenpoint{% 14^10^7 on 17pt
  \def\rm{\fam0\fourteenrm}%
  \textfont0\fourteenrm  \scriptfont0\tenrm  \scriptscriptfont0\sevenrm%
  \textfont1\fourteeni   \scriptfont1\teni   \scriptscriptfont1\seveni%
  \textfont2\fourteensy  \scriptfont2\tensy  \scriptscriptfont2\sevensy%
  \textfont\itfam=\fourteenit\def\it{\fam\itfam\fourteenit}%
  \ifprod@font
    \scriptfont\itfam=\tenit
      \scriptscriptfont\itfam=\sevenit
  \else
    \scriptfont\itfam=\fourteenit
      \scriptscriptfont\itfam=\fourteenit
  \fi
  \textfont\bffam=\fourteenbf%
    \scriptfont\bffam=\tenbf%
      \scriptscriptfont\bffam=\sevenbf%
  \def\bf{\fam\bffam\fourteenbf}%
  \textfont\slfam=\fourteensl\def\sl{\fam\slfam\fourteensl}%
  \ifprod@font
    \scriptfont\slfam=\tensl
      \scriptscriptfont\slfam=\sevensl
  \else
    \scriptfont\slfam=\fourteensl
      \scriptscriptfont\slfam=\fourteensl
  \fi
  \textfont\ttfam=\fourteentt\def\tt{\fam\ttfam\fourteentt}%
  \ifprod@font
    \scriptfont\ttfam=\tentt
      \scriptscriptfont\ttfam=\seventt
  \else
    \scriptfont\ttfam=\fourteentt
      \scriptscriptfont\ttfam=\fourteentt
  \fi
  \textfont\scfam=\fourteencsc\def\sc{\fam\scfam\fourteencsc}%
  \ifprod@font
    \scriptfont\scfam=\tencsc
      \scriptscriptfont\scfam=\sevencsc
  \else
    \scriptfont\scfam=\fourteencsc
      \scriptscriptfont\scfam=\fourteencsc
  \fi
  \textfont\sffam=\fourteensf\def\sf{\fam\sffam\fourteensf}%
  \ifprod@font
    \scriptfont\sffam=\tensf
      \scriptscriptfont\sffam=\sevensf
  \else
    \scriptfont\sffam=\fourteensf
      \scriptscriptfont\sffam=\fourteensf
  \fi
  \def\oldstyle{\fam\@ne\fourteeni}%
  \b@ls{17pt}\rm\@xivpt%
}
\def\@xivpt{}

\def\seventeenpoint{% 17^12^10 on 20pt
  \def\rm{\fam0\seventeenrm}%
  \textfont0\seventeenrm  \scriptfont0\twelverm  \scriptscriptfont0\tenrm%
  \textfont1\seventeeni   \scriptfont1\twelvei   \scriptscriptfont1\teni%
  \textfont2\seventeensy  \scriptfont2\twelvesy  \scriptscriptfont2\tensy%
  \textfont\itfam=\seventeenit\def\it{\fam\itfam\seventeenit}%
  \ifprod@font
    \scriptfont\itfam=\twelveit
      \scriptscriptfont\itfam=\tenit
  \else
    \scriptfont\itfam=\seventeenit
      \scriptscriptfont\itfam=\seventeenit
  \fi
  \textfont\bffam=\seventeenbf%
    \scriptfont\bffam=\twelvebf%
      \scriptscriptfont\bffam=\tenbf%
  \def\bf{\fam\bffam\seventeenbf}%
  \textfont\slfam=\seventeensl\def\sl{\fam\slfam\seventeensl}%
  \ifprod@font
    \scriptfont\slfam=\twelvesl
      \scriptscriptfont\slfam=\tensl
  \else
    \scriptfont\slfam=\seventeensl
      \scriptscriptfont\slfam=\seventeensl
  \fi
  \textfont\ttfam=\seventeentt\def\tt{\fam\ttfam\seventeentt}%
  \ifprod@font
    \scriptfont\ttfam=\twelvett
      \scriptscriptfont\ttfam=\tentt
  \else
    \scriptfont\ttfam=\seventeentt
      \scriptscriptfont\ttfam=\seventeentt
  \fi
  \textfont\scfam=\seventeencsc\def\sc{\fam\scfam\seventeencsc}%
  \ifprod@font
    \scriptfont\scfam=\twelvecsc
      \scriptscriptfont\scfam=\tencsc
  \else
    \scriptfont\scfam=\seventeencsc
      \scriptscriptfont\scfam=\seventeencsc
  \fi
  \textfont\sffam=\seventeensf\def\sf{\fam\sffam\seventeensf}%
  \ifprod@font
    \scriptfont\sffam=\twelvesf
      \scriptscriptfont\sffam=\tensf
  \else
    \scriptfont\sffam=\seventeensf
      \scriptscriptfont\sffam=\seventeensf
  \fi
  \def\oldstyle{\fam\@ne\seventeeni}%
  \b@ls{20pt}\rm\@xviipt%
}
\def\@xviipt{}

\lineskip=1pt      \normallineskip=\lineskip
\lineskiplimit=\z@ \normallineskiplimit=\lineskiplimit


% BOLD MATH SYMBOLS

\def\loadboldmathnames{%
  \def\balpha{{\bmath{\alpha}}}%
  \def\bbeta{{\bmath{\beta}}}%
  \def\bgamma{{\bmath{\gamma}}}%
  \def\bdelta{{\bmath{\delta}}}%
  \def\bepsilon{{\bmath{\epsilon}}}%
  \def\bzeta{{\bmath{\zeta}}}%
  \def\boldeta{{\bmath{\eta}}}%
  \def\btheta{{\bmath{\theta}}}%
  \def\biota{{\bmath{\iota}}}%
  \def\bkappa{{\bmath{\kappa}}}%
  \def\blambda{{\bmath{\lambda}}}%
  \def\bmu{{\bmath{\mu}}}%
  \def\bnu{{\bmath{\nu}}}%
  \def\bxi{{\bmath{\xi}}}%
  \def\bpi{{\bmath{\pi}}}%
  \def\brho{{\bmath{\rho}}}%
  \def\bsigma{{\bmath{\sigma}}}%
  \def\btau{{\bmath{\tau}}}%
  \def\bupsilon{{\bmath{\upsilon}}}%
  \def\bphi{{\bmath{\phi}}}%
  \def\bchi{{\bmath{\chi}}}%
  \def\bpsi{{\bmath{\psi}}}%
  \def\bomega{{\bmath{\omega}}}%
  \def\bvarepsilon{{\bmath{\varepsilon}}}%
  \def\bvartheta{{\bmath{\vartheta}}}%
  \def\bvarpi{{\bmath{\varpi}}}%
  \def\bvarrho{{\bmath{\varrho}}}%
  \def\bvarsigma{{\bmath{\varsigma}}}%
  \def\bvarphi{{\bmath{\varphi}}}%
  \def\baleph{{\bmath{\aleph}}}%
  \def\bimath{{\bmath{\imath}}}%
  \def\bjmath{{\bmath{\jmath}}}%
  \def\bell{{\bmath{\ell}}}%
  \def\bwp{{\bmath{\wp}}}%
  \def\bRe{{\bmath{\Re}}}%
  \def\bIm{{\bmath{\Im}}}%
  \def\bpartial{{\bmath{\partial}}}%
  \def\binfty{{\bmath{\infty}}}%
  \def\bprime{{\bmath{\prime}}}%
  \def\bemptyset{{\bmath{\emptyset}}}%
  \def\bnabla{{\bmath{\nabla}}}%
  \def\btop{{\bmath{\top}}}%
  \def\bbot{{\bmath{\bot}}}%
  \def\btriangle{{\bmath{\triangle}}}%
  \def\bforall{{\bmath{\forall}}}%
  \def\bexists{{\bmath{\exists}}}%
  \def\bneg{{\bmath{\neg}}}%
  \def\bflat{{\bmath{\flat}}}%
  \def\bnatural{{\bmath{\natural}}}%
  \def\bsharp{{\bmath{\sharp}}}%
  \def\bclubsuit{{\bmath{\clubsuit}}}%
  \def\bdiamondsuit{{\bmath{\diamondsuit}}}%
  \def\bheartsuit{{\bmath{\heartsuit}}}%
  \def\bspadesuit{{\bmath{\spadesuit}}}%
  \def\bsmallint{{\bmath{\smallint}}}%
  \def\btriangleleft{{\bmath{\triangleleft}}}%
  \def\btriangleright{{\bmath{\triangleright}}}%
  \def\bbigtriangleup{{\bmath{\bigtriangleup}}}%
  \def\bbigtriangledown{{\bmath{\bigtriangledown}}}%
  \def\bwedge{{\bmath{\wedge}}}%
  \def\bvee{{\bmath{\vee}}}%
  \def\bcap{{\bmath{\cap}}}%
  \def\bcup{{\bmath{\cup}}}%
  \def\bddagger{{\bmath{\ddagger}}}%
  \def\bdagger{{\bmath{\dagger}}}%
  \def\bsqcap{{\bmath{\sqcap}}}%
  \def\bsqcup{{\bmath{\sqcup}}}%
  \def\buplus{{\bmath{\uplus}}}%
  \def\bamalg{{\bmath{\amalg}}}%
  \def\bdiamond{{\bmath{\diamond}}}%
  \def\bbullet{{\bmath{\bullet}}}%
  \def\bwr{{\bmath{\wr}}}%
  \def\bdiv{{\bmath{\div}}}%
  \def\bodot{{\bmath{\odot}}}%
  \def\boslash{{\bmath{\oslash}}}%
  \def\botimes{{\bmath{\otimes}}}%
  \def\bominus{{\bmath{\ominus}}}%
  \def\boplus{{\bmath{\oplus}}}%
  \def\bmp{{\bmath{\mp}}}%
  \def\bpm{{\bmath{\pm}}}%
  \def\bcirc{{\bmath{\circ}}}%
  \def\bbigcirc{{\bmath{\bigcirc}}}%
  \def\bsetminus{{\bmath{\setminus}}}%
  \def\bcdot{{\bmath{\cdot}}}%
  \def\bast{{\bmath{\ast}}}%
  \def\btimes{{\bmath{\times}}}%
  \def\bstar{{\bmath{\star}}}%
  \def\bpropto{{\bmath{\propto}}}%
  \def\bsqsubseteq{{\bmath{\sqsubseteq}}}%
  \def\bsqsupseteq{{\bmath{\sqsupseteq}}}%
  \def\bparallel{{\bmath{\parallel}}}%
  \def\bmid{{\bmath{\mid}}}%
  \def\bdashv{{\bmath{\dashv}}}%
  \def\bvdash{{\bmath{\vdash}}}%
  \def\bnearrow{{\bmath{\nearrow}}}%
  \def\bsearrow{{\bmath{\searrow}}}%
  \def\bnwarrow{{\bmath{\nwarrow}}}%
  \def\bswarrow{{\bmath{\swarrow}}}%
  \def\bLeftrightarrow{{\bmath{\Leftrightarrow}}}%
  \def\bLeftarrow{{\bmath{\Leftarrow}}}%
  \def\bRightarrow{{\bmath{\Rightarrow}}}%
  \def\bleq{{\bmath{\leq}}}%
  \def\bgeq{{\bmath{\geq}}}%
  \def\bsucc{{\bmath{\succ}}}%
  \def\bprec{{\bmath{\prec}}}%
  \def\bapprox{{\bmath{\approx}}}%
  \def\bsucceq{{\bmath{\succeq}}}%
  \def\bpreceq{{\bmath{\preceq}}}%
  \def\bsupset{{\bmath{\supset}}}%
  \def\bsubset{{\bmath{\subset}}}%
  \def\bsupseteq{{\bmath{\supseteq}}}%
  \def\bsubseteq{{\bmath{\subseteq}}}%
  \def\bin{{\bmath{\in}}}%
  \def\bni{{\bmath{\ni}}}%
  \def\bgg{{\bmath{\gg}}}%
  \def\bll{{\bmath{\ll}}}%
  \def\bnot{{\bmath{\not}}}%
  \def\bleftrightarrow{{\bmath{\leftrightarrow}}}%
  \def\bleftarrow{{\bmath{\leftarrow}}}%
  \def\brightarrow{{\bmath{\rightarrow}}}%
  \def\bmapstochar{{\bmath{\mapstochar}}}%
  \def\bsim{{\bmath{\sim}}}%
  \def\bsimeq{{\bmath{\simeq}}}%
  \def\bperp{{\bmath{\perp}}}%
  \def\bequiv{{\bmath{\equiv}}}%
  \def\basymp{{\bmath{\asymp}}}%
  \def\bsmile{{\bmath{\smile}}}%
  \def\bfrown{{\bmath{\frown}}}%
  \def\bleftharpoonup{{\bmath{\leftharpoonup}}}%
  \def\bleftharpoondown{{\bmath{\leftharpoondown}}}%
  \def\brightharpoonup{{\bmath{\rightharpoonup}}}%
  \def\brightharpoondown{{\bmath{\rightharpoondown}}}%
  \def\blhook{{\bmath{\lhook}}}%
  \def\brhook{{\bmath{\rhook}}}%
  \def\bldotp{{\bmath{\ldotp}}}%
  \def\bcdotp{{\bmath{\cdotp}}}%
}

% Make \, work in non-math mode
\def\,{\relax\ifmmode \mskip\thinmuskip\else \thinspace\fi}
\let\protect=\relax

\long\def\@ifundefined#1#2#3{\expandafter\ifx\csname
  #1\endcsname\relax#2\else#3\fi}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% NewFont.sty: ALPHA VERSION patchlevel 8, 16th August 1994, M. Reed

% \addtom@thgroup{math font loading info}
% Adds to internal \math@groups definition, which is executed at the end
% of each size changing command. It is called by \NewSymbolFont.

\newtoks\math@groups \math@groups={}
\def\addtom@thgroup#1#2{#1\expandafter{\the#1#2}} %  \mac={new\the\mac}


% Make TeX change the values of \s@ze, \ss@ze, \sss@ze when \@npt is
% executed. This makes it possible for math characters to be loaded
% at the correct size automatically when the size is changed.

% \addtosizeh@ok{x}{10}{7}{5}

\def\addtosizeh@ok#1#2#3#4{%
  \expandafter\def\csname @#1pt\endcsname{%
    \def\s@ze{#2}\def\ss@ze{#3}\def\sss@ze{#4}\the\math@groups%
  }%
}


% \resetsizehook allows the size parameters to be reset after \addtosizeh@ok
% has been called (it re-defines \@npt).
% e.g JFM which requires \xpt to have 10.5pt instead of 10pt.
% Note: \resetsizehook must be used in the preamble BEFORE any
% \New... commands.

% e.g. \resetsizehook{x}{10.5}{7}{5}

\let\resetsizehook=\addtosizeh@ok


% Standard LaTeX sizes

\ifprod@font
%  \addtosizeh@ok{v}    {5} {5}  {5}
%  \addtosizeh@ok{vi}   {6} {6}  {6}
%  \addtosizeh@ok{vii}  {7} {6}  {5}
  \addtosizeh@ok{viii} {8} {6}  {5}
  \addtosizeh@ok{ix}   {9} {6}  {5}
  \addtosizeh@ok{x}    {10}{7}  {5}
  \addtosizeh@ok{xi}   {11}{8}  {6}
%  \addtosizeh@ok{xii}  {12}{8}  {6}
  \addtosizeh@ok{xiv}  {14}{10} {7}
  \addtosizeh@ok{xvii} {17}{12}{10}
%  \addtosizeh@ok{xx}   {20}{14}{12}
%  \addtosizeh@ok{xxv}  {25}{20}{17}
\else
%  \addtosizeh@ok{v}    {5}     {5}     {5}
%  \addtosizeh@ok{vi}   {6}     {6}     {6}
%  \addtosizeh@ok{vii}  {7}     {6}     {5}
  \addtosizeh@ok{viii} {8}     {6}     {5}
  \addtosizeh@ok{ix}   {9}     {6}     {5}
  \addtosizeh@ok{x}    {10}    {7}     {5}
  \addtosizeh@ok{xi}   {10.95} {8}     {6}
%  \addtosizeh@ok{xii}  {12}    {8}     {6}
  \addtosizeh@ok{xiv}  {14.4}  {10}    {7}
  \addtosizeh@ok{xvii} {17.28} {12}    {10}
%  \addtosizeh@ok{xx}   {20.74} {14.4}  {12}
%  \addtosizeh@ok{xxv}  {24.88} {20.74} {17.28}
\fi


\def\get@font#1#2#3{%
  \edef\fonts@ze{\romannumeral#3}%         10 -> x
  \edef\fontn@me{\fonts@ze#1}%             AMSa -> xAMSa
  \@ifundefined{\fontn@me}%
    {%%\typeout{defining \fontn@me}%
     \global\expandafter\font\csname \fontn@me\endcsname=#2 at #3pt}%
    {}%
}

\def\ass@tfont#1#2{%
  \xdef\fam@name{\csname #1\endcsname}%
  \xdef\font@name{\csname #2\endcsname}%
  \let\textfont@name\font@name
  \textfont\fam@name\textfont@name
}

\def\ass@sfont#1#2{%
  \xdef\fam@name{\csname #1\endcsname}%
  \xdef\font@name{\csname #2\endcsname}%
  \let\textfont@name\font@name
  \scriptfont\fam@name\textfont@name
}

\def\ass@ssfont#1#2{%
  \xdef\fam@name{\csname #1\endcsname}%
  \xdef\font@name{\csname #2\endcsname}%
  \let\textfont@name\font@name
  \scriptscriptfont\fam@name\textfont@name
}


%                fam name  base font  (allocates a \newfam)
% \NewSymbolFont {AMSa}    {mtxm10}

\def\NewSymbolFont#1#2{%
  \expandafter\ifx\csname sym#1fam\endcsname\relax % if not defined
    \expandafter\newfam\csname sym#1fam\endcsname
    \expandafter\edef\csname sym#1fam\endcsname{\the\allocationnumber}%
    \addtom@thgroup\math@groups{%
      \get@font{#1}{#2}{\s@ze}%
      \ass@tfont{sym#1fam}{\fontn@me}%
      \get@font{#1}{#2}{\ss@ze}%
      \ass@sfont{sym#1fam}{\fontn@me}%
      \get@font{#1}{#2}{\sss@ze}%
      \ass@ssfont{sym#1fam}{\fontn@me}%
    }%
  \else
    \errmessage{Family `#1' already defined}%
  \fi
}


%                symbol         type fam    pos (hex)
% \NewMathSymbol {\blacksquare} {0}  {AMSa} {04}

\def\NewMathSymbol#1#2#3#4{%
  \edef\f@mly{\expandafter\hexnumber{\csname sym#3fam\endcsname}}%
  \mathchardef#1="#2\f@mly#4\relax
}


%                  macro name  type  fam1   pos  fam2   pos
% \NewMathDelimiter{\ulcorner} {4}   {AMSa} {70} {AMSb} {70}

\newif\ifd@f

\def\NewMathDelimiter#1#2#3#4#5#6{%
  \d@ftrue
  \expandafter\ifx\csname sym#3fam\endcsname\relax
    \d@ffalse \errmessage{Family `#3' is not defined}%
  \fi
  \expandafter\ifx\csname sym#5fam\endcsname\relax
    \d@ffalse \errmessage{Family `#5' is not defined}%
  \fi
  \ifd@f
    \edef\f@mly{\expandafter\hexnumber{\csname sym#3fam\endcsname}}%
    \edef\f@mlytw@{\expandafter\hexnumber{\csname sym#5fam\endcsname}}%
    \xdef#1{\delimiter"#2\f@mly #4\f@mlytw@ #6\relax}%
  \fi
}


%                  macro name  base font  skewchar setting e.g '60 (octal)
% \NewMathAlphabet {mathbssi}  {mtmisb10} {}

\def\setboxz@h{\setbox\z@\hbox}
\def\wdz@{\wd\z@}
\def\boxz@{\box\z@}
\def\setbox@ne{\setbox\@ne}
\def\wd@ne{\wd\@ne}

\def\math@atom#1#2{%
   \binrel@{#1}\binrel@@{#2}}
\def\binrel@#1{\setboxz@h{\thinmuskip0mu
  \medmuskip\m@ne mu\thickmuskip\@ne mu$#1\m@th$}%
 \setbox@ne\hbox{\thinmuskip0mu\medmuskip\m@ne mu\thickmuskip
  \@ne mu${}#1{}\m@th$}%
 \setbox\tw@\hbox{\hskip\wd@ne\hskip-\wdz@}}
\def\binrel@@#1{\ifdim\wd2<\z@\mathbin{#1}\else\ifdim\wd\tw@>\z@
 \mathrel{#1}\else{#1}\fi\fi}

\def\m@thit{1}

\def\set@skchar#1{\global\expandafter\skewchar
  \csname\fontn@me\endcsname=#1\relax}

\def\NewMathAlphabet#1#2#3{%
  \def\tst{#3}%
  \ifx\tst\empty\else % if a \skewchar setting is present
    \expandafter\gdef\csname #1@sc\endcsname{}%  \def\cmd@sc{..}
  \fi
  %
  \expandafter\def\csname #1\endcsname{%  \def\cmd{\protect\@cmd}
    \protect\csname @#1\endcsname}%
  %
  \expandafter\def\csname @#1\endcsname##1{%  \def\@cmd{..}
    {%
    \begingroup
      \get@font{#1}{#2}{\s@ze}%
      \@ifundefined{#1@sc}{}{\set@skchar{#3}}%
      \ass@tfont{m@thit}{\fontn@me}%
      \get@font{#1}{#2}{\ss@ze}%
      \@ifundefined{#1@sc}{}{\set@skchar{#3}}%
      \ass@sfont{m@thit}{\fontn@me}%
      \get@font{#1}{#2}{\sss@ze}%
      \@ifundefined{#1@sc}{}{\set@skchar{#3}}%
      \ass@ssfont{m@thit}{\fontn@me}%
      %
      \math@atom{##1}{%
      \mathchoice%
        {\hbox{$\m@th\displaystyle##1$}}%
        {\hbox{$\m@th\textstyle##1$}}%
        {\hbox{$\m@th\scriptstyle##1$}}%
        {\hbox{$\m@th\scriptscriptstyle##1$}}}%
    \endgroup
    }%
  }%
}


%                  macro name  base font  hyphenchar setting e.g -1 (off)
% \NewTextAlphabet {textbfit}  {mtbxti10} {}

% save a family if \NewTextAlphabet is not used.
\newif\iffirstta  \firsttatrue

\def\set@hchar#1{\global\expandafter\hyphenchar
  \csname\fontn@me\endcsname=#1\relax}

\def\NewTextAlphabet#1#2#3{%
  \iffirstta
    \global\firsttafalse
    \newfam\scratchfam
    \edef\scrt@fam{\the\allocationnumber}%
  \fi
  \def\tst{#3}%
  \ifx\tst\empty\else % if a \hyphenchar setting is required
    \expandafter\gdef\csname #1@hc\endcsname{}%  \def\cmd@sc{..}
  \fi
  %
  \expandafter\def\csname #1\endcsname{%  \def\cmd{\protect\t@cmd}
    \protect\csname t@#1\endcsname}%
  %
  \long\expandafter\def\csname t@#1\endcsname##1{%  \def\t@cmd{..}
    \ifmmode
      \typeout{Warning: do not use \expandafter\string\csname #1\endcsname
        \space in math mode}\fi%
    {%
      \get@font{#1}{#2}{\s@ze}\let\t@xtfnt=\fontn@me\relax
      \@ifundefined{#1@hc}{}{\set@hchar{#3}}%
      \ass@tfont{scrt@fam}{\fontn@me}%
      \get@font{#1}{#2}{\ss@ze}%
      \@ifundefined{#1@hc}{}{\set@hchar{#3}}%
      \ass@sfont{scrt@fam}{\fontn@me}%
      \get@font{#1}{#2}{\sss@ze}%
      \@ifundefined{#1@hc}{}{\set@hchar{#3}}%
      \ass@ssfont{scrt@fam}{\fontn@me}%
      \fam\scratchfam\csname\t@xtfnt\endcsname
    ##1%
    }%
  }%
  %
  \expandafter\def\csname #1shape%  \def\cmdshape{\protect\@cmdshape}
    \endcsname{\protect\csname @#1shape\endcsname}%
  %
  \expandafter\def\csname @#1shape\endcsname{%  \def\@cmdshape
    \ifmmode
      \typeout{Warning: do not use \expandafter\string\csname
        #1shape\endcsname \space in math mode}\fi
      %
      \get@font{#1}{#2}{\s@ze}\let\t@xtfnt=\fontn@me\relax
      \@ifundefined{#1@hc}{}{\set@hchar{#3}}%
      \ass@tfont{scrt@fam}{\fontn@me}%
      \get@font{#1}{#2}{\ss@ze}%
      \@ifundefined{#1@hc}{}{\set@hchar{#3}}%
      \ass@sfont{scrt@fam}{\fontn@me}%
      \get@font{#1}{#2}{\sss@ze}%
      \@ifundefined{#1@hc}{}{\set@hchar{#3}}%
      \ass@ssfont{scrt@fam}{\fontn@me}%
      \fam\scratchfam\csname\t@xtfnt\endcsname
  }%
}


% \bmath{math text}

\ifprod@font
  \def\math@itfnt{mtmib10}
  \def\math@syfnt{mtbsy10}
\else
  \def\math@itfnt{cmmib10}
  \def\math@syfnt{cmbsy10}
\fi

\def\m@thsy{2}

\def\bmath{\protect\@bmath}
\def\@bmath#1{%
  {%
  \begingroup
    \get@font{mthit}{\math@itfnt}{\s@ze}\set@skchar{'177}%
    \ass@tfont{m@thit}{\fontn@me}%
    \get@font{mthit}{\math@itfnt}{\ss@ze}\set@skchar{'177}%
    \ass@sfont{m@thit}{\fontn@me}%
    \get@font{mthit}{\math@itfnt}{\sss@ze}\set@skchar{'177}%
    \ass@ssfont{m@thit}{\fontn@me}%
    %
    \get@font{mthsy}{\math@syfnt}{\s@ze}\set@skchar{'60}%
    \ass@tfont{m@thsy}{\fontn@me}%
    \get@font{mthsy}{\math@syfnt}{\ss@ze}\set@skchar{'60}%
    \ass@sfont{m@thsy}{\fontn@me}%
    \get@font{mthsy}{\math@syfnt}{\sss@ze}\set@skchar{'60}%
    \ass@ssfont{m@thsy}{\fontn@me}%
    %
    \math@atom{#1}{%
    \mathchoice%
      {\hbox{$\m@th\displaystyle#1$}}%
      {\hbox{$\m@th\textstyle#1$}}%
      {\hbox{$\m@th\scriptstyle#1$}}%
      {\hbox{$\m@th\scriptscriptstyle#1$}}}%
  \endgroup
  }%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% Astronomy and Astrophysics symbol macros

\def\la{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr<\cr\sim\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr
<\cr\sim\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
<\cr\sim\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
<\cr\sim\cr}}}}}

\def\ga{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr>\cr\sim\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr
>\cr\sim\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
>\cr\sim\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
>\cr\sim\cr}}}}}

\def\getsto{\mathrel{\mathchoice {\vcenter{\offinterlineskip
\halign{\hfil
$\displaystyle##$\hfil\cr\gets\cr\to\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr\gets
\cr\to\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr\gets
\cr\to\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
\gets\cr\to\cr}}}}}

\def\cor{\mathrel{\mathchoice {\hbox{$\widehat=$}}{\hbox{$\widehat=$}}
{\hbox{$\scriptstyle\hat=$}}
{\hbox{$\scriptscriptstyle\hat=$}}}}

\def\lid{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr<\cr\noalign{\vskip1.2pt}=\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr<\cr
\noalign{\vskip1.2pt}=\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr<\cr
\noalign{\vskip1pt}=\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
<\cr
\noalign{\vskip0.9pt}=\cr}}}}}

\def\gid{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr>\cr\noalign{\vskip1.2pt}=\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr>\cr
\noalign{\vskip1.2pt}=\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr>\cr
\noalign{\vskip1pt}=\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
>\cr
\noalign{\vskip0.9pt}=\cr}}}}}

\def\sol{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr\sim\cr<\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr\sim\cr
<\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr\sim\cr
<\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
\sim\cr<\cr}}}}}

\def\sog{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr\sim\cr>\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr\sim\cr
>\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
\sim\cr>\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
\sim\cr>\cr}}}}}

\def\lse{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr<\cr\simeq\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr
<\cr\simeq\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
<\cr\simeq\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
<\cr\simeq\cr}}}}}

\def\gse{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr>\cr\simeq\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr
>\cr\simeq\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
>\cr\simeq\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
>\cr\simeq\cr}}}}}

\def\grole{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr>\cr\noalign{\vskip-1.5pt}<\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr
>\cr\noalign{\vskip-1.5pt}<\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
>\cr\noalign{\vskip-1pt}<\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
>\cr\noalign{\vskip-0.5pt}<\cr}}}}}

\def\leogr{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr<\cr\noalign{\vskip-1.5pt}>\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr
<\cr\noalign{\vskip-1.5pt}>\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
<\cr\noalign{\vskip-1pt}>\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
<\cr\noalign{\vskip-0.5pt}>\cr}}}}}

\def\loa{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr<\cr\approx\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr
<\cr\approx\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
<\cr\approx\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
<\cr\approx\cr}}}}}

\def\goa{\mathrel{\mathchoice {\vcenter{\offinterlineskip\halign{\hfil
$\displaystyle##$\hfil\cr>\cr\approx\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\textstyle##$\hfil\cr
>\cr\approx\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptstyle##$\hfil\cr
>\cr\approx\cr}}}
{\vcenter{\offinterlineskip\halign{\hfil$\scriptscriptstyle##$\hfil\cr
>\cr\approx\cr}}}}}

\def\sun{\hbox{$\odot$}}
\def\degr{\hbox{$^\circ$}}
\def\diameter{{\ifmmode\mathchoice
{\ooalign{\hfil\hbox{$\displaystyle/$}\hfil\crcr
{\hbox{$\displaystyle\mathchar"20D$}}}}
{\ooalign{\hfil\hbox{$\textstyle/$}\hfil\crcr
{\hbox{$\textstyle\mathchar"20D$}}}}
{\ooalign{\hfil\hbox{$\scriptstyle/$}\hfil\crcr
{\hbox{$\scriptstyle\mathchar"20D$}}}}
{\ooalign{\hfil\hbox{$\scriptscriptstyle/$}\hfil\crcr
{\hbox{$\scriptscriptstyle\mathchar"20D$}}}}
\else{\ooalign{\hfil/\hfil\crcr\mathhexbox20D}}%
\fi}}

\def\sq{\ifmmode\squareforqed\else{\unskip\nobreak\hfil
\penalty50\hskip1em\null\nobreak\hfil\squareforqed
\parfillskip=0pt\finalhyphendemerits=0\endgraf}\fi}
\def\squareforqed{\hbox{\rlap{$\sqcap$}$\sqcup$}}

\def\fd{\hbox{$.\!\!^{\rm d}$}}
\def\fh{\hbox{$.\!\!^{\rm h}$}}
\def\fm{\hbox{$.\!\!^{\rm m}$}}
\def\fs{\hbox{$.\!\!^{\rm s}$}}
\def\fdg{\hbox{$.\!\!^\circ$}}
\def\farcm{\hbox{$.\mkern-4mu^\prime$}}
\def\farcs{\hbox{$.\!\!^{\prime\prime}$}}
\def\fp{\hbox{$.\!\!^{\scriptscriptstyle\rm p}$}}
\def\arcmin{\hbox{$^\prime$}}
\def\arcsec{\hbox{$^{\prime\prime}$}}

% Simulated Blackboard Bold symbols

\def\bbbr{{\rm I\!R}}
\def\bbbm{{\rm I\!M}}
\def\bbbn{{\rm I\!N}}
\def\bbbf{{\rm I\!F}}
\def\bbbh{{\rm I\!H}}
\def\bbbk{{\rm I\!K}}
\def\bbbp{{\rm I\!P}}
\def\bbbone{{\mathchoice {\rm 1\mskip-4mu l} {\rm 1\mskip-4mu l}
{\rm 1\mskip-4.5mu l} {\rm 1\mskip-5mu l}}}
\def\bbbc{{\mathchoice {\setbox0=\hbox{$\displaystyle\rm C$}\hbox{\hbox
to0pt{\kern0.4\wd0\vrule height0.9\ht0\hss}\box0}}
{\setbox0=\hbox{$\textstyle\rm C$}\hbox{\hbox
to0pt{\kern0.4\wd0\vrule height0.9\ht0\hss}\box0}}
{\setbox0=\hbox{$\scriptstyle\rm C$}\hbox{\hbox
to0pt{\kern0.4\wd0\vrule height0.9\ht0\hss}\box0}}
{\setbox0=\hbox{$\scriptscriptstyle\rm C$}\hbox{\hbox
to0pt{\kern0.4\wd0\vrule height0.9\ht0\hss}\box0}}}}
\def\bbbq{{\mathchoice {\setbox0=\hbox{$\displaystyle\rm
Q$}\hbox{\raise
0.15\ht0\hbox to0pt{\kern0.4\wd0\vrule height0.8\ht0\hss}\box0}}
{\setbox0=\hbox{$\textstyle\rm Q$}\hbox{\raise
0.15\ht0\hbox to0pt{\kern0.4\wd0\vrule height0.8\ht0\hss}\box0}}
{\setbox0=\hbox{$\scriptstyle\rm Q$}\hbox{\raise
0.15\ht0\hbox to0pt{\kern0.4\wd0\vrule height0.7\ht0\hss}\box0}}
{\setbox0=\hbox{$\scriptscriptstyle\rm Q$}\hbox{\raise
0.15\ht0\hbox to0pt{\kern0.4\wd0\vrule height0.7\ht0\hss}\box0}}}}
\def\bbbt{{\mathchoice {\setbox0=\hbox{$\displaystyle\rm
T$}\hbox{\hbox to0pt{\kern0.3\wd0\vrule height0.9\ht0\hss}\box0}}
{\setbox0=\hbox{$\textstyle\rm T$}\hbox{\hbox
to0pt{\kern0.3\wd0\vrule height0.9\ht0\hss}\box0}}
{\setbox0=\hbox{$\scriptstyle\rm T$}\hbox{\hbox
to0pt{\kern0.3\wd0\vrule height0.9\ht0\hss}\box0}}
{\setbox0=\hbox{$\scriptscriptstyle\rm T$}\hbox{\hbox
to0pt{\kern0.3\wd0\vrule height0.9\ht0\hss}\box0}}}}
\def\bbbs{{\mathchoice
{\setbox0=\hbox{$\displaystyle     \rm S$}\hbox{\raise0.5\ht0\hbox
to0pt{\kern0.35\wd0\vrule height0.45\ht0\hss}\hbox
to0pt{\kern0.55\wd0\vrule height0.5\ht0\hss}\box0}}
{\setbox0=\hbox{$\textstyle        \rm S$}\hbox{\raise0.5\ht0\hbox
to0pt{\kern0.35\wd0\vrule height0.45\ht0\hss}\hbox
to0pt{\kern0.55\wd0\vrule height0.5\ht0\hss}\box0}}
{\setbox0=\hbox{$\scriptstyle      \rm S$}\hbox{\raise0.5\ht0\hbox
to0pt{\kern0.35\wd0\vrule height0.45\ht0\hss}\raise0.05\ht0\hbox
to0pt{\kern0.5\wd0\vrule height0.45\ht0\hss}\box0}}
{\setbox0=\hbox{$\scriptscriptstyle\rm S$}\hbox{\raise0.5\ht0\hbox
to0pt{\kern0.4\wd0\vrule height0.45\ht0\hss}\raise0.05\ht0\hbox
to0pt{\kern0.55\wd0\vrule height0.45\ht0\hss}\box0}}}}
\def\bbbz{{\mathchoice {\hbox{$\sf\textstyle Z\kern-0.4em Z$}}
{\hbox{$\sf\textstyle Z\kern-0.4em Z$}}
{\hbox{$\sf\scriptstyle Z\kern-0.3em Z$}}
{\hbox{$\sf\scriptscriptstyle Z\kern-0.2em Z$}}}}


% NUMBER THE DESIGN ELEMENTS

\def\Nulle{0} % null element
\def\Afe{1}   % author affiliation
\def\Hae{2}   % heading A
\def\Hbe{3}   % heading B
\def\Hce{4}   % heading C
\def\Hde{5}   % heading D


% TEMPORARY REGISTERS

\newcount\LastMac       \LastMac=\Nulle

\newskip\half      \half=5.5pt plus 1.5pt minus 2.25pt
\newskip\one       \one=11pt plus 3pt minus 5.5pt
\newskip\onehalf   \onehalf=16.5pt plus 5.5pt minus 8.25pt
\newskip\two       \two=22pt plus 5.5pt minus 11pt

\def\Half{\addvspace{\half}}
\def\One{\addvspace{\one}}
\def\OneHalf{\addvspace{\onehalf}}
\def\Two{\addvspace{\two}}

\def\Referee{% produce version for refereeing
  \def\baselinestretch{2}%
  \ninepoint
}

\def\Raggedright{% set lines unjustified
  \rightskip=\z@ plus \hsize\relax
}

\def\Fullout{% set lines justified
  \rightskip=\z@\relax
}

\def\Hang#1#2{% set hanging indentation
  \hangindent=#1%
  \hangafter=#2\relax
}

\def\makeatletter{\catcode `\@=11\relax}
\def\makeatother{\catcode `\@=12\relax}


% Pagestyles

\newif\ifsp@page
\def\pagestyle#1{\csname ps@#1\endcsname}
\def\thispagestyle#1{\global\sp@pagetrue\gdef\sp@type{#1}}

\def\ps@titlepage{%
  \def\@oddhead{\eightpoint\noindent \the\CatchLine
    \ifprod@font\else\qquad Printed\ \today\qquad
      (MN plain \TeX\ macros\ v\@version)\fi \hfil}%
  \let\@evenhead=\@oddhead
  \def\@oddfoot{\eightpoint\copyright\ \@pubyear\ RAS\hfil}%
  \def\@evenfoot{\hfil\eightpoint\noindent\copyright\ \@pubyear\ RAS}%
}

\def\ps@headings{%
  \def\@oddhead{\elevenpoint\it\noindent
    \hfill\the\RightHeader\hskip1.5em\rm\folio}%
  \def\@evenhead{\elevenpoint\noindent
    \folio\hskip1.5em\it\the\LeftHeader\hfill}%
  \def\@oddfoot{\eightpoint\noindent\copyright\ \@pubyear\ RAS,
    MNRAS {\bf \@volume}, \@pagerange\hfil}%
  \def\@evenfoot{\hfil\eightpoint\copyright\ \@pubyear\ RAS,
    MNRAS {\bf \@volume}, \@pagerange}%
}

\def\ps@plate{%
  \def\@oddhead{\eightpoint\noindent\plt@cap\hfil}%
  \def\@evenhead{\eightpoint\noindent\plt@cap\hfil}%
  \def\@oddfoot{\eightpoint\noindent\copyright\ \@pubyear\ RAS,
    MNRAS {\bf \@volume}, \@pagerange\hfil}%
  \def\@evenfoot{\hfil\eightpoint\copyright\ \@pubyear\ RAS,
    MNRAS {\bf \@volume}, \@pagerange}%
}


% DESIGN ELEMENT DEFINITIONS

% Article opening

\def\title#1{% article title
  \bgroup
    \vbox to 8pt{\vss}%
    \seventeenpoint
    \Raggedright
    \noindent \strut{\bf #1}\par
  \egroup
}

\def\author#1{% article author(s)
  \bgroup
    \ifnum\LastMac=\Afe \OneHalf\else \vskip 21pt\fi
    \fourteenpoint
    \Raggedright
    \noindent \strut #1\par
    \vskip 3pt%
  \egroup
}

\def\affiliation#1{% author(s) affiliation
  \bgroup
    \vskip -4pt%
    \eightpoint
    \Raggedright
    \noindent \strut {\it #1}\par
  \egroup
  \LastMac=\Afe\relax
}

\def\acceptedline#1{% acceptance date
  \bgroup
    \Two
    \eightpoint
    \Raggedright
    \noindent \strut #1\par
  \egroup
}

\long\def\abstract#1{%
  \bgroup
    \vskip 20pt%
    \leftskip 11pc\rightskip\z@
    \noindent{\ninebf ABSTRACT}\par
    \tenpoint
    \Fullout
    \noindent #1\par
  \egroup
}

\long\def\keywords#1{% keywords
  \bgroup
    \Half
    \leftskip 11pc\rightskip\z@
    \tenpoint
    \Fullout
    \noindent\hbox{\bf Key words:}\ #1\par
  \egroup
}


% The \maketitle macro ensures that the two spanning material appears
% at the top of the first page, and that it has two lines of space
% underneath it. If you forget this in you input, no output will be produced.
% The \BeginOpening (alias \begintopmatter) macro should be called at the
% very start of the input file, so that it is in force when the document
% starts. This ensures that when \maketitle is called that the group is
% closed, and the material gets printed.

\def\maketitle{%
  \EndOpening
  \ifsinglecol \else \MakePage\fi
}


% Page offset

\def\pageoffset#1#2{\hoffset=#1\relax\voffset=#2\relax}


% Counter setup

\def\@nameuse#1{\csname #1\endcsname}
\def\arabic#1{\@arabic{\@nameuse{#1}}}
\def\alph#1{\@alph{\@nameuse{#1}}}
\def\Alph#1{\@Alph{\@nameuse{#1}}}
\def\@arabic#1{\number #1}
\def\@Alph#1{\ifcase#1\or A\or B\or C\or D\else\@Ialph{#1}\fi}
\def\@Ialph#1{\ifcase#1\or \or \or \or \or E\or F\or G\or H\or I\or J\or
   K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or
   Y\or Z\else\errmessage{Counter out of range}\fi}
\def\@alph#1{\ifcase#1\or a\or b\or c\or d\else\@ialph{#1}\fi}
\def\@ialph#1{\ifcase#1\or \or \or \or \or e\or f\or g\or h\or i\or j\or
   k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or
   z\else\errmessage{Counter out of range}\fi}


% Equation auto-numbering

\newcount\Eqnno
\newcount\SubEqnno

\def\theeq{\arabic{Eqnno}}
\def\thesubeq{\alph{SubEqnno}}

\def\stepeq{\relax
  \global\SubEqnno \z@
  \global\advance\Eqnno \@ne\relax
  {\rm (\theeq)}%
}

\def\startsubeq{\relax
  \global\SubEqnno \z@
  \global\advance\Eqnno \@ne\relax
  \stepsubeq
}

\def\stepsubeq{\relax
  \global\advance\SubEqnno \@ne\relax
  {\rm (\theeq\thesubeq)}%
}


% Headings

\newcount\Sec        %  heading auto number counters
\newcount\SecSec
\newcount\SecSecSec

\def\thesection{\arabic{Sec}}
\def\thesubsection{\thesection.\arabic{SecSec}}
\def\thesubsubsection{\thesubsection.\arabic{SecSecSec}}


\Sec=\z@

\def\:{\let\@sptoken= } \:  % this makes \@sptoken a space token 
\def\:{\@xifnch} \expandafter\def\: {\futurelet\@tempc\@ifnch}

\def\@ifnextchar#1#2#3{%
  \let\@tempMACe #1%
  \def\@tempMACa{#2}%
  \def\@tempMACb{#3}%
  \futurelet \@tempMACc\@ifnch%
}

\def\@ifnch{%
\ifx \@tempMACc \@sptoken%
  \let\@tempMACd\@xifnch%
\else%
  \ifx \@tempMACc \@tempMACe%
    \let\@tempMACd\@tempMACa%
  \else%
    \let\@tempMACd\@tempMACb%
  \fi%
\fi%
\@tempMACd%
}

\def\@ifstar#1#2{\@ifnextchar *{\def\@tempMACa*{#1}\@tempMACa}{#2}}

\newskip\@tempskipb

\def\addvspace#1{%
  \ifvmode\else \endgraf\fi%
  \ifdim\lastskip=\z@%
    \vskip #1\relax%
  \else%
    \@tempskipb#1\relax\@xaddvskip%
  \fi%
}

\def\@xaddvskip{%
  \ifdim\lastskip<\@tempskipb%
    \vskip-\lastskip%
    \vskip\@tempskipb\relax%
  \else%
    \ifdim\@tempskipb<\z@%
      \ifdim\lastskip<\z@ \else%
        \advance\@tempskipb\lastskip%
        \vskip-\lastskip\vskip\@tempskipb%
      \fi%
    \fi%
  \fi%
}

\newskip\@tmpSKIP

\def\addpen#1{%
  \ifvmode
    \if@nobreak
    \else
      \ifdim\lastskip=\z@
        \penalty#1\relax
      \else
        \@tmpSKIP=\lastskip
        \vskip -\lastskip
        \penalty#1\vskip\@tmpSKIP
      \fi
    \fi
  \fi
}

\newcount\@clubpen   \@clubpen=\clubpenalty
\newif\if@nobreak    \@nobreakfalse

\def\@noafterindent{%
  \global\@nobreaktrue
  \everypar{\if@nobreak
              \global\@nobreakfalse
              \clubpenalty \@M
              {\setbox\z@\lastbox}%
              \LastMac=\Nulle\relax%
            \else
              \clubpenalty \@clubpen
              \everypar{}%
            \fi}%
}

\newcount\gds@cbrk   \gds@cbrk=-300

\def\@nohdbrk{\interlinepenalty \@M\relax}

\let\@par=\par
\def\@restorepar{\def\par{\@par}}

\newif\if@endpe   \@endpefalse
 
\def\@doendpe{\@endpetrue \@nobreakfalse \LastMac=\Nulle\relax%
     \def\par{\@restorepar\everypar{}\par\@endpefalse}%
              \everypar{\setbox\z@\lastbox\everypar{}\@endpefalse}%
}

\def\section{\@ifstar{\@ssection}{\@section}}

\def\@section#1{% heading A (\section{....})
  \if@nobreak
    \everypar{}%
    \ifnum\LastMac=\Hae \addvspace{\half}\fi
  \else
    \addpen{\gds@cbrk}%
    \addvspace{\two}%
  \fi
  \bgroup
    \ninepoint\bf
    \Raggedright
    \global\advance\Sec \@ne
    \ifappendix
      \global\Eqnno=\z@ \global\SubEqnno=\z@\relax
      \def\ch@ck{#1}%
      \ifx\ch@ck\empty \def\c@lon{}\else\def\c@lon{:}\fi
      \noindent\@nohdbrk APPENDIX\ \thesection\c@lon\hskip 0.5em%
        \uppercase{#1}\par
    \else
      \noindent\@nohdbrk\thesection\hskip 1pc \uppercase{#1}\par
    \fi
    \global\SecSec=\z@
  \egroup
  \nobreak
  \vskip\half
  \nobreak
  \@noafterindent
  \LastMac=\Hae\relax
}

\def\@ssection#1{%  main section heading (\section*{....})
  \if@nobreak
    \everypar{}%
    \ifnum\LastMac=\Hae \addvspace{\half}\fi
  \else
    \addpen{\gds@cbrk}%
    \addvspace{\two}%
  \fi
  \bgroup
    \ninepoint\bf
    \Raggedright
%    \ifappendix
%      \global\Eqnno=\z@ \global\SubEqnno=\z@\relax % mh in apps dont reset
%      \noindent\@nohdbrk APPENDIX:\hskip 0.5em%
%        \uppercase{#1}\par
%    \else
    \noindent\@nohdbrk\uppercase{#1}\par
%    \fi
  \egroup
  \nobreak
  \vskip\half
  \nobreak
  \@noafterindent
  \LastMac=\Hae\relax
}

\def\subsection{\@ifstar{\@ssubsection}{\@subsection}}

\def\@subsection#1{% heading B
  \if@nobreak
    \everypar{}%
    \ifnum\LastMac=\Hae \addvspace{1pt plus 1pt minus .5pt}\fi
  \else
    \addpen{\gds@cbrk}%
    \addvspace{\onehalf}%
  \fi
  \bgroup
    \ninepoint\bf
    \Raggedright
    \global\advance\SecSec \@ne
    \noindent\@nohdbrk\thesubsection \hskip 1pc\relax #1\par
    \global\SecSecSec=\z@
  \egroup
  \nobreak
  \vskip\half
  \nobreak
  \@noafterindent
  \LastMac=\Hbe\relax
}

\def\@ssubsection#1{% heading B*
  \if@nobreak
    \everypar{}%
    \ifnum\LastMac=\Hae \addvspace{1pt plus 1pt minus .5pt}\fi
  \else
    \addpen{\gds@cbrk}%
    \addvspace{\onehalf}%
  \fi
  \bgroup
    \ninepoint\bf
    \Raggedright
    \noindent\@nohdbrk #1\par
  \egroup
  \nobreak
  \vskip\half
  \nobreak
  \@noafterindent
  \LastMac=\Hbe\relax
}

\def\subsubsection{\@ifstar{\@ssubsubsection}{\@subsubsection}}

\def\@subsubsection#1{% heading C
  \if@nobreak
    \everypar{}%
    \ifnum\LastMac=\Hbe \addvspace{1pt plus 1pt minus .5pt}\fi
  \else
    \addpen{\gds@cbrk}%
    \addvspace{\onehalf}%
  \fi
  \bgroup
    \ninepoint\it
    \Raggedright
    \global\advance\SecSecSec \@ne
    \noindent\@nohdbrk\thesubsubsection \hskip 1pc\relax #1\par
  \egroup
  \nobreak
  \vskip\half
  \nobreak
  \@noafterindent
  \LastMac=\Hce\relax
}

\def\@ssubsubsection#1{% heading C*
  \if@nobreak
    \everypar{}%
    \ifnum\LastMac=\Hbe \addvspace{1pt plus 1pt minus .5pt}\fi
  \else
    \addpen{\gds@cbrk}%
    \addvspace{\onehalf}%
  \fi
  \bgroup
    \ninepoint\it
    \Raggedright
    \noindent\@nohdbrk #1\par
  \egroup
  \nobreak
  \vskip\half
  \nobreak
  \@noafterindent
  \LastMac=\Hce\relax
}

\def\paragraph#1{% heading D
  \if@nobreak
    \everypar{}%
  \else
    \addpen{\gds@cbrk}%
    \addvspace{\one}%
  \fi%
  \bgroup%
    \ninepoint\it
    \noindent #1\ \nobreak%
  \egroup
  \LastMac=\Hde\relax
  \ignorespaces
}


% Appendix

\newif\ifappendix

\def\appendix{%
  \global\appendixtrue
  \def\thesection{\Alph{Sec}}%
  \def\thesubsection{\thesection\arabic{SecSec}}%
  \def\theeq{\thesection\arabic{Eqnno}}%
  \Sec=\z@ \SecSec=\z@ \SecSecSec=\z@ \Eqnno=\z@ \SubEqnno=\z@\relax
}


% Text

\let\tx=\relax % provided for backward compatibility


% Lists

\def\beginlist{%
  \par\if@nobreak \else\addvspace{\half}\fi%
  \bgroup%
    \ninepoint
    \let\item=\list@item%
}

\def\list@item{%
  \par\noindent\hskip 1em\relax%
  \ignorespaces%
}

\def\endlist{\par\egroup\addvspace{\half}\@doendpe}


% References

\def\beginrefs{%
  \par
  \bgroup
    \eightpoint
    \Fullout
    \let\bibitem=\bib@item
}

\def\bib@item{%
  \par\parindent=1.5em\Hang{1.5em}{1}%
  \everypar={\Hang{1.5em}{1}\ignorespaces}%
  \noindent\ignorespaces
}

\def\endrefs{\par\egroup\@doendpe}


% Page heads

\newtoks\CatchLine

\def\@journal{Mon.\ Not.\ R.\ Astron.\ Soc.\ }  % The journal title string
\def\@pubyear{1994}        % Assign a default publication year
\def\@pagerange{000--000}  % Assign a default page-range
\def\@volume{000}          % Assign a default volume number
\def\@microfiche{}         %

\def\pubyear#1{\gdef\@pubyear{#1}\@makecatchline}
\def\pagerange#1{\gdef\@pagerange{#1}\@makecatchline}
\def\volume#1{\gdef\@volume{#1}\@makecatchline}
\def\microfiche#1{\gdef\@microfiche{and Microfiche\ #1}\@makecatchline}

\def\@makecatchline{%
  \global\CatchLine{%
    {\rm \@journal {\bf \@volume},\ \@pagerange\ (\@pubyear)\ \@microfiche}}%
}

\@makecatchline % Assign a catchline, using the above defaults

\newtoks\LeftHeader
\def\shortauthor#1{% left page head
  \global\LeftHeader{#1}%
}

\newtoks\RightHeader
\def\shorttitle#1{% right page head
  \global\RightHeader{#1}%
}

\def\PageHead{% recto/verso running heads
  \begingroup
    \ifsp@page
      \csname ps@\sp@type\endcsname
    \fi
    \ifodd\pageno
      \let\the@head=\@oddhead
    \else
      \let\the@head=\@evenhead
    \fi
    \vbox to \z@{\vskip-22.5\p@%
      \hbox to \PageWidth{\vbox to8.5\p@{}%
        \the@head
      }%
    \vss}%
  \endgroup
  \nointerlineskip
}

\gdef\PageFoot{%
  \nointerlineskip%
  \begingroup
  \ifsp@page
    \csname ps@\sp@type\endcsname
    \global\sp@pagefalse
  \fi
  \vbox to 22pt{\vfil%
    \hbox to \PageWidth{%
      \eightpoint\strut\noindent
      \ifodd\pageno
        \@oddfoot
      \else
        \@evenfoot
      \fi
    }%
  }%
  \endgroup
}

\def\today{%
  \number\day\space
  \ifcase\month\or January\or February\or March\or April\or May\or June\or
    July\or August\or September\or October\or November\or December\fi
  \space\number\year%
}


\def\authorcomment#1{%
  \gdef\PageFoot{%
    \nointerlineskip%
    \vbox to 20pt{\vfil%
      \hbox to \PageWidth{\elevenpoint\noindent \hfil #1 \hfil}}%
  }%
}


% Plate pages

\newif\ifplate@page
\newbox\plt@box

\def\beginplatepage{%
  \let\plate=\plate@head
  \let\caption=\fig@caption
  \global\setbox\plt@box=\vbox\bgroup
  \TEMPDIMEN=\PageWidth % For \fig@caption test
  \hsize=\PageWidth\relax
}

\def\endplatepage{\par\egroup\global\plate@pagetrue}
\def\plate@head#1{\gdef\plt@cap{#1}}

% Letters option

\def\letters{%
  \gdef\folio{\ifnum\pageno<\z@ L\romannumeral-\pageno
    \else L\number\pageno \fi}%
}


% Math setup

% The standard math indentation
\newdimen\mathindent

\global\mathindent=\z@
\global\everydisplay{\global\@dspwd=\displaywidth\displaysetup}

% New versions of \displaylines, \eqalign, \eqalignno for
% when non-centered math is in use.

\def\@displaylines#1{% (for non-centered math)
  {}$\displ@y\hbox{\vbox{\halign{$\@lign\hfil\displaystyle##\hfil$\crcr
  #1\crcr}}}${}%
}

\def\@eqalign#1{\null\vcenter{\openup\jot\m@th% (for non-centered math)
  \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
      \crcr#1\crcr}}%
}

\def\@eqalignno#1{% (for non-centered math)
  \global\advance\@dspwd by -\mathindent%
  {}$\displ@y\hbox{\vbox{\halign to\@dspwd%
  {\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
  &$\@lign\displaystyle{{}##}$\hfil\tabskip\centering
  &\llap{$\@lign##$}\tabskip\z@skip\crcr
  #1\crcr}}}${}%
}

% When equations are flushleft ensure, that \displaylines,
% \eqalign, \eqalignno and \leqalignno point to the new versions of
% the macros. Also make \leqalignno act like \eqalignno, otherwise the
% equation text would `crash' into the equation number.

\global\let\displaylines=\@displaylines
\global\let\eqalign=\@eqalign
\global\let\eqalignno=\@eqalignno
\global\let\leqalignno=\@eqalignno

\newdimen\@dspwd   \@dspwd=\z@
\newif\if@eqno
\newif\if@leqno
\newtoks\@eqn
\newtoks\@eq

\def\displaysetup#1$${\displaytest#1\eqno\eqno\displaytest}

\def\displaytest#1\eqno#2\eqno#3\displaytest{%
 \if!#3!\ldisplaytest#1\leqno\leqno\ldisplaytest
 \else\@eqnotrue\@leqnofalse\@eqn={#2}\@eq={#1}\fi
 \generaldisplay$$}

\def\ldisplaytest#1\leqno#2\leqno#3\ldisplaytest{%
\@eq={#1}%
 \if!#3!\@eqnofalse\else\@eqnotrue\@leqnotrue
  \@eqn={#2}\fi}

\def\generaldisplay{%
  \if@eqno
    \if@leqno
      \hbox to \displaywidth{\noindent
        \rlap{$\displaystyle\the\@eqn$}%
        \hskip\mathindent$\displaystyle\the\@eq$\hfil}%
    \else
      \hbox to \displaywidth{\noindent
        \hskip\mathindent
        $\displaystyle\the\@eq$\hfil$\displaystyle\the\@eqn$}%
    \fi
  \else
    \hbox to \displaywidth{\noindent
      \hskip\mathindent$\displaystyle\the\@eq$\hfil}%
  \fi
}


% Finishing notice

\def\@notice{%
  \par\Two%
  \noindent{\b@ls{11pt}\ninerm This paper has been produced using the
    Royal Astronomical Society/Blackwell Science \TeX\ macros.\par}%
}

% redefine \bye to output our identification notice :
\outer\def\bye{\@notice\par\vfill\supereject\end}


% define a sign on :

\def\start@mess{%
  Monthly notices of the RAS journal style (\@typeface)\space
    v\@version,\space \@verdate.%
}

\everyjob{\Warn{\start@mess}}


% Two-column macros

%--------------------------------------------------------%
%                     INITIALISATION                     %
%--------------------------------------------------------%

\newif\if@debug \@debugfalse  %  when false, only warnings displayed

\def\Print#1{\if@debug\immediate\write16{#1}\else \fi}
\def\Warn#1{\immediate\write16{#1}}
\def\wlog#1{}

\newcount\Iteration % temporary loop counter

\def\Single{0} \def\Double{1}                 % ItemSPAN's
\def\Figure{0} \def\Table{1}                  % ItemTYPE's

\def\InStack{0}  % ItemSTATUS
\def\InZoneA{1}
\def\InZoneB{2}
\def\InZoneC{3}

\newcount\TEMPCOUNT % temporary count register
\newdimen\TEMPDIMEN % temporary dimen register
\newbox\TEMPBOX     % temporary box register
\newbox\VOIDBOX     % a box which is permenately void

\newcount\LengthOfStack % number of items currently in stack
\newcount\MaxItems      % maximum number of items allowed in stack
\newcount\StackPointer
\newcount\Point         % used in calculation for generating the
                        % physical address of an item in the stack.
\newcount\NextFigure    % number of next figure to be output
\newcount\NextTable     % number of next table to be output
\newcount\NextItem      % Next item to consider by order in stack

\newcount\StatusStack   % set to point to top of STATUS stack
\newcount\NumStack      % set to point to top of NUMBER stack
\newcount\TypeStack     % set to point to top of TYPE stack
\newcount\SpanStack     % set to point to top of SPAN stack
\newcount\BoxStack      % set to point to top of BOX stack

\newcount\ItemSTATUS    % status of present item
\newcount\ItemNUMBER    % number of present item
\newcount\ItemTYPE      % type of present item
\newcount\ItemSPAN      % span of present item
\newbox\ItemBOX         % box of present item
\newdimen\ItemSIZE      % size of present item
                        % (calculated by GetItemBOX)

\newdimen\PageHeight    % vertical measure of full page
\newdimen\TextLeading   % distance between baselines of body text
\newdimen\Feathering    % amount of interline stretch
\newcount\LinesPerPage  % height of page in text lines
\newdimen\ColumnWidth   % width of 1 column of text
\newdimen\ColumnGap     % size of gap between columns
\newdimen\PageWidth     % = \ColumnWidth * 2 + \ColumnGap
\newdimen\BodgeHeight   % Bodge to align figures and tables with text
\newcount\Leading       % Set to same as \TextLeading above

\newdimen\ZoneBSize  % size of items in ZoneB
\newdimen\TextSize   % size of text in ZoneB
\newbox\ZoneABOX     % contains Zone A material
\newbox\ZoneBBOX     % contains Zone B material
\newbox\ZoneCBOX     % contains Zone C material

\newif\ifFirstSingleItem
\newif\ifFirstZoneA
\newif\ifMakePageInComplete
\newif\ifMoreFigures \MoreFiguresfalse % set true in join stack
\newif\ifMoreTables  \MoreTablesfalse  % set true in join stack

\newif\ifFigInZoneB % used to determine in which zone an item
\newif\ifFigInZoneC % will be placed based on what is in other
\newif\ifTabInZoneB % zones already for a given page.
\newif\ifTabInZoneC

\newif\ifZoneAFullPage

\newbox\MidBOX    % = LeftBOX+gap+RightBOX
\newbox\LeftBOX
\newbox\RightBOX
\newbox\PageBOX   % complete made-up page

\newif\ifLeftCOL  % flags first pass through output routine
\LeftCOLtrue

\newdimen\ZoneBAdjust

\newcount\ItemFits
\def\Yes{1}
\def\No{2}

\def\LineAdjust#1{\global\ZoneBAdjust=#1\TextLeading\relax}


% Setup file.

\MaxItems=15
\NextFigure=\z@        % used for article opening
\NextTable=\@ne

\BodgeHeight=6pt
\TextLeading=11pt    % baselineskip of body text
\Leading=11
\Feathering=\z@      % amount of interline stretch
\LinesPerPage=61     % number of text lines per full page -1
\topskip=\TextLeading
\ColumnWidth=20pc    % width of text columns
\ColumnGap=2pc       % gap between columns

\newskip\ItemSepamount  % space between floats
\ItemSepamount=\TextLeading plus \TextLeading minus 4pt

\parskip=\z@ plus .1pt
\parindent=18pt
\widowpenalty=\z@
\clubpenalty=10000
\tolerance=1500
\hbadness=1500
\abovedisplayskip=6pt plus 2pt minus 1pt
\belowdisplayskip=6pt plus 2pt minus 1pt
\abovedisplayshortskip=6pt plus 2pt minus 1pt
\belowdisplayshortskip=6pt plus 2pt minus 1pt

\frenchspacing

\ninepoint % start main text size

\PageHeight=682pt
\PageWidth=2\ColumnWidth
\advance\PageWidth by \ColumnGap

\pagestyle{headings}


%--------------------------------------------------------%
%                         STACKS                         %
%--------------------------------------------------------%

% THE ITEM STACK
% The item stack contains contains figures and tables
% in the order in which they appear in the article source
% code.

% allocate stack space

\newcount\DUMMY \StatusStack=\allocationnumber
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY

\newcount\DUMMY \NumStack=\allocationnumber
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY

\newcount\DUMMY \TypeStack=\allocationnumber
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY

\newcount\DUMMY \SpanStack=\allocationnumber
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY 
\newcount\DUMMY \newcount\DUMMY \newcount\DUMMY

\newbox\DUMMY   \BoxStack=\allocationnumber
\newbox\DUMMY   \newbox\DUMMY \newbox\DUMMY 
\newbox\DUMMY   \newbox\DUMMY \newbox\DUMMY 
\newbox\DUMMY   \newbox\DUMMY \newbox\DUMMY 
\newbox\DUMMY   \newbox\DUMMY \newbox\DUMMY 
\newbox\DUMMY   \newbox\DUMMY \newbox\DUMMY

\def\wlog{\immediate\write\m@ne}

% \GetItemSTATUS, \GetItemNUMBER, \GetItemTYPE, \GetItemSPAN,
% \GetItemBox 
% are used to get details of a particular item from the item
% stack. The argument to each of these is the items position
% in the stack (usually \StackPointer)...not the items number.

\def\GetItemAll#1{%
 \GetItemSTATUS{#1}
 \GetItemNUMBER{#1}
 \GetItemTYPE{#1}
 \GetItemSPAN{#1}
 \GetItemBOX{#1}
}

% Note: \LeaveStack uses this routine. Do not destroy \Point
\def\GetItemSTATUS#1{%
 \Point=\StatusStack
 \advance\Point by #1
 \global\ItemSTATUS=\count\Point
}

% Note: \LeaveStack uses this routine. Do not destroy \Point
\def\GetItemNUMBER#1{%
 \Point=\NumStack
 \advance\Point by #1
 \global\ItemNUMBER=\count\Point
}

% Note: \LeaveStack uses this routine. Do not destroy \Point
\def\GetItemTYPE#1{%
 \Point=\TypeStack
 \advance\Point by #1
 \global\ItemTYPE=\count\Point
}

% Note: \LeaveStack uses this routine. Do not destroy \Point
\def\GetItemSPAN#1{%
 \Point\SpanStack
 \advance\Point by #1
 \global\ItemSPAN=\count\Point
}

% Note: \LeaveStack uses this routine. Do not destroy \Point
\def\GetItemBOX#1{%
 \Point=\BoxStack
 \advance\Point by #1
 \global\setbox\ItemBOX=\vbox{\copy\Point}
 \global\ItemSIZE=\ht\ItemBOX
 \global\advance\ItemSIZE by \dp\ItemBOX
 \TEMPCOUNT=\ItemSIZE
 \divide\TEMPCOUNT by \Leading
 \divide\TEMPCOUNT by 65536
 \advance\TEMPCOUNT \@ne
 \ItemSIZE=\TEMPCOUNT pt
 \global\multiply\ItemSIZE by \Leading
}

% item joins stack

\def\JoinStack{%
 \ifnum\LengthOfStack=\MaxItems % stack is full of items
  \Warn{WARNING: Stack is full...some items will be lost!}
 \else
  \Point=\StatusStack
  \advance\Point by \LengthOfStack
  \global\count\Point=\ItemSTATUS
  \Point=\NumStack
  \advance\Point by \LengthOfStack
  \global\count\Point=\ItemNUMBER
  \Point=\TypeStack
  \advance\Point by \LengthOfStack
  \global\count\Point=\ItemTYPE
  \Point\SpanStack
  \advance\Point by \LengthOfStack
  \global\count\Point=\ItemSPAN
  \Point=\BoxStack
  \advance\Point by \LengthOfStack
  \global\setbox\Point=\vbox{\copy\ItemBOX}
  \global\advance\LengthOfStack \@ne
  \ifnum\ItemTYPE=\Figure % used in \MakePage
   \global\MoreFigurestrue
  \else
   \global\MoreTablestrue
  \fi
 \fi
}

% item leaves stack
% #1=physical position of the item to be removed

\def\LeaveStack#1{%
 {\Iteration=#1
 \loop
 \ifnum\Iteration<\LengthOfStack
  \advance\Iteration \@ne
  \GetItemSTATUS{\Iteration}
   \advance\Point by \m@ne
   \global\count\Point=\ItemSTATUS
  \GetItemNUMBER{\Iteration}
   \advance\Point by \m@ne
   \global\count\Point=\ItemNUMBER
  \GetItemTYPE{\Iteration}
   \advance\Point by \m@ne
   \global\count\Point=\ItemTYPE
  \GetItemSPAN{\Iteration}
   \advance\Point by \m@ne
   \global\count\Point=\ItemSPAN
  \GetItemBOX{\Iteration}
   \advance\Point by \m@ne
   \global\setbox\Point=\vbox{\copy\ItemBOX}
 \repeat}
 \global\advance\LengthOfStack by \m@ne
}

% clean stack
% This routine scans through the stack and removes anything
% that does not have STATUS=\InStack.

\newif\ifStackNotClean

\def\CleanStack{%
 \StackNotCleantrue
 {\Iteration=\z@
  \loop
   \ifStackNotClean
    \GetItemSTATUS{\Iteration}
    \ifnum\ItemSTATUS=\InStack
     \advance\Iteration \@ne
     \else
      \LeaveStack{\Iteration}
    \fi
   \ifnum\LengthOfStack<\Iteration
    \StackNotCleanfalse
   \fi
 \repeat}
}

% Find item.
% This macro searches from the top to the bottom of the
% stack for an item of a specified type and number.
% #1=type, #2=number
% If the specified item is found, then \StackPointer is set
% to point to it, else \StackPointer=-1.
% This routine is used to find the next figure or table
% by number.

\def\FindItem#1#2{%
 \global\StackPointer=\m@ne % assume item isn't in stack for now
 {\Iteration=\z@
  \loop
  \ifnum\Iteration<\LengthOfStack
   \GetItemSTATUS{\Iteration}
   \ifnum\ItemSTATUS=\InStack
    \GetItemTYPE{\Iteration}
    \ifnum\ItemTYPE=#1
     \GetItemNUMBER{\Iteration}
     \ifnum\ItemNUMBER=#2
      \global\StackPointer=\Iteration
      \Iteration=\LengthOfStack % terminate loop
     \fi
    \fi
   \fi
  \advance\Iteration \@ne
 \repeat}
}

% Find next type
% This macro searches from the top to the bottom of the stack
% looking for the first item which has STATUS=\InStack.
% If it is a figure then a figure is what will be considered
% next by \MakePage else table.

\def\FindNext{%
 \global\StackPointer=\m@ne % assume stack is empty for now
 {\Iteration=\z@
  \loop
  \ifnum\Iteration<\LengthOfStack
   \GetItemSTATUS{\Iteration}
   \ifnum\ItemSTATUS=\InStack
    \GetItemTYPE{\Iteration}
   \ifnum\ItemTYPE=\Figure
    \ifMoreFigures
      \global\NextItem=\Figure
      \global\StackPointer=\Iteration
      \Iteration=\LengthOfStack % terminate loop
    \fi
   \fi
   \ifnum\ItemTYPE=\Table
    \ifMoreTables
      \global\NextItem=\Table
      \global\StackPointer=\Iteration
      \Iteration=\LengthOfStack % terminate loop
    \fi
   \fi
  \fi
  \advance\Iteration \@ne
 \repeat}
}

% Change status
% Macro to change the status of a specified item in stack.
% #1=item, #2=new status

\def\ChangeStatus#1#2{%
 \Point=\StatusStack
 \advance\Point by #1
 \global\count\Point=#2
}


%--------------------------------------------------------%
%                       MAKEPAGE                         %
%--------------------------------------------------------%

% This macro is called at the start of every new page
% including the first. It scans through the stack picking
% out items which should be placed on this page. It then
% leaves space for the items to be placed later. The routine
% terminates when either there is no room on the page to
% fit the next figure or table, or there are no more items
% in the stack.

\def\Zone{\InZoneA}

\ZoneBAdjust=\z@

\def\MakePage{% allocate space on this page for stack items
 \global\ZoneBSize=\PageHeight
 \global\TextSize=\ZoneBSize
 \global\ZoneAFullPagefalse
 \global\topskip=\TextLeading
 \MakePageInCompletetrue
 \MoreFigurestrue
 \MoreTablestrue
 \FigInZoneBfalse
 \FigInZoneCfalse
 \TabInZoneBfalse
 \TabInZoneCfalse
 \global\FirstSingleItemtrue
 \global\FirstZoneAtrue
 \global\setbox\ZoneABOX=\box\VOIDBOX
 \global\setbox\ZoneBBOX=\box\VOIDBOX
 \global\setbox\ZoneCBOX=\box\VOIDBOX
 \loop
  \ifMakePageInComplete
 \FindNext
 \ifnum\StackPointer=\m@ne
  \NextItem=\m@ne
  \MoreFiguresfalse
  \MoreTablesfalse
 \fi
 \ifnum\NextItem=\Figure
   \FindItem{\Figure}{\NextFigure}
   \ifnum\StackPointer=\m@ne \global\MoreFiguresfalse
   \else
    \GetItemSPAN{\StackPointer}
    \ifnum\ItemSPAN=\Single \def\Zone{\InZoneB}\relax
     \ifFigInZoneC \global\MoreFiguresfalse\fi
    \else
     \def\Zone{\InZoneA}
     \ifFigInZoneB \def\Zone{\InZoneC}\fi
    \fi
   \fi
   \ifMoreFigures\Print{}\FigureItems\fi
 \fi
\ifnum\NextItem=\Table
   \FindItem{\Table}{\NextTable}
   \ifnum\StackPointer=\m@ne \global\MoreTablesfalse
   \else
    \GetItemSPAN{\StackPointer}
    \ifnum\ItemSPAN=\Single\relax
     \ifTabInZoneC \global\MoreTablesfalse\fi
    \else
     \def\Zone{\InZoneA}
     \ifTabInZoneB \def\Zone{\InZoneC}\fi
    \fi
   \fi
   \ifMoreTables\Print{}\TableItems\fi
 \fi
   \MakePageInCompletefalse % assume page is complete
   \ifMoreFigures\MakePageInCompletetrue\fi
   \ifMoreTables\MakePageInCompletetrue\fi
 \repeat
%\Print{TextSize=\the\TextSize}
%\Print{ZoneBSize=\the\ZoneBSize}
 \ifZoneAFullPage
  \global\TextSize=\z@
  \global\ZoneBSize=\z@
  \global\vsize=\z@\relax
  \global\topskip=\z@\relax
  \vbox to \z@{\vss}
  \eject
 \else
 \global\advance\ZoneBSize by -\ZoneBAdjust
 \global\vsize=\ZoneBSize
 \global\hsize=\ColumnWidth
 \global\ZoneBAdjust=\z@
 \ifdim\TextSize<23pt
 \Warn{}
 \Warn{* Making column fall short: TextSize=\the\TextSize *}
 \vskip-\lastskip\eject\fi
 \fi
}

\def\MakeRightCol{% allocate space for the right column of text
 \global\TextSize=\ZoneBSize
 \MakePageInCompletetrue
 \MoreFigurestrue
 \MoreTablestrue
 \global\FirstSingleItemtrue
 \global\setbox\ZoneBBOX=\box\VOIDBOX
 \def\Zone{\InZoneB}
 \loop
  \ifMakePageInComplete
 \FindNext
 \ifnum\StackPointer=\m@ne
  \NextItem=\m@ne
  \MoreFiguresfalse
  \MoreTablesfalse
 \fi
 \ifnum\NextItem=\Figure
   \FindItem{\Figure}{\NextFigure}
   \ifnum\StackPointer=\m@ne \MoreFiguresfalse
   \else
    \GetItemSPAN{\StackPointer}
    \ifnum\ItemSPAN=\Double\relax
     \MoreFiguresfalse\fi
   \fi
   \ifMoreFigures\Print{}\FigureItems\fi
 \fi
 \ifnum\NextItem=\Table
   \FindItem{\Table}{\NextTable}
   \ifnum\StackPointer=\m@ne \MoreTablesfalse
   \else
    \GetItemSPAN{\StackPointer}
    \ifnum\ItemSPAN=\Double\relax
     \MoreTablesfalse\fi
   \fi
   \ifMoreTables\Print{}\TableItems\fi
 \fi
   \MakePageInCompletefalse % assume page is complete
   \ifMoreFigures\MakePageInCompletetrue\fi
   \ifMoreTables\MakePageInCompletetrue\fi
 \repeat
 \ifZoneAFullPage
  \global\TextSize=\z@
  \global\ZoneBSize=\z@
  \global\vsize=\z@\relax
  \global\topskip=\z@\relax
  \vbox to \z@{\vss}
  \eject
 \else
 \global\vsize=\ZoneBSize
 \global\hsize=\ColumnWidth
 \ifdim\TextSize<23pt
 \Warn{}
 \Warn{* Making column fall short: TextSize=\the\TextSize *}
 \vskip-\lastskip\eject\fi
\fi
}

\def\FigureItems{% Stack pointer points to next figure
 \Print{Considering...}
 \ShowItem{\StackPointer}
 \GetItemBOX{\StackPointer} % auto calculates ItemSIZE
 \GetItemSPAN{\StackPointer}
  \CheckFitInZone % check to see if item fits
  \ifnum\ItemFits=\Yes
   \ifnum\ItemSPAN=\Single
     \ChangeStatus{\StackPointer}{\InZoneB} % flag to be output
     \global\FigInZoneBtrue
     \ifFirstSingleItem
      \hbox{}\vskip-\BodgeHeight
     \global\advance\ItemSIZE by \TextLeading
     \fi
     \unvbox\ItemBOX\ItemSep
     \global\FirstSingleItemfalse
     \global\advance\TextSize by -\ItemSIZE% allocate space
     \global\advance\TextSize by -\TextLeading
   \else
    \ifFirstZoneA
     \global\advance\ItemSIZE by \TextLeading
     \global\FirstZoneAfalse\fi
    \global\advance\TextSize by -\ItemSIZE
    \global\advance\TextSize by -\TextLeading
    \global\advance\ZoneBSize by -\ItemSIZE
    \global\advance\ZoneBSize by -\TextLeading
    \ifFigInZoneB\relax
     \else
     \ifdim\TextSize<3\TextLeading
     \global\ZoneAFullPagetrue
     \fi
    \fi
    \ChangeStatus{\StackPointer}{\Zone}
    \ifnum\Zone=\InZoneC \global\FigInZoneCtrue\fi
  \fi
   \Print{TextSize=\the\TextSize}
   \Print{ZoneBSize=\the\ZoneBSize}
  \global\advance\NextFigure \@ne
   \Print{This figure has been placed.}
  \else
   \Print{No space available for this figure...holding over.}
   \Print{}
   \global\MoreFiguresfalse
  \fi
}

\def\TableItems{% Stack pointer points to next table
 \Print{Considering...}
 \ShowItem{\StackPointer}
 \GetItemBOX{\StackPointer} % auto calculates ItemSIZE
 \GetItemSPAN{\StackPointer}
  \CheckFitInZone % check to see of item fits in Zone
  \ifnum\ItemFits=\Yes
   \ifnum\ItemSPAN=\Single
    \ChangeStatus{\StackPointer}{\InZoneB}
     \global\TabInZoneBtrue
     \ifFirstSingleItem
      \hbox{}\vskip-\BodgeHeight
     \global\advance\ItemSIZE by \TextLeading
     \fi
     \unvbox\ItemBOX\ItemSep
     \global\FirstSingleItemfalse
     \global\advance\TextSize by -\ItemSIZE
     \global\advance\TextSize by -\TextLeading
   \else
    \ifFirstZoneA
    \global\advance\ItemSIZE by \TextLeading
    \global\FirstZoneAfalse\fi
    \global\advance\TextSize by -\ItemSIZE
    \global\advance\TextSize by -\TextLeading
    \global\advance\ZoneBSize by -\ItemSIZE
    \global\advance\ZoneBSize by -\TextLeading
    \ifFigInZoneB\relax
     \else
     \ifdim\TextSize<3\TextLeading
     \global\ZoneAFullPagetrue
     \fi
    \fi
    \ChangeStatus{\StackPointer}{\Zone}
    \ifnum\Zone=\InZoneC \global\TabInZoneCtrue\fi
   \fi
%   \Print{TextSize=\the\TextSize}
%   \Print{ZoneBSize=\the\ZoneBSize}
  \global\advance\NextTable \@ne
   \Print{This table has been placed.}
  \else
  \Print{No space available for this table...holding over.}
   \Print{}
   \global\MoreTablesfalse
  \fi
}

% These macros check to see if an item of ItemSIZE will
% fit in a particular zone. If it will, then ItemFits
% will be set true else false.

\def\CheckFitInZone{%
{\advance\TextSize by -\ItemSIZE
 \advance\TextSize by -\TextLeading
 \ifFirstSingleItem
  \advance\TextSize by \TextLeading
 \fi
 \ifnum\Zone=\InZoneA\relax
  \else \advance\TextSize by -\ZoneBAdjust
 \fi
 \ifdim\TextSize<3\TextLeading \global\ItemFits=\No
 \else \global\ItemFits=\Yes\fi}
}

\def\BeginOpening{%
  % start 9pt a.s.a.p. so that \New.. commands get a chance to init.
  \ninepoint
  \thispagestyle{titlepage}%
  \global\setbox\ItemBOX=\vbox\bgroup%
    \hsize=\PageWidth%
    \hrule height \z@
    \ifsinglecol\vskip 6pt\fi % Bodge, to get same pos. as two-column!
}

\let\begintopmatter=\BeginOpening  %  alias for \BeginOpening

\def\EndOpening{%
  \One%  1 line fixed space below opening
  \egroup
  \ifsinglecol
    \box\ItemBOX%
    \vskip\TextLeading plus 2\TextLeading% var. space: min 1, max 3 lines
    \@noafterindent
  \else
    \ItemNUMBER=\z@%
    \ItemTYPE=\Figure
    \ItemSPAN=\Double
    \ItemSTATUS=\InStack
    \JoinStack
  \fi
}


% Figures

\newif\if@here  \@herefalse

\def\no@float{\global\@heretrue}
\let\nofloat=\relax % only enabled for one column

\def\beginfigure{%
  \@ifstar{\global\@dfloattrue \@bfigure}{\global\@dfloatfalse \@bfigure}%
}

\def\@bfigure#1{%
  \par
  \if@dfloat
    \ItemSPAN=\Double
    \TEMPDIMEN=\PageWidth
  \else
    \ItemSPAN=\Single
    \TEMPDIMEN=\ColumnWidth
  \fi
  \ifsinglecol
    \TEMPDIMEN=\PageWidth
  \else
    \ItemSTATUS=\InStack
    \ItemNUMBER=#1%
    \ItemTYPE=\Figure
  \fi
  \bgroup
    \hsize=\TEMPDIMEN
    \global\setbox\ItemBOX=\vbox\bgroup
      \eightpoint\nostb@ls{10pt}%
      \let\caption=\fig@caption
      \ifsinglecol \let\nofloat=\no@float\fi
}

\def\fig@caption#1{%
  \vskip 5.5pt plus 6pt%
  \bgroup % grouping and size change needed for plate pages
    \eightpoint\nostb@ls{10pt}%
    \setbox\TEMPBOX=\hbox{#1}%
    \ifdim\wd\TEMPBOX>\TEMPDIMEN
      \noindent \unhbox\TEMPBOX\par
    \else
      \hbox to \hsize{\hfil\unhbox\TEMPBOX\hfil}%
    \fi
  \egroup
}

\def\endfigure{%
  \par\egroup % end \vbox
  \egroup
  \ifsinglecol
    \if@here \midinsert\global\@herefalse\else \topinsert\fi
      \unvbox\ItemBOX
    \endinsert
  \else
    \JoinStack
    \Print{Processing source for figure \the\ItemNUMBER}%
  \fi
}


% Tables

\newbox\tab@cap@box
\def\tab@caption#1{\global\setbox\tab@cap@box=\hbox{#1\par}}

\newtoks\tab@txt@toks
\long\def\tab@txt#1{\global\tab@txt@toks={#1}\global\table@txttrue}

\newif\iftable@txt  \table@txtfalse
\newif\if@dfloat    \@dfloatfalse

\def\begintable{%
  \@ifstar{\global\@dfloattrue \@btable}{\global\@dfloatfalse \@btable}%
}

\def\@btable#1{%
  \par
  \if@dfloat
    \ItemSPAN=\Double
    \TEMPDIMEN=\PageWidth
  \else
    \ItemSPAN=\Single
    \TEMPDIMEN=\ColumnWidth
  \fi
  \ifsinglecol
    \TEMPDIMEN=\PageWidth
  \else
    \ItemSTATUS=\InStack
    \ItemNUMBER=#1%
    \ItemTYPE=\Table
  \fi
  \bgroup
    \eightpoint\nostb@ls{10pt}%
    \global\setbox\ItemBOX=\vbox\bgroup
      \let\caption=\tab@caption
      \let\tabletext=\tab@txt
      \ifsinglecol \let\nofloat=\no@float\fi
}

\def\endtable{%
  \par\egroup % end \vbox
  \egroup
  \setbox\TEMPBOX=\hbox to \TEMPDIMEN{%
    \eightpoint\nostb@ls{10pt}%
    \hss
    \vbox{%
      \hsize=\wd\ItemBOX
      \ifvoid\tab@cap@box
      \else
        \noindent\unhbox\tab@cap@box
        \vskip 5.5pt plus 6pt%
      \fi
      \box\ItemBOX
      \iftable@txt
        \vskip 10pt%
        \noindent\the\tab@txt@toks
        \global\table@txtfalse
      \fi
    }%
    \hss
  }%
  \ifsinglecol
    \if@here \midinsert\global\@herefalse\else \topinsert\fi
      \box\TEMPBOX
    \endinsert
  \else
    \global\setbox\ItemBOX=\box\TEMPBOX
    \JoinStack
    \Print{Processing source for table \the\ItemNUMBER}%
  \fi
}


\def\UnloadZoneA{%
\FirstZoneAtrue
 \Iteration=\z@
  \loop
   \ifnum\Iteration<\LengthOfStack
    \GetItemSTATUS{\Iteration}
    \ifnum\ItemSTATUS=\InZoneA
     \GetItemBOX{\Iteration}
     \ifFirstZoneA \vbox to \BodgeHeight{\vfil}%
     \FirstZoneAfalse\fi
     \unvbox\ItemBOX\ItemSep
     \LeaveStack{\Iteration}
     \else
     \advance\Iteration \@ne
   \fi
 \repeat
}

\def\UnloadZoneC{%
\Iteration=\z@
  \loop
   \ifnum\Iteration<\LengthOfStack
    \GetItemSTATUS{\Iteration}
    \ifnum\ItemSTATUS=\InZoneC
     \GetItemBOX{\Iteration}
     \ItemSep\unvbox\ItemBOX
     \LeaveStack{\Iteration}
     \else
     \advance\Iteration \@ne
   \fi
 \repeat
}


%--------------------------------------------------------%
%                         DIAGNOSTICS                    %
%--------------------------------------------------------%

\def\ShowItem#1{% Show details of on item entry in stack
  {\GetItemAll{#1}
  \Print{\the#1:
  {TYPE=\ifnum\ItemTYPE=\Figure Figure\else Table\fi}
  {NUMBER=\the\ItemNUMBER}
  {SPAN=\ifnum\ItemSPAN=\Single Single\else Double\fi}
  {SIZE=\the\ItemSIZE}}}
}

\def\ShowStack{% 
 \Print{}
 \Print{LengthOfStack = \the\LengthOfStack}
 \ifnum\LengthOfStack=\z@ \Print{Stack is empty}\fi
 \Iteration=\z@
 \loop
 \ifnum\Iteration<\LengthOfStack
  \ShowItem{\Iteration}
  \advance\Iteration \@ne
 \repeat
}

\def\B#1#2{%
\hbox{\vrule\kern-0.4pt\vbox to #2{%
\hrule width #1\vfill\hrule}\kern-0.4pt\vrule}
}


%-------------------------------------------------------%
%             SINGLE COLUMN OUTPUT ROUTINE              %
%-------------------------------------------------------%

\newif\ifsinglecol   \singlecolfalse

\def\onecolumn{%
  \global\output={\singlecoloutput}%
  \global\hsize=\PageWidth
  \global\vsize=\PageHeight
  \global\ColumnWidth=\hsize
  \global\TextLeading=12pt
  \global\Leading=12
  \global\singlecoltrue
  \global\let\onecolumn=\relax%         stop them using \onecolumn again
  \global\let\footnote=\sing@footnote%  enable footnotes
  \global\let\vfootnote=\sing@vfootnote
  \ninepoint % reset \baselineskip after leading change
  \message{(Single column)}%
}

\def\singlecoloutput{%
  \shipout\vbox{\PageHead\vbox to \PageHeight{\pagebody\vss}\PageFoot}%
  \advancepageno
%
  \ifplate@page
    \shipout\vbox{%
      \sp@pagetrue
      \def\sp@type{plate}%
      \global\plate@pagefalse
      \PageHead\vbox to \PageHeight{\unvbox\plt@box\vfil}\PageFoot%
    }%
    \message{[plate]}%
    \advancepageno
  \fi
%
  \ifnum\outputpenalty>-\@MM \else\dosupereject\fi%
}

\def\ItemSep{\vskip\ItemSepamount\relax}

\def\ItemSepbreak{\par\ifdim\lastskip<\ItemSepamount
  \removelastskip\penalty-200\ItemSep\fi%
}

% Modify plain's \endinsert so that the mn's spacing is used

\let\@@endinsert=\endinsert % save plain's original \endinsert

\def\endinsert{\egroup % finish the \vbox
  \if@mid \dimen@\ht\z@ \advance\dimen@\dp\z@ \advance\dimen@12\p@
    \advance\dimen@\pagetotal \advance\dimen@-\pageshrink
    \ifdim\dimen@>\pagegoal\@midfalse\p@gefalse\fi\fi
  \if@mid \ItemSep\box\z@\ItemSepbreak
  \else\insert\topins{\penalty100 % floating insertion
    \splittopskip\z@skip
    \splitmaxdepth\maxdimen \floatingpenalty\z@
    \ifp@ge \dimen@\dp\z@
    \vbox to\vsize{\unvbox\z@\kern-\dimen@}% depth is zero
    \else \box\z@\nobreak\ItemSep\fi}\fi\endgroup%
}


% Footnotes (only enabled in single column)

\def\gobbleone#1{}
\def\gobbletwo#1#2{}
\let\footnote=\gobbletwo % Gobble footnote's unless enabled by \onecolumn
\let\vfootnote=\gobbleone

\def\sing@footnote#1{\let\@sf\empty % parameter #2 (the text) is read later
  \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  \hbox{$^{\hbox{\eightpoint #1}}$}\@sf\sing@vfootnote{#1}%
}

\def\sing@vfootnote#1{\insert\footins\bgroup\eightpoint\b@ls{9pt}%
  \interlinepenalty\interfootnotelinepenalty
  \splittopskip\ht\strutbox % top baseline for broken footnotes
  \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  \noindent $^{\scriptstyle\hbox{#1}}$\hskip 4pt%
    \footstrut\futurelet\next\fo@t%
}

% Kill footnote rule
\def\footnoterule{\kern-3\p@ \hrule height \z@ \kern 3\p@}

\skip\footins=19.5pt plus 12pt minus 1pt
\count\footins=1000
\dimen\footins=\maxdimen

% for footnotes in double column: use \note{$\star$}{footnote}
\def\note#1#2{%
  \let\@sf=\empty \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  #1\insert\footins\bgroup
    \eightpoint\b@ls{10pt}\rm
    \interlinepenalty\interfootnotelinepenalty
%    \splittopskip\ht\strutbox % top baseline for broken footnotes
    \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
    \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
    \noindent\footstrut #1$\,$#2\strut\par
  \egroup
  \@sf\relax}

% Landscape

\def\landscape{%
  \global\TEMPDIMEN=\PageWidth
  \global\PageWidth=\PageHeight
  \global\PageHeight=\TEMPDIMEN
  \global\let\landscape=\relax%         stop them using \landscape again.
  \onecolumn
  \message{(landscape)}%
  \raggedbottom
}


%-------------------------------------------------------%
%               TWO COLUMN OUTPUT ROUTINE               %
%-------------------------------------------------------%

% Very slight redefinition of the \output routine of mn.tex, to allow footnotes.
\output{%
  \ifLeftCOL
    \global\setbox\LeftBOX=\vbox to \ZoneBSize{\box255\unvbox\ZoneBBOX
      \ifvoid\footins\else
        \vskip\skip\footins\unvbox\footins\fi
    }%
    \global\LeftCOLfalse
    \MakeRightCol
  \else
    \setbox\RightBOX=\vbox to \ZoneBSize{\box255\unvbox\ZoneBBOX
      \ifvoid\footins\else
        \vskip\skip\footins\unvbox\footins\fi
    }%
    \setbox\MidBOX=\hbox{\box\LeftBOX\hskip\ColumnGap\box\RightBOX}%
    \setbox\PageBOX=\vbox to \PageHeight{%
      \UnloadZoneA\box\MidBOX\UnloadZoneC}%
    \shipout\vbox{\PageHead\vbox to \PageHeight{\box\PageBOX\vss}\PageFoot}%
    \advancepageno
%
    \ifplate@page
      \shipout\vbox{%
        \sp@pagetrue
        \def\sp@type{plate}%
        \global\plate@pagefalse
        \PageHead\vbox to \PageHeight{\unvbox\plt@box\vfil}\PageFoot%
      }%
      \message{[plate]}%
      \advancepageno
    \fi
%
    \global\LeftCOLtrue
    \CleanStack
    \MakePage
  \fi
}



% Startup message

\Warn{\start@mess}

\newif\ifCUPmtplainloaded % for use in documents
\ifprod@font
  \global\CUPmtplainloadedtrue
\fi

\def\mnmacrosloaded{} % so articles can see if a format file has been used.

\catcode `\@=12 % @ signs are non-letters

% \dump

% end of mn.tex

