%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                      pmsart.cls                                   %%
%%  Probability and Mathematical Statistics document class file      %%
%%                                                                   %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This file was prepared by:                                        %%
%% Marek Czysto\'lowski                                              %%
%% Mathematical Institute, Wroc\'law University                      %%
%% pl. Grunwaldzki 2/4                                               %%
%% 50-384 Wroc\'law                                                  %%
%% Poland                                                            %%
%% Please submit any bugs and comments to:                           %%
%%  Marek.Czystolowski@math.uni.wroc.pl                              %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\@addtoreset{equation}{section}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                      Identification                               %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesClass{pmsart}[2017/04/17 v1.1 Probability and Mathematical Statistics document class]

\NeedsTeXFormat{LaTeX2e}

\RequirePackage{ifthen}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%              The declaration and execution of options             %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@blstr{1.1}
\newboolean{cropmarks}
\newboolean{wartermarks}

\DeclareOption{submission}{%
    \PassOptionsToClass{11pt,45paper,twoside}{article}
    \PassOptionsToPackage{leqno}{amsmath}
    %\PassOptionsToPackage{frame}{crop}
    \setboolean{cropmarks}{false}
    \setboolean{wartermarks}{false}
    \def\@blstr{1.5}
}

\DeclareOption{finalversion}{%
    \PassOptionsToClass{a4paper,11pt,twoside}{article}
    \PassOptionsToPackage{leqno}{amsmath}
    \def\@blstr{0.961}
    %\PassOptionsToPackage{frame}{crop}
    \setboolean{cropmarks}{false}
      \setboolean{wartermarks}{false}
}

\DeclareOption{finalversionApproved}{%
    \PassOptionsToClass{a4paper,11pt,twoside}{article}
    \PassOptionsToPackage{leqno}{amsmath}
    \def\@blstr{0.961}
    %\PassOptionsToPackage{frame}{crop}
    \setboolean{cropmarks}{false}
      \setboolean{wartermarks}{true}
}

\DeclareOption{press}{%
    \setboolean{cropmarks}{true}
}

\DeclareOption*{%
    \PassOptionsToClass{\CurrentOption}{article}
}

\ProcessOptions

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                  Package and class loading                        %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\LoadClass{article}
\let\baselinestretch\@blstr
\RequirePackage{pms}

\ifthenelse{\boolean{wartermarks}}{
\RequirePackage{draftwatermark}
\usepackage{draftwatermark}
\SetWatermarkText{Accepted manuscript}
\SetWatermarkColor[gray]{0.8}
\SetWatermarkScale{0.6}
\SetWatermarkAngle{60}
\def\@doiFlag{1}
}
{\def\@doiFlag{0}}

\ifthenelse{\boolean{cropmarks}}{
\RequirePackage[a4,center,noinfo]{crop}
\newcommand*\pmsULMark{% upper left corner and upper center
\begin{picture}(0,0)
\unitlength1mm\thinlines
\put(-10,0){\line(1,0){8}}
\put(0,10){\line(0,-1){8}}
\put(75.5,6){\line(1,0){17}}
\put(84,2){\line(0,1){8}}
\put(84,6){\circle{4}}
\end{picture}%
}
\newcommand*\pmsURMark{% upper right corner and right center
\begin{picture}(0,0)
\unitlength1mm\thinlines
\put(10,0){\line(-1,0){8}}
\put(0,10){\line(0,-1){8}}
\put(6,-127.5){\line(0,1){17}}
\put(2,-119){\line(1,0){8}}
\put(6,-119){\circle{4}}
\end{picture}%
}
\newcommand*\pmsLRMark{% lower right corner and lower center
\begin{picture}(0,0)
\unitlength1mm\thinlines
\put(10,0){\line(-1,0){8}}
\put(0,-10){\line(0,1){8}}
\put(-75.5,-6){\line(-1,0){17}}
\put(-84,-2){\line(0,-1){8}}
\put(-84,-6){\circle{4}}
\end{picture}%
}
\newcommand*\pmsLLMark{% lower left corner and left center
\begin{picture}(0,0)
\unitlength1mm\thinlines
\put(-10,0){\line(1,0){8}}
\put(0,-10){\line(0,1){8}}
\put(-6,127.5){\line(0,-1){17}}
\put(-2,119){\line(-1,0){8}}
\put(-6,119){\circle{4}}
\end{picture}%
}
\newcommand*\pmsCropinfo{Probability and Mathematical Statistics page}

\cropdef[\pmsCropinfo]\pmsULMark\pmsURMark\pmsLLMark\pmsLRMark{pmsCrops}
\crop[pmsCrops]
}
{\RequirePackage[a4,center,noinfo]{crop}}
