%%%%%%%%%%%%%%%%%%% zaa.cls %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}

\if@compatibility
\errmessage{You cannot run zaa in compatibility mode!^^J
  Change your \string\documentstyle\space statement to
   \string\documentclass\space and rerun}
\fi

\ProvidesClass{zaa}[2013/10/01 ZAA article class 1.51]
\RequirePackage{ifthen}

%%%%%%%%%%%%%%%%%% Options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newboolean{@sectionnumbering}
\setboolean{@sectionnumbering}{true}
\DeclareOption{nosectionnumber}{%
  \setboolean{@sectionnumbering}{false}}


\newboolean{@abstractonly}
\setboolean{@abstractonly}{false}
\DeclareOption{abstractonly}{%
  \setboolean{@abstractonly}{true}}

\newboolean{@erratum}
\setboolean{@erratum}{false}
\DeclareOption{erratum}{%
  \setboolean{@erratum}{true}}


\newboolean{@finalsize}
\setboolean{@finalsize}{false}
\DeclareOption{finalsize}{%
  \PassOptionsToClass{12pt,a4paper,twoside}{article}
  \setboolean{@finalsize}{true}}

\DeclareOption{twocolumn}
{\ClassError{zaa}{Option 'twocolumn' not supported}{}}
\DeclareOption{titlepage}
{\ClassError{zaa}{Option 'titlepage' not supported}{}}


\newboolean{@finaltitle}
\setboolean{@finaltitle}{false}
\DeclareOption{finaltitle}{\setboolean{@finaltitle}{true}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions

%%%%%%%%%%%%%%%%%% Other packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\LoadClass{article}
\RequirePackage{amsmath}
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage[noadjust]{cite}

%%%%%%%%%%%%%%%%%%% finalsize  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifthenelse{\boolean{@finalsize}}{
\setlength{\parindent}{7.2mm}
\setlength{\normallineskiplimit}{.99pt}
\setlength{\textwidth}{14.2cm}
\setlength{\textheight}{21.6cm}
\setlength{\headsep}{18pt}
\setlength{\oddsidemargin}{0pt}
\setlength{\evensidemargin}{45pt}
\setlength{\topmargin}{-28pt}
}{\relax}


%%%%%%%%%%%%%%%%%%%%%%%%% Titlepage %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% article defines title, author, date, thanks and abstract environments
% in author, separated by \and
%

% * arg may not include paragraphs
\renewcommand*{\title}[1]{\gdef\@title{#1}\gdef\@runtitle{#1}}
\def\@title{\@latex@error{No \noexpand\title given}\@ehc}
\renewcommand*{\author}[1]{\gdef\@author{#1}\gdef\@runauthor{#1}}
\def\@author{\@latex@warning@no@line{No \noexpand\author given}}
\newcommand*{\runtitle}[1]{\gdef\@runtitle{#1}}
\def\@runtitle{}
\newcommand*{\runauthor}[1]{\gdef\@runauthor{#1}}
\def\@runauthor{}
\newcommand*{\keywords}[1]{\gdef\@keywords{#1}}
\def\@keywords{}
\newcommand*{\primclass}[1]{\gdef\@primclass{#1}
 \global\let\classification\undefined}
\def\@primclass{}
\newcommand*{\secclasses}[1]{\gdef\@secclasses{#1}}
\def\@secclasses{}
\newcommand*{\classification}[1]{\gdef\@classification{#1}
 \global\let\primclass\undefined
 \global\let\secclasses\undefined
}
\def\@classification{}
\newcommand*{\dedication}[1]{\gdef\@dedication{#1}}
\def\@dedication{}
\renewcommand{\abstract}[1]{\gdef\@abstract{#1}}
\def\@abstract{}


\newcommand{\@ninepoint}{\fontfamily{cmr}\fontsize{10.95pt}{13pt}\selectfont}
\newcommand{\@tenpoint}{\fontfamily{cmr}\fontsize{12pt}{14pt}\selectfont}
\newcommand{\@titlefont}{\fontfamily{cmr}\fontsize{17.28pt}{20pt}\selectfont}
\newcommand{\@authorfont}{\fontfamily{cmr}\fontsize{14.4pt}{17pt}\selectfont}
% authorfont was 13.5pt 


\newbox\@@caption
\newcount\addresscount
\addresscount=1
\newcount\addressnum

\def\address#1{%
 \expandafter\gdef\csname @address\number\addresscount \endcsname {#1}
 \global\advance\addresscount by 1}
\def\@addresses{
 \kern-12pt
 \addressnum=0
 \loop
  \ifnum\addressnum<\addresscount
   \advance\addressnum by 1
   \csname @address\number\addressnum \endcsname
   \ifnum\addressnum<\addresscount\hfill\break\fi
 \repeat
}

\def\email#1{%
{\leavevmode\unskip\nobreak;\ \hfil\penalty50\hskip0em%
    \nobreak #1\hfil%
    \parfillskip=0pt \finalhyphendemerits=0}%
}

\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
  \else\let\next\f@t\fi \next}
\def\f@@t{\bgroup\aftergroup\@foot\let\next}
\def\f@t#1{#1\@foot}
\def\@foot{\strut\egroup}
\def\footstrut{\vbox to\splittopskip{}}

\renewcommand{\maketitle}{
  \begingroup
  \ifthenelse{\boolean{@finaltitle}}
  {\thispagestyle{zaatitlestyle}}
  {\thispagestyle{empty}}
  \def\\{\hfill\egroup\hbox to \hsize\bgroup\strut\hfill}%
  \parindent0pt
  \def\afootnote{%
    \insert\footins\bgroup%
    \interlinepenalty\interfootnotelinepenalty%
    \@ninepoint%
    \splittopskip\ht\strutbox \splitmaxdepth\dp\strutbox%
    \floatingpenalty\@MM%
    \leftskip\z@skip \rightskip\z@skip \xspaceskip\z@skip%
    \footstrut
    \futurelet\next\fo@t}
  \vglue-19mm
  \@logo
  \vskip36pt
  \begingroup \@titlefont\bf
  \hbox to \hsize\bgroup\strut\hfill\@title\hfill\egroup
  \endgroup
%\bigskip
  \begin{center}
    \@authorfont\it\@author    
  \end{center}
   \vskip10mm
  \ifx\@dedication\undefined
  \else
  \vbox to 0pt{%
    \vskip-39pt%
    \centerline{\@tenpoint\strut\it\@dedication}%
    \vss}%
  \nointerlineskip
  \fi
\ifthenelse{\boolean{@erratum}}{\relax}{%
  \vbox{\@ninepoint\noindent \bf Abstract.\ \rm\@abstract\par}
  \medskip
  \vbox{\@ninepoint\noindent\bf Keywords.\ \rm\@keywords\par}
  \smallskip
  \vbox{\@ninepoint
    \noindent \bf Mathematics Subject Classification (2010).\
    \ifx\classification\undefined
    \rm Primary\ \@primclass, secondary\ \@secclasses\par
    \else
    \rm \@classification
    \fi}
}
  \afootnote{\@addresses}
  \let\maketitle\relax
  \endgroup
\ifthenelse{\boolean{@abstractonly}}
{\end{document}}{}
}


%%%%%%%%%%%%%%%%%%%%%% ZAA logo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtoks\@start
\newtoks\@end
\newtoks\@vol
\newtoks\@year
\newtoks\@no
\newtoks\@doi
\@start={000}\@end={000}\@vol={00}\@year={1900}\@no={0}\@doi={XXX}

\newcommand{\logox}[5]{
\@vol={#1}\@year={#2}\@no={#3}\@start={#4}\@end={#5}
\setcounter{page}{#4}
}


\newcommand{\doi}[1]{
\@doi={#1}}

\ifthenelse{\boolean{@finaltitle}}{
 \def\@logo{\vtop{
\fontfamily{cmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{12pt}\selectfont
 \noindent{Zeitschrift f{\"u}r Analysis und ihre Anwendungen\hfill \copyright\ European Mathematical Society}\newline
 \noindent{Journal of Analysis and its Applications}\newline
 \noindent{Volume \the\@vol\ (\the\@year),
    \the\@start--\the\@end}\newline
  \noindent{DOI: 10.4171/ZAA/\the\@doi}}}}
   {\def\@logo{\vtop{
\fontfamily{cmr}\fontseries{m}\fontshape{n}\fontsize{10pt}{11pt}\selectfont
 \hbox to \hsize{\strut\hfill}
 \hbox to \hsize{\strut\hfill}
 \hbox to \hsize{\strut\hfill}
 \hbox to \hsize{\strut\hfill}}}}

%%%%%%%%%%%%%%%%%%%%% Theorem etc environments %%%%%%%%%%%%%%%%
% without counter:
\theoremstyle{plain}   % bold head, italic body
  \newtheorem*{theorem*}{{Theorem}}
  \newtheorem*{lemma*}{{Lemma}}
  \newtheorem*{proposition*}{{Proposition}}
  \newtheorem*{corollary*}{{Corollary}}   

\theoremstyle{definition} %  bold head, normal body
  \newtheorem*{definition*}{{Definition}}
  \newtheorem*{conjecture*}{{Conjecture}}
  \newtheorem*{example*}{{Example}}
  \newtheorem*{remark*}{{Remark}}

\theoremstyle{remark}   % italic head, normal body 
  \newtheorem*{note*}{{Note}}
  \newtheorem*{case*}{{Case}}



\ifthenelse{\boolean{@sectionnumbering}}{
  \theoremstyle{plain}   % bold head, italic body
     \newtheorem{theorem}{{Theorem}}[section] 
     \newtheorem{lemma}[theorem]{{Lemma}}
     \newtheorem{proposition}[theorem]{{Proposition}}
     \newtheorem{corollary}[theorem]{{Corollary}}   
   \theoremstyle{definition} %  bold head, normal body
     \newtheorem{definition}[theorem]{{Definition}}
     \newtheorem{conjecture}[theorem]{{Conjecture}}
     \newtheorem{example}[theorem]{{Example}}
     \newtheorem{remark}[theorem]{{Remark}}
   \theoremstyle{remark}   % italic head, normal body 
     \newtheorem{note}[theorem]{{Note}}
     \newtheorem{case}[theorem]{{Case}}
}{
  \theoremstyle{plain}   % bold head, italic body
     \newtheorem{theorem}{{Theorem}} 
     \newtheorem{lemma}{{Lemma}}
     \newtheorem{proposition}{{Proposition}}
     \newtheorem{corollary}{{Corollary}} 
   \theoremstyle{definition} %  bold head, normal body
     \newtheorem{definition}{{Definition}}
     \newtheorem{conjecture}{{Conjecture}}
     \newtheorem{example}{{Example}}
     \newtheorem{remark}{{Remark}}
   \theoremstyle{remark}   % italic head, normal body 
     \newtheorem{note}{{Note}}
     \newtheorem{case}{{Case}}
}

\providecommand{\qedsymbol}{\openbox}
%\renewcommand{\qedsymbol}{\relax}
%%\newcommand{\@qedrule}{\hbox{\vrule height1.6ex depth0pt width1ex}}
%%\newcommand{\QED}{\hfill\mbox{\ \@qedrule}}
\newcommand{\QED}{\qed}
%\renewcommand{\qedsymbol}{\QED}


\renewenvironment{proof}[1][\proofname]{\par%
%  \pushQED{\qedbox}%
  \normalfont \topsep6\p@\@plus6\p@\relax%
  \trivlist%
  \item[\hskip\labelsep%
        \itshape%
    #1.]\ignorespaces%
}{%
%  \popQED
\endtrivlist\@endpefalse%
}

\providecommand{\proofname}{Proof}


%%%%%%%%%%%%%%%%%%%%% Running titles %%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\ps@zaastyle}{%
\renewcommand{\@oddhead}{%
\fontfamily{cmr}\fontseries{m}\fontshape{n}%
\fontsize{10.95pt}{13pt}\selectfont%
\hfil\@runtitle\qquad%
\fontfamily{cmr}\fontseries{rm}\fontshape{n}\fontsize{12pt}{13pt}\selectfont%
\thepage}%
\renewcommand{\@evenhead}{%
\fontfamily{cmr}\fontseries{rm}\fontshape{n}\fontsize{12pt}{13pt}\selectfont%
\thepage\qquad%
\fontfamily{cmr}\fontseries{m}\fontshape{n}%
\fontsize{10.95pt}{13pt}\selectfont%
\@runauthor\hfil}%
\renewcommand{\@oddfoot}{}%
\renewcommand{\@evenfoot}{}%
}

\newcommand{\ps@zaatitlestyle}{%
  \renewcommand{\@oddhead}{}%
  \renewcommand{\@evenhead}{}%
  \renewcommand{\@oddfoot}{}%
\renewcommand{\@evenfoot}{}%
 }

\ifthenelse{\boolean{@finaltitle}}{\pagestyle{zaastyle}}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Sections %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname .\enspace}

%name level indent beforeskip afterskip style
\renewcommand{\section}{\@startsection%
{section}{1}{0pt}{-24pt plus -8pt minus -8pt}%
{14 pt plus 4 pt minus 4pt}%
{\fontfamily{cmr}\fontseries{bx}\fontshape{n}\fontsize{14.4pt}{16pt}%
\selectfont}%
}

\newcommand{\subsectionn}{\@startsection%
{subsection}{2}{0pt}{14pt plus 4 pt minus 4pt}{-\fontdimen2\font%
plus -\fontdimen3\font minus -\fontdimen4\font}%
{\fontfamily{cmr}\fontseries{bx}\fontshape{n}\fontsize{12pt}{14pt}%
\selectfont}%
}

\renewcommand{\subsection}{\@ifstar{\my@s}{\my@ns}}
\newcommand{\my@s}[1]{\subsectionn*{#1\unskip.}}
\newcommand{\my@ns}[1]{\subsectionn{#1\unskip.}}

\newcommand{\subsubsectionn}{\@startsection%
{subsubsection}{3}{0pt}{14pt plus 4 pt minus 4pt}{-\fontdimen2\font%
plus -\fontdimen3\font minus -\fontdimen4\font}%
{\fontfamily{cmr}\fontseries{bx}\fontshape{n}\fontsize{12pt}{14pt}%
\selectfont}%
}

\renewcommand{\subsubsection}{\@ifstar{\mys@s}{\mys@ns}}
\newcommand{\mys@s}[1]{\subsubsectionn*{#1\unskip.}}
\newcommand{\mys@ns}[1]{\subsubsectionn{#1\unskip.}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%% References %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand{\refname}{%
\fontfamily{cmr}\fontseries{bx}\fontshape{n}\fontsize{14.4pt}{16pt}%
References}

\renewenvironment{thebibliography}[1]
     {\section*{\refname}%
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
      \fontfamily{cmr}\fontseries{m}\fontshape{n}\fontsize{10.95pt}{13pt}%
      \selectfont
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \addtolength{\leftmargin}{.8em}
            \itemsep2pt plus 1pt minus 1pt
            \parsep3pt plus2pt minus1pt
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}


%%%%%%%%%%%%%%%%%%%%%%%% tighter lists etc %%%%%
\AtBeginDocument{%
	  % \renewcommand{\@listi}
	  %   {\setlength{\leftmargin}{\leftmargini}
	  %    \setlength{\topsep} {0pt}
	  %    \setlength{\parsep} {\parskip}
	  %    \setlength{\itemsep}{0pt}}
	  % \renewcommand{\@listii}
	  %   {\setlength{\leftmargin}{\leftmarginii}
	  %    \setlength{\labelwidth}{\leftmarginii}
	  %    \addtolength{\labelwidth}{-\labelsep}}
	  % \renewcommand{\@listiii}
	  %   {\setlength{\leftmargin}{\leftmarginiii}
	  %    \setlength{\labelwidth}{\leftmarginiii}
	  %    \addtolength{\labelwidth}{-\labelsep}}}
\let\@@listi=\@listi
\def\@listi{
	\@@listi
	\topsep 2\p@
	\itemsep 1\p@
        \parsep 0\p@
        \parskip 1\p@
        \partopsep 1\p@
}
\let\@@listii=\@listii
\def\@listii{
	\@@listii
	\topsep 2\p@
	\itemsep 1\p@
        \parsep 0\p@
        \parskip 1\p@
        \partopsep 1\p@
}
\let\@@listiii=\@listiii
\def\@listiii{
	\@@listiii
	\topsep 2\p@
	\itemsep 1\p@
        \parsep 0\p@
        \parskip 1\p@
        \partopsep 1\p@
}
}

%\newenvironment{tightitemize}{\begin{itemize}}{\end{itemize}}

%%%%%%%%%%%%%%%%%%%%%%%%% tightitemize %%%%%%%%%%%%%%%%
% tightitemize only for compatibility 
% (some older articles might use it)
\newenvironment{tightitemize}[1][0pt]{%
  \begin{list}{$\bullet$}%
    {\setlength{\topsep}{\smallskipamount}%
      \setlength{\itemsep}{-\parsep}%
      \addtolength{\itemsep}{2pt}%
      \setlength{\labelwidth}{\leftmargini}%
        \advance\labelwidth-\labelsep% 
      \addtolength{\leftmargin}{#1}%
      \addtolength{\labelwidth}{#1}%
      %\setlength{\itemindent}{0pt}%
    }%
  }%
  {\end{list}}

% \newcounter{tightenum}
% \newenvironment{tightenumerate}[1][0pt]{%
%   \begin{list}{\arabic{tightenum}.}%
%     {\usecounter{tightenum}
%       \setlength{\topsep}{\smallskipamount}%
%       \setlength{\parsep}{0pt}
%       \setlength{\itemsep}{0pt}%
%       \addtolength{\itemsep}{0pt}%
%       \setlength{\labelwidth}{\leftmargini}%
%         \advance\labelwidth-\labelsep% 
%       \addtolength{\leftmargin}{#1}%
%       \addtolength{\labelwidth}{#1}%
%       %\setlength{\itemindent}{0pt}%
%     }%
%   }%
%   {\end{list}}





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%  better floating
\renewcommand{\fps@figure}{htbp}
\renewcommand{\fps@table}{htbp}

%%%%%%%%%%% additions 2013 %%%%%%%%%%%%%%%%%%
\newcommand{\n}{\noindent}
\newcommand{\s}{\smallskip}
\newcommand{\m}{\medskip}
\newcommand{\lb}{\linebreak}
\newcommand{\pb}{\pagebreak}

\allowdisplaybreaks

%%%%% itemize 

\newenvironment{litemize}[1]{%
\begin{list}{}{%
\settowidth{\labelwidth}{#1}%
\setlength{\leftmargin}{\labelwidth}%
\addtolength{\leftmargin}{\labelsep}}}%
{\end{list}}


%%%%%%%%%%%%%%%%%%%%%%%%% AtEndDocument %%%%%%%%%%%%%%%%
\def\last@page#1{\global\def\xlastpage{#1}}
\last@page{0}

\newcommand*{\received}[1]{\gdef\@received{#1}}
\def\@received{}
\newboolean{@isrevised}
\setboolean{@isrevised}{false}
\newcommand*{\revised}[1]{\setboolean{@isrevised}{true}\gdef\@revised{#1}}
\def\@revised{}

\AtEndDocument{\ifthenelse{\boolean{@abstractonly}}{}{
\vspace*{1cm}\noindent Received \rm\@received%
\ifthenelse{\boolean{@isrevised}}{; revised \rm\@revised}
{}
}
\write\@auxout{\protect\last@page{\thepage}}
}
\newcommand{\logo}[4]{\logox{#1}{#2}{#3}{#4}{\xlastpage}}

%%%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
