%% -*- coding: utf-8 -*-

% This file is adapted from a copy of emsprocart.cls dated July 07, % 2006.
% The original file was essentially a concatentaion of article.cls
% with some changes, plus amsthm.sty
% The present file takes a difffernt approach: It loads article.cls
% and amsthm.sty, and then redefines commands where appropriate.

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{birthday}[2016/09/27]
\DeclareOption{10pt}{\ClassWarning{birthday}{10pt option ignored}}
\DeclareOption{11pt}{\ClassWarning{birthday}{11pt option ignored}}
\DeclareOption{12pt}{\ClassWarning{birthday}{12pt option ignored}}
\DeclareOption{nostix}{\useSTIXfalse} \newif\ifuseSTIX \useSTIXtrue
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ExecuteOptions{a4paper,twoside}
\ProcessOptions
\LoadClass{article}
\RequirePackage[T1]{fontenc}
\ifuseSTIX
  \RequirePackage{stix}
  % generalized from ulasy.fd (to avoid font resizing):
  \DeclareFontFamily{U}{lasy}{}
  \DeclareFontShape{U}{lasy}{m}{n}{
    <-5.5> lasy5 <-6.5> lasy6 <-7.5> lasy7 <-8.5> lasy8 <-9.5> lasy9
    <-> lasy10 }{}
  \DeclareFontShape{U}{lasy}{b}{n}{ <-10> ssub * lasy/m/n
    <->lasyb10  }{}
\else
  \RequirePackage{lmodern}
\fi
% Alterations to macros from article.cls
\def\ps@myheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\thepage\hfil\small\leftmark}%
    \def\@oddhead{{\small\rightmark}\hfil\thepage}%
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    }
\if@titlepage\else
\renewcommand\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{empty}\@thanks  % <-- only difference from article.cls
  \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\@subtitle\@empty
  \global\let\subtitle\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}
\def\@maketitle{% this is quite different from the one in article.cls
  \newpage
  %%%%\null%%%
   %\vspace*{38pt}
  %\vskip 2em%
  %%%%%\begin{center}%
  \let \footnote \thanks
    {\Large \bfseries\boldmath\noindent \@title \par}%
    {\ifx\@subtitle\@empty\else\vskip 0.5em \large\noindent \@subtitle \par \fi}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      %%%%%%\begin{tabular}[t]{c}%
        \noindent\rmfamily\tracingcommands=2 \tracingmacros=2 \@author\tracingcommands=0 \tracingmacros=0 %%%%%\@author
      \par}%%%%\end{tabular}\par}%
    %%%%\vskip 1em%
    %%%{\large \@date}%
  %%%%%\end{center}%
  \par
  \vskip24pt}%%%%\vskip 1.5em}
\fi
\renewcommand{\section}{\@startsection {section}{1}{\z@}%
                                   {-5.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\normalfont\large\bfseries\boldmath}}
\renewcommand{\subsection}{\@startsection{subsection}{2}{\z@}%
                                     {12pt\@plus 1ex \@minus .2ex}%
                                     {-1.5ex \@plus -.2ex}%
                                     {\normalfont\normalsize\bfseries\boldmath}}
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{\z@}%
                                     {12pt\@plus 1ex \@minus .2ex}%
                                     {-1.5ex \@plus -.2ex}%
                                     {\normalfont\normalsize\bfseries\boldmath}}
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\normalfont\normalsize\bfseries\boldmath}}
\renewcommand{\subparagraph}{\@startsection{subparagraph}{5}{\parindent}%
                                       {3.25ex \@plus1ex \@minus .2ex}%
                                       {-1em}%
                                      {\normalfont\normalsize\bfseries\boldmath}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewenvironment{abstract}{\par
              \vspace{.8cm}\small
         \noindent%
          {\bfseries \abstractname.\vspace{\z@}}}%
        {\par}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%new%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newenvironment{classification}{\par
             \vspace{.5cm}\small
              {\noindent\bfseries{\classificationname.}\vspace{\z@}}}%
            {\par}

\newenvironment{keywords}{\par
              \vspace{2pt}\small
                 {\noindent\bfseries{\keywordname.}\vspace{\z@}}}
            {\par}
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
    \sbox\@tempboxa{\small #1. #2}
  \ifdim \wd\@tempboxa >\hsize
       \small #1. #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\renewcommand*\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 \rmfamily
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss \rm#2}\par
    \endgroup
  \fi}
\renewenvironment{thebibliography}[1]
     {\section*{\refname}%
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
      \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\keywordname{Keywords}
\newcommand\classificationname{2010 Mathematics Subject Classification}
% Here we copy in modified from size10.clo
\renewcommand\normalsize{%
   \@setfontsize\normalsize{3.7mm}{4.42mm}%
   \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
   \abovedisplayshortskip \z@ \@plus3\p@
   \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI}
\rm\normalsize % \rm is needed here to avoid font size warnings
\renewcommand\small{%
   \@setfontsize\small{3.3mm}{4.0mm}%
   \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@
   \abovedisplayshortskip \z@ \@plus2\p@
   \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
   \def\@listi{\leftmargin\leftmargini
               \topsep 4\p@ \@plus2\p@ \@minus2\p@
               \parsep 2\p@ \@plus\p@ \@minus\p@
               \itemsep \parsep}%
   \belowdisplayskip \abovedisplayskip
}
\renewcommand\footnotesize{%
   \@setfontsize\footnotesize{3.0mm}{3.7mm}%
   \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
}
\renewcommand\scriptsize{\@setfontsize\scriptsize{2.6mm}{3.0mm}}
\renewcommand\tiny{\@setfontsize\tiny{1.9mm}{2.3mm}}
\renewcommand\large{\@setfontsize\large{4.1mm}{4.9mm}} % \subsection
\renewcommand\Large{\@setfontsize\Large{4.5mm}{5.4mm}} % \section
\renewcommand\LARGE{\@setfontsize\LARGE{5.0mm}{6.0mm}} % \maketitle
\renewcommand\huge{\@setfontsize\huge{6.0mm}{7.2mm}}
\renewcommand\Huge{\@setfontsize\Huge{7.2mm}{14.4mm}}
%\setlength\headheight{12\p@}
%\setlength\headsep   {25\p@}
\setlength\topskip   {3.7mm}
\setlength\footskip{30\p@}
\setlength\maxdepth{.5\topskip}
\setlength\textwidth{125mm}
%textheight=41\baselineskip+\topskip=41*4.42mm+3.7mm=184.92mm
% Do this instead of what size10.clo does
\RequirePackage[textwidth=125mm,textheight=184.92mm]{geometry}
% And now, additions
\AtBeginDocument{\pagestyle{headings}}
% The following copied blindly from emsprocart.cls (for now):
\RequirePackage{amsmath,amssymb,latexsym,ifthen}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% define block environment as short for trivlist
\newenvironment{block}{\begin{trivlist}\item{}}{\end{trivlist}}

\newlength{\@textwidthminusparindent}
\newlength{\@saveparindent}
\let\@contact=\empty
\newcommand{\contact}[2][]{
  \expandafter\gdef\expandafter\@contact\expandafter{%
    \@contact
  \setlength{\@textwidthminusparindent}{\textwidth}
  \setlength{\@saveparindent}{\parindent}
  \addtolength{\@textwidthminusparindent}{-\parindent}
  \small
  \begin{block}%\hspace{\parindent}%
    \begin{minipage}{\@textwidthminusparindent}%
     \setlength{\parindent}{\@saveparindent}%
      \noindent%\hspace*{-\parindent}%
      #2\ifthenelse{\equal{#1}{}}{}{\\[2pt]E-mail: #1}
    \end{minipage}
  \end{block}}}

% provide commands \author, \title 
% for the headings and the titlepage
% and provide default values to hint user
\pagestyle{myheadings}
\renewcommand{\@author}{}
\renewcommand{\@title}{}

\newcommand{\@authorhead}{}
\newcommand{\@titlehead}{}
\renewcommand{\author}[2][no@ption]{
  \renewcommand{\@author}{#2}
  \ifthenelse{\equal{#1}{no@ption}}{
    \renewcommand{\@authorhead}{#2}}{
    \renewcommand{\@authorhead}{#1}}
  \markboth{\@authorhead}{\@titlehead}}
\renewcommand{\title}[2][no@ption]{
  \renewcommand{\@title}{\boldmath{}#2}
  \ifthenelse{\equal{#1}{no@ption}}{
    \renewcommand{\@titlehead}{#2}}{
    \renewcommand{\@titlehead}{#1}}
  \markboth{\@authorhead}{\@titlehead}}
% optional subtitle. The typography and layout may need some tweaking.
\newcommand{\@subtitle}{}
\newcommand{\subtitle}[1]{\renewcommand{\@subtitle}{#1}}
\let\orig@thanks\thanks
% http://tex.stackexchange.com/q/100017/1424 for the meaning of this:
% We also needed to robustify it.
\DeclareRobustCommand{\thanks}[1]{\begingroup\let\rlap=\relax\orig@thanks{#1}\endgroup}

% provide command to set end matter
\newcommand{\makelastpage}{
  \medskip
  \ifx\empty\@contact\empty\noindent
  \makeatother
  Use \texttt{\textbackslash contact[peter@mail]\{Peter Smith, York\} before
  \textbackslash begin\{document\}}
  \par
  \makeatletter
  \else\@contact\fi}

% redefine \begin{document} and \end{document}
% in order to include begin and end matter automatically
% originan environment is still available as origdocument
\let\origdocument\document
\def\document{\origdocument\maketitle}
\let\endorigdocument\enddocument
\def\enddocument{\makelastpage\endorigdocument}

%%%%%% redefine sub(sub)section(*)
% so that subsections
% are typeset with a dot at the end
\let\s@ction=\section
\newcommand{\c@mdasekt}[2][]{\s@ction[#1]{#2}}
\newcommand{\c@mdbsekt}[1]{\s@ction*{#1}}
\renewcommand{\section}{\secdef\c@mdasekt\c@mdbsekt}

\let\s@bsection=\subsection
\newcommand{\c@mda}[2][]{\s@bsection[#1]{#2.}}
\newcommand{\c@mdb}[1]{\s@bsection*{#1.}}
\renewcommand{\subsection}{\secdef\c@mda\c@mdb}
\let\s@bsubsection=\subsubsection
\newcommand{\c@mdsuba}[2][]{\s@bsubsection[#1]{#2.}}
\newcommand{\c@mdsubb}[1]{\s@bsubsection*{#1.}}
\renewcommand{\subsubsection}{\secdef\c@mdsuba\c@mdsubb}

\renewcommand{\itemize}{\ifnum \@itemdepth >3 \@toodeep\else \advance\@itemdepth \@ne
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
\list{\csname\@itemitem\endcsname}{\def\makelabel##1{\hss\llap{\rm##1}}}\fi}

\def\enumerate{\ifnum \@enumdepth >3 \@toodeep\else
      \advance\@enumdepth \@ne
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
      {\csname label\@enumctr\endcsname}{\usecounter
        {\@enumctr}\def\makelabel##1{\hss\llap{\rm ##1}}}\fi} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\renewcommand{\@seccntformat}[1]{{\csname the#1\endcsname.}\hspace{.5em}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% type area %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\textheight=548pt%%%%19.2cm%%%%
\textwidth=357pt%%%%%12.5cm%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\endinput
