%  ****************************************
%  *       SAO2.sty, v 3.2, 03.03.05      *
%  ****************************************

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sao2}[2005/03/03 sao2.sty,v.3.2]

\newif\if@oldLaTeX
\@ifundefined{if@compatibility}{\@oldLaTeXtrue}{\@oldLaTeXfalse}
\if@oldLaTeX
%    \typeout{***old way LaTeX***}%
\else
%    \typeout{***new way LaTeX***}
\fi

\input fleqn.clo\relax
\mathindent=5mm

% New command saoname
\def\saoname{Special Astrophysical Observatory of the Russian AS,
		      Nizhnij Arkhyz 369167, Russia}

% Command picplace (from A&A)
\def\picplace#1{\vbox{\hrule\@height 0.4pt\@width\hsize
\hbox to\hsize{\vrule\@width 0.4pt\@height#1\hfil
\vrule\@width 0.4pt\@height#1}\hrule\@height 0.4pt\@width\hsize}}

% New command receivaccep (for \date)
\newcommand{\receivaccep}[2]{{\small\it Received #1; accepted #2.}}

%************************ PAGE LAYOUT ****************************
%
\textwidth=168mm
\oddsidemargin= -3.4mm
\evensidemargin= -3.4mm
\topmargin= -15.4pt % -5.4mm
\headheight=12pt % 4.2mm
\headsep=32pt    % 11.2mm
\if@oldLaTeX
   \footheight=12pt % 4.2mm
\else
   \relax
\fi
\footskip=30pt   % 10.5mm
%\textheight=56\baselineskip % 235.2mm
\textheight=54\baselineskip % 226.8mm
\advance\textheight by\topskip % +10pt(3.5mm)=230.3mm
\columnsep=6mm

%************************ PAGE STYLE *****************************
%
% New command issue
\newsavebox{\issueblok}
\def\issue#1{\sbox{\issueblok}{{\it\bsao, #1}}}

%***** saotitle ****

\def\ps@saotitle{\let\@mkboth\@gobbletwo
\def\@oddhead{\null\copy\issueblok\hfil\footnotesize
\copyright\ Special Astrophysical Observatory of the Russian AS,
\number\year}
\def\@oddfoot{}
\let\@evenhead\@oddhead\let\@evenfoot\@oddfoot
}

%***** myheadings ****

\def\ps@myheadings{\let\@mkboth\@gobbletwo
\def\@oddhead{\hbox{}\hfil\rightmark\hfil\rm\thepage}%
\def\@oddfoot{}%
\def\@evenhead{\rm\thepage\hfil\leftmark\hfil\hbox{}}%
\def\@evenfoot{}
\def\sectionmark##1{}\def\subsectionmark##1{}}
\def\@rightmark#1#2{\textsl{#2}}
\def\@leftmark#1#2{\textsl{#1}}

%********************** TITLE AND ABSTRACT *********************
%
\newcounter{@inst}
\renewcommand{\the@inst}{\alph{@inst}}
\newdimen\instindent

\def\institute#1{\gdef\@institute{#1}}

\def\institutename{\par
 \begingroup
 \parindent=0pt
 \parskip=0pt
 \setcounter{@inst}{1}%
 \def\and{\par\stepcounter{@inst}%
 \noindent
 \hbox to\instindent{\hss$^{\the@inst}$\enspace}\ignorespaces}%
 \setbox0=\vbox{\def\thanks##1{}\@institute}
 \ifnum\c@@inst>9\relax\setbox0=\hbox{$^{88}$\enspace}%
                 \else\setbox0=\hbox{$^{8}$\enspace}\fi
 \instindent=\wd0\relax
 \ifnum\c@@inst=1\relax
 \else
   \setcounter{@inst}{1}%
   \noindent
   \hbox to\instindent{\hss$^{\the@inst}$\enspace}\ignorespaces
 \fi
 \ignorespaces
 \@institute\par
 \endgroup}

\def\inst#1{\unskip$^{#1}$}

\def\subtitle#1{\gdef\@subtitle{#1}}
\def\@subtitle{}

\def\thesaurus#1{\gdef\@thesaurus{#1}}
\def\@thesaurus{missing; you have not inserted them}%

\def\date#1#2{\gdef\@date{\receivaccep{#1}{#2}}}
\def\@date{}

\def\maketitle{\par
 \begingroup
  \if@twocolumn
   \twocolumn[\@maketitle]
  \else
   \newpage
   \global\@topnum\z@
   \@maketitle
  \fi
  \thispagestyle{saotitle}
% \@thanks
 \endgroup
 \let\maketitle\relax
 \let\@maketitle\relax
 \gdef\@author{}
 \gdef\@title{}
% \gdef\@thanks{}
 \let\thanks\relax
}

\def\@maketitle{\newpage
 {\LARGE \bf %\boldmath
  \pretolerance=10000
  \rightskip=0pt plus 4cm
  \noindent\ignorespaces
  \@title \par}\vskip 21pt
\if!\@subtitle!\else {\Large \bf
  \vskip .05cm
  \pretolerance=10000
  \rightskip=0pt plus 3cm
  \noindent\@subtitle \par}\vskip10pt\fi
 {\bf \lineskip .5em
 \def\and{\unskip, }%
 \noindent\ignorespaces\@author\vskip .3cm}
 \small\rm
 \institutename
 \vskip 0.35cm
 \noindent\@date
 \par
 \vskip 21pt}

\def\abstract{\if@twocolumn
   \start@SFBbox\@abstract
 \else
   \@abstract
 \fi
 %\def\thefootnote{\mbox{{$\fnsymbol{footnote}$}}}
 %\def\@makefnmark{\hbox to 0pt{$\m@th^{\@thefnmark}$\hss}}
}
\def\endabstract{\if@twocolumn
   \par\endgroup\vspace*{3\baselineskip}\finish@SFBbox
 \else
   \par\endgroup\vspace*{3\baselineskip}
 \fi
 \@thanks\gdef\@thanks{}
 %\setcounter{footnote}{0}
}
\def\@abstract{\vspace*{1.3\baselineskip}
\begingroup \rightskip=10mm \leftskip=10mm}
%\noindent{\bf \abstractname .}\hskip 1em}

% Define \keywords
\def\keywname{Key words}
\def\keywords{\par\vspace{12pt}\noindent{\bf \keywname :\hspace*{1em}}}

\def\start@SFBbox{\@next\@currbox\@freelist{}{}%
 \global\setbox\@currbox
 \vbox\bgroup
  \hsize \textwidth
  \@parboxrestore
}
\def\finish@SFBbox{\par\vskip -\dbltextfloatsep
  \egroup
  \global\count\@currbox\tw@
  \global\@dbltopnum\@ne
  \global\@dbltoproom\maxdimen\@addtodblcol
  \global\vsize\@colht
  \global\@colroom\@colht
}
%*************************** SECTIONS ******************************
%
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus
 -.2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex
minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus
-1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\it}}
\def\paragraph{\@startsection {paragraph}{4}{\z@}{3.25ex plus 1ex minus
.2ex}{-.6em}{\normalsize\sl}}
\def\subparagraph#1{\typeout{SAO2 Warning: You should not use
\protect\subparagraph \space in this style.}\vskip0.5cm
You should not use $\backslash${\tt subparagraph} in this
style.\vskip0.5cm}

\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.\ }\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}}

%************************** LISTS ********************************
%
\parindent 1.5em
\leftmargini   \z@
\leftmarginii  1.5em
\leftmarginiii 1.5em
\leftmarginiv  1.5em
\leftmarginv   1.5em
\leftmarginvi  1.5em
\leftmargin\leftmargini
\labelsep 0.5em
\labelwidth\leftmarginii\advance\labelwidth-\labelsep
\parsep \z@
\topsep 6pt plus 1pt minus 1pt
\itemsep \z@ plus 1pt
\partopsep \z@

%\def\@listI{\leftmargin\leftmargini}
\def\@listI{\leftmargin\z@\itemindent=3em}

\def\@listii{\leftmargin\leftmarginii
 \labelwidth\leftmarginii\advance\labelwidth-\labelsep
\itemindent=3em}
\def\@listiii{\leftmargin\leftmarginiii
 \labelwidth\leftmarginiii\advance\labelwidth-\labelsep
\itemindent=3em}

\def\labelenumii{\theenumii)}

%************************** FOOTNOTES *******************************
%
%\renewcommand{\thefootnote}{\mbox{{$\alph{footnote}$}}}

%\def\@fnsymbol#1{\ifcase#1\or\star\or{\star\star}\or{\star\star\star}%
%   \or \dagger\or \ddagger\or
%   \mathchar "278\or \mathchar "27B\or \|\or **\or \dagger\dagger
%   \or \ddagger\ddagger \else\@ctrerr\fi\relax}

\long\def\@makefntext#1{\parindent 1em\noindent
  $^{\@thefnmark}$\hspace{4pt}#1}

\skip\footins 4ex plus 1ex minus .5ex
\footnotesep 2ex

%********************** FIGURES AND TABLES **********************
%
\long\def\@makecaption#1#2{%
   \vskip 10\p@
   \setbox\@tempboxa\hbox{#1: {\it #2}}%
   \ifdim \wd\@tempboxa >\hsize
       #1: {\it#2}\par
     \else
       \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
   \fi}
\setcounter{topnumber}{2}
\def\topfraction{.9}
\setcounter{bottomnumber}{1}
\def\bottomfraction{.9}
\setcounter{totalnumber}{3}
\def\textfraction{.1}
\def\floatpagefraction{.9}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{.9}
\def\dblfloatpagefraction{.9}

%************************ ACKNOWLEDGEMENTS ***********************
%
\def\acknowname{Acknowledgements}
\def\acknowledgements{\par\addvspace{10pt}\begingroup\small\rm
\trivlist\item[\hskip\labelsep{\bf \acknowname .\/}]}
\def\endacknowledgements{\endtrivlist\endgroup\addvspace{6pt}}

%************************ THEBIBLIOGRAPHY *************************
%
\def\thebibliography#1{\small\section*{\refname}\list
% The \arabic{enumi} command has been removed because we don't use
% numbered citations in astronomical journals.
 {}{\setlength\labelwidth{1.4em}\leftmargin\labelwidth
 \setlength\parsep{0pt}\setlength\itemsep{0pt}
 \setlength{\itemindent}{-\leftmargin}
 \usecounter{enumi}}
 \def\newblock{\hskip .11em plus .33em minus -.07em}
 \sloppy
 \sfcode`\.=1000\relax}
\let\endthebibliography=\endlist

%******* SPECIAL SIGNS AND CHARACTERS FOR MATH MODE (FROM A&A) *******
%
\def\squareforqed{\hbox{\rlap{$\sqcap$}$\sqcup$}}

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

\def\sun{\hbox{$\odot$}}

\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\degr{\hbox{$^\circ$}}

\def\arcmin{\hbox{$^\prime$}}

\def\arcsec{\hbox{$^{\prime\prime}$}}

\def\utw{\smash{\rlap{\lower5pt\hbox{$\sim$}}}}

\def\udtw{\smash{\rlap{\lower6pt\hbox{$\approx$}}}}

\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\cor{\mathrel{\mathchoice {\hbox{$\widehat=$}}{\hbox{$\widehat=$}}
{\hbox{$\scriptstyle\hat=$}}
{\hbox{$\scriptscriptstyle\hat=$}}}}

\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\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\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\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}}}}}

%********** ABBREVIATIONS OF THE OFT-REFERENCED JOURNALS ***********
%
% *** Annual Review of Astronomy and Astrophys.
\newcommand{\araa}{Annu. Rev. Astron. Astrophys.}
% *** Astronomical Journal
\newcommand{\aj}{AJ}
% *** Astronomicekij Zhurnal
\newcommand{\azh}{Astron. Zh.}
% *** Astronomy and Astrophysics
\newcommand{\aaa}{A\&A}
% *** Astronomy and Astrophys. Supplement Series
\newcommand{\aas}{A\&AS}
% *** Astronomy and Astrophysics Review
\newcommand{\aar}{Astron. Astroph. Rev}
% *** Astrophysical Journal
\newcommand{\apj}{ApJ}
% *** Astrophysical Journal Supplement Series
\newcommand{\apjs}{ApJS}
% *** Astrophysics and Space Science
\newcommand{\apss}{Astrophys. Space Sci.}
% *** Bulletin of the American Astron. Society
\newcommand{\baas}{BAAS}
% *** ��������� ����. ����������. ������������
%\newcommand{\bsao}{����. ����. ��������. ������.}
% *** Bulletin of the Special Astrophysical Observatory
\newcommand{\bsao}{Bull. Spec. Astrophys. Obs.}
% *** Inform. Bul. Var. Stars
\newcommand{\ibvs}{IBVS}
% *** Journal of Astronomy and Astrophysics
\newcommand{\jaa}{J. Astron. Astroph.}
% *** Monthly Notices of the Roy. Astron. Society
\newcommand{\mnras}{MNRAS}
% *** Publ. Astr. Soc. Japan
\newcommand{\pasj}{PASJ}
% *** Publ. of the Astron. Society of the Pacific
\newcommand{\pasp}{PASP}
% *** Pis'ma v Astronomicekij Zhurnal
\newcommand{\pazh}{Pis'ma Astron. Zh.}
% *** Soviet Astronomy
\newcommand{\sovast}{Sov. Astron.}
% *** Scientific American
\newcommand{\sca}{Scient.~Am.}
% *** Sky and Telescope
\newcommand{\skytel}{Sky Telesc.}
% *** Space Science Reviews
\newcommand{\spsrev}{Space Sci.~Rev.}

%************************** INITIALIZATION ************************
%
%\if@oldLaTeX \ds@twoside \else \@twosidetrue\@mparswitchtrue\fi% two side
\@twosidetrue
\@twocolumntrue
\@mparswitchtrue
\flushbottom
\hfuzz=3pt
\vfuzz=3pt
\tolerance=1000
\ps@myheadings
\pagenumbering{arabic}
\if@twocolumn
 \twocolumn
 \sloppy
\else
 \onecolumn
\fi
\frenchspacing

%************** TRANSITION FROM TWOCOLUMN TO ONECOLUMN **************
%
% environment \begin{onecolumn}...\end{onecolumn} used for transition
% from twocolumn to onecolumn (for example for wide tables)

\def\onecol{\columnwidth\textwidth
	    \hsize\columnwidth
	    \linewidth\columnwidth
	    \@twocolumnfalse
	    \@floatplacement}

\newbox\partialpage

\def\onecolumn{\begingroup
   \output={\balancepartbeg} % saving of the text in \partialpage (2 columns)
   \par\penalty -\@M         % eject
   \global\advance\@colroom by -\ht\partialpage
   \output={\onecolumnout}
   \onecol
   \dimen@=\textheight \advance\dimen@ by-\ht\partialpage
   \global\vsize=\dimen@
}

\def\onecolumnout{
   \dimen@=\textheight \advance\dimen@ by-\ht\partialpage
   \setbox0=\vbox to \dimen@{\unvbox255}
   \setbox\@outputbox \vbox{\pagesofarone} \@outputpage
   \global\vsize=\textheight
   \global\@colroom=\textheight
   \unvbox255 \penalty\outputpenalty}

\def\pagesofarone{\unvbox\partialpage \hbox to \textwidth{\box0}}

\def\endonecolumn{\output={\balancepartend}\par\penalty -\@M
   \endgroup
}

\def\balancepartend{\@topnewpage[{\unvbox\partialpage\unvbox255}\bigskip]}

\def\balancepartbeg{
   \setbox0=\vbox{\if@firstcolumn \unvbox255
		  \else \global\@firstcolumntrue
			\unvbox\@leftcolumn\unvbox255
		  \fi}
  \dimen@=\ht0
  \ifdim\ht0<20pt
     \setbox2=\vbox to\dimen@{}
  \else
   \advance\dimen@ by\topskip
   \advance\dimen@ by-\baselineskip
   \divide\dimen@ by 2
   \splittopskip=\topskip \splitmaxdepth=\maxdepth
   \global\setbox3=\copy0
   \global\setbox1=\vsplit3 to \dimen@
   {\vbadness=10000 \@whiledim \ht3>\dimen@
      \do{
	\global\advance\dimen@ by1pt
	\ifdim\dimen@<\textheight
	  \global\setbox3=\copy0
	  \global\setbox1=\vsplit3 to \dimen@
	\else
	  \global\advance\dimen@ by-1pt
	  \global\setbox0=\vbox to\dimen@{\unvbox1}
	  \global\setbox2=\vsplit3 to \dimen@
	  \setbox\@outputbox \vbox{\hbox to \textwidth{\box0\hfil\box2}}
	  \@outputpage
	  \global\dimen@=\ht3
	  \global\setbox1=\vsplit3 to \dimen@
	  \unvbox1
	  \unvbox255 \penalty\outputpenalty
       \fi
      }
   }
   \setbox0=\vbox to\dimen@{\unvbox1}
   \setbox2=\vbox to\dimen@{\unvbox3}
  \fi
  \wd0=\hsize \wd2=\hsize
  \global\setbox\partialpage=\vbox{%
	     \hbox to \textwidth{\box0\hfil\box2}}
}
%
% End of file `sao2.sty'.
%
%******************* SAOTABUL.STY (v.1.0, 12.11.95) ******************
%
\newif\if@topcaption \@topcaptiontrue
\def\topcaption{\@topcaptiontrue\tablecaption}
\def\bottomcaption{\@topcaptionfalse\tablecaption}
\def\tailofcaption#1{\gdef\@tailofcaption{#1}}   % added by TAP 12.02.96
\def\@tailofcaption{(continued)}                 % added by TAP 12.02.96
\long\def\tablecaption{\refstepcounter{table} \@dblarg{\@xtablecaption}}
\long\def\@xtablecaption[#1]#2{%
  \long\gdef\@process@tablecaption{\@stcaption{table}[#1]{#2}}
  \long\gdef\@process@tablecaption@cont{%               added by TAP 12.02.96
	 \@stcaption@cont{table}[#1]{#2 \@tailofcaption}}} % added by TAP 12.02.96
\global\let\@process@tablecaption\relax
\global\let\@process@tablecaption@cont\relax          % added by TAP 12.02.96

\long\def\@stcaption#1[#2]#3{\par%
    \addcontentsline{\csname ext@#1\endcsname}{#1}%
        {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}
  \begingroup
    \@parboxrestore
    \normalsize
    \if@topcaption \vskip -10pt \fi % 'fix'
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \if@topcaption \vskip 10pt \fi % 'fix'
  \endgroup}

\long\def\@stcaption@cont#1[#2]#3{\par%
  \begingroup
    \@parboxrestore
    \normalsize
    \if@topcaption \vskip -10pt \fi % 'fix'
    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
    \if@topcaption \vskip 10pt \fi % 'fix'
  \endgroup}

\def\@tablehead{}
\def\tablehead#1{\gdef\@tablehead{#1}}
\def\tablefirsthead#1{\gdef\@table@first@head{#1}}
\def\@tabletail{}
\def\tabletail#1{%
    \gdef\@tabletail{\noalign{\global\let\@savcr=\\\global\let\\=\cr}%
                     #1\noalign{\global\let\\=\@savcr}}}
\def\tablelasttail#1{\gdef\@table@last@tail{#1}}
\newdimen\maxsize            % maximum pagesize
\newdimen\actsize            % actual pagesize
\newdimen\twocolsize         % needed for correct max height if twocolumn
\newdimen\parboxheight       % height plus depth of a parbox-argument
\newdimen\addspace           % stores the value of \\[#1]
\newdimen\midlineheight      % estimated size of a normal line
\newdimen\pargcorrection     % to set page height tolerance if p-arg
\newdimen\computedimens      % computation variable
\newif\ifstar
\newbox\tabparbox

\def\@stabularcr{{\ifnum0=`}\fi\@ifstar{\@sxtabularcr}{\@sxtabularcr}}
\def\@sxtabularcr{\@ifnextchar[{\@sargtabularcr}%
                 {\ifnum0=`{\fi}\cr\nextline}}
\def\@sargtabularcr[#1]{\ifnum0=`{\fi}\ifdim #1>\z@
    \unskip\@sxargarraycr{#1}\else \@syargarraycr{#1}\fi}
\def\@sxargarraycr#1{\@tempdima #1\advance\@tempdima \dp \@arstrutbox%
    \vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr%
    \noalign{\global\addspace=#1}\nextline}
\def\@syargarraycr#1{\cr\noalign{\vskip #1\global\addspace=#1}\nextline}
\def\@sstartpbox#1{\global\advance\maxsize by -\pargcorrection
                   \global\pargcorrection=0pt
                   \setbox\tabparbox%
                          \vtop\bgroup\hsize#1\@arrayparboxrestore}
\def\@sendpbox{\par\vskip\dp\@arstrutbox\egroup%
               \computedimens=\ht\tabparbox%
               \advance\computedimens by \dp\tabparbox%
               \ifnum\parboxheight<\computedimens
                  \global\parboxheight=\computedimens
               \fi
               \computedimens=0pt
               \box\tabparbox\hfil}
\def\calmidlineheight{\midlineheight=\arraystretch \baslineskp
                      \global\advance\midlineheight by 1pt
                      \global\pargcorrection=4\midlineheight}
\def\calpage{\global\actsize=\pagetotal  % where am I on the actual page?
	     \twocolsize=\textheight            %  added 06.06.89
	     \advance\twocolsize by -\@colroom  %        "
	     \global\advance\actsize by \twocolsize    %        "
	     \global\advance\actsize by \midlineheight
	     \maxsize=\textheight        % start a new page when 90% of
	     \multiply \maxsize by 9     % the page are used
	     \divide\maxsize by 10
	     \advance\actsize 2\midlineheight
	     \ifnum\actsize > \maxsize
%                   \clearpage  % commented by TAP
		   \newpage  % added by TAP
		   \global\actsize=\pagetotal
	     \fi
	     \advance\actsize -2\midlineheight  % added by TAP 12.11.96
	     \maxsize=\textheight       % now set \maxsize with tolerance
             \setbox\@tempboxa=\vbox{\@arrayparboxrestore%
		\begin{tabular}{\tableformat}\@tabletail\end{tabular}}
             \global\advance\maxsize by-\ht\@tempboxa}
                             % Here is the definition of supertabular
\def\supertabular#1 {%           % before it was \edef\tableformat,
    \def\tableformat{\string#1} % store preamble
    \global\starfalse % remember this is the normal version
    \global\let\@oldcr=\\
    \def\baslineskp{\baselineskip}
    \calmidlineheight% estimate height of a normal line
    \calpage         % calculate max. pagesize and startpoint
    \if@topcaption                                    % added by TAP
      \@process@tablecaption                          % added by TAP
      \setbox\@tempboxa=\vbox{\@parboxrestore         % added by TAP
			      \@process@tablecaption} % added by TAP
      \global\advance\actsize by \ht\@tempboxa        % added by TAP
    \fi                                               % added by TAP
    \let\@@tabularcr\@tabularcr%             Added JB 4/2/91
    \let\@tabularcr\@stabularcr
    \let\@@startpbox=\@sstartpbox
    \let\@@endpbox=\@sendpbox
    \ifx\@table@first@head\undefined
        \let\@@tablehead=\@tablehead
    \else
        \let\@@tablehead=\@table@first@head
    \fi%                                     Added JB 4/2/91
%    \begin{tabular}[b]{\tableformat}%
    \begin{tabular}{\tableformat}%
    \@@tablehead}%   Added JB 15/2/91
\def\endsupertabular{%
    \ifx\@table@last@tail\undefined%
        \@tabletail%
    \else%
        \@table@last@tail%
    \fi%                                     Added JB 4/2/91
    \end{tabular}
    \let\@tabularcr\@@tabularcr             % Added JB 4/2/91
    \if@topcaption
    \else
        \@process@tablecaption
        \@topcaptiontrue
    \fi
    \global\let\\=\@oldcr
    \let\@table@first@head\undefined        % For the next ocurrence
    \let\@table@last@tail\undefined         % of this environment
    \global\let\@process@tablecaption\relax
    \global\let\@process@tablecaption@cont\relax  % added by TAP 12.02.96
}

\def\nextline{%           %%% algorithm to calculate the pagebreaks %%%
    \noalign{\ifnum\parboxheight<\midlineheight
                   \advance\actsize by \midlineheight
                   \global\advance\actsize by \addspace
             \else
                   \global\advance\actsize by \parboxheight
                   \divide\parboxheight by 11\relax
                   \global\advance\actsize by \parboxheight%
                   \global\parboxheight=0pt
             \fi
             \global\addspace=0pt}%
    \ifnum\actsize<\maxsize
    \noalign{\global\let\next\@empty}
    \else
         \@tabletail
	 \end{tabular}%
	 \newpage%
	 \if@twocolumn%                        % added 10.05.89
	    \global\actsize=\pagetotal                % added by TAP
	    \twocolsize=\textheight%           % added 06.06.89
	    \advance\twocolsize by -\@colroom% %       "
	    \global\advance\actsize by \twocolsize % added by TAP
%            \global\advance\actsize by 3\midlineheight % added by TAP
	    \global\advance\actsize by \midlineheight % added by TAP
	 \else
	    \global\actsize=\pagetotal                % added by TAP
	    \global\advance\actsize by \midlineheight % added by TAP
	 \fi
	 \if@topcaption
	    \@process@tablecaption@cont
	    \setbox\@tempboxa=\vbox{\@parboxrestore
				    \@process@tablecaption@cont}
	    \global\advance\actsize by \ht\@tempboxa
	 \fi
	 \let\next\@tablehead%                 % Added 15.2.91
%           \begin{tabular}[b]{\tableformat}%
	 \begin{tabular}{\tableformat}%
    \fi\next}%                                % Added \next 15.2.91

%
% End of file `saotabul.sty'.

\DeclareOption{saorus}{\input{saorus.clo}}
\ProcessOptions\relax

