% 	SIAMTEX.STY;  11-25-87;  RALPH YOUNGEN, AMERICAN MATHEMATICAL SOCIETY
%
%	This file may be freely distributed but may not be altered in
%	any way.
%
%	This is a file of macros and definitions for creating an article
%	for publication in a SIAM journal.
%
% Make the @ sign a letter for internal control sequences.
\catcode`\@=11
%
% Report the version number of this package.
\message{ *** SIAM Plain TeX macro package, version 1.02, 1-APR-1989 *** }
%
%
%  FONTS
\font\tenrm=cmr10
\font\tenbf=cmbx10
\font\tenit=cmti10
\font\tensmc=cmcsc10
\def\tenpoint{%
   \def\rm{\tenrm}\def\bf{\tenbf}%
   \def\it{\tenit}\def\smc{\tensmc}
        \textfont0=\tenrm \scriptfont0=\sevenrm
	\textfont1=\teni \scriptfont1=\seveni
	\textfont2=\tensy \scriptfont2=\sevensy
	\textfont3=\tenex \scriptfont3=\tenex
\baselineskip=12pt\rm}%

\font\ninerm=cmr9
\font\ninebf=cmbx9
\font\nineit=cmti9
\def\ninepoint{%
   \def\rm{\ninerm}\def\bf{\ninebf}%
   \def\it{\nineit}\baselineskip=11pt\rm}%

\font\eightrm=cmr8
\font\eightbf=cmbx8
\font\eightit=cmti8
\font\eighti=cmmi8
\font\eightsy=cmsy8
\def\eightpoint{%
   \def\rm{\eightrm}\def\bf{\eightbf}%
   \def\it{\eightit}\def\smc{\eightrm}\baselineskip=10pt\rm%
        \textfont0=\eightrm \scriptfont0=\sixrm
	\textfont1=\eighti \scriptfont1=\sixi
	\textfont2=\eightsy \scriptfont2=\sixsy
	\textfont3=\tenex \scriptfont3=\tenex
}

\font\sixrm=cmr6
\font\sixbf=cmbx6
\font\sixi=cmmi6
\font\sixsmc=cmr5
\font\sixsy=cmsy6
\def\sixpoint{%
   \def\rm{\sixrm}\def\bf{\sixbf}%
   \def\smc{\sixsmc}\baselineskip=8pt\rm}%

\fontdimen13\tensy=2.6pt
\fontdimen14\tensy=2.6pt
\fontdimen15\tensy=2.6pt
\fontdimen16\tensy=1.2pt
\fontdimen17\tensy=1.2pt
\fontdimen18\tensy=1.2pt

\def\rheadfont{\tenpoint\smc}
\def\titlefont{\tenpoint\bf}
\def\authorfont{\eightpoint\rm}
\def\dedicatefont{\ninepoint\it}



%  DIMENSIONS
\hsize=31pc
\vsize=50pc
\parindent=2em


%  MACROS
\newif\ifkeywords@
\newif\ifsubjclass@
\newif\ifdedicate@
\newif\ifrecdate@
\newif\ifoneclass@

\keywords@false
\subjclass@false
\dedicate@false
\recdate@false
\oneclass@false

\def\title#1\endtitle{\def\thetitle{\uppercase{#1}}%
           \def\\{\relax\ }\xdef\rightrh{\lowercase{#1}}}

\def\shorttitle#1{\xdef\rightrh{\lowercase{#1}}}

\def\author#1\endauthor{%
	\def\and{\hbox{\sixrm AND }}%  prevent \uppercase when typesetting
        \def\theauthor{\uppercase{#1}}%
	 {%
	   \def\\{\relax\ }%         change \\ to be a space in the running head
	   \def\fnmark##1{}%     turn address off in the running head
	   \def\and{and }%    "and" is the same size as names in the running head
	   \xdef\leftrh{\lowercase{#1}}%
	}}

\def\shortauthor#1{\def\and{and }\xdef\leftrh{\lowercase{#1}}}

\gdef\fnmark#1{#1}
\gdef\address#1#2{\makefootnote@{\textfont2=\eightsy #1}{#2\unskip.}}
\def\journal#1{\def\thejournal{#1}}
\journal{SIAM J. S{\smc CI. }S{\smc TAT. }C{\smc OMP.}}
\def\copyyear#1{\def\thecopyyear{#1}}
\copyyear{1989}
\def\vol#1{\def\thevol{#1}}
\def\no#1{\def\theno{#1}}
\def\date#1{\def\thedate{#1}}
\def\code#1{\def\thecode{#1}}
\def\dedicate#1{\dedicate@true\def\thededicate{#1}}
\def\keywords#1\endkeywords{\keywords@true\def\thekeywords{#1}}
\def\subjclass#1\endsubjclass{\subjclass@true\def\thesubjclass{#1}}
\def\oneclass{\oneclass@true}
\long\def\abstract#1{\def\theabstract{#1}}

\def\raggedcenter{\leftskip=0pt plus 1fill \rightskip=0pt plus 1fill}

\def\copyright#1{{\ooalign{\hfil\raise.07ex\hbox{c}\hfil\crcr#1\char"0D}}}

\def\recdate#1#2{\global\recdate@true
	\gdef\recdate@{#1Received by the editors \ignorespaces#2\unskip.}%
	\makefootnote@{}{\recdate@}}



\def\heading#1#2{%
    	\vskip6pt{\bf #1.\enspace\ignorespaces#2.\enspace}\ignorespaces}

\def\thm#1{{\smc #1.}\begingroup\it\enspace\ignorespaces}
\let\lem=\thm
\let\cor=\thm
\let\prop=\thm

\def\endthm{\endgroup}
\let\endlem=\endthm
\let\endcor=\endthm
\let\endprop=\endthm

\def\prf#1{{\it #1.}\rm\enspace\ignorespaces}
\let\rem=\prf
\let\case=\prf

\def\dfn#1{{\smc #1.}\rm\enspace\ignorespaces}

\let\topmatter=\relax
\def\endtopmatter{%
	\global\headline={\vtop to \z@ {%
          	\sixpoint\rm\noindent\thejournal \hfill%
        	\rm\copyright{\sevensy}\rm%
		\thecopyyear\ Society for Industrial and Applied Mathematics\par
		\noindent Vol. \thevol , No. \theno , \thedate\hfill\thecode\par
	\vss}}%
	\leavevmode\vskip8pt
     	\vbox{\noindent\raggedcenter\let\\=\break\titlefont\thetitle
            \ifrecdate@*\fi}
	\vskip6pt
	\centerline{\authorfont\theauthor}
	\ifdedicate@
		\vskip6pt
		\vbox{\noindent\raggedcenter\let\\=\break\dedicatefont
		\thededicate}
	\fi
	\vskip14pt
	\eightpoint{\bf Abstract.\ }\theabstract\par
	\ifkeywords@
		\vskip10pt
		{\bf Key words.} \thekeywords\par
	\fi
	\ifsubjclass@
		\vskip10pt
		{\bf AMS(MOS) subject classification\ifoneclass@\else s\fi. }%
	        \thesubjclass\par
	\fi
	\vskip8pt
	\tenpoint}


%%% REFERENCES

\newdimen\refindent@
\newdimen\refhangindent@
\newbox\refbox@
\setbox\refbox@=\hbox{\eightpoint\rm [00]}%   Default 2 digits
\refindent@=\wd\refbox@

\def\resetrefindent#1{%
	\setbox\refbox@=\hbox{\eightpoint\rm [#1]}%
	\refindent@=\wd\refbox@}

\def\Refs{%
	\unskip\vskip2pc
	\centerline{\eightpoint\rm REFERENCES}%
	\penalty10000
	\vskip4pt
	\penalty10000
	\refhangindent@=\refindent@
	\global\advance\refhangindent@ by 2em
        \global\everypar{\hangindent\refhangindent@}%
	\parindent=0pt\eightpoint\rm}

\def\sameauthor{\leavevmode\vbox to 1ex{\vskip 0pt plus 100pt
    \hbox to 3em{\leaders\hrule\hfil}\vskip 0pt plus 300pt}}

\def\ref#1\\#2\endref{\leavevmode\hbox to \refindent@{\hfil[#1]}\enspace #2\par}

%%% OUTPUT

\global\footline={\hss\tenpoint\rm\folio\hss}% first page

\output{\plainoutput}
\def\plainoutput{\shipout\vbox{\makeheadline\pagebody\makefootline}%
  \advancepageno
  \ifnum\pageno>1
	\global\footline={\hfill}%
  \fi
  \ifodd\pageno
	\global\headline={\hss\rightrh\hss{\tenpoint\rm\folio}}%
  \else
	\global\headline={{\tenpoint\rm\folio}\hss\leftrh\hss}%
  \fi
  \ifnum\outputpenalty>-\@MM \else\dosupereject\fi}
\def\pagebody{\vbox to\vsize{\boxmaxdepth\maxdepth \pagecontents}}
\def\makeheadline{\vbox to\z@{\vskip-22.5\p@
  \line{\vbox to8.5\p@{}\rheadfont\the\headline}\vss}%
    \nointerlineskip}
\def\makefootline{\baselineskip24\p@\vskip-8\p@\line{\the\footline}}
\def\dosupereject{\ifnum\insertpenalties>\z@ % something is being held over
  \line{}\kern-\topskip\nobreak\vfill\supereject\fi}

\def\footmarkform@#1{\ifmmode {}^{#1}\else$^{#1}$\fi }
\let\thefootnotemark\footmarkform@
\def\makefootnote@#1#2{\insert\footins
	{\interlinepenalty\interfootnotelinepenalty
	\eightpoint \splittopskip=\ht\strutbox \splitmaxdepth=\dp\strutbox
	\floatingpenalty=\@MM \leftskip=\z@ \rightskip=\z@
	\spaceskip=\z@ \xspaceskip=\z@
%%%%	\noindent{#1}\footstrut\ignorespaces#2\unskip
	\leavevmode{#1}\footstrut\ignorespaces#2\unskip
	\lower\dp\strutbox\vbox to\dp\strutbox{}}}
% \footmarkcount@=\z@			% Initialization
\def\footnotemark{\let\@sf=\empty \relaxnext@
	\ifhmode \edef\@sf{\spacefactor=\the\spacefactor}\/\fi
	\def\next@{\ifx[\next \let\next=\nextii@ \else
		\ifx"\next \let\next=\nextiii@ \else
			\let\next=\nextiv@ \fi\fi\next}%
	\def\nextii@[##1]{\footmarkform@{##1}\@sf}%
	\def\nextiii@"##1"{{##1}\@sf}%
	\def\nextiv@{\global\advance\footmarkcount@\@ne
		\footmarkform@{\number\footmarkcount@}\@sf}%
	\futurelet\next\next@}
\def\footnotetext{\relaxnext@
	\def\next@{\ifx[\next \let\next=\nextii@ \else
		\ifx"\next \let\next=\nextiii@ \else
			\let\next=\nextiv@ \fi\fi\next}%
	\def\nextii@[##1]##2{\makefootnote@{\footmarkform@{##1}}{##2}}%
	\def\nextiii@"##1"##2{\makefootnote@{##1}{##2}}%
  \def\nextiv@##1{\makefootnote@{\footmarkform@{\number\footmarkcount@}}{##1}}%
	\futurelet\next\next@}
%\def\footnote{\let\@sf\empty=\relaxnext@
\def\footnote{\let\@sf=\empty \relaxnext@
	\ifhmode \edef\@sf{\spacefactor\the\spacefactor}\/\fi
	\def\next@{\ifx[\next \let\next=\nextii@ \else
		\ifx"\next \let\next=\nextiii@ \else
			\let\next=\nextiv@ \fi\fi\next}%
	\def\nextii@[##1]##2{\footnotemark[##1]\footnotetext[##1]{##2}}%
    	\def\nextiii@"##1"##2{\footnotemark"##1"\footnotetext"##1"{##2}}%
	\def\nextiv@##1{\footnotemark\footnotetext{##1}}%
	\futurelet\next\next@}
\def\adjustfootnotemark#1{\advance\footmarkcount@#1\relax}

\skip\footins=18\p@ plus6\p@ minus6\p@
\def\footnoterule{\kern-4\p@ \hrule width 3pc \kern 3.6\p@ } % rule = .4pt high

%	Turn off @ as being a letter.
%
\catcode`\@=13
