
% Current version: July 2, 1993

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Style File for `Large Format Journals'                               %%
%% Kluwer Academic Publishers                                           %%
%%                                                                      %%
%% Prepared by Amy Hendrickson, TeXnology Inc.                          %%
%%                                                                      %%
%% Inquiries to Suzanne M. Rumsey, net address: prod@world.std.com      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\typeout{\space\space\space\space\space\space\space\space\space}
\typeout{Document Style `Large Format Journals' 
for Kluwer Academic Publishers}
\typeout{\space\space\space\space\space\space\space\space\space}
\typeout{Written by Amy Hendrickson, TeXnology, Inc., 6/93\space}
\typeout{\space\space\space\space\space\space\space\space\space}
\typeout{\space\space\space\space\space\space\space\space\space}

\newif\iflgjfonts

%% Variation on
% BOOK DOCUMENT STYLE -- Released 24 May 1989
%    for LaTeX version 2.09
% Copyright (C) 1988 by Leslie Lamport

\def\@ptsize{0}     
\@twosidetrue     %  Defines twoside option.
\@mparswitchtrue  %  Marginpars go on outside of page.
\def\ds@draft{\overfullrule 5pt}  % Causes overfull hboxes to be marked.
\@options

%% ===> Variations on bk10.sty, 19-Jan-88

\widowpenalty=10000 %% No widow lines
\clubpenalty=10000 %% No orphan lines

\lineskip 1pt \normallineskip 1pt
\def\baselinestretch{1}

\def\@normalsize{\@setsize\normalsize{12pt}\xpt\@xpt
\abovedisplayskip 8pt plus4pt minus1pt %% was plus 2pt
\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus3pt\belowdisplayshortskip 6pt plus3pt
minus3pt\let\@listi\@listI
\expandafter\ifx\csname bit\endcsname\xrelax\let\bit\bf\fi
} 

\def\small{\@setsize\small{11pt}\ixpt\@ixpt
\abovedisplayskip 8.5pt plus 3pt minus 4pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus2pt\belowdisplayshortskip 4pt plus2pt minus 2pt
\def\@listi{\leftmargin\leftmargini \topsep 4pt plus 2pt minus 2pt\parsep 2pt
plus 1pt minus 1pt
\expandafter\ifx\csname bit\endcsname\xrelax \let\bit\bf\fi
\itemsep \parsep}}

\def\footnotesize{\@setsize\footnotesize{9.5pt}\viiipt\@viiipt
\abovedisplayskip 6pt plus 2pt minus 4pt\belowdisplayskip \abovedisplayskip
\abovedisplayshortskip \z@ plus 1pt\belowdisplayshortskip 3pt plus 1pt minus
2pt
\def\@listi{\leftmargin\leftmargini \topsep 3pt plus 1pt minus 1pt\parsep 2pt
plus 1pt minus 1pt
\expandafter\ifx\csname bit\endcsname\xrelax \let\bit\bf\fi
\itemsep \parsep}}

\def\scriptsize{\@setsize\scriptsize{8pt}\viipt\@viipt}
\def\tiny{\@setsize\tiny{6pt}\vpt\@vpt}
\def\large{\@setsize\large{14pt}\xiipt\@xiipt}
\def\Large{\@setsize\Large{18pt}\xivpt\@xivpt}
\def\LARGE{\@setsize\LARGE{22pt}\xviipt\@xviipt}
\def\huge{\@setsize\huge{25pt}\xxpt\@xxpt}
\def\Huge{\@setsize\Huge{30pt}\xxvpt\@xxvpt}
\normalsize 

\oddsidemargin 0pt% .5in 
\evensidemargin 0pt% 1.5in 
\marginparwidth .75in \marginparsep 7pt 
\topmargin 0pt %.75in 
\headheight 12pt 
\headsep 22pt 
\footskip 12pt% .35in 

\textheight = 50pc
\textwidth 38pc 
\columnsep 2pc 
\columnseprule 0pt 

%colwidth=18pc


\footnotesep 0pt %6.65pt 
\skip\footins  9pt plus 4pt minus 2pt 
\floatsep 12pt plus 2pt minus 2pt \textfloatsep 20pt plus 2pt minus 4pt
\intextsep 12pt plus 2pt minus 2pt \@maxsep 20pt \dblfloatsep 12pt plus 2pt
minus 2pt \dbltextfloatsep 20pt plus 2pt minus 4pt \@dblmaxsep 20pt 
\@fptop 0pt plus 1fil \@fpsep 8pt plus 2fil \@fpbot 0pt plus 1fil 
\@dblfptop 0pt plus 1fil \@dblfpsep 8pt plus 2fil \@dblfpbot 0pt plus 1fil
\marginparpush 5pt 

\parskip 0pt plus .01pt
\parindent 12pt \partopsep 2pt plus 1pt minus 1pt 
\@lowpenalty 51 \@medpenalty 151 \@highpenalty 301 
\@beginparpenalty -\@lowpenalty \@endparpenalty -\@lowpenalty \@itempenalty
-\@lowpenalty 


\def\@makechapterhead#1{ \vspace*{50pt} { \parindent 0pt \raggedright 
 \ifnum \c@secnumdepth >\m@ne \huge\bf \@chapapp{} \thechapter \par 
 \vskip 20pt \fi \Huge \bf #1\par 
 \nobreak \vskip 40pt } }

\def\@makeschapterhead#1{ \vspace*{50pt} { \parindent 0pt \raggedright 
 \Huge \bf #1\par 
 \nobreak \vskip 40pt } }

\def\chapter{\cleardoublepage \thispagestyle{plain} \global\@topnum\z@
\@afterindentfalse \secdef\@chapter\@schapter} 
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
 \refstepcounter{chapter}
 \typeout{\@chapapp\space\thechapter.}
 \addcontentsline{toc}{chapter}{\protect
 \numberline{\thechapter}#1}\else
 \addcontentsline{toc}{chapter}{#1}\fi
 \chaptermark{#1}
 \addtocontents{lof}{\protect\addvspace{10pt}}
\addtocontents{lot}{\protect\addvspace{10pt}} \if@twocolumn
\@topnewpage[\@makechapterhead{#2}] 
 \else \@makechapterhead{#2}
 \@afterheading \fi} 
\def\@schapter#1{\if@twocolumn \@topnewpage[\@makeschapterhead{#1}]
 \else \@makeschapterhead{#1} 
 \@afterheading\fi}


\def\@sect#1#2#3#4#5#6[#7]#8{
\ifnum #2>\c@secnumdepth
     \def\@svsec{}\else 
     \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname\hskip .5em\relax}
\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@ 
        \begingroup
 #6\relax
          \@hangfrom{\hskip #3\relax\@svsec}{\def\\ {\hfill\break}%
\interlinepenalty \@M #8\par}%
        \endgroup
%
\else
        \def\@svsechd{#6\hskip #3\def\\ {\hfill\break}\@svsec #8}
\fi
     \@xsect{#5}}


% \@sect{NAME}{LEVEL}{INDENT}{BEFORESKIP}{AFTERSKIP}{STYLE}[ARG1]{ARG2} ==

\def\section{\@startsection {section}{1}{\z@}{-24pt plus -1pt minus 
 -4pt}{12pt  minus 2pt}
{\normalsize\iflgjfonts\sectionfont\else\bf\fi}}

\def\subsection{\@startsection{subsection}{2}{\z@}{-24pt plus -.01pt minus
 -4pt}{12pt}{\normalsize\iflgjfonts\subsectionfont\else\it\fi}}

\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{3.25ex plus
1ex minus .2ex}{-1em}{\normalsize\iflgjfonts\subsubsectionfont\else\tenbf\fi}}

\def\paragraph{\@startsection
 {paragraph}{4}{\z@}{2ex plus .5ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
 {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus 
 .2ex}{-1em}{\normalsize\bf}}

\def\chaptermark#1{}

\setcounter{secnumdepth}{2}




\leftmargini 12pt %25pt
\leftmarginii 20pt %22pt 
\leftmarginiii 16pt %18.7pt 
\leftmarginiv 17pt \leftmarginv 10pt
\leftmarginvi 10pt
\leftmargin\leftmargini
\labelsep 4pt
\labelwidth\leftmargini\advance\labelwidth-\labelsep

\def\@listI{\leftmargin\leftmargini \parsep 0pt\topsep 0pt
\itemsep 0pt}
\let\@listi\@listI
\@listi 
\def\@listii{\leftmargin\leftmarginii
 \labelwidth\leftmarginii\advance\labelwidth-\labelsep
 \topsep 4pt plus 2pt minus 1pt
 \parsep 2pt plus 1pt minus 1pt
 \itemsep \parsep}
\def\@listiii{\leftmargin\leftmarginiii
 \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
 \topsep 2pt plus 1pt minus 1pt 
 \parsep \z@ \partopsep 1pt plus 0pt minus 1pt
 \itemsep \topsep}
\def\@listiv{\leftmargin\leftmarginiv
 \labelwidth\leftmarginiv\advance\labelwidth-\labelsep}
\def\@listv{\leftmargin\leftmarginv
 \labelwidth\leftmarginv\advance\labelwidth-\labelsep}
\def\@listvi{\leftmargin\leftmarginvi
 \labelwidth\leftmarginvi\advance\labelwidth-\labelsep}

%% <=== end book10.sty

\def\labelenumi{\theenumi.}    
\def\theenumi{\arabic{enumi}}     
 
\def\labelenumii{(\theenumii)}
\def\theenumii{\alph{enumii}}
\def\p@enumii{\theenumi}

\def\labelenumiii{\theenumiii.}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\theenumi(\theenumii)}

\def\labelenumiv{\theenumiv.}
\def\theenumiv{\Alph{enumiv}}     
\def\p@enumiv{\p@enumiii\theenumiii}



\def\labelitemi{\hbox to 4pt{\hss\raise.1ex\hbox{$\bullet$}\hskip3pt}}
\def\labelitemii{\bf \endash}
\def\labelitemiii{$\ast$}
\def\labelitemiv{$\cdot$}


\def\verse{\let\\=\@centercr  
  \list{}{\itemsep\z@ \itemindent -1.5em\listparindent \itemindent 
          \rightmargin\leftmargin\advance\leftmargin 1.5em}\item[]}
\let\endverse\endlist

\def\quotation{\list{}{\listparindent 1.5em
    \itemindent\listparindent
    \rightmargin\leftmargin\parsep 0pt plus 1pt}\item[]}
\let\endquotation=\endlist

\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist


\def\descriptionlabel#1{\hspace\labelsep \bf #1}
\def\description{\list{}{\labelwidth\z@ \itemindent-\leftmargin
       \let\makelabel\descriptionlabel}}

\let\enddescription\endlist

\newdimen\descriptionmargin
\descriptionmargin=3em

\def\titlepage{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
     \else \newpage \fi \thispagestyle{empty}\c@page\z@}

\def\endtitlepage{\if@restonecol\twocolumn \else \newpage \fi}


\arraycolsep 5pt     % Half the space between columns in an array environment.
\tabcolsep 6pt       % Half the space between columns in a tabular environment.
\arrayrulewidth .4pt % Width of rules in array and tabular environment.
\doublerulesep 2pt   % Space between adjacent rules in array or tabular env.

\tabbingsep \labelsep   % Space used by the \' command.  (See LaTeX manual.)


\skip\@mpfootins = \skip\footins

\fboxsep = 3pt    % Space left between box and text by \fbox and \framebox.
\fboxrule = .4pt  % Width of rules in box made by \fbox and \framebox.

\newcounter{part}
\newcounter {chapter}
\newcounter {section}[chapter]
\newcounter {subsection}[section]
\newcounter {subsubsection}[subsection]
\newcounter {paragraph}[subsubsection]

\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \def\@svsec{}\else 
     \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname.%<=== new, 7/1/93
\hskip 1em }\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@ 
        \begingroup #6\relax
          \@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty \@M #8\par}%
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{#6\hskip #3\@svsec #8\csname #1mark\endcsname
                      {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                             \protect\numberline{\csname the#1\endcsname}\fi
                       #7}}\fi
     \@xsect{#5}}

\def\thechapter       {\arabic{chapter}}
\def\thesection       {\arabic{section}}
\def\thesubsection    {\thesection.\arabic{subsection}}
\def\thesubsubsection {\thesubsection.\arabic{subsubsection}}
\def\theparagraph     {\thesubsubsection.\arabic{paragraph}}

\def\@chapapp{Chapter}


\def\thebibliography#1{\chapter*{Bibliography\@mkboth
  {BIBLIOGRAPHY}{BIBLIOGRAPHY}}\list
  {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \usecounter{enumi}}
    \def\newblock{\hskip .11em plus .33em minus .07em}
    \sloppy\clubpenalty4000\widowpenalty4000
    \sfcode`\.=1000\relax}

\let\endthebibliography=\endlist


\newif\if@restonecol

\setcounter{topnumber}{2}
\def\topfraction{.7}
\setcounter{bottomnumber}{1}
\def\bottomfraction{.3}
\setcounter{totalnumber}{3}
\def\textfraction{.2}
\def\floatpagefraction{.5}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.5}

\newif\ifsetcounterforward
\let\theletter\relax

%%%%%%%%% Lettered Captions

\def\theletter{\relax}
\newif\ifxfirsttime
\xfirsttimetrue

\def\caption{\ifx\@captype\xtable
% table caption
\ifx\theletter\xrelax
\global\xfirsttimetrue\refstepcounter\@captype\else
\ifxfirsttime\global\xfirsttimefalse\refstepcounter\@captype\fi\fi
\else
\ifx\theletter\xrelax
\global\xfirsttimetrue\refstepcounter\@captype\else
\ifxfirsttime\global\xfirsttimefalse\refstepcounter\@captype\fi\fi\fi
\edef\@currentlabel{\expandafter\csname p@\@captype\endcsname%
\expandafter\csname the\@captype\endcsname\theletter}
\xdef\currcaptype{\@captype}
\@dblarg{\@caption\@captype}}

\def\letteredcaption#1{\gdef\theletter{#1}\caption}

\long\def\@makecaption#1#2{%
   \vskip 10pt 
%
   \setbox\@tempboxa\hbox{\footnotesize{\it #1.} #2}
   \ifdim \wd\@tempboxa >\hsize   % IF longer than one line:
\noindent\footnotesize{\it #1.} #2\par     %   THEN set as ordinary paragraph.
     \else                        %   ELSE  center.
\hbox to\hsize{\hfil\box\@tempboxa\hfil}\fi
% 
\xdef\@currentlabel{\expandafter\csname p@\@captype\endcsname%
\expandafter\csname the\@captype\endcsname\theletter}
%
\gdef\theletter{\relax}
}


\long\def\@caption#1[#2]#3{\par
\begingroup
    \@parboxrestore
    \normalsize
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}%\par
  \endgroup
}

\newcounter{figure}[chapter]
\def\thefigure{\@arabic\c@figure}

\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{{\it Fig.\ \ifappendon A\fi\thefigure\theletter}}
\def\figure{\@float{figure}}
\let\endfigure\end@float
\@namedef{figure*}{\@dblfloat{figure}}
\@namedef{endfigure*}{\end@dblfloat}

\newcounter{table}[chapter]
\def\thetable{\@arabic\c@table}

\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{{\it Table \ifappendon A\fi\thetable\theletter}}
\def\table{\@float{table}}
\let\endtable\end@float
\@namedef{table*}{\@dblfloat{table}}
\@namedef{endtable*}{\end@dblfloat}

\mark{{}{}}   % Initializes TeX's marks

\def\ps@headings{\def\@oddfoot{}\def\@evenfoot{}%       No feet.
\def\@evenhead{{\tenrm\thepage}\hskip18pt\it\theauthors\hfill}% 
                                                %       Left heading.
\def\@oddhead{\hbox{}\iftitle\global\titlefalse
\hfill\vbox to0pt{\vss\kluwerline}\else
\hfill{\tenrm\thetitle}\hskip18pt{\tenrm\thepage}\fi}% Right heading.
}

\@addtoreset{equation}{chapter}   % Makes \chapter reset 'equation' counter.


\ps@headings                % `headings' page style
\pagenumbering{arabic}      % Arabic page numbers
\onecolumn                  % Single-column.

%%%%%%%%
%%% Double column output routines, 
%%% with single and double column insertions,
%%% to be positioned at page or column top, page or column bottom, page 
%%% or column center, or full page floating insertion.
%%% This code was originally based on Frank Mittlebach's Multicol.sty.
%%% The concept of how to balance columns and integrate the changed output
%%% routine into the standard LaTeX output routine is due to Frank. I have
%%% made and notated many changes to his code, and added another 50% of the
%%% code in this section.  If something doesn't work 
%%% correctly it is my responsibility, not due to any error on Frank's part.


%%% New version of \@makecol that includes dbltopins, a top insertion
%%% spanning both columns.

\def\@makecol{\ifvoid\topfigins\else\global\setbox\savetopinsert%
\vbox{[[\unvbox\topfigins]]}\fi
\ifvoid\botfigins\else\global\setbox\savebotinsert%
\vbox{\unvbox\botfigins}\fi
\setbox\@outputbox
     \vbox{\boxmaxdepth \maxdepth
\ifvoid\dbltopins\else\unvbox\dbltopins\fi
     \unvbox\@cclv
\ifvoid\footins\else
\vskip\skip\footins\footnoterule\unvbox\footins\fi\vss}
     \xdef\@freelist{\@freelist\@midlist}\gdef\@midlist{}\@combinefloats
     \setbox\@outputbox\vbox to\@colht{\boxmaxdepth\maxdepth
        \@texttop\dimen128=\dp\@outputbox\unvbox\@outputbox
        \vskip-\dimen128\@textbottom}%
     \global\maxdepth\@maxdepth
}

%% Default Latex output routine, to return to after balance columns

\def\latexoutput{\ifnum\outputpenalty <-\@M\@specialoutput\else
  \@makecol\@opcol\@floatplacement\@startcolumn
  \@whilesw\if@fcolmade \fi{\@opcol\@startcolumn}\fi
  \global\vsize\ifnum\outputpenalty >-\@Miv \@colroom
                  \else \maxdimen\fi}


\def\twocolumns{\par\let\figure\onecolfig
\let\endfigure\relax
\let\table\onecoltable
\let\endtable\relax
  \@ifnextchar[\mult@cols{\mult@cols[]}}

\def\mult@cols[#1]{\@ifnextchar[%
  {\mult@@cols{#1}}%
  {\mult@@cols{#1}[\premulticols]}}% premulticols is a dimen

\def\mult@@cols#1[#2]{%
   \enough@room#2%
   #1\par\addvspace\multicolsep
   \begingroup
   \prepare@multicols\ignorespaces}

\def\enough@room#1{\par \penalty\z@
   \page@free \pagegoal
   \advance \page@free -\pagetotal
   \ifdim \page@free <#1 
\edef\test{\the\output}
\ifx\test\secondoutput 
\newpage \fi\fi}

\def\prepare@multicols{%
  \output{\global\setbox\partial@page
                 \vbox{\unvbox\@cclv}}\eject
  \vbadness10001 \hbadness5000
  \tolerance\multicoltolerance
  \pretolerance\m@ne
  \setemergencystretch  2\hsize%\col@number
%%==>>> replace both lines with top line
  \doublecol@number=4 %\col@number
%  \multiply\doublecol@number\tw@
%%<<==
  \advance\baselineskip\multicolbaselineskip
  \advance\@colroom-\ht\partial@page
%  \vsize\col@number\@colroom !!!!! Don't multiply \@colroom by \@colnumber.
% Changed so each column is output
% separately so we can find out if there are top or bottom inserts
% in first column.
\vsize\@colroom
% Use this only in the firstcolout output routine.
%  \advance\vsize\c@collectmore\baselineskip
  \hsize\columnwidth \advance\hsize\columnsep
  \advance\hsize-2%\col@number
\columnsep
  \divide\hsize 2 % \col@number
  \linewidth\hsize
%  \output{\multi@columnout}%<================== !!!!!
%  set output to firstcolout, which checks to see if there are inserts
%  then doubles the vsize and send material back into input stream, then
%  sets the next output routine to \multi@columnout.
\output={\firstcolout}
  \multiply\count\footins2%\col@number
  \multiply\skip\footins2%\col@number
  \count\dbltopins=\count\footins
\reinsert@dbltopinsert
  \reinsert@footnotes}

%% Added by AH: ====>>>
\newbox\savetopinsert
\newbox\savebotinsert

\def\firstcolout{\ifvoid\topfigins\else
\global\setbox\savetopinsert=\vbox{\unvbox\topfigins}\fi
\ifvoid\botfigins\else%
\global\setbox\savebotinsert=\vbox{\unvbox\botfigins}\fi
\global\advance\vsize \@colroom
% Use \c@collectmore only with care since it can cause a problem
% by not calling multicolout soon enough on the final page. If that
% page if full and balancecolumns is called with \endtwocolumns then
% balancecolumns tries to fit too much text on one page.
   \global\advance\vsize
      \c@collectmore\baselineskip
       \unvbox\@cclv
       \penalty\outputpenalty
\global\output={\multi@columnout}}
%% End Added by AH <<<====

\def\secondoutput{{\multi@columnout }}

\def\endtwocolumns{\par\penalty\z@ 
%% Need to reset output routine below to \latexoutput
%% since we had to set multicolout to be the global output routine.
\dimen1=\pagetotal \global\advance\dimen1 by\ht\dbltopins
\global\advance\dimen1 by\ht\footins
\ifdim\dimen1>\pagegoal
\edef\test{\the\output}
\ifx\test\secondoutput 
\global\output={\multi@columnout\global
  \output{\balance@columns\global\output={\latexoutput}}}\eject
\else
  \output{\balance@columns\global\output={\latexoutput}}\eject\fi
\else
  \output{\balance@columns\global\output={\latexoutput}}\eject\fi
  \endgroup 
\reinsert@footnotes
\reinsert@dbltopinsert
  \global\c@unbalance\z@
 \enough@room\postmulticols
  \addvspace\multicolsep
}


\newcount\c@unbalance     \c@unbalance   = 0
\newcount\c@collectmore   \c@collectmore = 0
\newcount\c@tracingmulticols
                     \c@tracingmulticols = 0
%\newcount\col@number
\newcount\doublecol@number
\newcount\multicoltolerance
                   \multicoltolerance = 9999
\newdimen\page@free
\newdimen\premulticols  \premulticols = 12pt
\newdimen\postmulticols \postmulticols= 12pt
\newskip\multicolsep
      \multicolsep = 6pt plus 1pt minus 1pt
\newskip\multicolbaselineskip
                   \multicolbaselineskip=0pt plus .01pt 
%% AH: Added `plus .01pt' above
% to allow some stretch between lines. I think this looks better than
% having noticeable space between paragraphs.

\newbox\partial@page

\def\process@cols#1#2{\count@#1\relax
     \loop #2%
     \advance\count@\tw@
     \ifnum\count@<\doublecol@number
   \repeat}

%%%   Version for balanced column output.
\def\Bpage@sofar{\unvbox\partial@page 
   \process@cols\z@{\wd\count@\hsize}%
   \hbox to\textwidth{%
     \process@cols\tw@{\box\count@
       \hss\vrule\@width\columnseprule\hss}%
     \box\z@}}

%%% AH: Version for two column output.
\def\page@sofar{\unvbox\partial@page
\wd\firstcolbox\hsize
\wd\secondcolbox\hsize
\hbox to\textwidth{%
\vbox{\unvbox\firstcolbox}
   \hss\vrule\@width\columnseprule\hss
\vbox{\unvbox\secondcolbox}}}

\def\reinsert@footnotes{\ifvoid\footins\else
         \insert\footins{\unvbox\footins}\fi}
\def\reinsert@dbltopinsert{\ifvoid\dbltopins\else
         \insert\dbltopins{\unvbox\dbltopins}\fi}

\newdimen\firstcol
\newdimen\secondcol
\newbox\firstcolbox
\newbox\secondcolbox
\newbox\thefirstbox
\newbox\thesecondbox

\def\multi@columnout{%
   \splittopskip\topskip
   \splitmaxdepth\maxdepth
   \dimen@\@colroom
   \divide\skip\footins 2%\col@number
%% Leave space if there is a two-column wide bottom insertion:
%% Footnotes are turned into endnotes in this format, so we can
%% use this insertion for two-column bottom inserts.
   \ifvoid\footins \else
      \advance\dimen@-\skip\footins
      \advance\dimen@-\ht\footins   \fi
% 
%% Leave space if there is a two-column wide top insertion:
\ifvoid\dbltopins\else 
 \advance\dimen@-\ht\dbltopins\fi
%%
%% These changes are made to cut the column size down if we need
%% to fit an insert into the column. This allows the right and
%% left column to have differing amounts of text cut from box 255,
%% called box \@cclv in LaTeX. See \vsplit below.
\firstcol=\dimen@
\ifvoid\savetopinsert\else%
\ifdim\ht\savetopinsert>24pt
\advance\firstcol by-\ht\savetopinsert
\advance\firstcol by -\lineskip
\fi\fi
\ifvoid\savebotinsert\else
\ifdim\ht\savebotinsert>24pt
\advance\firstcol by-\ht\savebotinsert
\advance\firstcol by -\lineskip
\fi\fi
%
\secondcol=\dimen@
\ifvoid\topfigins\else
\advance\secondcol by-\ht\topfigins
\advance\secondcol by -\lineskip
\fi
\ifvoid\botfigins\else
\advance\secondcol by-\ht\botfigins
\advance\secondcol by -\lineskip
\fi
%
%% Cutting the amount of text that will fit from box255:
\setbox\thefirstbox \vsplit\@cclv to\firstcol
\setbox\thesecondbox \vsplit\@cclv to\secondcol
%
%% Making a text box that includes the inserts, column to the left:
\setbox\firstcolbox\vbox{%
\ifvoid\savetopinsert\else%
\ifdim\ht\savetopinsert>24pt\unvbox\savetopinsert\fi\fi%
\box\thefirstbox%
\ifvoid\savebotinsert\else\ifdim\ht\savebotinsert>24pt%
\unvbox\savebotinsert\fi\fi%
}
% 
%% Making a text box that includes the inserts, column to the right:
\setbox\secondcolbox\vbox{%
\ifvoid\savebotinsert\else\unvbox\savebotinsert\fi%
\ifvoid\topfigins\else\unvbox\topfigins\fi%
\box\thesecondbox%
\ifvoid\botfigins\else%
\unvbox\botfigins\fi%
}
% Put back any text material that is not used:
  \ifvoid\@cclv \else
       \unvbox\@cclv
       \penalty\outputpenalty
  \fi
   \setbox\@cclv\vbox{\page@sofar}%
   \@makecol\@outputpage
   \global\@colroom\@colht
   \process@deferreds
% Changed this so that each column will be output separately, 
% so we have a chance to see if there are any insertions in the first
% column. 
%   \global\vsize\col@number\@colroom !!!!!
\global\vsize\@colroom
% The following is also added to the first column output routine:
   \global\advance\vsize
      \c@collectmore\baselineskip
   \multiply\skip\footins2 %\col@number
\global\output={\firstcolout}
\ifvoid\pagefigins\else
\insertpage{\unvbox\pagefigins}\fi
}


\def\xrelax{\relax}

%% Variant on \@outputpage to use for floating page insert:
\def\insertpage#1{\begingroup\catcode`\ =10 
     \let\-\@dischyph \let\'\@acci \let\`\@accii \let\=\@acciii
     \if@twoside 
       \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
            \let\@themargin\oddsidemargin
          \else \let\@thehead\@evenhead
          \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
     \fi\fi
     \shipout
     \vbox{\normalsize \baselineskip\z@ \lineskip\z@ 
           \let\par\@@par %% 15 Sep 87
           \vskip \topmargin \moveright\@themargin
           \vbox{\setbox\@tempboxa
                   \vbox to\headheight{\vfil \hbox to\textwidth
                                       {\let\label\@gobble \let\index\@gobble
                                         \@thehead}} %% 22 Feb 87
                 \dp\@tempboxa\z@
                 \box\@tempboxa
                 \vskip \headsep
%% change from \@outputpage below
\vbox to\textheight{\vfil #1}
                 \baselineskip\footskip
                 \hbox to\textwidth{\let\label\@gobble 
                           \let\index\@gobble  %% 22 Feb 87
                           \@thefoot}}}\global\@colht\textheight
           \endgroup\stepcounter{page}\let\firstmark\botmark}


\def\process@deferreds{%
   \@floatplacement
   \begingroup
    \let\@tempb\@deferlist
    \gdef\@deferlist{}%
    \let\@elt\@scolelt
      \@tempb \endgroup}

\newif\ifshr@nking

\def\raggedcolumns{%
   \@bsphack\shr@nkingtrue\@esphack}

\def\flushcolumns{%
   \@bsphack\shr@nkingfalse\@esphack}

\def\balance@columns{%
   \splittopskip\topskip
   \splitmaxdepth\maxdepth
  \setbox\z@\vbox{%
\ifvoid\savetopinsert\else
\vglue2.5pt\unvbox\savetopinsert\fi
\ifvoid\topfigins\else
\vglue2.5pt\ifdim\ht\topfigins>12pt\unvbox\topfigins\fi\fi
\unvbox\@cclv
\ifvoid\savebotinsert\else \unvbox\savebotinsert\fi
\ifvoid\botfigins\else\unvbox\botfigins\fi}
\dimen@\ht\z@
   \advance\dimen@2%\col@number
\topskip
   \advance\dimen@-2%\col@number
\baselineskip
   \divide\dimen@2%\col@number
   \advance\dimen@\c@unbalance\baselineskip
   \vbadness\@M \loop
    {\process@cols\@ne{\global\setbox\count@
                             \box\voidb@x}}%
     \global\setbox\@ne\copy\z@
   {\process@cols\thr@@{\global\setbox\count@
                     \vsplit\@ne to\dimen@}}%
    \ifshr@nking \global\setbox\thr@@
                 \vbox{\unvbox\thr@@}%
\fi
    \ifdim\ht\@ne >\ht\thr@@
    \global\advance\dimen@\p@
    \repeat
   \dimen@\ht\thr@@
   \process@cols\z@{\@tempcnta\count@
        \advance\@tempcnta\@ne
        \setbox\count@\vbox to\dimen@
           {\unvbox\@tempcnta
            \ifshr@nking\vfill\fi}}%
   \global\vsize\@colroom
   \global\advance\vsize\ht\partial@page
   \Bpage@sofar}


\@ifundefined{emergencystretch}
     {\newdimen\emergencystretch}{}

\emergencystretch 1pt

\def\setemergencystretch#1#2{%
   \emergencystretch 4pt
   \multiply\emergencystretch#1}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Figure and table captions in two column text and spanning both
%%% columns.

%%%%%%%%%%%%%%%%%%%%%%%%%
%% Single column inserts: 

\newinsert\topfigins
\skip\topfigins=0pt
\count\topfigins=500 % magnification factor (1 to 1)
\dimen\topfigins=\maxdimen % no limit per page

\newinsert\botfigins
\skip\botfigins=0pt % no space added when a botfigins is present
\count\botfigins=500 % magnification factor (1 to 1)
\dimen\botfigins=\maxdimen % no limit per page

\newinsert\pagefigins
\skip\pagefigins=0pt % no space added when a botfigins is present
\count\pagefigins=0 % magnification factor 
\dimen\pagefigins=\maxdimen % no limit per page


\newif\if@bot
\def\topinsert{\@botfalse\@ins}
\def\botinsert{\@bottrue\@ins}

\def\@ins{\par\begingroup\setbox\z@\vbox\bgroup} % start a \vbox

\def\endinsert{\egroup % finish the \vbox
\if@bot
  \insert\botfigins{\penalty100 % floating insertion
    \splittopskip\z@skip
    \splitmaxdepth\maxdimen \floatingpenalty \z@
\vbox{\nobreak\bigskip
\box\z@}}
 \else
  \insert\topfigins{\penalty100 % floating insertion
    \splittopskip\z@skip
    \splitmaxdepth\maxdimen \floatingpenalty\z@
\vbox{\box\z@\nobreak\bigskip}}\fi\endgroup}

\def\onecolfig{\par\def\@captype{figure}
\@ifnextchar[\lookforposition{\lookforposition[t]}}

\def\onecoltable{\footnotesize\par\def\@captype{table}
\@ifnextchar[\lookforposition{\lookforposition[t]}}

\def\endinginsert{\vskip1sp\endinsert\par
\gdef\@currentlabel{}}

\newskip\intextfigskip
\intextfigskip=3pt plus .01pt

\newbox\figandtabbox
\def\startfigbox{\vskip-\lastskip
\vskip\intextfigskip
\global\setbox\figandtabbox\vbox\bgroup
\ifx\@captype\xtable \centering\fi
\vskip1sp}

\def\finishfigbox{\vskip1sp\egroup
\copy\figandtabbox
\vskip\intextfigskip
\gdef\@currentlabel{}}

\def\topandcenter{\topinsert\ifx\@captype\xtable\centering\fi}

\def\botandcenter{\botinsert\ifx\@captype\xtable\centering\fi}

%% This is used in case we get more than one letter, i.e., 
%% \begin{figure}[htp]. This macro picks up only the first letter.

\def\defone#1#2*{\def\one{#1}}

\def\lookforposition[#1]{\defone#1*
\if\one h 
\let\go\startfigbox 
\let\endfigure\finishfigbox
\let\endtable\finishfigbox
\else
\if\one t\let\go\topandcenter \let\endfigure\endinginsert 
\let\endtable\endinginsert
\else
\if\one b\let\go\botandcenter
\let\endfigure\endinsert
\let\endtable\endinsert
\else
\if\one p \let\go\dblspanpagefig
\fi\fi\fi\fi\go}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Inserts spanning across both columns:

\newinsert\dbltopins
\skip\dbltopins=\z@skip % no space added when a dbltopins is present
\count\dbltopins=1000 % magnification factor 
\dimen\dbltopins=\maxdimen % no limit per page

\newbox\spanbox

\newdimen\spacedblspan
\spacedblspan=12pt 

\def\spanbothcolumns{\bgroup
\let\figure\dblspanfig
\let\table\dblspantable\@ifnextchar[\dodblspanhere\relax}

\let\endspanbothcolumns\egroup

\def\dodblspanhere[#1]{\let\endspanbothcolumns\enddblspanhere
\global\setbox\spanbox\vbox\bgroup
\hsize=\textwidth
\linewidth=\textwidth}

\def\enddblspanhere{%% this def is only used if double span is [h]
\egroup\egroup\endtwocolumns
\vbox{\vskip1sp
\copy\spanbox
\vskip1sp}
\twocolumns}


\newbox\savepageinsert

\def\sendpagefig{\egroup\insert\pagefigins{\unvbox\savepageinsert}%
\gdef\@currentlabel{}}

\long\def\dblspanpagefig{\let\endfigure\sendpagefig
\let\endtable\sendpagefig
\global\setbox\savepageinsert=\vbox\bgroup
\ifx\@captype\xtable\centering\fi
\hsize=\textwidth
\linewidth=\textwidth}


\long\def\dblspantopfig{\let\endfigure\enddblspantopfig
\let\endtable\enddblspantopfig
\global\setbox\spanbox=\vbox\bgroup
\ifx\@captype\xtable\centering\fi
\hsize=\textwidth
\linewidth=\textwidth
}

\def\enddblspantopfig{\egroup
\insert\dbltopins{\vbox{
    \interlinepenalty\interfootnotelinepenalty 
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
\ignorespaces
\vbox{\unvbox\spanbox}\strut\rule{\z@}{\spacedblspan}}}%
\gdef\@currentlabel{}}

\def\dblspanbotfig{\let\endfigure\enddblspanbotfig
\let\endtable\enddblspanbotfig
\global\setbox\spanbox=\vbox\bgroup
\ifx\@captype\xtable\centering\fi
\hsize=\textwidth
\linewidth=\textwidth}

\def\enddblspanbotfig{\egroup\insert\footins{
    \interlinepenalty\interfootnotelinepenalty 
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
    {\rule{\z@}{\spacedblspan}\ignorespaces
\vbox{\unvbox\spanbox}
\strut}}\gdef\@currentlabel{}}

\def\dblspanfig{\def\@captype{figure}
\@ifnextchar[\dotopandbot{\dotopandbot[h]}}

\def\dblspantable{\footnotesize\def\@captype{table}
\@ifnextchar[\dotopandbot{\dotopandbot[h]}}

\def\dotopandbot[#1]{\defone#1*
\if\one t\let\go\dblspantopfig\else
\if\one h\let\go\dblspanherefig\else
\if\one b\let\go\dblspanbotfig\else
\if\one p\let\go\dblspanpagefig\else
\let\go\dblspanbotfig\fi\fi\fi\fi\go}

\def\dblspanherefig{\ifdim\hsize=\textwidth\else 
\typeout{ERROR!!  Please use \string\spanbothcolumns[h]
\string\begin\string{figure\string}...\string\end\string{figure\string}
\string\endspanbothcolumns}

\noindent{\tt ERROR!! Please use \string\spanbothcolumns[h]\newline
\string\begin\string{figure\string}...\string\end\string{figure\string}
\newline
\string\endspanbothcolumns}

\fi}

%%%%%%%%%%%%%%%%%%%%%%%%%%
%% End Notes

\newcount\footnum
\newcount\savefootnum

\newskip\endskip
\endskip=2pt plus 2pt

\def\endnotes{\ifnum\footnum=0\else
\vskip\endskip
\savefootnum=\footnum
\footnum=0
\vskip1sp
\section*{Notes}\nobreak%
\noindent\loop\ifnum\savefootnum>\footnum
\global\advance\footnum by1
\csname foot\the\footnum\endcsname
\expandafter\gdef\csname foot\the\footnum\endcsname{\relax}
\repeat\global\footnum=0\relax\fi}

\def\footnote#1{\global\advance\footnum by 1\relax$^{\the\footnum}$%
\long\expandafter\gdef\csname foot\the\footnum\endcsname{%
\vskip1sp
\vbox{\footnotesize\leftskip=12pt\relax\parindent=-12pt
\indent\hbox to12pt{\hfill\the\footnum. }{#1\strut}}
}}

\let\footnoterule\relax
%%%
%% Article commands:

\def\authorrunninghead#1{\def\theauthors{#1}}
\def\titlerunninghead#1{\def\thetitle{#1}}

\def\thetitle{THE TITLE???}
\def\theauthors{THE AUTHORS???}

\newif\iftitle
\def\title#1{\global\appendonfalse
\c@section=0
\c@subsection=0
\c@subsubsection=0
\c@footnote=0
\c@equation=0
\c@figure=0
\c@table=0
\vspace*{8pt}
\global\titletrue
{\parskip=2pt \parindent=0pt \def\\ {\par}%
\everypar={\hskip\parfillskip}%
\large\hyphenpenalty=10000\relax%
\bf#1\vskip18pt}}
\let\articletitle\title

\newcount\thanksnum
\newcount\dothanks

\def\dothankssymbol{\ifcase\dothanks\or *\or **\or \dagger\or
 \ddagger\or \mathchar "278\or \mathchar "27B\or \|\or \dagger\dagger
   \or \ddagger\ddagger \else\@ctrerr\fi\relax}

\def\thanks#1{\global\advance\thanksnum by1\relax
\expandafter\gdef\csname\the\thanksnum @thanks\endcsname{#1}}


\long\def\author#1{\setbox0=\vbox{#1}
{\parskip=2pt \parindent=0pt \def\\ {\par}%
\everypar={\hskip\parfillskip}\vskip1sp
\def\thanks##1{\global\advance\dothanks by1\relax
$^{\dothankssymbol}$}%
\uppercase{\bf#1}\vskip1sp}
}


\let\authors\author

\def\affil#1{\vskip1sp
\hbox to\textwidth{\hfill\def\\ {\hfill\break}
\scriptsize\it#1\hfill}\vskip4pt}

\def\email#1{\vskip1sp
\hbox to\textwidth{\hfill\scriptsize\it#1\hfill}\vskip1sp}


\def\issuenumber#1{\def\currissuenumber{#1}}
\def\issuemonth#1{\def\currissuemonth{#1}}
\def\volnumber#1{\def\currvolnumber{#1}}
\def\volyear#1{\def\currvolyear{#1}}
\def\journame#1{\def\thisjourname{#1}}

\volnumber{[Volumn Number]}
\volyear{[Volumn Year]}
\issuenumber{[Issue Number]}
\issuemonth{[Issue Year]}
\journame{[Journal Name]}

\newcount\articlenumber

\def\article{\refstepcounter{chapter} % resets fig. etc. counters with
                                      % each article. We never actually
                                      % use the chapter counter.
\vskip12pt
\ifnum\dothanks>0
\dothanks=0
\botinsert
\vglue 12pt
\hsize=216pt
\loop
\ifnum\thanksnum>\dothanks
\global\advance\dothanks by1
\vskip\lineskip
\footnotesize\noindent\hbox to12pt{$^{\dothankssymbol}$\hss}%
\expandafter\csname\the\dothanks @thanks\endcsname
\repeat
\endinsert\fi
\global\dothanks=0 \global\thanksnum=0
\normalsize
\twocolumns}


\def\endarticle{\endtwocolumns
\normalsize
\ifvoid\pagefigins
\else\newpage
\insertpage{\unvbox\pagefigins}\fi
\write\@auxout{\string\expandafter\string\gdef\string\csname\space 
endpage\the\articlenumber\endcsname{\the\c@page}}
\newpage
\authorrunninghead{}
}

\def\endash{\raise.5ex\hbox to 5pt{\leaders\hrule height.5pt\hfill}}

\def\kluwerline{\global\advance\articlenumber by1
\hbox to30pc{\hfill\egtrm \thisjourname,
\currvolnumber, \the\c@page\endash%
\expandafter\ifx\csname endpage\the\articlenumber\endcsname\relax%
??\else\csname endpage\the\articlenumber\endcsname\fi\ (\currvolyear)}
\vskip2pt
\hbox to30pc{\hfill\egtrm \raise1.5pt\hbox{\scriptsize\copyright}%
\ \currvolyear\ %
Kluwer Academic Publishers, Boston. Manufactured in The Netherlands.}
\vskip3pt
}

\def\received#1 \revised#2{\def\thereceived{Received #1. Revised #2.}}
\let\thereceived\relax

\def\editor#1{\def\theeditors{\vskip1sp
\hbox to\textwidth{\hfill\footnotesize Editor: #1\hfill}}}

\def\editors#1{\def\theeditors{\vskip4pt
\hbox to\textwidth{\hfill\footnotesize Editors: #1\hfill}}}

\let\theeditors\relax

\def\abstract{\ifx\thereceived\relax\else
\vskip3pt
\hbox to\textwidth{\hfill\footnotesize\thereceived\hfill}\fi
\ifx\theeditors\relax\else
\ifx\theeditors\empty\else\theeditors\fi\fi
\vskip21pt
\noindent{\iflgjfonts\sectionfont\else\ninbf\fi Abstract.}~\ignorespaces}

\def\endabstract{\vskip1sp}

\def\keywords#1{\vskip12pt
\noindent{\iflgjfonts\sectionfont\else\ninbf\fi Keywords:} #1\vskip1sp}


%% End Matter
\def\acknowledgements{\goodbreak\section*{Acknowledgements}}

\def\thebibliography#1{\section*{References}%
\bgroup\footnotesize\labelsep=6pt
\list{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \usecounter{enumi}}
    \def\newblock{\hskip .11em plus .33em minus .07em}
    \sloppy\clubpenalty4000\widowpenalty4000
    \sfcode`\.=1000\relax}

\def\endthebibliography{\endlist\egroup\vskip\baselineskip\relax}

\def\references{\goodbreak\endnotes\goodbreak\section*{References}
\bgroup\footnotesize\labelsep=6pt
\list{[\arabic{enumi}]}{\settowidth\labelwidth{[99]}\leftmargin\labelwidth
 \advance\leftmargin\labelsep
 \usecounter{enumi}}
 \def\newblock{\hskip .11em plus .33em minus .07em}
 \sloppy\clubpenalty4000\widowpenalty4000
 \sfcode`\.=1000\relax\frenchspacing}

\def\endreferences{\endlist\egroup}

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

%% Alphabetical References
\def\alphareferences{\goodbreak
\section*{References}
\bgroup\let\bibitem\alphabibitem\footnotesize \leftskip=6pt
\parindent=-6pt \indent\hskip-6pt\relax\ignorespaces}
\def\endalphareferences{\vskip1sp\egroup}

\def\alphabibitem{\@ifnextchar[{\alpha@lbibitem}{\alpha@bibitem}}

\def\alpha@lbibitem[#1]#2{\vskip1sp%\item[\@biblabel{#1}]
\if@filesw 
      { \def\protect##1{\string ##1\space}\immediate
        \write\@auxout{\string\bibcite{#2}{#1}}}\fi\ignorespaces}
%% Placement of `}' in def of \@lbibitem corrected 29 Apr 87
%% (Error found by Arthur Ogawa.)

\def\alpha@bibitem#1{\vskip1sp%\item
\if@filesw \immediate\write\@auxout
       {\string\bibcite{#1}{#1}}\fi\ignorespaces}

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

\newif\ifappendon

\def\appendix{\goodbreak
\global\appendontrue
\refstepcounter{chapter}
\setcounter{section}{0}
\setcounter{equation}{0}
\section*{Appendix}}

\def\startnewpage{\clearpage
\ifodd\c@page\else\null\clearpage\fi}

\def\bio#1{\vskip24pt\small\noindent{\bf #1} }

%%%%%%%%%%%%
%%% Math

\def\themathletter{\relax}

\def\mathletter#1{\gdef\themathletter{#1}}
\def\spletter#1{\gdef\thespletter{#1}}
\spletter{}

%% Use: 
% \begin{equation} or \[  
% \begin{splitmath} top line\\ 
%                 bottom line
% \end{splitmath}
% \end{equation} or \]  

\def\splitmath#1\\{\hbox to-\mathindent{}\vcenter\bgroup%
\ifequation\advance\hsize by-24pt\relax\fi
\hbox to\hsize{%
$\displaystyle #1$\hss}\vskip2pt
\global\setbox0=\hbox\bgroup$\displaystyle}

\def\endsplitmath{$\egroup\hbox to\hsize{\hss\unhbox0}\egroup}

\newif\ifinmathqed
\newif\ifqedequation

\def\theequation{\thespletter\ifappendon A.\fi\arabic{equation}\themathletter}

%%% Variation on Fleqn.sty
% fleqn.sty 24-May-89

\def\[{\relax\ifmmode\@badmath\else\bgroup\@beginparpenalty\predisplaypenalty
 \@endparpenalty\postdisplaypenalty
 \begin{trivlist}
\vskip\abovedisplayskip
\item[]\leavevmode
 \hbox to\linewidth\bgroup$ \displaystyle
 \hskip\mathindent\bgroup\fi}

\def\]{\relax\ifmmode \egroup $\hfil%
\ifinmathqed\vrule height 6pt width6pt depth0pt\relax\fi%
\egroup 
\ifinmathqed\else\vskip\belowdisplayskip\fi
\end{trivlist}
\egroup\else
\@badmath \fi\spletter{}\mathletter{}}

\def\xrelax{\relax}


\newif\iffirsttime
\global\firsttimetrue
\newif\ifequation
\def\equation{\global\equationtrue\@beginparpenalty\predisplaypenalty%
\@endparpenalty\postdisplaypenalty%
\trivlist%
\vskip\abovedisplayskip%
\item[]\leavevmode%
\setbox0=\hbox\bgroup $ \displaystyle%
\hskip\mathindent}

\def\endequation{$\egroup%
\ifx\themathletter\xrelax\global\firsttimetrue%
\refstepcounter{equation}\else%
\iffirsttime\global\firsttimefalse\refstepcounter{equation}\fi\fi%
\setbox1=\hbox{\copy0\@eqnnum}%
\ifdim\wd1>\linewidth%
\vbox{\unskip\noindent\hbox to\linewidth{\unhbox0\hss}\vskip3pt%
\noindent\hbox to\linewidth{\hfill\displaywidth\linewidth\llap{\@eqnnum}}}%
\else%
\vbox{\unskip\noindent\hbox to\linewidth{%
\unhbox0\hfil\displaywidth\linewidth\llap{\@eqnnum}}}%
\fi%
\gdef\themathletter{\relax}\spletter{}%
\ifinmathqed\global\inmathqedfalse\global\qedequationtrue\fi%
\vskip\belowdisplayskip%
\endtrivlist\def\themathletter{}\global\equationfalse}

\def\@@eqncr{\let\@tempa\relax 
    \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &} 
      \else \def\@tempa{&}\fi 
     \@tempa 
\ifx\themathletter\xrelax\stepcounter{equation}
\else\iffirsttime\global\firsttimefalse\stepcounter{equation}\fi\fi
\if@eqnsw\@eqnnum
\fi\global\@eqnswtrue\global\@eqcnt\z@\cr}

\def\eqnarray{\let\@currentlabel=\theequation
\global\@eqnswtrue
\global\@eqcnt\z@\tabskip\mathindent\let\\=\@eqncr
\abovedisplayskip\topsep\ifvmode\advance\abovedisplayskip\partopsep\fi
\belowdisplayskip\abovedisplayskip
\belowdisplayshortskip\abovedisplayskip
\abovedisplayshortskip\abovedisplayskip
$$\everycr={\noalign{\gdef\themathletter{\relax}}}
\halign to
\linewidth\bgroup\@eqnsel\hskip\@centering$\displaystyle\tabskip\z@
 {##}$&\global\@eqcnt\@ne 
\hskip 2\arraycolsep \hfil${##}$\hfil
 &\global\@eqcnt\tw@ 
\hskip 2\arraycolsep $\displaystyle{##}$\hfil 
 \tabskip\@centering&\llap{##}\tabskip\z@\cr}

\def\endeqnarray{\@@eqncr\egroup
\global\firsttimetrue\spletter{}
$$\global\@ignoretrue }

\newdimen\mathindent 
\mathindent = 36pt

\def\wideequation{\bgroup\mathindent=0pt}
\def\endwideequation{\egroup\mathindent=36pt}

%%% End Math

%% Listing
\newcount\thestep

\def\step{\vskip2pt
\global\advance\thestep by1\relax
\item[\raise.1ex\hbox {$\bullet$}\hskip3pt
{\it Step \the\thestep.}]}

\def\boldstep{\vskip2pt
\global\advance\thestep by1\relax
\item[\raise.1ex\hbox {$\bullet$}\hskip3pt
{\bf Step \the\thestep.}]}


\def\zerospacelist{\leftmargin\leftmargini
\partopsep=0pt 
\parsep=0pt \topsep=0pt \itemsep=0pt\relax}

\zerospacelist

\def\steps{\bgroup\let\@listi\zerospacelist
\let\@listii\zerospacelist
\leftmarginii 12pt
\begin{description}}


\def\boldsteps{\bgroup\let\@listi\zerospacelist
\let\@listii\zerospacelist
\leftmarginii 12pt 
\let\step\boldstep
\begin{description}}


\def\endsteps{\end{description}\global\thestep=0\egroup}
\let\endboldsteps\endsteps

%%%%%%%%%%% Code examples in text

%% Algorithm

\newcount\algocount
\def\looker{\ifx\next\end\else\ifx\next\lineending\vskip-4pt%
\noindent\qquad\else\global\advance\algocount by1\relax%
\vskip0pt\noindent\hskip12pt\hbox to0pt{\hss\the\algocount.}\quad\fi\fi}

\def\lineending{\parfillskip=0pt plus1fil\relax\futurelet\next\looker}

{\obeylines
\gdef\algorithm{\medskip
\def\note##1{\parfillskip=0pt\hfill##1}\def\ {\qquad}%
\baselineskip=12pt\parskip=2pt\obeylines\let^^M=\lineending}}

\def\endalgorithm{\vskip1pt}

%% code example

\newif\ifcodeon
\newif\ifneedspace
{\obeylines\obeyspaces

\gdef\codelooker{\ifx\next\lineending\vskip-4pt%
\noindent\else%
\ifx\next\end\vskip-4pt\let^^M\ \endcodesamp\else%
\vskip0pt\noindent\fi\fi}

\gdef\codelineending{\relax\futurelet\next\codelooker}

\gdef\codesamp{\small\smallskip\global\codeontrue\baselineskip=12pt%
\parskip=2pt\tt\obeylines\obeyspaces\let^^M=\codelineending}

\gdef\endcodesamp{\global\codeonfalse\smallskip}

\gdef\spcodesamp{\baselineskip=12pt%
\parskip=2pt\tt\obeylines\obeyspaces\let^^M=\codelineending}

\gdef\codebox#1{\let\go\relax%
\ifcodeon\else\global\needspacetrue\let\go\spcodesamp\fi\go%
\global\dimen1=#1\relax\global\setbox0=\vbox\bgroup}

\gdef\endcodebox{\ifneedspace\global\needspacefalse\vskip\baselineskip\fi%
\egroup%
\vtop to \ht0{\vskip-3pt\hrule\hbox to\dimen1{\vrule height\ht0%
\hfill\vrule height\ht0 depth \dp0}\hrule\vss}%
\nobreak\vskip-\ht0\rlap{\hskip6pt\vbox{\unvbox0}}}}


%% Theorems, Proofs, Examples, etc.

\def\demo#1{\vskip-\lastskip
\bigskip
\noindent{\it#1.\/} }
\def\enddemo{\vskip12pt}

\def\example{\vskip-\lastskip
\bigskip
\noindent{\it Example:\/} }


\def\inmathqed{\global\inmathqedtrue}

\def\qed{\penalty-250%
\hbox to 6pt{\hfill}\hfill\llap{%
\vbox{\hrule\hbox{\vrule height6pt\hskip6pt\vrule}\hrule}}}

\def\slug{\penalty-250%
\hbox to 6pt{\hfill}\hfill\llap{\vrule height 6pt width 6pt depth0pt}}

\def\proof{\vskip-\lastskip
\bigskip
\futurelet\next\lookforbracket}

\def\lookforbracket{\ifx\next[\let\go\usespecialterm
\else\let\go\relax
\noindent{\bf Proof:}\enskip\relax\ignorespaces\fi\go}

\def\usespecialterm[#1]{%
\noindent\hbox{\bf #1:}\enskip\relax\ignorespaces}


\def\endproof{\ifqedequation\global\qedequationfalse\vskip-6pt%
\vskip-\belowdisplayskip\hfill\slug\else
\ifinmathqed\smallskip\else\slug\smallskip\fi\fi%
\global\inmathqedfalse}

\let\endexample\endproof

\def\proclaim#1{\vskip-\lastskip
\bigskip
\bgroup\noindent\hbox{\bf#1}\enskip\it\ignorespaces}
\def\endproclaim{\egroup}

%%%% Computer Window example

\newbox\wrapbox
\def\window{\bgroup\obeylines\let\par\cr%
\global\setbox\wrapbox=\vtop\bgroup\obeylines\let\par\cr%
\halign\bgroup\it\strut##\hfil\cr}

\def\endwindow{\crcr\egroup\egroup%
\raise8.5pt\vtop{\hrule
\hbox{\vrule height 14pt\hskip6pt{%
\obeylines\let\par\cr\vtop{\vskip-20pt\copy\wrapbox\vskip4pt}}%
\hskip6pt\vrule}\hrule}\egroup%
\vskip12pt}

\def\winline#1#2{\vskip12pt%
\hskip-24pt\hbox to24pt{#1\hss}%
\hbox to7.5pc{#2\hfil}}

\def\endwinline{\vskip1pt}

\def\interface{\bgroup\small\leftmargini 45pt
\leftskip=24pt \parindent=0pt}

\def\endinterface{\vskip1sp\egroup\vskip1sp}

%%%%%%
%% Table change, to make text go to edges of first and last columns

\def\new@tabacol{\edef\@preamble{\@preamble\hskip0pt}}

\def\@tabclassz{\ifcase \@lastchclass\@acolampacol% 
\or \@ampacol \or
   \or \or \@addamp \or \@acolampacol\or \@firstampfalse 
\ifx\@captype\xtable\new@tabacol\else\@tabacol \fi%
\fi%
\edef\@preamble{\@preamble%
  \ifcase \@chnum%
     \hfil\ignorespaces\@sharp\unskip\hfil%
     \or \ignorespaces\@sharp\unskip\hfil%
     \or \hfil\hskip\z@ \ignorespaces\@sharp\unskip\fi}}

\def\xtable{table}
\let\savehline\hline

\def\hline{\noalign{\vskip3pt
\hrule height .6pt
\vskip3pt}}

\def\@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule 
     height\arraystretch \ht\strutbox
     depth\arraystretch \dp\strutbox
     width\z@}\@mkpream{#2}\edef\@preamble{\halign \noexpand\@halignto
\bgroup%
\tabskip\z@\@arstrut\@preamble
\ifx\@captype\xtable%
\hskip-\tabcolsep\fi%% <==== Changed
\tabskip\z@ \cr}%
\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox%
  \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi%
  \bgroup\let\par\relax%
  \let\@sharp##\let\protect\relax \lineskip\z@\baselineskip\z@\@preamble}

\def\tableterms{\bgroup\everycr={\noalign{\vskip1pt}}%
\let\\=\cr\halign\bgroup\hfill## :&\ ##\hfill\cr}

\def\endtableterms{\crcr\egroup\vskip4pt\egroup}

\def\tablenotes{\vskip6pt\rightskip=0pt \leftskip=0pt
\parindent=0pt \parfillskip0pt plus 1fil
\vskip1sp\footnotesize}
\def\endtablenotes{\vskip1sp}


\def\authorbio#1#2{{\footnotesize\vskip1sp\noindent{\bf #1}#2\vskip1sp}}

%
\let\nonouternewinsert\newinsert

%%%%%
%%% Macros for Kluwer: Issue and Volume Table of Contents

\def\volumetocline{\hbox to30pc{\hss\Large\bf Table of Contents:
Volume \currvolnumber\ (\currvolyear)\hss}}

\def\volumetoc{\clearpage\thispagestyle{empty}\bgroup
\hyphenpenalty=10000
\let\TOCarticle\volTOCarticle
\def\\ {\hfill\break}
\volumetocline}

\def\endvolumetoc{\egroup\newpage}

\def\tocnumberline#1{\vskip26pt
{\elvbf\noindent#1}\vskip8pt}

\def\TOCvolumeline#1{\noindent{\large#1}\vskip24pt
\hrule width 30pc}

%% Changed to accept titles more than 2 lines long


\def\volTOCarticle#1#2#3{\vskip.5pt
\setbox0=\hbox{#1\hskip12pt{\it#2}}
\ifdim\wd0<27pc
   %% The simple case, it will fit on one line:
  \hbox to30pc{\strut#1\dotfill{\it#2}\hbox to36pt{\hss#3}}
\else
   %% Find out what we must do next:
   \setbox1=\hbox{#1} \setbox2=\hbox{\hskip18pt{\it #2}}
   \dimen3=\wd1
   \advance\dimen3 by \wd2
   %% Is it 2 lines long?
  \ifdim\dimen3<56pc
   %% Yes, it is 2 lines long.
   %% Is title more than one line long?
       \ifdim\wd1>28pc
   %% Title is more than 1 line long:
   \parfillskip=0pt \parindent=0pt
   \rightskip=36pt
   #1% 
   \dotfill\strut\hbox{{\it#2}\hbox to0pt{\hskip36pt\hbox to0pt{\hss#3}\hss}}
       \else
   %% Title is not more than 1 line long:
   \parfillskip=0pt
   \parindent=0pt
   \rightskip=36pt
   #1\dotfill\break\hbox to27pc{\dotfill\strut\hbox{{\it#2}\hbox 
   to0pt{\hskip36pt\hbox to0pt{\hss#3}\hss}}}
       \fi
   \else
   %% It is more than 2 lines long!
   %% Is title more than two lines long?
       \ifdim\wd1>56pc
   %% Title is more than 2 lines long:
   \parfillskip=0pt \parindent=0pt
   \rightskip=36pt
   #1%
   \dotfill\strut\hbox{{\it#2}\hbox to0pt{\hskip36pt\hbox to0pt{\hss#3}\hss}}
       \else
   %% Title is not more than 2 line long:
   \parfillskip=0pt
   \parindent=0pt
   \rightskip=36pt
   #1\dotfill\break
      \hbox to27pc{\dotfill\strut\hbox{{\it#2}\hbox 
      to0pt{\hskip36pt\hbox to0pt{\hss#3}\hss}}}
       \fi
   \fi
\fi
\vskip.5pt
}

%% Changed to cover possibility of title 2 or more lines long.

\def\TOCarticle#1#2#3{\vskip5.2pt
\setbox0=\hbox{#1\hskip18pt{\it#2}}
\ifdim\wd0<28pc
   %% The simple case, it will fit on one line:
  \hbox to30pc{\strut#1\dotfill{\it#2}\hbox to24pt{\hss#3}}
\else
   %% Find out what we must do next:
   \setbox1=\hbox{#1} \setbox2=\hbox{\hskip18pt{\it #2}}
   \dimen3=\wd1
   \advance\dimen3 by \wd2
   %% Is it 2 lines long?
  \ifdim\dimen3<56pc
   %% Yes, it is 2 lines long.
   %% Is title more than one line long?
       \ifdim\wd1>28pc
   %% Title is more than 1 line long:
   \parfillskip=0pt \parindent=0pt
   \rightskip=24pt
   #1% 
   \dotfill\strut\hbox{{\it#2}\hbox to0pt{\hskip24pt\hbox to0pt{\hss#3}\hss}}
       \else
   %% Title is not more than 1 line long:
   \parfillskip=0pt
   \parindent=0pt
   \rightskip=24pt
   #1\dotfill\break\hbox to28pc{\dotfill\strut\hbox{{\it#2}\hbox 
   to0pt{\hskip24pt\hbox to0pt{\hss#3}\hss}}}
       \fi
   \else
   %% It is more than 2 lines long!
   %% Is title more than two lines long?
       \ifdim\wd1>56pc
   %% Title is more than 2 lines long:
   \parfillskip=0pt \parindent=0pt
   \rightskip=24pt
   #1%
   \dotfill\strut\hbox{{\it#2}\hbox to0pt{\hskip24pt\hbox to0pt{\hss#3}\hss}}
       \else
   %% Title is not more than 2 line long:
   \parfillskip=0pt
   \parindent=0pt
   \rightskip=24pt
   #1\dotfill\break
      \hbox to28pc{\dotfill\strut\hbox{{\it#2}\hbox 
      to0pt{\hskip24pt\hbox to0pt{\hss#3}\hss}}}
       \fi
   \fi
\fi
\vskip5.2pt\hrule width 30pc}

\def\aster{*}
\newcount\linenumber
\def\findtitle#1 {\def\one{#1}%
\ifx\one\aster\let\xgo\relax\else\global\advance\linenumber by 1
\expandafter\gdef\csname line\the\linenumber\endcsname{#1}%
\let\xgo\findtitle\fi\xgo}


\def\makeissuetoc{\expandafter\ifx\csname line\the\linenumber\endcsname\relax
\let\ygo\relax\else\let\ygo\makeissuetoc
\hbox to30pc{\hfill\issuetocfont 
\expandafter\csname line\the\linenumber\endcsname\hfill}
\vskip8pt\fi\global\advance\linenumber by1\relax\ygo}

\def\issuetoc{\thispagestyle{empty}
\expandafter\findtitle\thisjourname{} *
\linenumber=1
\bgroup
\hyphenpenalty=10000
\def\\ {\hfill\break}
\makeissuetoc
\vskip24pt
\TOCvolumeline{Volume \currvolnumber, No.~\currissuenumber, \currissuemonth 
\ \currvolyear}}
\def\endissuetoc{\egroup\newpage}


