%
% ivs.cls   
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%\ProvidesClass{ivs}[2000/01/24 v1.00-NV- IVS Standard LaTeX]
%\ProvidesClass{ivs}[2000/04/17 v1.04-NV- IVS Standard LaTeX]
%\ProvidesClass{ivs2e}[2000/11/20 v1.05-NV- IVS Standard LaTeX]
\ProvidesClass{ivs2e}[2001/03/07 v1.06-NV- IVS Standard LaTeX]
%
% This is file `ivs.cls', based on  'article.cls'
%
%  WHEN          WHO        Ver WHAT
%  99-05-19      Hayo Hase  0.1 created from article.cls = Leonid's ivs.sty
%                               \figurename, \tablename, \parskip modified
%                               other \setlength from ivs-header.tex added
%  99-05-19      Hayo Hase  0.2 cut and paste of Leonid's ivs.sty v.0.2
%                               removed \it from his abstract
%  99-05-21      Hayo Hase  0.5 adjusted to ivs.sty V 0.5 of Leonid Petrov
%                               \figurename, \tablename, \parskip reset to
%                               original, \setlength commands removed
%  99-06-10      Hayo Hase  0.7 adjusted to ivs.sty V 0.7 of Leonid Petrov
%                               default point size is 11pt
%                               \caption for figure and table now \small        
%                               : after Figure/Table replaced by .
%  99-06-11      Hayo Hase  0.71 \caption for fig./tab. are \footnotesize
%                               headers are not \it anymore                             
%  99-06-11      Hayo Hase  0.72 \caption for fig./tab. are \small
%                               abstract is \small too
%  00-01-24      NRV        1.00 Copied IVS specific code from ivs_100.sty.
%  00-11-20      NRV        1.05 Copied IVS specific code from ivs_105.sty.
%  01-03-07      KDB        1.06 Redefine \AA as A with small circle above, 
%                                not just plain A.  (But PET warns that this
%                                will generate extra characters in the table of
%                                contents, as well as potentially other 
%                                problems.)
%  03-11-12      KDB        1.07 Until now, ivs2e.cls has placed short table 
%                                captions directly on the start of the table.  
%                                Now insert some space between the caption and
%                                the table start.  Specifically, 10pt will be
%                                inserted, to make the spacing look the same as
%                                in ivs.sty tables.
%                                NOTE: this change should not be put into 
%                                      ivs.sty.  The whole point of the change
%                                      is to make the vertical table caption/
%                                      table spacing in the two files the same
%                                      (selecting the nicer (ivs.sty) spacing.)
%
%  06-07-09      DBB        1.08 Changed oddsidemargin and evensidemargin for
%                                letter size to get 2-sided print match.
%                                hoffset was not changed.
%                                Note: Previous to new values are:
%                                      oddsidemargin    24mm to 19mm
%                                      evensidemargin   13mm to  8mm
%
% 
%  Send comments and bug reports (and praise) to hase@wettzell.ifag.de
%
%  Known problems
%  --------------
%  1. \documentclass[10pt]{ivs2e} or \documentclass[11pt]{ivs2e} are moving
%     textbody to the right side compared with 12pt (default).
%
% ivs.sty  V 1.00  24-JAN-2000 18:31:11
%
%
%  ivs.sty was created by L. Petrov
%
%  Send comments and bug reports to lpetrov@ivscc.gsfc.nasa.gov
%
%*******************************************************************
%*                                                                 *
%*  This is the release of Version 1.00, following development     *
%*  of earlier versions.                                           *
%*                                                                 *
%*******************************************************************
%
%  NEW COMMANDS:
%  ~~~~~~~~~~~~~
%
%  \PublicationName{NAME}   -- Publication name.
%                              Example:
%                                  \PublicationName{IVS Annual report, 1999}
%
%  \PublicationType{TYPE}   -- publication type. One of the list:
%                              report, proceedings
%                              Example: \PublicationType{report}
%
%  \PaperSize{CODE}         -- Optional command: paper size. One of the list:
%                              A4 or Letter. Default is Letter, used when 
%                              this command is omitted.
%
%  \IvsComponentName{NAME}  -- name of your IVS component
%                              Examples: \IvsComponentName{Matera} or
%                                 \IvsComponentName{Onsala Analysis Center}
%
%  \Title{NAME}             -- Title of the presentation. Words may stay in
%                              upper or lower case.
%                              Example: \Title{First geodetic observations
%                                              using Mark-VII VLBI system}
%
%  \STitle{NAME}            -- Shortened version of the title of the 
%                              presentation, used for page headers. 
%                              Should not contain more than 30 characters.
%                              Example: \STitle{First Mark-VII observations}
%
%  \NumberofAuthors{NUMBER} -- number of the authors of the presentation whose
%                              names will be listed.
%                              Example: \NumberofAuthors{2}
%
%  \AuthorName{NUMBER}{NAME} -- name of the NUMBER-th author. Name is in the
%                               format: F. Last
%                               Example: \AuthorName{1}{R. Smith}
%                               Example: \AuthorName{87}{Z. Li-Huan}
%
%  \AuthorEmail{NUMBER}{NAME} -- e-mail address of the NUMBER-th author. Empty
%                                argument should be used if the author doesn't
%                                have e-mail address.
%                                Example: \AuthorEmail{4}{smith@astro.edu}
%                                Example: \AuthorEmail{1}{}
%
%  \AuthorTelephone{NUMBER}{NAME} -- telephone number(s) of the NUMBER-th
%                                 author. Empty argument should be used if the
%                                 author doesn't have telephone. Country code
%                                 and area code should be present. More than
%                                 one telephone number may be specified. Either
%                                 office telephone or private telephone number
%                                 or both may be specified.
%                                 Example: \AuthorTelephone{1}{}
%                                 Example:
%                                   \AuthorTelephone{6}{+49-9941-603-104
%                                       (office), +49-9941-603-314 (TIGO-VLBI)}
%
%  \AuthorPersonalWebPage{NUMBER}{NAME} -- URL of personal Web page of the
%                                 NUMBER-th author. Empty argument should be
%                                 used if the author doesn't have a personal
%                                 Web page.
%                                 Example: \AuthorPersonalWebPage{3}{}
%                                 Example: \AuthorPersonalWebPage{5}
%                                   {http://www.astro.org/~smith/index.html}
%
%  \AuthorInstitutionReference{NUMBER}{REF} -- REF is the index of the 
%                                 institution in the institution list for the 
%                                 NUMBER-th author.
%                                 Examples:
%                                   \AuthorInstitutionReference{1}{1}
%                                      (for author 1 at institution 1)
%                                   \AuthorInstitutionReference{2}{1}
%                                      (for author 2 at institution 1)
%                                   \AuthorInstitutionReference{3}{2}
%                                      (for author 3 at institution 2)
%
%  \ContactAuthorReference{NUMBER}   -- index of the author in the author list
%                                    who is considered as the contact author.
%                                    The name and e-mail address of the
%                                    contact author are printed below the
%                                    institution line. Value of 0 suppress 
%                                    printing the name and e-mail of the 
%                                    contact author.
%                                 Example:
%                                   \ContactAuthorReference{2}
%                                   \ContactAuthorReference{0}
%
%
%  \NumberofInstitutions{NUMBER) -- the number of institutions with which 
%                              authors of the presentation are affiliated.
%                              Example: \NumberofInstitutions{1}
%
%  \InstitutionName{NUMBER}{NAME} -- Full name of the NUMBER-th Institution.
%                               No abbreviations please.
%                               Example: \InstitutionName{1}{Astronomical
%                                     Institute of the Underground Observatory}
%                               Example: \InstitutionName{8}{University of
%                                                            Babylon}
%
%  \InstitutionPostAddress{NUMBER}{NAME} -- Full address of the institution,
%                               including zip code and country name.
%                               IMPORTANT: use \ (backslash and blank) to 
%                               split items of the address onto lines:
%                               Example: \InstitutionName{1}{Ramses sq. 5, \
%                                         Babylon, 88102, \ Assyria}
%
%                                 It corresponds to:
%
%                                    Ramses sq. 5, 
%                                    Babylon, 88102, 
%                                    Assyria
%
%  \InstitutionCountry{NUMBER}{NAME} -- Country name where the institution
%                                       is located.
%
%  \InstitutionFax{NUMBER}{NAME} -- Fax number of the NUMBER-th institution.
%                                 Empty argument should be used if the
%                                 institution doesn't have fax. Country code
%                                 and area code should be specified also.
%                                 Example: \InstitutionFax{1}{+49-9941-603-104}
%
%  \InstitutionWebPage{NUMBER}{NAME} -- URL of the Web page of the
%                                 NUMBER-th institution. Empty argument should
%                                 be used if the institution doesn't have
%                                 a Web page.
%                                 Example: \InstitutionWebPage{2}{}
%                                 Example: \InstitutionWebPage{4}
%                                           {http://www.babylon.ant}
%
%   \MakeTitle -- command for making title. It is a replacement of the standard
%                 \maketitle command. \MakeTitle should be the first executable
%                 command after \begin{document}. The following commands
%
%                 \Title, \STitle, \PublicationType, \PublicationName, 
%                 \IvsComponentName, \NumberofAuthors, \AuthorName, 
%                 \AuthorEmail, \AuthorTelephone, \AuthorPersonalWebPage,
%                 \AuthorInstitutionReference, \ContactAuthorReference, 
%                 \NumberofInstitutions, \InstitutionName, 
%                 \InstitutionPostAddress, \InstitutionCountry, 
%                 \InstitutionFax, \InstitutionWebPage
%
%                 must all be specified and must precede \MakeTitle
%
%  WARNING:
%
%  1) User working directory should not contain files with extension .ivs --
%     filenames  with extension .ivs are reserved for special needs.
%  2) LaTeX will generate a file with extension .frm and if user had it
%     before, contents of that file will be re-written.
%
%
%  History:
%
%  19-MAY-99  v 0.5  Leonid Petrov  first pre-release.
%
%  05-JUN-99  v 0.6  Leonid Petrov  Added some internal commands for an editor
%                                   of the proceedings.
%
%  10-JUN-99  v 0.7  Leonid Petrov  Changed fontsize from 12pt to 11 pt
%                                   in according with a special request of
%                                   editor.
%
%  10-JUN-99  v 0.71 Leonid Petrov  Changed font style for headings from italic
%                                   to normal. Changed fontsize for captions
%                                   from normal to footnotesize in according
%                                   with a special request of editor.
%
%  10-JUN-99  v 0.72 Leonid Petrov  Changed font style for captions from
%                                   footnotesize to small in according with
%                                   a request
%
%  24-JUN-99  v 0.8  Leonid Petrov  Support of new editorial commands is added:
%                                     \@Twoside{logical}
%                                     \@MakeHeader{logical}
%                                     \@MakeFooter{logical}
%                                     \@HeaderText{string}
%                                     \@FooterText{string}
%                                     \@PaperSize{constant}
%                                   These commands may appear only in 
%                                   {jobname}.ivs file
%
%  27-JUN-99  v 0.81 Leonid Petrov  a) Corrected a mistake in re-definition of
%                                     \enddocument: added \leavevmode
%                                   b) Corrected a mistake in definition of 
%                                   defaults for editorial commands: use 
%                                   \let instead of \gdef
%                                   c) Corrected a type for \@PaperSizeDefault
%
%  01-JUL-99  v 0.82 N. Vandenberg  Changed \@HeaderText to
%                                           \@LeftHeaderText and
%                                           \@RightHeaderText
%                                   Defaults are component name and institution
%
%  05-JUL-99  v 0.83 L. Petrov      a) Corrected a bug in implementation of 
%                                      header logic. 
%                                   b) Renamed LeftHeader to FirstHeader
%                                      and RightHeader to SecondHeader.
%                                   c) Redefined accents-making commands to
%                                      the definitions declared in plain.tex
%
%  05-JUL-99  v 0.84 N. Vandenberg  Changed default paper size to Letter.
%  14-JUL-99  v 0.85 N. Vandenberg  Changed oddsidemargin, evensidemargin,
%                                   and hoffset to get 2-sided print match.
%  15-JUL-99  v 0.86 L. Petrov      a) Redefined all accent-making macros by 
%                                      using definitions from plain.tex. 
%                                      Redefined \AA as A (as simple A without 
%                                      a small circle at the top)
%                                   b) Corrected an error in the re-definition 
%                                      of enddocument: the previous version 
%                                      wrote a wrong last pagenumber in the 
%                                      case when the source file contained 
%                                      float objects at the very end.
%
% 16-JAN-2000 v 0.90 L. Petrov      Massive changes.
%                                   a) Added new mandatory commands:
%                                      \STitle, \InstitutionCountry, \PaperSize
%                                   b) Added support of new \PublicationType :
%                                      proceedings
%                                   c) Added support of new editorial commands:
%                                      \@Url, @UrlExtension
%                                   d) Now editorial commands @PublicationName,
%                                      @PaperSize supersede user-defined 
%                                      commands \PublicationName \PaperSize 
%                                   e) Corrected \voffset for A4 page size
%
% 20-JAN-2000 v 0.91 L. Petrov      Fixed a bug: counter start@counter was not
%                                   initiliazed when no editoral commands were 
%                                   supplied.
%
% 21-JAN-2000 v 0.92 L. Petrov      Institution list is centered when only one
%                                   institution and adjusted to the left edge
%                                   otherwise.
%
%                                   New item: contact e-mail is added to the
%                                   title just after institution list when
%                                   publication type is proceedings
%
% 24-JAN-2000 v 0.93 L. Petrov      Added support of a new mandatory macros
%                                   \ContactAuthorReference. Forced to flushleft
%                                   institution list in all cases.

% 24-JAN-2000 v 1.00 N. Vandenberg  Edited some descriptive comments.
%                                  
%
%  END OF NEW COMMANDS DESCRIPTION
%  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
%  
%  END OF NEW COMMANDS DESCRIPTION
%  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
%
%  Notes for programmers:
%
%%
%% The original source files were:
%%
%% classes.dtx  (with options: `article')
%% 
%% This is a generated file.
%% 
%% Copyright 1993 1994 1995 1996 1997
%% The LaTeX3 Project and any individual authors listed elsewhere
%% in this file.
%% 
%% For further copyright information, and conditions for modification
%% and distribution, see the file legal.txt, and any other copyright
%% notices in this file.
%% 
%% MODIFICATION ADVICE:
%% 
%% If you want to customize this file, it is best to make a copy of
%% the source file(s) from which it was produced.  Use a different
%% name for your copy(ies) and modify the copy(ies); this will ensure
%% that your modifications do not get overwritten when you install a
%% new release of the standard system.  You should also ensure that
%% your modified source file does not generate any modified file with
%% the same name as a standard file.
%% 
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%
%
\newcommand\@ptsize{}
\newif\if@restonecol
\newif\if@titlepage
\@titlepagefalse
\if@compatibility\else
\DeclareOption{a4paper}
   {\setlength\paperheight {297mm}%
    \setlength\paperwidth  {210mm}}
\DeclareOption{a5paper}
   {\setlength\paperheight {210mm}%
    \setlength\paperwidth  {148mm}}    
\DeclareOption{b5paper}
   {\setlength\paperheight {250mm}%
    \setlength\paperwidth  {176mm}}
\DeclareOption{letterpaper}
   {\setlength\paperheight {11in}%
    \setlength\paperwidth  {8.5in}}
\DeclareOption{legalpaper}
   {\setlength\paperheight {14in}%
    \setlength\paperwidth  {8.5in}}
\DeclareOption{executivepaper}
   {\setlength\paperheight {10.5in}%
    \setlength\paperwidth  {7.25in}}
\DeclareOption{landscape}
   {\setlength\@tempdima   {\paperheight}%
    \setlength\paperheight {\paperwidth}%
    \setlength\paperwidth  {\@tempdima}}
\fi
\if@compatibility
  \renewcommand\@ptsize{0}
\else
\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
\fi
\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
\if@compatibility\else
\DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse}
\fi
\DeclareOption{twoside}{\@twosidetrue  \@mparswitchtrue}
\DeclareOption{draft}{\setlength\overfullrule{5pt}}
\if@compatibility\else
\DeclareOption{final}{\setlength\overfullrule{0pt}}
\fi
\DeclareOption{titlepage}{\@titlepagetrue}
\if@compatibility\else
\DeclareOption{notitlepage}{\@titlepagefalse}
\fi
\if@compatibility\else
\DeclareOption{onecolumn}{\@twocolumnfalse}
\fi
\DeclareOption{twocolumn}{\@twocolumntrue}
\DeclareOption{leqno}{\input{leqno.clo}}
\DeclareOption{fleqn}{\input{fleqn.clo}}
\DeclareOption{openbib}{%
  \AtEndOfPackage{%
   \renewcommand\@openbib@code{%
      \advance\leftmargin\bibindent
      \itemindent -\bibindent
      \listparindent \itemindent
      \parsep \z@
      }%
   \renewcommand\newblock{\par}}%
}
\ExecuteOptions{letterpaper,11pt,oneside,onecolumn,final}
\ProcessOptions
\input{size1\@ptsize.clo}
\setlength\lineskip{1\p@}
\setlength\normallineskip{1\p@}
\renewcommand\baselinestretch{}
%\setlength\parskip{1.5ex \@plus0.5ex \@minus0.5ex}
%\setlength\parindent{0mm}
\setlength\parskip{0\p@ \@plus \p@}
\@lowpenalty   51
\@medpenalty  151
\@highpenalty 301
\setcounter{topnumber}{2}
\renewcommand\topfraction{.7}
\setcounter{bottomnumber}{1}
\renewcommand\bottomfraction{.3}
\setcounter{totalnumber}{3}
\renewcommand\textfraction{.2}
\renewcommand\floatpagefraction{.5}
\setcounter{dbltopnumber}{2}
\renewcommand\dbltopfraction{.7}
\renewcommand\dblfloatpagefraction{.5}
\if@twoside
  \def\ps@headings{%
      \let\@oddfoot\@empty\let\@evenfoot\@empty
      \def\@evenhead{\thepage\hfil\slshape\leftmark}%
      \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
      \let\@mkboth\markboth
    \def\sectionmark##1{%
      \markboth {\MakeUppercase{%
        \ifnum \c@secnumdepth >\z@
          \thesection\quad
        \fi
        ##1}}{}}%
    \def\subsectionmark##1{%
      \markright {%
        \ifnum \c@secnumdepth >\@ne
          \thesubsection\quad
        \fi
        ##1}}}
\else
  \def\ps@headings{%
    \let\@oddfoot\@empty
    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \let\@mkboth\markboth
    \def\sectionmark##1{%
      \markright {\MakeUppercase{%
        \ifnum \c@secnumdepth >\m@ne
          \thesection\quad
        \fi
        ##1}}}}
\fi
\def\ps@myheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\thepage\hfil\slshape\leftmark}%
    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    }
  \if@titlepage
  \newcommand\maketitle{\begin{titlepage}%
  \let\footnotesize\small
  \let\footnoterule\relax
  \let \footnote \thanks
  \null\vfil
  \vskip 60\p@
  \begin{center}%
    {\LARGE \@title \par}%
    \vskip 3em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
      \vskip 1.5em%
    {\large \@date \par}%       % Set date in \large size.
  \end{center}\par
  \@thanks
  \vfil\null
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}
\else
\newcommand\maketitle{\par
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hb@xt@1.8em{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
    \if@twocolumn
      \ifnum \col@number=\@ne
        \@maketitle
      \else
        \twocolumn[\@maketitle]%
      \fi
    \else
      \newpage
      \global\@topnum\z@   % Prevents figures from going at top of page.
      \@maketitle
    \fi
    \thispagestyle{plain}\@thanks
  \endgroup
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}
\def\@maketitle{%
  \newpage
  \null
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
    {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em}
\fi
\setcounter{secnumdepth}{3}
\newcounter {part}
\newcounter {section}
\newcounter {subsection}[section]
\newcounter {subsubsection}[subsection]
\newcounter {paragraph}[subsubsection]
\newcounter {subparagraph}[paragraph]
\renewcommand \thepart {\@Roman\c@part}
\renewcommand \thesection {\@arabic\c@section}
\renewcommand\thesubsection   {\thesection.\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection .\@arabic\c@subsubsection}
\renewcommand\theparagraph    {\thesubsubsection.\@arabic\c@paragraph}
\renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}
\newcommand\part{\par
   \addvspace{4ex}%
   \@afterindentfalse
   \secdef\@part\@spart}

\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
    {\parindent \z@ \raggedright
     \interlinepenalty \@M
     \normalfont
     \ifnum \c@secnumdepth >\m@ne
       \Large\bfseries \partname~\thepart
       \par\nobreak
     \fi
     \huge \bfseries #2%
     \markboth{}{}\par}%
    \nobreak
    \vskip 3ex
    \@afterheading}
\def\@spart#1{%
    {\parindent \z@ \raggedright
     \interlinepenalty \@M
     \normalfont
     \huge \bfseries #1\par}%
     \nobreak
     \vskip 3ex
     \@afterheading}
\newcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\Large\bfseries}}
\newcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\large\bfseries}}
\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\normalfont\normalsize\bfseries}}
\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\bfseries}}
\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                       {3.25ex \@plus1ex \@minus .2ex}%
                                       {-1em}%
                                      {\normalfont\normalsize\bfseries}}
\if@twocolumn
  \setlength\leftmargini  {2em}
\else
  \setlength\leftmargini  {2.5em}
\fi
\leftmargin  \leftmargini
\setlength\leftmarginii  {2.2em}
\setlength\leftmarginiii {1.87em}
\setlength\leftmarginiv  {1.7em}
\if@twocolumn
  \setlength\leftmarginv  {.5em}
  \setlength\leftmarginvi {.5em}
\else
  \setlength\leftmarginv  {1em}
  \setlength\leftmarginvi {1em}
\fi
\setlength  \labelsep  {.5em}
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
\renewcommand\theenumi{\@arabic\c@enumi}
\renewcommand\theenumii{\@alph\c@enumii}
\renewcommand\theenumiii{\@roman\c@enumiii}
\renewcommand\theenumiv{\@Alph\c@enumiv}
\newcommand\labelenumi{\theenumi.}
\newcommand\labelenumii{(\theenumii)}
\newcommand\labelenumiii{\theenumiii.}
\newcommand\labelenumiv{\theenumiv.}
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\theenumi(\theenumii)}
\renewcommand\p@enumiv{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
\newcommand\labelitemiii{\textasteriskcentered}
\newcommand\labelitemiv{\textperiodcentered}
\newenvironment{description}
               {\list{}{\labelwidth\z@ \itemindent-\leftmargin
                        \let\makelabel\descriptionlabel}}
               {\endlist}
\newcommand*\descriptionlabel[1]{\hspace\labelsep
                                \normalfont\bfseries #1}
\if@titlepage
  \newenvironment{abstract}{%
      \titlepage
      \null\vfil
      \@beginparpenalty\@lowpenalty
      \begin{center}%
        \bfseries \abstractname
        \@endparpenalty\@M
      \end{center}}%
      {\par\vfil\null\endtitlepage}
\else
  \newenvironment{abstract}{%
      \if@twocolumn
        \section*{\abstractname}%
      \else
        \small
        \begin{center}%
          {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}%
        \end{center}%
        \quotation
      \fi}
      {\if@twocolumn\else\endquotation\fi}
\fi
\newenvironment{verse}
               {\let\\\@centercr
                \list{}{\itemsep      \z@
                        \itemindent   -1.5em%
                        \listparindent\itemindent
                        \rightmargin  \leftmargin
                        \advance\leftmargin 1.5em}%
                \item\relax}
               {\endlist}
\newenvironment{quotation}
               {\list{}{\listparindent 1.5em%
%               {\list{}{\listparindent 0.0em%       % no indent in abstract!
                        \itemindent    \listparindent
                        \rightmargin   \leftmargin
                        \parsep        \z@ \@plus\p@}%
                \item\relax}
               {\endlist}
\newenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax}
               {\endlist}
\if@compatibility
\newenvironment{titlepage}
    {%
      \if@twocolumn
        \@restonecoltrue\onecolumn
      \else
        \@restonecolfalse\newpage
      \fi
      \thispagestyle{empty}%
      \setcounter{page}\z@
    }%
    {\if@restonecol\twocolumn \else \newpage \fi
    }
\else
\newenvironment{titlepage}
    {%
      \if@twocolumn
        \@restonecoltrue\onecolumn
      \else
        \@restonecolfalse\newpage
      \fi
      \thispagestyle{empty}%
      \setcounter{page}\@ne
    }%
    {\if@restonecol\twocolumn \else \newpage \fi
     \if@twoside\else
        \setcounter{page}\@ne
     \fi
    }
\fi
\newcommand\appendix{\par
  \setcounter{section}{0}%
  \setcounter{subsection}{0}%
  \renewcommand\thesection{\@Alph\c@section}}
\setlength\arraycolsep{5\p@}
\setlength\tabcolsep{6\p@}
\setlength\arrayrulewidth{.4\p@}
\setlength\doublerulesep{2\p@}
\setlength\tabbingsep{\labelsep}
\skip\@mpfootins = \skip\footins
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}
\renewcommand \theequation {\@arabic\c@equation}
\newcounter{figure}
\renewcommand \thefigure {\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename~\thefigure}
\newenvironment{figure}
               {\@float{figure}}
               {\end@float}
\newenvironment{figure*}
               {\@dblfloat{figure}}
               {\end@dblfloat}
\newcounter{table}
\renewcommand\thetable{\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename~\thetable}
\def\tableconstant{table}
\newenvironment{table}
               {\@float{table}}
               {\end@float}
\newenvironment{table*}
               {\@dblfloat{table}}
               {\end@dblfloat}
\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{10\p@}
\setlength\belowcaptionskip{0\p@}
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
%  \sbox\@tempboxa{#1: #2}%
  \sbox\@tempboxa{#1. #2}%
  \ifdim \wd\@tempboxa >\hsize
%    #1: #2\par
    #1. #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal}
\DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal}
\newcommand\@pnumwidth{1.55em}
\newcommand\@tocrmarg{2.55em}
\newcommand\@dotsep{4.5}
\setcounter{tocdepth}{3}
\newcommand\tableofcontents{%
    \section*{\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
    \@starttoc{toc}%
    }
\newcommand*\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty\@secpenalty
    \addvspace{2.25em \@plus\p@}%
    \begingroup
      \setlength\@tempdima{3em}%
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
       \nobreak
       \if@compatibility
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
      \fi
    \endgroup
  \fi}
\newcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
    \endgroup
  \fi}
\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}}
\newcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}}
\newcommand*\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}}
\newcommand*\l@subparagraph{\@dottedtocline{5}{10em}{5em}}
\newcommand\listoffigures{%
    \section*{\listfigurename
      \@mkboth{\MakeUppercase\listfigurename}%
              {\MakeUppercase\listfigurename}}%
    \@starttoc{lof}%
    }
\newcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\newcommand\listoftables{%
    \section*{\listtablename
      \@mkboth{%
          \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}%
    \@starttoc{lot}%
    }
\let\l@table\l@figure
\newdimen\bibindent
\setlength\bibindent{1.5em}
\newenvironment{thebibliography}[1]
     {\section*{\refname
        \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}%
%      \list{\@biblabel{\@arabic\c@enumiv}}%
      \small \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
\let\@openbib@code\@empty
\newenvironment{theindex}
               {\if@twocolumn
                  \@restonecolfalse
                \else
                  \@restonecoltrue
                \fi
                \columnseprule \z@
                \columnsep 35\p@
                \twocolumn[\section*{\indexname}]%
                \@mkboth{\MakeUppercase\indexname}%
                        {\MakeUppercase\indexname}%
                \thispagestyle{plain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \let\item\@idxitem}
               {\if@restonecol\onecolumn\else\clearpage\fi}
\newcommand\@idxitem{\par\hangindent 40\p@}
\newcommand\subitem{\@idxitem \hspace*{20\p@}}
\newcommand\subsubitem{\@idxitem \hspace*{30\p@}}
\newcommand\indexspace{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
\renewcommand\footnoterule{%
  \kern-3\p@
  \hrule\@width.4\columnwidth
  \kern2.6\p@}
\newcommand\@makefntext[1]{%
    \parindent 1em%
    \noindent
    \hb@xt@1.8em{\hss\@makefnmark}#1}
\newcommand\contentsname{Contents}
\newcommand\listfigurename{List of Figures}
\newcommand\listtablename{List of Tables}
\newcommand\refname{References}
\newcommand\indexname{Index}
\newcommand\figurename{Figure}
\newcommand\tablename{Table}
%% \newcommand\figurename{\sl \small Fig.}
%% \newcommand\tablename{\sl \small Tab.}
\newcommand\partname{Part}
\newcommand\appendixname{Appendix}
\newcommand\abstractname{Abstract}
\newcommand\today{}
\edef\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}
\setlength\columnsep{10\p@}
\setlength\columnseprule{0\p@}
\pagestyle{plain}
\pagenumbering{arabic}
\if@twoside
\else
  \raggedbottom
\fi
\if@twocolumn
  \twocolumn
  \sloppy
  \flushbottom
\else
  \onecolumn
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% The part below was taken from ivs.sty v0.7 by Leonid Petrov.
% Commands below are original TeX.
% Many of them can be replaced by high-level LaTeX commands.
% Send comments and bug reports (and praise) to lpetrov@ivscc.gsfc.nasa.gov
%
% The part below was taken from ivs_105.sty.
%
% IVS specific definitions
% ~~~~~~~~~~~~~~~~~~~~~~~~
%
%     RE-DEFINITIONS
%
%
% --- Re-definition of caption "." instead of ":" is put between the
% --- caption counter and caption name
%
\long\def\@makecaption#1#2{\vskip 9pt \setbox\@tempboxa
         \hbox{\small #1. #2}
         \ifdim \wd\@tempboxa >\hsize{\small #1. #2}
           \par 
         \else 
           \hbox to\hsize {\hfil\box\@tempboxa\hfil}
%          If this is a table, insert some space between the caption and the
%          start of the table.
           \ifx\@captype\tableconstant
             \vskip 10pt
           \fi
         \fi}
%
% --- Re-definition of sections. Identation in the first paragraph of the
% --- section is allowed.
%
\def\@spart#1{{\parindent 0pt \raggedright
 \huge \bf
 #1\par} \nobreak \vskip 3ex \@afterheading }
\def\section{\@startsection {section}{1}{\z@}{3.5ex plus -1ex minus
 -.2ex}{2.3ex plus .2ex}{\large\bf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{3.25ex plus -1ex minus
 -.2ex}{1.5ex plus .2ex}{\large\bf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{3.25ex plus
 -1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\bf}}
\def\paragraph{\@startsection
 {paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-1em}{\normalsize\bf}}
\def\subparagraph{\@startsection
 {subparagraph}{4}{\parindent}{3.25ex plus 1ex minus
 .2ex}{-1em}{\normalsize\bf}}
%
% --- Re-definition of sect in order to add a dot after a section name.
% --- Decreased space between the dot after the section name and the section
% --- name
%
\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \let\@svsec\@empty\else
     \refstepcounter{#1}\edef\@svsec{\csname the#1\endcsname.\hskip 0.5em}\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\relax  %% \relax added 2 May 90
                   \@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}}
%
% --- Changed interval between items in the list of the first level --
% --- interval set less.
%
\def\@listI{\leftmargin\leftmargini \parsep 3pt plus 1.5pt minus 1pt\topsep
5pt plus 2pt minus 3pt\itemsep 3pt plus 1.5pt minus 1pt}
\let\@listi\@listI
\@listi
%
% --- Redefinition of \thebibliography. Fontsize was changed to \small
% --- (10-JUN-99)
%
\def\thebibliography#1{\section*{\refname\@mkboth
 {\uppercase{\refname}}{\uppercase{\refname}}}\small\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
%
% --- Definition of Headers
%
\gdef\@oddhead{\parbox{\textwidth}{\footnotesize%
   \ifx \@PublicationType \@StringProceedings
        \ifnum \c@page = \start@counter
%
% ---------- In the case of Proceedings and first page we put two items at 
% ---------- the header: Citation and URL
%
             \@nameuse{@Citation} \ \\
	     \if F\@nameuse{@UrlExtension}
	          \@nameuse{@Url} 
	        \else
	          \@nameuse{@Url}\jobname\@nameuse{@UrlExtension}
	     \fi
             \par\vspace{-6ex}\par\noindent\
	   \else
%
% ---------- Normal header
%
             \@FirstHeaderText\hfill%
             \par\vspace{-2ex}\par\noindent\rule{\textwidth}{0.1mm}
	\fi
      \else
             \@FirstHeaderText\hfill\@SecondHeaderText%
             \par\vspace{-2ex}\par\noindent\rule{\textwidth}{0.1mm}
   \fi
}}
%
\gdef\@evenhead{\parbox{\textwidth}{\footnotesize%
   \ifx \@PublicationType \@StringProceedings
        \ifnum \c@page = \start@counter
%
% ---------- In the case of Proceedings and first page we put two items at 
% ---------- the header: Citation and URL
%
             \@nameuse{@Citation} \ \\
	     \if F\@nameuse{@UrlExtension}
	          \@nameuse{@Url} 
	        \else
	          \@nameuse{@Url}\jobname\@nameuse{@UrlExtension}
	     \fi
             \par\vspace{-6ex}\par\noindent\
          \else
%
% ---------- Normal header
%
             \@FirstHeaderText\hfill%
             \par\vspace{-2ex}\par\noindent\rule{\textwidth}{0.1mm}
	\fi
      \else
             \@SecondHeaderText\hfill\@FirstHeaderText%
             \par\vspace{-2ex}\par\noindent\rule{\textwidth}{0.1mm}
   \fi
}}
%
% --- Definition of Footers
%
\def\@oddfoot{\parbox{\textwidth}{\footnotesize
    \par\noindent\footnotesize\rule{\textwidth}{0.1mm}%
    \par\vspace{0.1ex}\par\noindent\@nameuse{@FooterText}\hfill\thepage}}
%
\def\@evenfoot{\parbox{\textwidth}{\footnotesize
    \par\noindent\footnotesize\rule{\textwidth}{0.1mm}%
    \par\vspace{0.1ex}\par\noindent\thepage\hfill\@nameuse{@FooterText}}}
%
% --- Redefined \enddocument in order to write the last page number in
% --- {jobname}.frm file (27-JUN-99) (Corrected on 15-JUL-99)
%
\newcount\@IfCounter
\def\if@one#1#2#3{ 
	          \@IfCounter=\@nameuse{#1}
                  \ifnum \@IfCounter=1
                         #2
                     \else                  
                         #3
                  \fi
                 }
\def\if@zero#1#2#3{ 
	          \@IfCounter=\@nameuse{#1}
                  \ifnum \@IfCounter=0
                         #2
                     \else                  
                         #3
                  \fi
                 }
%
\def\enddocument{\@checkend{document}\leavevmode
\clearpage
%
\let\c@lastpage=\c@page
\advance\c@lastpage by -1
%
% --- Write down some commads whcih will be used in future:
% --- StartPage, LastPage and Citation 
%
\immediate\write\@auxout{\string\@gnamedef{@StartPage}{\number\start@counter}}
\immediate\write\@auxout{\string\@gnamedef{@LastPage}{\number\c@lastpage}}
%       
\if@one{@NumberofAuthors}
       {\immediate\write
        \@auxout{\string\@gnamedef{@Citation}{\@nameuse{@AuthorName1}: 
                                 \@nameuse{@Title}, 
                                 \@nameuse{@PublicationName}, 
                               p.\number\start@counter--\number\c@lastpage } }
       }
%
% --- more than one author
%
       {
        \if@zero{@NumberofAuthors}
           {
            \immediate\write
            \@auxout{\string\@gnamedef{@Citation}{\@nameuse{@Title}, 
                            \@nameuse{@PublicationName}, 
                             p.\number\start@counter--\number\c@lastpage }}
           }
           {
            \immediate\write
            \@auxout{\string\@gnamedef{@Citation}{\@nameuse{@AuthorName1} 
                             et al.: \@nameuse{@Title}, 
                            \@nameuse{@PublicationName}, 
                             p.\number\start@counter--\number\c@lastpage }}
           }
       }
\immediate\write\@frmfile{\string Lastpagenumber: \number\c@lastpage}
\typeout{FirstPagenumber is \number\start@counter}
\typeout{LastPagenumber  is \number\c@lastpage}
%
\begingroup
\if@filesw \immediate\closeout\@mainaux
\def\global\@namedef##1##2{}\def\newlabel{\@testdef r}%
\def\bibcite{\@testdef b}\@tempswafalse \makeatletter\input \jobname.aux
\if@tempswa \@@warning{Label(s) may have changed.  Rerun to get
cross-references right}\fi\fi\endgroup\deadcycles\z@\@@end}
%
% --- definition accents as it had been done in plain TeX (refer to TeX-book,
% --- page 356 ). Version of LaTeX 99.6.2 (and probably older, but not older 
% --- than 96.3.29) re-defines accents by using \@ commands what makes 
% --- impossible to use expanded text in another LaTeX documents. These 
% --- definitions have been copied from plain.tex file.
%
\def\`#1{{\accent18 #1}}
\def\'#1{{\accent19 #1}}
\def\v#1{{\accent20 #1}} \let\^^_=\v
\def\u#1{{\accent21 #1}} \let\^^S=\u
\def\=#1{{\accent22 #1}}
\def\^#1{{\accent94 #1}} \let\^^D=\^
\def\.#1{{\accent95 #1}}
\def\H#1{{\accent"7D #1}}
\def\~#1{{\accent"7E #1}}
\def\"#1{{\accent"7F #1}}
\def\t#1{{\edef\next{\the\font}\the\textfont1\accent"7F\next#1}}
%
\chardef\%=`\%
\chardef\&=`\&
\chardef\#=`\#
\chardef\$=`\$
\chardef\ss="19
\chardef\ae="1A
\chardef\oe="1B
\chardef\o="1C
\chardef\AE="1D
\chardef\OE="1E
\chardef\O="1F
\chardef\i="10 \chardef\j="11 % dotless letters
\def\aa{\accent23a}
\def\l{\char32l}
\def\L{\leavevmode\setbox0\hbox{L}\hbox to\wd0{\hss\char32L}}
%\def\AA{A}
\def\AA{\leavevmode\setbox0\hbox{h}\dimen@\ht0\advance\dimen@-1ex%
  \rlap{\raise.67\dimen@\hbox{\char'27}}A}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%     DEFINITIONS OF NEW COMMANDS
%
%
% --- Definitions of constants
%
\gdef\@StringAfour{A4}
\gdef\@StringLetter{Letter}
\gdef\@StringReport{report}
\gdef\@StringProceedings{proceedings}
\gdef\@StringEmpty{\ }
\gdef\@QMark{?}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Syntax of editoral commands:  (defined in \jobname.ivs 
%  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
%                              NB: editoral commands are for an editor only!
%
%
%  \@Startpage{number}     -- sets the page number of the starting page
%                             \@Startpage{164} means that the first page of the
%                             paper has number 164, the second page -- 165 and
%                             so on
%  \@Abstractonly{logical} -- If T then only abstract will be made, while other 
%                             part of the document is ignored.
%  \@Twoside{logical}      -- If T then left horizonatal margins for add and 
%                             even pages will not be equal.
%  \@MakeHeader{logical}   -- If T then headers will be add at the top of the
%                             page.
%  \@MakeFooter{logical}   -- If T then footer will be add at the bottom of the
%                             page.
%  \@HeaderText{string}    -- defines the header text. \@IvsComponentName 
%                             overrides this definition when \@PublicationType 
%                             is report
%  \@FooterText{string}    -- defines the footer text
%  \@PaperSize{constant}   -- Two constants are supported: A4 and Letter.
%                             They defines paper size. When defined supersedes
%                             user-supplied paper size.
%  \@PublicationName{string} -- Publication name. When defined supersedes
%                               user-supplied publication name.
%  \@Url{string}           -- URL of the publication which is printed in the
%                             header of the first page in proceedings 
%                             publication type.
%  \@UrlExtension{string}  -- Extension of the URL. If not defined then the
%                             string @Url is considered as a final URL.
%                             If \@UrlExtension is defined then full URL is
%                             concatenation of @Url \jobnmame \@UrlExtension .
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% --- Global version of @namedef
%
\def\@gnamedef#1{\expandafter\gdef\csname #1\endcsname}
%
% --- Define a new counter for keeping the page number 
% --- (Command @Startpage may reset value of this counter)
%
\newcount\start@counter 
\start@counter=\c@page 
%
%
% --- Definitions of default values of editors commands. These defaults
% --- are used when no editoral file {jobname}.ivs was found in the current
% --- directory
%
\gdef\@Startpage#1{\c@page=#1 
                   \start@counter=\c@page 
                   \typeout{Start page: \thepage} }
\gdef\@AbstractonlyDefault{}  % Default: dummy command
\gdef\@TwosideDefault{F}
\gdef\@MakeFooterDefault{F}
\gdef\@MakeHeaderDefault{F}
\gdef\@HeaderTextDefault{Header text (default)}
\gdef\@FirstHeaderTextDefault{First header text (default)}
\gdef\@SecondHeaderTextDefault{Second header text (default)}
\gdef\@FooterTextDefault{Footer text (default)}
\gdef\@PaperSizeDefault{Letter}
\gdef\@UrlDefault{http://www.default.host}
\gdef\@CitationDefault{???}
\gdef\@LastPageDefault{?}
\gdef\@UrlExtensionDefault{F}
%
% --- Read input file {jobname}.ivs (05-JUN-99)
%
\def\@Input#1{\openin\@inputcheck #1 \ifeof\@inputcheck
                \relax
              \else\closein\@inputcheck \relax\@@input #1
                 \typeout {Read input file: #1}
              \fi}
%
% --- Now check: if the file {jobname}.ivs exist then read it. (05-JUN-99)
%
\@Input{\jobname.ivs}
%
% --- Open the output file for information about the presentation.
% --- frm-file is for making Web page, table of content, list of authors,
% --- list of institutions and so on. It will be processed by special software.
%
\newwrite\@frmfile
\immediate\openout\@frmfile=\jobname.frm
%
% ---- Use default if not defined (27-JUN-99)
%
\@ifundefined{@Abstractonly}{\let\@Abstractonly=\@AbstractonlyDefault}{\relax}
\@ifundefined{@Twoside}     {\let\@Twoside=\@TwosideDefault}          {\relax}
\@ifundefined{@MakeFooter}  {\let\@MakeFooter=\@MakeFooterDefault}    {\relax}
\@ifundefined{@MakeHeader}  {\let\@MakeHeader=\@MakeHeaderDefault}    {\relax}
\@ifundefined{@HeaderText}  {\let\@HeaderText=\@HeaderTextDefault}    {\relax}
\@ifundefined{@FirstHeaderText} {\let\@FirstHeaderText=\@FirstHeaderTextDefault}
                                {\relax}
\@ifundefined{@SecondHeaderText}{\let\@SecondHeaderText=\@SecondHeaderTextDefault}
                                {\relax}
\@ifundefined{@FooterText}  {\let\@FooterText=\@FooterTextDefault}    {\relax}
\@ifundefined{@Url}         {\let\@Url=\@UrlDefault}                  {\relax}
\@ifundefined{@UrlExtension}{\let\@UrlExtension=\@UrlExtensionDefault}{\relax}
\@ifundefined{@LastPage}    {\let\@LastPage=\@LastPageDefault}        {\relax}
\@ifundefined{@Citation}    {\if T\@Abstractonly
                                 {\let\@Citation=\@EmptyString}
                                 {\let\@Citation=\@CitationDefault}
                             \fi}                                     {\relax}
%
%
% --- Write down first number of the first page (05-JUN-99)
%
\immediate\write\@frmfile{\string Firstpagenumber: \thepage}
%
% --- Template defintions for TITLE section. @-analog is defined for each
% --- macros. And its ocntent is written to the frm-file.
%
\gdef\Title#1{\gdef\@Title{#1}
\immediate\write\@frmfile{\string Title: #1} }

\gdef\STitle#1{\gdef\@STitle{#1}
\immediate\write\@frmfile{\string STitle: #1} }

\gdef\PublicationType#1{\@namedef{@PublicationType}{#1}
\immediate\write\@frmfile{\string PublicationType: #1} }

\@ifundefined{@PublicationName}
  {\gdef\PublicationName#1{\gdef\@PublicationName{#1}
   \immediate\write\@frmfile{\string PublicationName: #1} }
  }
  {\gdef\PublicationName#1{
   \immediate\write\@frmfile{\string PublicationName: 
   \@nameuse{@PublicationName} } }
  }

\gdef\PaperSize#1{\@ifundefined{@PaperSizea}{\relax}{\gdef\@PaperSize{#1}} }

\gdef\IvsComponentName#1{\gdef\@IvsComponentName{#1}
\immediate\write\@frmfile{\string IvsComponentName: #1} }

%
% --- Template defintions for AUTHORS section
%
\gdef\NumberofAuthors#1{\gdef\@NumberofAuthors{#1}
\immediate\write\@frmfile{\string NumberofAuthors: #1} }

\gdef\@AuthorName{}{}
\gdef\AuthorName#1#2{\@namedef{@AuthorName#1}{#2}
\immediate\write\@frmfile{\string AuthorName#1: #2} }

\gdef\@AuthorEmail{}{}
\gdef\AuthorEmail#1#2{\@namedef{@AuthorEmail#1}{#2}
\immediate\write\@frmfile{\string AuthorEmail#1: #2} }

\gdef\@AuthorTelephone{}{}
\gdef\AuthorTelephone#1#2{\@namedef{@AuthorTelephone#1}{#2}
\immediate\write\@frmfile{\string AuthorTelephone#1: #2} }

\gdef\@AuthorPersonalWebPage{}{}
\gdef\AuthorPersonalWebPage#1#2{\@namedef{@AuthorPersonalWebPage#1}{#2}
\immediate\write\@frmfile{\string AuthorPersonalWebPage#1: #2} }

\gdef\@AuthorInstitutionReference{}{}
\gdef\AuthorInstitutionReference#1#2{\@namedef{@AuthorInstitutionReference#1}{#2}
\immediate\write\@frmfile{\string AuthorInstitutionReference#1: #2} }

\gdef\ContactAuthorReference#1{\gdef\@ContactAuthorReference{#1}
\immediate\write\@frmfile{\string ContactAuthorReference: #1} }

%
% --- Template defintions for INSTITUTIONS section
%
\gdef\NumberofInstitutions#1{\gdef\@NumberofInstitutions{#1}
\immediate\write\@frmfile{\string NumberofInstitutions: #1} }

\gdef\@InstitutionName{}{}
\gdef\InstitutionName#1#2{\@namedef{@InstitutionName#1}{#2}
\immediate\write\@frmfile{\string InstitutionName#1: #2} }

\gdef\@InstitutionPostAddress{}{}
\gdef\InstitutionPostAddress#1#2{\@namedef{@InstitutionPostAddress#1}{#2}
\immediate\write\@frmfile{\string InstitutionPostAddress#1: #2} }

\gdef\@InstitutionCountry{}{}
\gdef\InstitutionCountry#1#2{\@namedef{@InstitutionCountry#1}{#2}
\immediate\write\@frmfile{\string InstitutionCountry#1: #2} }

\gdef\@InstitutionFax{}{}
\gdef\InstitutionFax#1#2{\@namedef{@InstitutionFax#1}{#2}
\immediate\write\@frmfile{\string InstitutionFax#1: #2} }

\gdef\@InstitutionWebPage{}{}
\gdef\InstitutionWebPage#1#2{\@namedef{@InstitutionWebPage#1}{#2}
\immediate\write\@frmfile{\string InstitutionWebPage#1: #2} }

\gdef\MakeTitle{
%
% --- First checks of the general arguments. All of them should be defined
%
   \@CheckCharArg{Title}
   \@CheckCharArg{STitle}
   \@CheckCharArg{PublicationType}
   \@CheckCharArg{PublicationName}
   \@CheckCharArg{IvsComponentName}
   \@CheckCharArg{NumberofAuthors}
   \if@zero{@NumberofAuthors}
            {\typeout{Warning: NumberofAuthors is ZERO. Are you sure?}}
            {\@CheckIntegerArg{ContactAuthorReference}}
   \@CheckCharArg{NumberofInstitutions}
   \if@zero{@NumberofAuthors}{\relax}
           {\@CheckContactAuthorReference{ContactAuthorReference}}
%
% --- Check: was all information about all institutions defined?
%
   \if@zero{@NumberofAuthors}{\relax}
      {\newcount\counter@Institutions  % Counter of the institutions
       \loop
           \advance\counter@Institutions by 1
           \@CheckInstitution{\number\counter@Institutions}
           \ifnum\counter@Institutions < \@NumberofInstitutions
       \repeat
      }
%
% --- Define headers
%
   \ifx \@PublicationType \@StringReport
        \gdef\@FirstHeaderText {\@nameuse{@InstitutionName1}}
        \gdef\@SecondHeaderText{\@nameuse{@IvsComponentName}} 
        \def\@PulicationTypeDefined{\relax}
   \fi
   \ifx \@PublicationType \@StringProceedings
        \if@one{@NumberofAuthors}
               {\gdef\@FirstHeaderText {\@nameuse{@AuthorName1}: \quad
                                        \@nameuse{@STitle} }
               }
%
% ------------ else
%
                 {\if@zero{@NumberofAuthors}
                          {\gdef\@FirstHeaderText{\@nameuse{@STitle}} }
                          {\gdef\@FirstHeaderText {\@nameuse{@AuthorName1} 
                                       et al.: \quad \@nameuse{@STitle} }
                 }
               }
        \gdef\@SecondHeaderText{\@nameuse{@StringEmpty}} 
        \def\@PulicationTypeDefined{\relax}
   \fi
   \@ifundefined{@PulicationTypeDefined}
      {\@latexerr{PublicationType \@PublicationType is not supported.
                  report or proceedings expected}
                 {Please check syntax of the preamble. Refer to manual 
                  of ivs.sty}
       \end
      }
      {\relax}
   \@ifundefined{@PaperSize}   
      {\let\@PaperSize=\@PaperSizeDefault}
      {\relax}
   \ifx \@PaperSize\@StringAfour
        \hoffset        = -21mm
        \voffset        = -25mm
        \typeout{A4 paper size}
      \else
        \ifx \@PaperSize\@StringLetter
             \hoffset = -13mm
             \voffset = -11mm
             \typeout{Letter paper size}
        \else
             \@latexerr{PaperSize \@PaperSize is not supported. 
                        Only A4 or Letter are supported}
                        {Please check syntax of the {jobname}.ivs file. 
                        Refer to manual of ivs.sty}
    \fi
\fi
%
\if T\@Twoside
    \@twosidetrue 
    \@mparswitchtrue 
    \typeout{Two side mode} 
    \ifx \@PaperSize \@StringAfour
         \oddsidemargin  25mm
         \evensidemargin 13mm
       \else
         \ifx \@PaperSize \@StringLetter
              \oddsidemargin  19mm
              \evensidemargin  8mm
         \fi
    \fi
  \else
    \gdef\@evenhead{\@oddhead} 
    \gdef\@evenfoot{\@oddfoot} 
    \typeout{One side mode} 
\fi
%
% --- Now make the title
%
   \begin{center}
      \null
      \ifx \@PublicationType \@StringProceedings
%
% -------- We took some soapce for citation
%
           \vskip  0.0ex
	 \else
           \vskip -3.0ex
      \fi
%
%  --- Print title name
%
      {\Large\bf \@Title \par}
      \vskip 2.5ex
%
% --- ... and authors list
%
      {\large \lineskip .5em \sl
       \if@zero{@NumberofAuthors}{\relax}
          {\newcount\counter@Authors % Counter of authors
           \loop
              \advance\counter@Authors by 1
%
% ----------- Check: was all information about the author supplied?
%
              \@CheckAuthor{\number\counter@Authors}
              \ifnum \counter@Authors < \@NumberofAuthors
%
% --------------- Add the author to the line of the authors and put the comma
%
                 \ifx \@PublicationType \@StringProceedings
	              \ifnum \@NumberofInstitutions > 1
                          \mbox{\@nameuse{@AuthorName\number\counter@Authors}
${}^{\@nameuse{@AuthorInstitutionReference\number\counter@Authors}}$, }
	                \else
                          \mbox{\@nameuse{@AuthorName\number\counter@Authors}, }
                      \fi
                 \fi
                 \ifx \@PublicationType \@StringReport
                     \mbox{\@nameuse{@AuthorName\number\counter@Authors}, }
                 \fi
                 \hspace{-3.0em}
               \else
%
% --------------- Add the author to the line of the authors
%
                 \ifx \@PublicationType \@StringProceedings
	              \ifnum \@NumberofInstitutions > 1
                          \mbox{\@nameuse{@AuthorName\number\counter@Authors}
${}^{\@nameuse{@AuthorInstitutionReference\number\counter@Authors}}$ }
	               \else
                           \mbox{\@nameuse{@AuthorName\number\counter@Authors}}
                      \fi
                 \fi
                 \ifx \@PublicationType \@StringReport
                      \mbox{\@nameuse{@AuthorName\number\counter@Authors}}
                 \fi
             \fi
            \ifnum\counter@Authors < \@NumberofAuthors
          \repeat
         }
      \par
%
      \ifx \@PublicationType \@StringProceedings
         \if@zero{@NumberofAuthors}{\relax}
           { \vskip 2.5ex
%
% ----------- Institutions list
%
             \newcount\counter@Institutions % Counter of authors
	     \ifnum \@NumberofInstitutions > -1 % always 24-JAN-2000 18:15:00
	          \begin{flushleft} % adjusted to the left edge when more than
	        \else                %          one institution
	          \begin{center}    % centered when only one institution
	     \fi
%
             \loop
                \advance\counter@Institutions  by 1
%
% -------------- Check: was all information about the institution is supplied?
%
                \@CheckInstitution{\number\counter@Institutions}
                { \quad \small \it 
	            \ifnum \@NumberofInstitutions > 1
                         ${}^{\number\counter@Institutions)}$
	            \fi 
                    \@nameuse{@InstitutionName\number\counter@Institutions}} \\
                \ifnum\counter@Institutions < \@NumberofInstitutions
             \repeat
%
% ---------- Contact e-mail
%
	     \ifnum\@nameuse{@ContactAuthorReference} > 0
%
% ------------- It is printed only if @ContactAuthorReference is not 0
%
	        \vskip 0.25ex
	        {\quad \small \it 
%
% ---------------- Name of the contact author is printed only if there is more
% ---------------- than one author
%
	           \if@one{@NumberofAuthors}
	              {\relax}
                      {Contact author:  
                       \mbox{\@nameuse{@AuthorName\@nameuse{@ContactAuthorReference}}},
	              }
%
% ----------------- Now e-mail address
%
                    e-mail: 
                    \tt \mbox{
                       \@nameuse{@AuthorEmail\@nameuse{@ContactAuthorReference}}
                             }
	        }
	     \fi % ContactAuthorReference
%
	     \ifnum \@NumberofInstitutions > -1 % always 24-JAN-2000 18:15:07
	         \end{flushleft}
	       \else
	         \end{center}
	     \fi
           }
         \fi % number of authores
      }
      \par
      \vskip 2.5ex
   \end{center}
}
%
% --- re-definition of abstract environment
%
\gdef\abstract{
    \if T\@Abstractonly
           \typeout{Abstract only mode}
           \relax
        \else
           \small
     \fi
%
    \begin{center}
           {\normalsize\bf \abstractname\vspace{-.5em}\vspace{0pt}}
    \end{center}
%
    \smallskip
    \if T\@Abstractonly
           \relax
        \else
           \footnotesize
    \fi
    \quotation
}
%
% --- Redifition of \endabstract.  (05-JUN-99)
% --- TeX will process the input file in normal more if the file
% --- {jobname}.ivs  doesn't have definition  of @Abstractonly or it
% --- is it defines @Abstractonly as some string not T.
% ---
% --- If @Abstractonly is defined as T  ( \gdef\@Abstractonly{T} )
% --- then TeX should quit processing after printing abstract.
%
\gdef\endabstract{\endquotation
      \if T\@Abstractonly
          {\gdef\thepage{}\clearpage\deadcycles\z@\@@end}
      \fi
}
%
%  --- Check: was all information about the author defined?
%
\def\@CheckAuthor#1{
  \@ifundefined{@AuthorName#1}
     {\@latexerr{AuthorName{#1} was not defined}
     {Please check syntax of the author list. Refer to manual of ivs.sty}}
     {\relax}
%
  \@ifundefined{@AuthorEmail#1}
     {\@latexerr{AuthorEmail{#1} was not defined}
     {Please check syntax of the author list. Refer to manual of ivs.sty}}
     {\relax}
%
  \@ifundefined{@AuthorTelephone#1}
     {\@latexerr{AuthorTelephone{#1} was not defined}
     {Please check syntax of the author list. Refer to manual of ivs.sty}}
     {\relax}
%
  \@ifundefined{@AuthorPersonalWebPage#1}
     {\@latexerr{AuthorPersonalWebPage{#1} was not defined}
     {Please check syntax of the author list. Refer to manual of ivs.sty}}
     {\relax}
%
  \@ifundefined{@AuthorInstitutionReference#1}
     {\@latexerr{AuthorInstitutionReference{#1} was not defined}
     {Please check syntax of the author list. Refer to manual of ivs.sty}}
     {\relax}
  \ifnum \@nameuse{@AuthorInstitutionReference#1} < 1
     {\@latexerr{AuthorInstitutionReference{#1} is less than 1 }
     {Please check syntax of the author list. Refer to manual of ivs.sty}}
  \fi
%
  \ifnum \@nameuse{@AuthorInstitutionReference#1} > 
         \@nameuse{@NumberofInstitutions}
     {\@latexerr{AuthorInstitutionReference{#1} is greater than the number of
      Institutions}
     {Please check syntax of the author list. Refer to manual of ivs.sty}}
  \fi
}
%
%  --- Check: was all information about the institution defined?
%
\def\@CheckInstitution#1{
  \@ifundefined{@InstitutionName#1}
     {\@latexerr{InstitutionName{#1} was not defined}
     {Please check syntax of the institution list. Refer to manual of ivs.sty}}
     {\relax}
%
  \@ifundefined{@InstitutionPostAddress#1}
     {\@latexerr{InstitutionPostAddress{#1} was not defined}
     {Please check syntax of the institution list. Refer to manual of ivs.sty}}
     {\relax}
%
  \@ifundefined{@InstitutionCountry#1}
     {\@latexerr{InstitutionCountry{#1} was not defined}
     {Please check syntax of the institution list. Refer to manual of ivs.sty}}
     {\relax}
%
  \@ifundefined{@InstitutionFax#1}
     {\@latexerr{InstitutionFax{#1} was not defined}
     {Please check syntax of the institution list. Refer to manual of ivs.sty}}
     {\relax}
%
  \@ifundefined{@InstitutionWebPage#1}
     {\@latexerr{InstitutionWebPage{#1} was not defined}
     {Please check syntax of the institution list. Refer to manual of ivs.sty}}
     {\relax}
}
\def\@CheckContactAuthorReference#1{
   \@CheckIntegerArg{#1}
   \ifnum\@nameuse{@#1}<0
     {\@latexerr{Negative index in \ContactAuthior }
      {Please check syntax of the institution list. Refer to manual of ivs.sty}}
     {\relax}
   \fi
   \ifnum\@nameuse{@ContactAuthorReference}>\@nameuse{@NumberofAuthors}
     {\@latexerr{Too large index in \ContactAuthior }
      {Please check syntax of the institution list. Refer to manual of ivs.sty}}
     {\relax}
   \fi
}
%
%  --- Check: was the character arguemnt defined?
%
\def\@CheckCharArg#1{
\@ifundefined{@#1}
   {\@latexerr{#1 was not defined}
              {Please check syntax of the preamble. Refer to manual of ivs.sty}
   }
   {\relax}
}
%
%  --- Check: was the integer arguemnt defined?
%
\def\@CheckIntegerArg#1{
\@ifundefined{@#1}
   {\@latexerr{#1 was not defined}
              {Please check syntax of the preamble. Refer to manual of ivs.sty}
   }
   {\relax}
}
%
% --- Tolerance pharameters
%
\tolerance      = 600     % more loose test is allowed
\hfuzz          = 0.3mm   % more loose right edge alignment is allowed
%
% --- Margins
%
\footskip       =  10mm
\textheight     = 217mm
\textwidth      = 164mm
%
\if T\@MakeFooter
    \relax
    \typeout{Make footer}
  \else
    \gdef\@evenfoot{\hfill \thepage \hfill} 
    \gdef\@oddfoot {\hfill \thepage \hfill} 
    \typeout{Don't make footer}
\fi
%
\if T\@MakeHeader
    \relax
    \typeout{Make header}
  \else
    \gdef\@evenhead{\relax} 
    \gdef\@oddhead {\relax} 
    \typeout{Don't make header}
\fi
%
% and that is all for today...
%
