% Class file for SUT Jornal of Mathematics
%
% Written by Kadunori Sai
% Date:   Jul 1, 1999
% Version: 0.4
%
% Revised: July 7, 2003 
% Revised: Sept. 6, 2010 
% Revised: Apr. 21, 2022  2020 Subject Classification 
% Revised: May 30, 2022  DOI
%
%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{sutj}[1999/07/01 Class for SUT Jornal of Mathematics, Ver.0.4]
\newif\ifeqnwithinsection\eqnwithinsectiontrue
\DeclareOption{eqnwithoutsection}{\eqnwithinsectionfalse}
\def\theoremnumwith{.}
\DeclareOption{theoremwithoutdot}{\def\theoremnumwith{}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax
\LoadClass[11pt,twoside,leqno]{article}
\PassOptionsToPackage{leqno}{amsmath}
%
% Page size
\setlength{\topmargin}{0.9cm}
\setlength{\oddsidemargin}{1.5cm}
\setlength{\evensidemargin}{1.5cm}
\setlength{\textwidth}{13cm}
\setlength{\textheight}{20cm}
\setlength{\parindent}{0.5cm}
\setlength{\footskip}{1cm}
%
%
% Commands for title and etc.
\renewcommand{\title}[2][]{\gdef\@title{#2}%
  {\def\temp{#1}\ifx\temp\@empty\else\shorttitle{#1}\fi}}
\renewcommand{\author}[2][]{\gdef\@author{#2}%
  {\def\temp{#1}\ifx\temp\@empty\else\shortauthor{#1}\fi}}
\newcommand{\shortauthor}[1]{\gdef\@shortauthor{\uppercase{#1}}}
\newcommand{\shorttitle}[1]{\gdef\@shorttitle{\uppercase{#1}}}
\newcommand{\receiveddate}[1]{\gdef\@receiveddate{#1}}
%
\newcommand{\vol}[1]{\gdef\@vol{#1}}
\newcommand{\no}[1]{\gdef\@no{#1}}
\newcommand{\annum}[1]{\gdef\@annum{#1}}
\newcommand{\fpage}[1]{\gdef\@fpage{#1}}
\newcommand{\lpage}[1]{\gdef\@lpage{#1}}
% \volno = \vol & \no
\newcommand{\volno}[2]{\vol{#1}\no{#2}}
% pages = \fpage & \lpage
\newcommand{\pages}[2]{\fpage{#1}\lpage{#2}}
% doi : added (5/30/2022)
\newcommand{\doi}[1]{\gdef\@doi{#1}}
%
\newcommand{\classification}[1]{\gdef\@classification{#1}}
\newcommand{\keywords}[1]{\gdef\@keywords{#1}}
%
\shortauthor{AUTHOR NAMES}
\shorttitle{SHORT TITLE}
\receiveddate{??? ??, ????}
\volno{??}{?}
\doi{?}
\annum{????}
\newcommand{\@fpage@default}{??}
\let\@fpage\@fpage@default
\let\@lpage\@fpage@default
\classification{---}
\keywords{---}
%
% title
\let\maketitle@orig\maketitle
\renewcommand{\maketitle}{%
  \ifx\@fpage\@fpage@default\else\setcounter{page}{\@fpage}\fi
  \maketitle@orig
  \thispagestyle{toppage}}
\renewcommand{\@maketitle}{%
  \newpage
  \null
  \vskip 5mm%
  \begin{center}%
  \let\footnote\thanks
  {\bfseries\Large\@title\par}%
  \vskip 13mm%
  {\bfseries\begin{tabular}[t]{c}%
    \@author
  \end{tabular}\par}%
  \vskip 4mm%
  {\footnotesize (Received \@receiveddate)}%
  \end{center}
  \par \vskip 14mm}
%
% address
\let\addresses\@empty
\newcommand{\address}[2][]{\g@addto@macro\addresses{\address{#1}{#2}}}
\newcommand{\email}[2][]{\g@addto@macro\addresses{\email{#1}{#2}}}
\newcommand{\urladdr}[2][]{\g@addto@macro\addresses{\urladdr{#1}{#2}}}
%
\def\makeaddress{\ifx\@empty\addresses \else
  \@makeaddress\let\addresses\@empty\fi}
\def\@makeaddress{\par
  \nobreak \begingroup
  \footnotesize\parindent0pt%
  \def\address##1##2{\begingroup\def\tempa{##1}%
    \par\addvspace\bigskipamount\indent
    \ifx\@empty\tempa\else(\ignorespaces##1\unskip) \fi%
    {\ignorespaces##2}\par\endgroup}%
  \def\email##1##2{\begingroup
    \def\tempa{##1}\def\tempb{##2}%
    \ifx\tempb\@empty\else\nobreak\indent{\itshape E-mail}%
      \ifx\tempa\@empty\else, \ignorespaces##1\unskip\fi\/:\space
      \ttfamily##2\par\fi\endgroup}%
  \def\urladdr##1##2{\begingroup
    \def\tempa{##1}\def\tempb{##2}%
    \ifx\tempb\@empty\else\nobreak\indent{\itshape URL}%
      \ifx\tempa\@empty\else, \ignorespaces##1\unskip\fi\/:\space
      \ttfamily##2\par\fi\endgroup}%
  \addresses
  \endgroup
}
%
\AtEndDocument{\makeaddress}
%
% abstract, classification and keyword
\newcommand{\makeclassification}{%
  \begin{center}\footnotesize
  \begin{minipage}[t]{0.86\linewidth}%
  \noindent
  {\itshape AMS {\upshape 2020} Mathematics Subject 
  Classification.}\ \@classification \par
  \medskip
  \noindent
  {\itshape Key words and phrases.}\  \@keywords
  \end{minipage}\end{center}\vskip 7mm}
%
\def\abstractname{Abstract.}
\renewenvironment{abstract}{%
  \begin{center}%
  \begin{minipage}[t]{0.86\linewidth}\footnotesize
  \noindent{\bfseries \abstractname}\ %
 }{%
  \end{minipage}\end{center}%
  \makeclassification}
%
% headings
\newcommand{\firstheadline}{\vbox to 0pt{\vss\hbox{%
  {\footnotesize\begin{tabular}{l}%
  SUT Journal of Mathematics \hfill \\
  Vol. \@vol, No. \@no \, (\@annum),\hspace{1mm}\@fpage--\@lpage \\
  DOI: 10.55937/sut/\@doi
  \end{tabular}}}\vss}}
%
\newcommand{\ps@toppage}{%
  \renewcommand{\@oddhead}{\firstheadline\hfil}%
  \renewcommand{\@evenhead}{}%
  \renewcommand{\@oddfoot}{\hfil{\footnotesize\textrm{\thepage}}\hfil}%
  \renewcommand{\@evenfoot}{}}%
\newcommand{\ps@sutheadings}{%
  \renewcommand{\@oddhead}{{%
    \footnotesize\hfil\textrm{\@shorttitle}\hfil\textrm{\thepage}}}%
  \renewcommand{\@evenhead}{{%
    \footnotesize\textrm{\thepage}\hfil\textrm{\@shortauthor}\hfil}}%
  \renewcommand{\@oddfoot}{}%
  \renewcommand{\@evenfoot}{}}
%
\AtBeginDocument{\pagestyle{sutheadings}}
%
% section and counter
\renewcommand{\section}{%
  \@startsection{section}{1}{\z@}{-1truecm plus -1ex minus -.2ex}%
  {1.5ex plus .2ex}{\centering\bfseries}}
\renewcommand{\subsection}{%
  \@startsection{subsection}{1}{\z@}{-1truecm plus -1ex minus -.2ex}%
  {1.5ex plus .2ex}{\bfseries}}
\newcommand{\thesectionB}{\S\thesection.}
\newcommand{\thesubsectionB}{\thesubsection.}
\def\thesubsubsectionB{\thesubsubsection.}
\let\theparagraphB\theparagraph
\let\thesubparagraphB\thesubparagraph
\let\@seccntformat@orig\@seccntformat
\renewcommand{\@seccntformat}[1]{\csname the#1B\endcsname\quad}
%
\ifeqnwithinsection
\@addtoreset{equation}{section}
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\fi
%
% thebibliography
\let\thebibliography@orig\thebibliography
\renewcommand{\thebibliography}[1]{\thebibliography@orig{{\small #1}}\small}
%
% 
\def\@begintheorem#1#2{\trivlist 
   \item[\hskip \labelsep{\bfseries #1\ #2\theoremnumwith}]\itshape}
\def\@opargbegintheorem#1#2#3{\trivlist
      \item[\hskip \labelsep{\bfseries #1\ #2\ (#3)\theoremnumwith}]\itshape}
\def\theoremwithoutdot{\def\theoremnumwith{}}

