\NeedsTeXFormat{LaTeX2e}[2006/01/01]% LaTeX date must January 2006 or later

\ProvidesClass{mathscan}[2020/06/28 v1.10]

\DeclareOption*{\OptionNotUsed}
\ProcessOptions\relax

\LoadClass[a4paper,reqno]{amsart}[2000/10/26 v2.08]

\RequirePackage{amssymb}
\RequirePackage{varwidth}
\RequirePackage{mathtools}
\RequirePackage[british]{babel}
\RequirePackage{url}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% certain lines in amsart.cls 2000/10/26 v2.08 are modified
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%% line 222 in amsart.cls
\textwidth=28pc
\textheight=41pc
\footskip=14pt

%%%%% line 240 in amsart.cls
\parskip=0pt plus 1pt

%%%%% EMAIL
%%%%% lines 487-511  in amsart.cls

\newif\if@collectingaddrblock

\def\@setaddresses{\bigskip
  \nobreak \begingroup
  \Small
  \lineskiplimit=-1pt\lineskip=10pt
  \noindent
  \def\startauthorblock{\begin{varwidth}[t]{0.45\linewidth}%
    \rightskip=0pt plus 2em}%
  \def\endauthorblock{\par\end{varwidth}}%
  \def\author##1{\if@collectingaddrblock
    \endauthorblock\hspace{1em plus 1fill}%
    \startauthorblock\fi\@collectingaddrblockfalse}%
  \def\\{\newline}%   %%redefine
  \interlinepenalty\@M
  \def\address##1##2{\@collectingaddrblocktrue
    \begingroup\par\noindent
    \@ifnotempty{##1}{\textsc{\ignorespaces##1}\newline}%
    \textsc{\ignorespaces##2}\par\endgroup}%
  \def\curraddr##1##2{\@collectingaddrblocktrue
    \begingroup
    \@ifnotempty{##2}{\par\addvspace\smallskipamount\noindent
    \textit{Current address}%
    \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\newline
    \textsc{\ignorespaces##2}\par}\endgroup}%
  \def\email##1##2{\@collectingaddrblocktrue
    \begingroup
    \@ifnotempty{##2}{\nobreak\noindent\textit{E-mail}%   %%%%%
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      \textrm{##2}\par}\endgroup}%                          %%%%%
  \def\urladdr##1##2{\@collectingaddrblocktrue
    \begingroup
    \@ifnotempty{##2}{\nobreak\noindent\textit{URL}%      %%%%%
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      \textrm{##2}\par}\endgroup}%                          %%%%%
  \startauthorblock
  \@collectingaddrblockfalse
  \addresses
  \endauthorblock
  \par
  \endgroup
}

%%%%% and between authors, etc.
%%%%% line 587-589 in amsart.cls
\def\@@and{\protect\@@@and}
\def\@@@and{and}
\renewcommand{\andify}{%
  \nxandlist{\unskip, }{\unskip{} \@@and~}{\unskip{} \@@and~}}

%%% maketitle
%%% lines 632-653 in amsart.cls
\def\@maketitle{%
  \normalfont\normalsize
  \@adminfootnotes
  \@mkboth{\@nx\shortauthors}{\@nx\shorttitle}%
  \global\topskip42\p@\relax % reduced
  \@settitle
  \ifx\@empty\authors \else \@setauthors \fi
  \ifx\@empty\@dedicatory
  \else
    \baselineskip18\p@
    \vtop{\centering{\Small(\@dedicatory)\@@par}% font change
                                % and ()
      \global\dimen@i\prevdepth}\prevdepth\dimen@i
  \fi
  \@setabstract
  \normalsize
  \if@titlepage
    \newpage
  \else
    \dimen@34\p@ \advance\dimen@-\baselineskip
    \vskip\dimen@\relax
  \fi
} % end \@maketitle

%%%%% title
%%%%% lines 785-791
\def\@settitle{\begin{center}%
  \Large
  \uppercasenonmath\@title
  \@title\par
  \end{center}%
}

%%%%% author list
%%%%% lines 792--796
\def\author@andify{%
  \nxandlist {\unskip ,\penalty-1 \space\ignorespaces}%
    {\unskip {} \@@and~}%
    {\unskip {}\penalty-2 \space \@@and~}%
}

%%%%% ABSTRACT
%%%%% lines 742-759  in amsart.cls

\renewenvironment{abstract}{%
  \ifx\maketitle\relax
    \ClassWarning{\@classname}{Abstract should precede
      \protect\maketitle\space in this documentclass}%
  \fi
  \global\setbox\abstractbox=\vtop \bgroup
    \normalfont\Small
    \list{}{\labelwidth\z@
      \leftmargin0pc \rightmargin\leftmargin   %%%%%3pc -> 0pc
      \listparindent\normalparindent \itemindent\z@
      \parsep\z@ \@plus\p@
      \let\fullwidthdisplay\relax
    }%
    \item[\hskip\labelsep\bfseries\normalsize\abstractname]\mbox{}\\[1ex]%
                                              %%%%%sc->bf
                                                    %%%%% . -> mbox\\
}
{%
  \endlist\egroup
  \ifx\@setabstract\relax \@setabstracta \fi
}

%%%%% descriptions
%%%%% line 932 in amsart.cls
\renewcommand{\descriptionlabel}[1]{\hspace\labelsep\scshape #1:}

%%%%% STARTSECTION
%%%%% lines 937-946 in amsart.cls
\g@addto@macro\bfseries{\boldmath}

\def\@startsection#1#2#3#4#5#6{%
 \if@noskipsec \leavevmode \fi
 \par \@tempskipa #4\relax
 \@afterindentfalse                 %%%%% true -> false
 \ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi
 \if@nobreak \everypar{}\else
     \addpenalty\@secpenalty\addvspace\@tempskipa\fi
 \@ifstar{\@dblarg{\@sect{#1}{\@m}{#3}{#4}{#5}{#6}}}%
         {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
}

%%%%% SECTIONS ETC
%%%%% line 953 in amsart.cls

\def\@secnumfont{\bfseries}             %%%%%md -> bf

%%%%% sections
%%%%% lines 1013-1015 in amsart.cls

\def\section{\@startsection{section}{1}%
  \z@{.7\linespacing\@plus\linespacing}{.5\linespacing}%
  {\normalfont\bfseries}}   %%%%%small&bf ind; centering vaek

%%%%% below: line inserted to act on subsec and subsubsec,
%%%%% modifies line 953 in amsart.cls

\renewcommand{\@secnumfont}{\rmfamily}   %%%%%skifter til roman  e f t e r    section

%%%%% subsections and subsubsections
%%%%% lines 1016-1021 in amsart.cls
\def\subsection{\@startsection{subsection}{2}%
  \z@{.5\linespacing\@plus.7\linespacing}{+.001ex\@afterindentfalse}%%%%%false!
  {\noindent\normalfont\itshape}}  %%%%%noindent&itshape tilf. aendring ovenfor
\def\subsubsection{\@startsection{subsubsection}{3}%
  \z@{.5\linespacing\@plus.7\linespacing}{-.5em}%
  {\normalfont\itshape}}

%%%%%BIBLIOGRAPHY
%%%%%lines 1162-1174 in amsart.cls

\renewenvironment{thebibliography}[1]{%
  \bigbreak\begin{center}\normalfont\textsc{\refname}\end{center}% %%%%%
  \addcontentsline{toc}{section}{\refname}%  %%%%%
  \normalfont\Small\labelsep .5em\relax
  \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
  \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
    \leftmargin\labelwidth \advance\leftmargin\labelsep
    \usecounter{enumiv}}%
  \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
  \sfcode`\.=\@m
}{%
  \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
  \endlist
}

%%%%% BIBLABEL
%%%%% lines cf. line 1310 in amsart.cls
\def\@biblabel#1{#1.}   %%%%% [#1] -> #1.

%%%%%
%%%%% THEOREMSTYLE
%%%%% lines 1485-1494 in amsart.cls
%%%%% plain
\def\th@plain{%
    \let\thm@indent\indent % no indent  %%%%%indent
    \thm@headfont{\scshape}% heading font is bold   scshape
%%  \thm@notefont{}% same as heading font
%%  \thm@headpunct{.}% add period after heading
%%  \let\thm@swap\@gobble
%%  \thm@preskip\topsep
%%  \thm@postskip\theorempreskipamount
  \itshape % body font
}

%%%%% definition
%%%%% lines 1495-1497 in amsart.cls
\def\th@definition{%
    \let\thm@indent\indent % no indent  %%%%%indent
    \normalfont % body font
    \thm@headfont{\scshape}%%%%% heading font is scshape
}

%%%%% remark is identical to definition
\let\th@remark\th@definition

%%%%% END-OF-PROOF

%%%%% line 1694 in amsart.cls
\renewcommand{\qedsymbol}{\relax}       %%%%% self-expl.

%%%%% PROOF ENVIRONMENT
%%%%% lines 1695-1704 in amsart.cls
\renewenvironment{proof}[1][\proofname]{\par
  \pushQED{\qed}%
  \normalfont \topsep6\p@\@plus6\p@\relax
  \trivlist
  \item[\hskip\labelsep
        \indent\scshape           %%%%% it -> sc, indent tilf.
    #1\@addpunct{.}]\ignorespaces
}{%
  \popQED\endtrivlist\@endpefalse
}

%%%%% Acknowledgements

\newcommand{\ackname}{Acknowledgements}
\newenvironment{acknowledgements}{\par\bigbreak
\textsc{\ackname\@addpunct{.}}\enspace\ignorespaces}{\par}

%%%%% Additional constructs

\newcommand{\any}{\mkern1mu\cdot\mkern1mu}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

\frenchspacing
%%%%% END OF FILE  mathscan.cls
