%---------------------------------------------------------------------------
%Please  be  aware that the use of this LaTeX class file is governed by the
%following conditions:
%
% based on the original LaTeX ARTICLE DOCUMENT STYLE
% Copyright (C) 1988, 1989 by Leslie Lamport
%
% Copyright (c) 2017 WIT Press. All rights reserved.
%
%Rules of Use
%
%You are NOT ALLOWED to change this file.
%
%
%This class file is made available for use by authors who wish to prepare a
%Conference paper for publication in the WIT Press Conference Proceedings.
%The user may not exploit any part of the class file commercially.
%
%This class file is provided on an `as is'  basis, without warranties of any
%kind, either expressed or implied, including but not limited to warranties of
%title, or  implied warranties of merchantablility or fitness for a
%particular purpose. There will be no duty on the author[s] of the software
%or WIT Press to correct any errors or defects in the software.
%Any statutory rights you may have remain unaffected by your acceptance of
%these rules of use.
%---------------------------------------------------------------------------
%
% Created by Alistair Smith, Sunrise Setting Ltd, 6 March 2017
%
% wpconf.cls --- For WIT Press Conference Proceedings
% 
%
\def\update{2017/03/06 v1.00}

\newcommand{\journalnamelc}{WIT Press conference papers}
\newcommand{\journalclass}{wpconf.cls}
\newcommand{\journalclassshort}{wpconf}

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{wpconf}[\update\ \journalclass]

%\newcommand\hmmax{0}

\newif\if@timesfont
\DeclareOption{times}{%
\@timesfonttrue}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
\LoadClass{article}
\if@timesfont
\RequirePackage{times}
\RequirePackage[scaled=0.92]{helvet}
\fi

\RequirePackage{graphicx}
\RequirePackage{latexsym,ifthen,rotating,calc,textcase,booktabs,color}
\RequirePackage{amsfonts,amssymb,amsbsy,amsmath,amsthm}
%\RequirePackage{bm}
\RequirePackage[errorshow]{tracefnt}

\@twosidetrue
\flushbottom
\frenchspacing

%papersize={width,height}
\usepackage[text={130mm,200mm},%
papersize={210mm,297mm},%
%headsep=21pt,%
centering]{geometry}

\pretolerance=8000
\tolerance=9500
\hbadness=8000
\vbadness=10000
\displaywidowpenalty=0
\clubpenalty=10000
\widowpenalty=10000

\setcounter{topnumber}{10}
\def\topfraction{1}
\setcounter{bottomnumber}{10}
\def\bottomfraction{.8}
\setcounter{totalnumber}{10}
\def\textfraction{0}
\def\floatpagefraction{.8}

\thinmuskip = 3mu
\medmuskip = 4mu
\thickmuskip = 5mu

\renewcommand\normalsize{%
  \@setfontsize\normalsize{10\p@}{11.5\p@}%
  \abovedisplayskip 10\p@ \@plus 3\p@ \@minus4\p@
  \abovedisplayshortskip \z@ \@plus 3\p@
  \belowdisplayshortskip 6\p@ \@plus 3\p@ \@minus2\p@
  \belowdisplayskip \abovedisplayskip
  \let\@listi\@listI}
\normalsize
\let\@bls\baselineskip

\renewcommand\small{%
  \@setfontsize\small{9\p@}{10.5\p@}%
  \abovedisplayskip 6\p@ \@plus1\p@ \@minus1\p@
  \abovedisplayshortskip \z@ \@plus2\p@
  \belowdisplayshortskip 2\p@ \@plus1\p@ \@minus1\p@
  \def\@listi{\leftmargin\leftmargini
              \listparindent 1em
              \topsep 6\p@ \@plus2\p@ \@minus1\p@
              \parsep \z@ \itemsep \z@}%
  \belowdisplayskip \abovedisplayskip}
   
\renewcommand\footnotesize{%
  \@setfontsize\footnotesize{8\p@}{9.5\p@}%
  \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@
  \abovedisplayshortskip \z@ \@plus \p@
  \belowdisplayshortskip 3\p@ \@plus2\p@ \@minus2\p@
  \def\@listi{\leftmargin\leftmargini
              \listparindent 1em
              \topsep 5\p@ \@plus 2\p@ \@minus 1\p@
              \parsep \z@ \itemsep \z@}%
  \belowdisplayskip \abovedisplayskip}

\def\scriptsize{\@setfontsize\scriptsize{7\p@}{8.5\p@}}
\def\tiny{\@setfontsize\tiny{6\p@}{7\p@}}
\def\little{\@setfontsize\little{5\p@}{6\p@}}
\def\large{\@setfontsize\large{12\p@}{14\p@}}  
\def\Large{\@setfontsize\Large{14\p@}{16\p@}}
\def\LARGE{\@setfontsize\LARGE{16\p@}{18\p@}}
\def\huge{\@setfontsize\huge{24\p@}{26\p@}}
\def\Huge{\@setfontsize\Huge{25\p@}{27\p@}}

\newbox\absbox
\def\abstract{\lrbox\absbox\minipage{\textwidth}%
  \normalfont\small\centerline{ABSTRACT}\par%
  }
\def\endabstract{\endminipage\endlrbox}

\def\keywords#1{%
  \gdef\@keywords{\begin{minipage}{\textwidth}{Keywords:}\ {#1}\end{minipage}}}
\let\@keywords\@empty

\skip\footins 20pt plus  8pt
%\gdef\footnoterule{}
\def\footnoterule{\kern-3\p@
  \hrule \@width 144pt \kern 2.6\p@}

\renewcommand\thefootnote{\@fnsymbol\c@footnote}
\renewcommand\@makefntext[1]{%
    \parindent 0em%
    \noindent{\@makefnmark}#1}

\def\affiliation#1{%
  \gdef\@affiliation{#1}}
\let\@affiliation\@empty

\def\orcid#1#2{\footnotetext[#1]{\normalsize\it ORCID: #2}\addtocounter{footnote}{1}}

\def\affilnum#1{${}^{\text{#1}}$}
\def\comma{${}^{\text{,}}$}

\renewcommand\maketitle{\par
  \begingroup
     \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{title}%\@corraddr\@acks\@ack\@orcid\@cgs\@cgsn
  \endgroup
  %\setcounter{footnote}{0}%
  \global\let\affiliation\relax
  \global\let\address\relax
  \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\@affiliation\@empty
  \global\let\@address\@empty
  %\global\let\corraddr\relax
  \global\let\acks\relax
  \global\let\ack\relax
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}
\def\@maketitle{\vspace*{-5pt}%
\null%
\begin{center}
    {\Large{\protect\MakeTextUppercase\@title} \par}%
    \vskip 1.5em %
    \vskip -4pt%
    {\footnotesize
      \lineskip .5em%
      {\MakeTextUppercase\@author}
      \par}%
      \vskip 0pt
{\footnotesize
       %
        {\@affiliation}
      \par}%
    \vskip 15pt%
    {\noindent\usebox\absbox\par}
    {\vspace{1pt}%
      %
      {\noindent\small\it\@keywords}\par}
      \end{center}
      \vspace{-10pt}
        \par%
  }
 
%\def\startpage{\pageref{FirstPage}}
%\def\endpage{\pageref{LastPage}}
%\def\volumeyear{0000}
%\def\volumenumber{00}

\def\ps@title{%
\def\@oddhead{}
\let\@evenhead\@oddhead
\def\@oddfoot{}
\let\@evenfoot\@oddfoot}

\def\ps@wpage{%
\def\@evenhead{}
\let\@evenhead\@oddhead
\def\@oddfoot{}
\let\@evenfoot\@oddfoot}

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

\newdimen\@bls                              
\@bls=\baselineskip

\renewcommand\section{\@startsection{section}{1}{\z@}%
                                   {1.0\@bls  plus .3\@bls minus .1\@bls}%
                                   {0.1pt\@afterindentfalse}%
                                   {\centering\normalfont\normalsize\protect\MakeTextUppercase}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {1.0\@bls plus .2\@bls minus .1\@bls}%
                                     {1.0\@bls plus .2\@bls minus .1\@bls\@afterindentfalse}%
                                     {\normalfont\normalsize\raggedright}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {1.0\@bls plus .2\@bls minus .1\@bls}%
                                     {0.1pt\@afterindentfalse}%
                                     {\normalfont\normalsize\raggedright}}

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

\let\endenumerate =\endlist

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

\let\enditemize =\endlist

%\renewcommand{\thetable}{\Roman{table}}

\usepackage{caption}
\DeclareCaptionLabelSeparator{WITperiod}{:\hspace*{1.2ex}}
\captionsetup[figure]{format=hang,font=normalsize,labelfont=rm,labelsep=WITperiod,justification=justified,singlelinecheck=true}
\captionsetup[table]{format=hang,font=normalsize,labelfont=rm,labelsep=WITperiod,justification=justified,singlelinecheck=true}

%\newdimen\bibindent
%\setlength\bibindent{1.5em}
\renewenvironment{thebibliography}[1]
     {\section*{\refname}%
        \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
           \itemsep=0\p@\parsep=0\p@
            \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}

\pagestyle{wpage}
\normalsize
\sloppy
