% Copyright (C) 1988, 1994 Springer-Verlag, Inc.
% 
% Everyone is granted permission to copy and redistribute this file, as
% long as it is unchanged. If any changes are made the file MUST be renamed.
%
%
% svcon.sty Dec 94
% Fixed lots & lots of bugs
% Made compatible with LaTeX2e
%
%Get rid of ae's
\catcode`\^^Z 10

\newif\if@multipleauthors
\@ifundefined{@svsa}{%
        \@multipleauthorstrue
	\typeout{LaTeX2e package "svcon2e" (Springer-Verlag Contributor).
		released December 1994}}%
        {\@multipleauthorsfalse}
\@twosidetrue
\headheight=9pt
\headsep=15pt   % 2pc-9pt
\textheight=45pc
%Let's put integer number of 12-pt \baselineskip's on page
\advance\textheight-2\p@
\textwidth=27pc
\parindent=1em
\parskip\z@
%
% Running head: 9 pt CM, c/lc, 2em# inside of fl. outside folio, base aligns
% with folio; recto: CN, period, word # to CT; verso: contributor's name(s).
% In single-author, verso: SN, period, word # to ST.
%
% If you want the running heads on the opposite pages, just put \flipheads
% after the documentstyle.  LaTeX isn't bright enough to allow one option
% file to define ds@flipheads.
%
\newif\if@flipheads \@flipheadsfalse
\def\flipheads{\@flipheadstrue}
\def\ps@myheadings{%
  \let\@oddfoot\@empty\let\@evenfoot\@empty
  \if@flipheads
    \def\@evenhead{\small\upshape\thepage\hskip2em\rightmark\hfill}%
    \def\@oddhead{\small\upshape\hfil\leftmark\hskip 2em minus 1em\thepage}%
  \else
    \def\@evenhead{\small\upshape\thepage\hskip2em\leftmark\hfill}%
    \def\@oddhead{\small\upshape\hfil\rightmark\hskip 2em minus 1em\thepage}%
  \fi
  \def\chaptermark##1{\markbothsame{\dochapternumber##1}}%
  \if@multipleauthors
    \def\sectionmark##1{{}}%
  \else
    \def\sectionmark##1{\markboth{{}%
      {\ifnum\c@secnumdepth>\z@\thesection \ \fi##1}}}
  \fi}

\pagestyle{myheadings}
\pagenumbering{roman}   % toc is in roman
\def\@chapterauthors{}
\def\markbothsame#1{\mark{{#1}{#1}}}
%
% All pages without running heads must carry corner marks.
%
\def\clap#1{\hbox to 0pt{\hss#1\hss}}
\newdimen\@crosshairrule \@crosshairrule=.24pt
\def\@crosshairs{%
\vbox to 0pt{\hsize=0pt\baselineskip=0pt\lineskip=0pt
  \vss
  \clap{\vrule height .125in width \@crosshairrule depth 0pt}
  \clap{\vrule width .25in height \@crosshairrule depth 0pt
   \rlap{\vbox to\z@{\vss%\hbox{This is page \thepage\strut}%
%      \hbox{Printer: Opaque this\strut}
\vss}}}
  \clap{\vrule height .125in width \@crosshairrule depth 0pt}
  \vss}}
\def\ps@empty{%
\def\@oddhead{\hfill\raise\headheight\@crosshairs}
\let\@evenhead\@oddhead
\def\@evenfoot{}\let\@oddfoot\@evenfoot}
\frenchspacing
\def\@chapapp{}
%8/10
\def\viiiONx{\@setfontsize\@footnotesize\@viiipt{10pt}}
%12/14
\def\xiiONxiv{\@setfontsize\large\@xiipt{14pt}}
%14/16
\def\xivONxvi{\@setfontsize\Large\@xivpt{16pt}}
%14/14
\def\xivONxiv{\@setfontsize\Large\@xivpt{14pt}}
%20/20
\def\xxONxx{\@setfontsize\huge\@xxpt{20pt}}
%
\renewcommand\footnotesize{%
   \viiiONx
   \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@
   \abovedisplayshortskip \z@ \@plus\p@
   \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@
   \def\@listi{\leftmargin\leftmargini
               \topsep 3\p@ \@plus\p@ \@minus\p@
               \parsep 2\p@ \@plus\p@ \@minus\p@
               \itemsep \parsep}%
   \belowdisplayskip \abovedisplayskip
}
%
\def\chapter{\cleardoublepage      % Starts new recto.
   \thispagestyle{empty}     % Page style of chapter page is 'empty'
   \global\@topnum\z@        % Prevents figures from going at top of page.
   \@afterindentfalse        % Suppresses indent in first paragraph.  Change
   \secdef\@chapter\@schapter}   % to \@afterindenttrue to have indent.

%
% Chapter number: 20 CM bold, arabic numeral, fl.l, top text
% Chapter title: 20/20 CM bold x 27pc, c/lc, fl.l, sink 60 pt from top
%       type to base of CT, to's fl.l, do not hyphenate
%
\def\@makechapterhead#1{             % Heading for \chapter command
% We want the chapter number to be 20 pts from top text.  The simplest
% was is to set \topskip, making sure there's nothing between the number
% and the top of page, so \baselineskip doesn't come in.
  { \topskip=40pt \parindent 0pt \raggedright 
    \xxONxx\bf
    #1\par                      % Title.
    \nobreak                    % TeX penalty to prevent page break.
    \vskip-\prevdepth           % Fool TeX into ignoring the depth of
    \prevdepth=1sp              % the CT when spacing to the CA
    \if@multipleauthors
      \xdef\@chaptertitle{\dochapternumber#1}
      \vskip 16pt                % 2.5pi b/b between title and chapter authors
    \else
      \chaptermark{#1}
      \vskip 44pt        % want ~60pt b/b to abstract
    \fi
  } }
\def\dochapternumber{\ifnum\c@secnumdepth>\m@ne\@chapapp\ \thechapter. \ \fi}

\def\@makeschapterhead#1{             % Heading for \chapter* command
  { \topskip=80pt \parindent 0pt \raggedright 
    \xxONxx\bf
    #1\par                      % Title.
    \nobreak                    % TeX penalty to prevent page break.
    \vskip-\prevdepth           % Fool TeX into ignoring the depth of
    \prevdepth=1sp              % the CT when spacing to the CA
    \if@multipleauthors
      \xdef\@chaptertitle{\dochapternumber#1}
     \vskip 16pt                % 2.5pi b/b between title and chapter authors
    \else
      \chaptermark{#1}
      \vskip 44pt                % want ~60pt b/b to abstract
    \fi
  } }

\if@multipleauthors
\gdef\chapterauthors#1{%
        {\def\\{, }\def\footnote##1{}\def\footnotemark[##1]{}%
                \xdef\@chapterauthors{#1}}%
        \setsvmamark
        {\parindent0pt \raggedright\xivONxiv\bf #1\par
                \nobreak
}}\fi
\def\setsvmamark{\mark{{\@chapterauthors}{\@chaptertitle}}}
\def\shortchapname#1{\xdef\@chaptertitle{\dochapternumber#1}\setsvmamark}
\def\shortauthname#1{\xdef\@chapterauthors{#1}\setsvmamark}

%
% Restart the footnote counter each chapter.
%
%\newcounter{footnote}[chapter]
%
% FN    1pc space above footnotes to text.
%       5 pc 1/2 pt rule fl.l. above footnotes
%       leave 6pt # after rule followed by ftn
%
\skip\footins=18.5pt    % space above line and below line, 1pc+6pt+.5pt
\footskip=16pt
\footnotesep=7pt        % pretty arbitrary
\def\footnoterule{\kern-6.5pt\hrule width 5pc height .5pt\vskip 6pt}
%
% Footnote at end of chapter position below last text line (not at bottom
% of page).
%
\def\clearpage{\par\vfill\penalty -\@M \write\m@ne{}\vbox{}\penalty -\@Mi}
\def\newpage{\par\vfill\penalty -\@M}
\def\@makecol{\ifvoid\footins \setbox\@outputbox\box\@cclv
  \else\setbox\@outputbox
     \vbox{\unvbox\@cclv\vskip\skip\footins\footnoterule\unvbox\footins}\fi
     \xdef\@freelist{\@freelist\@midlist}\gdef\@midlist{}\@combinefloats
     \setbox\@outputbox\vbox to\@colht{\boxmaxdepth\maxdepth
        \@texttop
        \unvbox\@outputbox
        \@textbottom}\global\maxdepth\@maxdepth}
\flushbottom
%
% Abstract: 9/11 CMx25pi, sink 2.5pi b/b from CA
%
\def\abstract{\vskip 21pt % from CA
\rightskip=1pc\leftskip=1pc\parindent=\z@
\small\rm
{ABSTRACT }}
\def\endabstract{\par}  % If we don't do this, the paragraph won't be
                        % set until after rightskip and leftskip have been
                       % returned to their old values.

\def\tableofcontents{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
  \fi\chapter*{Contents\@mkboth{Contents}{Contents}}
  \@starttoc{toc}\if@restonecol\twocolumn\fi}

%
% Don't indent the paragraph following each header.  Vertical distances
% showld have \baselineskip taken out, and the height of the next
% line, which should be text (10/12 CM).
%
\setcounter{secnumdepth}{2}     % number section and subsections
\setcounter{tocdepth}{2}        % and put them in the table of contents
% No 1 Head, 14/16 CM, 36pt b/b above, 24 tp b/b below
\def\section{\@startsection
    {section}{1}{\z@}{-24pt plus -6pt minus -3pt}{12pt}%
        {\xivONxvi\rm\raggedright}}
% No 2 Head, 12/14 CM, c/sc, 30pt above, 18 pt below
\def\subsection{\@startsection
    {subsection}{2}{\z@}{-18pt plus-4.8pt minus-2.4pt}{6pt}%
        {\xiiONxiv\it\raggedright}}
% No 3 Head, 10/12 CM, 24pt above, 18pt below
\def\subsubsection{\@startsection
    {subsubsection}{3}{\z@}{-12pt plus-4.2pt minus-2.1pt}{6pt}%
        {\xONxii\rm\raggedright}}
% No 4 Head, 10/12 CM italic, 20pt above, 18pt below
\def\paragraph{\@startsection
     {paragraph}{4}{\z@}{-8pt plus-3.8pt minus-1.7pt}{6pt}%
        {\xONxii\it\raggedright}}
% No 5 Head, 10/12 CM italic, period,  en space to run in text, 18pt above
\def\subparagraph#1{\@startsection
     {subparagraph}{5}{\z@}{-6pt plus-1.8pt minus-.9pt}{-.5em}{\xONxii\it}{#1.}}
% Ack: Acknowledgements same as No 5 head, 36pt above
\def\acknowledgments{\@startsection
     {subparagraph}{6}{\z@}{-24pt plus-3.6pt minus-1.8pt}{-.5em}%
        {\xONxii\it}*{Acknowledgments:\/}}
% R-1: ``References'', same as No.2 head
% unless it's single-author.
\def\mainbibliography#1{{\@multipleauthorsfalse\bibliography{#1}}}
\def\thebibliography#1{%
\if@multipleauthors
%  \@startsection
%    {section}{2}{\z@}{-16pt plus -5pt minus -1pt}{6pt}%

\vspace{1cm}\noindent{\sc References}
%       {\xiiONxiv\sc\raggedright}{References}%
\else
  \chapter*{References\@mkboth
  {References}{References}}%
  \addcontentsline{toc}{chapter}{\protect\numberline{}References}%
\fi
%endif
  \list
  {[\arabic{enumiv}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
    \advance\leftmargin\labelsep
%Per zwart, enumi replaced by enumiv in this macro
    \usecounter{enumiv}}
    \def\newblock{\hskip .11em plus .33em minus -.07em}
    \sloppy
    \sfcode`\.=1000\relax}
% Put index in the toc
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
\columnsep 35pt\twocolumn[\hbox{}\vskip 48pt\@makeschapterhead{Index}]
    \addcontentsline{toc}{chapter}{\protect\numberline{}Index}%
    \@mkboth{Index}{Index}\thispagestyle{empty}\parindent\z@
    \parskip\z@ plus .3pt\relax\let\item\@idxitem}

%
% lists: 10/12 CMx27pc, 1/2line# above/below
%
\topsep 6pt plus1.8pt minus.9pt    % Extra vertical space, in addition to 
                                   % \parskip, added above and below list and
                                   % paragraphing environments.
\itemsep 6pt plus1.8pt minus.9pt   % Extra vertical space, in addition to
                                   % \parskip, added between list items.
%
% Eq: Center on text width; equation numbers set flush right, align with
% last line of equation, 6pt # above/below.
%
\abovedisplayskip=6pt plus 1.8pt minus.9pt
\belowdisplayskip=\abovedisplayskip
\abovedisplayshortskip=\z@ plus 1.2pt
\belowdisplayshortskip=3pt plus 1.5pt minus .75pt
%
% FL: Figure legends ``FIGURE 0.0'' 9/11 CM, c/lc, period, word # to text.
\floatsep 12pt plus 2.4pt minus 1.2pt
\textfloatsep 12pt plus 4.8pt
\intextsep 12pt plus 2.4pt minus 1.2pt
%%\@maxsep 12pt
%
\long\def\@makecaption#1#2{{
   \vskip 6pt
   \small
   \setbox\@tempboxa\hbox{#1. #2}
   \ifdim \wd\@tempboxa >\hsize   % IF longer than one line:
       \unhbox\@tempboxa\hfil\par      %   THEN set as ordinary paragraph.
     \else                        %   ELSE  center.
       \hbox to\hsize{\hfil\box\@tempboxa\hfil}
   \fi}}
\def\fnum@figure{\small FIGURE \thefigure}%{\sc FIGURE~}\thefigure}
%
% TN+TT: ``TABLE 0.0'' 9/11 CM, c/lc. period, word # to table title:
% 3 pt # below to 1/2 pt rule x table measuer, 3 pt # below rule to
% TCH
%
\arrayrulewidth=.5pt
\def\fnum@table{\small TABLE~\thetable}
\def\TableSubtitleRule{\noalign{\vskip 3pt}\hline\noalign{\vskip 3pt}}
\long\def\TableFootnote#1{\gdef\TFN{#1}}

\def\@@startpbox#1{\vtop\bgroup \hsize #1\@arrayparboxrestore
\parindent=-1em\leftskip=1em}
\newsavebox{\@stablebox}
\def\stable#1#2{\@ifnextchar[{\@stable{#1}{#2}}{\@stable{#1}{#2}[h]}}
\def\@stable#1#2[#3]{\begin{table}[#3]
        \def\foo{#1}\def\TFN{}%
        \viiiONx
        \setbox\@stablebox=\hbox\bgroup
        \begin{tabular}{#2}%
        \noalign{\vskip 3pt}
        \hline
        \noalign{\vskip 3pt}}
\@namedef{endstable}{\crcr\noalign{\vskip 6pt}\hline\end{tabular}\egroup
$$\vbox{\hsize=\wd\@stablebox
\caption{\foo}
\box\@stablebox
\prevdepth=0pt  % last thing was a rule
\par
\TFN}$$
\end{table}}
%%%% GROT.  This is hacked to move a label definition outside.
%%%% I think the whole stable idea is broken.

\def\stable#1#2{\@ifnextchar[{\@stable{#1}{#2}}{\@stable{#1}{#2}[h]}}
\def\@stable#1#2[#3]{\table[#3]
        \def\foo{#1}\def\TFN{}\def\stablelabel{}%
        \viiiONx
        \setbox\@stablebox=\hbox\bgroup\def\label##1{\gdef\stablelabel{\label{##1}}}%
        \tabular{#2}%
        \noalign{\vskip 3pt}%
        \hline
        \noalign{\vskip 3pt}}
\@namedef{endstable}{\crcr\noalign{\vskip 6pt}\hline\endtabular\egroup
$$\vbox{\hsize=\wd\@stablebox
\caption{\foo}\stablelabel
\box\@stablebox
\prevdepth=0pt  % last thing was a rule
\par
\TFN}$$
\endtable}

\def\stablecont#1#2{\@ifnextchar[{\@stablecont{#1}{#2}}{\@stablecont{#1}{#2}[h]}}
\def\@stablecont#1#2[#3]{\table[#3]
        \def\foo{#1}\def\TFN{}
        \viiiONx
        \setbox\@stablebox=\hbox\bgroup\def\label{\error}
        \tabular{#2}%
        \noalign{\vskip 3pt}%
        \hline
        \noalign{\vskip 3pt}}
\@namedef{endstablecont}{\crcr\noalign{\vskip 6pt}\hline\endtabular\egroup
$$\vbox{\hsize=\wd\@stablebox
  \begingroup
    \@parboxrestore
        \vskip 10pt
        \small
           \setbox\@tempboxa\hbox{\ignorespaces \foo}
           \ifdim \wd\@tempboxa >\hsize   % IF longer than one line:
               \unhbox\@tempboxa\hfil\par      %   THEN set as ordinary paragraph.
             \else                        %   ELSE  center.
               \hbox to\hsize{\hfil\box\@tempboxa\hfil}
           \fi\par
  \endgroup
\box\@stablebox
\prevdepth=0pt  % last thing was a rule
\par
\TFN}$$
\endtable}

%%%%
\newdimen\stabularwidth

\def\stabular{\@ifnextchar[{\@stabular}{\@stabular[h]}}
\def\@stabular[#1]#2{
       \setbox\@stablebox=\hbox\bgroup\viiiONx
        \tabular[#1]{#2}%
        \noalign{\vskip 3pt}%
        \hline
        \noalign{\vskip 3pt}}
\def\endstabular{\crcr\noalign{\vskip 6pt}\hline\endtabular\egroup
\stabularwidth=\wd\@stablebox
\box\@stablebox}

\def\thesection{\arabic{section}}  %% deletes Chap No from Section.
\def\thefigure{\@arabic\c@figure}  %% deletes Chap No from Section.

\def\appendix{\par
 \setcounter{chapter}{0}
 \setcounter{section}{0}
 \def\@chapapp{}
 \def\thechapter{\Alph{chapter}}}

\usepackage{psfig}
\def\figput#1#2#3{\begin{figure}\hfil%
\psfig{figure=#1,height=#2}\hfil\caption{#3}%
                    \end{figure}}
\def\figpage#1#2#3{\begin{figure}[p]\hfil%
\psfig{figure=#1,height=#2}\hfil\caption{#3}%
                    \end{figure}}
% End of svcon2e.sty
\endinput



