\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{paper}

\ProcessOptions\relax

\LoadClass[a4paper,12pt,oneside]{article}
\RequirePackage[numbers,sort&compress]{natbib}
\RequirePackage{base}

\renewcommand{\cite}[1]{\citep{#1}}


\setlength{\doublerulesep}{0pt}

\addtolength{\oddsidemargin}{-28pt}
\addtolength{\evensidemargin}{-28pt}
\addtolength{\marginparwidth}{-56pt}
\addtolength{\textwidth}{56pt}
\addtolength{\topmargin}{-17pt}
\addtolength{\textheight}{34pt}

\setlength{\parskip}{1.5ex plus0.5ex minus0.5ex}

\setcounter{topnumber}{1}
\setcounter{bottomnumber}{2}
\renewcommand{\topfraction}{.7}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.1}

\def\email#1{\thanks{email: \texttt{#1}}}

\let\@preprintnumber\@empty
\def\preprintnumber#1{\gdef\@preprintnumber{#1}}

\newcounter{institute}
\def\theinstitute{${}^{\textit{\alph{institute}}}$}

\let\@institute\@empty
\let\@institutes\@empty
\def\institute#1{\gdef\@institute{#1}}
\def\institutes#1{\gdef\@institutes{#1}}

\def\@makeinstitute{{\paskip\medskip\it\@institute\par}}
\def\@makeinstitutes{%
  \def\institute##1##2{%
    \refstepcounter{institute}%
    \label{##1}%
    {\it\theinstitute ##2\par}%
  }%
  \@institutes
}

\let\art@endabstract\endabstract
\let\art@abstract\abstract
\let\@abstract\@empty
\long\def\abstract#1{\long\gdef\@abstract{#1}}

%% \def\endabstract{%
%%   \art@endabstract%
%%   \thispagestyle{empty}%
%%   \setcounter{page}{0}%
%%   \newpage%
%% }



%% \newenvironment{institute}{%
%%   \medskip\parskip\z@\refstepcounter{institute}%
%%   \centering\theinstitute\it}%
%% {\par}


\def\@maketitle{%
  \newpage
%  \null
  \ifx\@empty\@preprintnumber
  \else
    {\raggedleft\@preprintnumber\par}
  \fi
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\LARGE\bf \@title \par}%
    \vskip 1.5em%
    {\large\sc
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1.5em%
    \ifx\@empty\@institutes
      \ifx\@empty\@institute
      \else
        \@makeinstitute
      \fi
    \else
      \@makeinstitutes
    \fi
%%     \vskip 1em%
%%     {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em%
  \ifx\@empty\@abstract
  \else
    \art@abstract%
      \noindent\ignorespaces\@abstract%
    \art@endabstract%
  \fi%
}

\def\maketitlepage{%
  \maketitle%
  \setcounter{page}{0}%
  \thispagestyle{empty}%
  \newpage%
}


%\numberwithin{equation}{section}
