%% rob.cls - version 1.0 
%% Aptara Inc., dated 1st April 2013
%% 
%% For CUP Journals
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{rob}[2013/04/01 v1.0 Robotica (ROB) Standard LaTeX document class]
%
\DeclareOption{final}{\setlength\overfullrule{0pt}}
\ExecuteOptions{final}
\ProcessOptions
%
\newcommand\contentsname{Contents}
\newcommand\listfigurename{List of Figures}
\newcommand\listtablename{List of Tables}
\newcommand\bibname{references}
\newcommand\indexname{Index}
\newcommand\figurename{Fig.}
\newcommand\tablename{Table}
\newcommand\partname{Part}
\newcommand\chaptername{CHAPTER}
\newcommand\appendixname{Appendix}
%
\newcommand\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space\number\day, \number\year}
%
\newcount\minute
\newcount\hour
\def\currenttime{%
     \minute\time
     \hour\minute
     \divide\hour60
     \the\hour:\multiply\hour60\advance\minute-\hour\the\minute}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Boxes & Dimensions %%%%%%%%%%%%%%%%%%%%%
%
\newdimen\trimwidth
\newdimen\trimheight
\newdimen\typewidth
\newdimen\typeheight
%
\newdimen\tempdimen
\newdimen\normaltextheight
\newskip\normalbaselineskip
\newdimen\blindfoliodrop
%
\newdimen\enumdim
\newdimen\figheight
\newdimen\figwidth
\newdimen\tabledim
\newskip\tableleftskip
\newskip\tablerightskip
%
\newdimen\mathindent
\newdimen\emathindent
\newdimen\bibindent
%
\newbox\tempbox
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End Boxes & Dimensions %%%%%%%%%%%%%%%%%
%
\newskip\Editsep
\Editsep0pt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%% Headings
\def\rhnfont{\fontsize{8.5}{9}\selectfont}
\def\rhfont{}
\def\foliofont{}
\def\dropfoliofont{\fontsize{9}{11}\selectfont}
\def\CTfont{\fontsize{18.5}{20}\selectfont\bfseries\raggedright\mathversion{bold}}%
\def\CSTfont{\fontsize{16}{18}\selectfont\bfseries\mathversion{bold}}%
\def\CSTparafont{\fontsize{9.5}{12}\selectfont\mathversion{sfnormal}}%
\def\authorfont{\fontsize{18.5}{20}\selectfont\raggedright\mathversion{normal}}%
\def\affilfont{\fontsize{10.5}{12}\selectfont\itshape\raggedright\mathversion{normal}}%
\def\bibliofont{\fontsize{9.5}{10}\selectfont\mathversion{normal}}
\def\receivedfont{\fontsize{9.5}{10}\selectfont\raggedright\mathversion{normal}}%
%
\def\absheadfont{\fontsize{8}{9.5}\selectfont}
\def\abstractfont{}
%
\def\kwdheadfont{\fontsize{8}{9.5}\selectfont\bfseries}
\def\keywordsfont{\fontsize{9.5}{11}\selectfont\mathversion{normal}}
\def\reviewfont{\fontsize{9.5}{11}\selectfont\raggedright\mathversion{normal}}
\def\Doifont{\fontsize{8.5}{10.5}\selectfont\mathversion{normal}}
%% Section
\def\sectionfont{\fontsize{10.5}{12}\selectfont\bfseries\raggedright\mathversion{bold}}
\def\subsectionfont{\fontsize{10.5}{12}\selectfont\itshape\raggedright\mathversion{normal}}
\def\subsubsectionfont{\fontsize{10.5}{12}\selectfont\itshape\mathversion{normal}}
\def\Xheadfont{\fontsize{10.5}{12}\selectfont\bfseries\raggedright\mathversion{bold}}
%% Figure
\def\figcaptionfont{\fontsize{9.5}{10}\selectfont\mathversion{normal}}
%% Table
\def\tablefont{\fontsize{9.5}{11}\selectfont\leftskip\tableleftskip\rightskip\tablerightskip\mathversion{normal}}%
\def\tablecaptionfont{\fontsize{9.5}{10}\selectfont\mathversion{normal}}%
\def\TCHfont{\fontsize{9.5}{10}\selectfont}%
\def\tabnotefont{\fontsize{9.5}{10}\selectfont\leftskip\tabnoteleftskip\rightskip\tabnoterightskip}% 
%
\def\listfont{}%
\def\listdevicefont{}
\def\extractfont{\fontsize{9.5}{11}\selectfont\leftskip10pt}
\def\confont{}%
%
%%%%%%%%%%%%%%%%%%%%%%%%% Fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\@viiipt{8}
\def\@viiihpt{8.5}
\def\@ixhpt{9.5}
\def\@xpt{10}
\def\@xhpt{10.5}
\def\@xipt{11}
\def\@xvpt{15}
\def\@xviiipt{18}
\def\@xxivpt{24}
%
\normalbaselineskip12pt
%
\renewcommand\normalsize{%
   \@setfontsize\normalsize\@xhpt{12}
   \abovedisplayskip 12\p@ \@plus2\p@ \@minus.5\p@
   \belowdisplayskip 12\p@ \@plus2\p@ \@minus.5\p@
   \abovedisplayshortskip \abovedisplayskip
   \belowdisplayshortskip 6\p@ \@plus2\p@ \@minus.5\p@
   \let\@listi\@listI}
\def\biggg#1{{\hbox{$\left#1\vbox to20.5\p@{}\right.\n@space$}}}
\def\Biggg#1{{\hbox{$\left#1\vbox to23.5\p@{}\right.\n@space$}}}
\normalsize
%
\newcommand\small{%
   \@setfontsize\small\@ixhpt{10}%
   \abovedisplayskip 10\p@ \@plus3\p@ \@minus4\p@
   \abovedisplayshortskip \z@ \@plus2\p@
   \belowdisplayshortskip 5\p@ \@plus2\p@ \@minus2\p@
   \def\@listi{\leftmargin\leftmargini
               \topsep 5\p@ \@plus2\p@ \@minus2\p@
               \parsep 0\p@% \@plus\p@ \@minus\p@
               \itemsep \parsep}%
   \belowdisplayskip \abovedisplayskip
   \setSmallDelims}
%
\def\setSmallDelims{%
\def\big##1{{\hbox{$\left##1\vbox to7.5\p@{}\right.\n@space$}}}%
\def\Big##1{{\hbox{$\left##1\vbox to10.5\p@{}\right.\n@space$}}}%
\def\bigg##1{{\hbox{$\left##1\vbox to13.5\p@{}\right.\n@space$}}}%
\def\Bigg##1{{\hbox{$\left##1\vbox to16.5\p@{}\right.\n@space$}}}%
\def\biggg##1{{\hbox{$\left##1\vbox to19.5\p@{}\right.\n@space$}}}%
\def\Biggg##1{{\hbox{$\left##1\vbox to22.5\p@{}\right.\n@space$}}}%
}
%
\newcommand\footnotesize{%
   \@setfontsize\footnotesize\@ixhpt{10}%
   \abovedisplayskip 5\p@ \@plus2\p@ \@minus4\p@
   \abovedisplayshortskip \z@ \@plus\p@
   \belowdisplayshortskip 5\p@ \@plus\p@ \@minus2\p@
   \def\@listi{\leftmargin\leftmargini
               \topsep 5\p@ \@plus\p@ \@minus\p@
               \parsep 0\p@% \@plus\p@ \@minus\p@
               \itemsep\parsep}%
   \belowdisplayskip \abovedisplayskip
   \setFootnotesizeDelims}
%
\def\setFootnotesizeDelims{%
\def\big##1{{\hbox{$\left##1\vbox to6.5\p@{}\right.\n@space$}}}%
\def\Big##1{{\hbox{$\left##1\vbox to9.5\p@{}\right.\n@space$}}}%
\def\bigg##1{{\hbox{$\left##1\vbox to12.5\p@{}\right.\n@space$}}}%
\def\Bigg##1{{\hbox{$\left##1\vbox to15.5\p@{}\right.\n@space$}}}%
\def\biggg##1{{\hbox{$\left##1\vbox to18.5\p@{}\right.\n@space$}}}%
\def\Biggg##1{{\hbox{$\left##1\vbox to21.5\p@{}\right.\n@space$}}}%
}
%   
\newcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt}
\newcommand\tiny{\@setfontsize\tiny\@vpt\@vipt}
\newcommand\large{\@setfontsize\large\@xiipt{14}}
\newcommand\Large{\@setfontsize\Large\@xivpt{18}}
\newcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}}
\newcommand\huge{\@setfontsize\huge\@xxpt{25}}
\newcommand\Huge{\@setfontsize\Huge\@xxvpt{30}}
%
%%
%
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\DeclareOldFontCommand{\bi}{\bfseries\itshape}{\bfseries\itshape}
\newcommand{\cal}{\protect\pcal}
\newcommand{\pcal}{\@fontswitch{\relax}{\mathcal}}
\newcommand{\mit}{\protect\pmit}
\newcommand{\pmit}{\@fontswitch{\relax}{\mathnormal}}
%
\DeclareSymbolFont{bold}{OT1}{\rmdefault}{bx}{n}
\DeclareSymbolFontAlphabet\mathbf{bold}
%
\DeclareFontFamily{OT1}{ams}{}
\DeclareFontShape{OT1}{ams}{m}{n}{<-> msam10 }{}
\DeclareFontShape{OT1}{ams}{m}{it}{<-> msam10 }{}
\DeclareFontShape{OT1}{ams}{bx}{n}{<-> msbm10 }{}
\DeclareFontShape{OT1}{ams}{bx}{it}{<-> msbm10 }{}
%
\def\encodingdefault{OT1}%
\fontencoding{OT1}%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End Fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setlength\trimheight{297mm}%
\setlength\trimwidth{210mm}%
%
\setlength\typeheight{58pc}
\setlength\typewidth{35pc}
%
\setlength\headheight{6.9\p@}% 
\setlength\headsep   {14pt}%
\setlength\topskip   {7.3\p@}
%
\setlength\textheight{56pc}%
\addtolength\textheight{-4.5pt}
%
\setlength\normaltextheight{\textheight}
\setlength\textwidth{\typewidth}
%
\setlength\topmargin{60pt}%
\setlength\oddsidemargin   {72pt}%
\setlength\evensidemargin\trimwidth
\addtolength\evensidemargin{-\textwidth}
\addtolength\evensidemargin{-\oddsidemargin}
%
\setlength\footskip{18pt}
\setlength\maxdepth{4\p@}
%
\blindfoliodrop\trimheight
\advance\blindfoliodrop-\typeheight%\textheight%
\advance\blindfoliodrop-\topmargin
\advance\blindfoliodrop-\footskip
\advance\blindfoliodrop70pt
%
\setlength\parindent{12pt}
%
\setlength\marginparwidth {.75in}
\setlength\marginparsep{7\p@}
\setlength\marginparpush{5\p@}
%
\setlength\footnotesep{0\p@}
\setlength{\skip\footins}{16\p@ \@plus 8\p@ minus4pt}% change + based on FN font height
\skip\@mpfootins = \skip\footins
%
\setlength\floatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
\setlength\intextsep   {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\dblfloatsep    {12\p@ \@plus 2\p@ \@minus 2\p@}
\setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@}
\setlength\@fptop{0\p@}
\setlength\@fpsep{8\p@ \@plus 1fil}
\setlength\@fpbot{0\p@ \@plus 1fil}
\setlength\@dblfptop{0\p@}
\setlength\@dblfpsep{8\p@ \@plus 1fil}
\setlength\@dblfpbot{0\p@ \@plus 1fil}
%%
%%
\setlength\partopsep{0pt}
\setlength\lineskip{1\p@}% check if it can be flexible
\setlength\normallineskip{1\p@}%
\renewcommand\baselinestretch{}
\setlength\parskip{\z@}%{0\p@ \@plus \p@}
\@lowpenalty   51
\@medpenalty  151
\@highpenalty 301
%
\@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty
\@itempenalty     -\@lowpenalty
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End Parameters %%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\jname#1{\gdef\@jname{#1}}
\jname{Robotica}
%
\def\price#1{\gdef\@price{#1}}
\price{{\itshape\char'044}12.00}
%
\def\issn#1{\gdef\@issn{#1}}
\issn{0020-7438/04\ \@price}
%
\def\firstpage#1{\xdef\@firstpage{#1}}
\firstpage{}%
%
\def\endpage#1{\xdef\@endpage{#1}}
\endpage{}%
%
\def\pubyear#1{\gdef\@pubyear{#1}}%
\pubyear{}
%
\def\cpyear#1{\gdef\@cpyear{#1}}%
\cpyear{}
%
\def\volume#1{\gdef\@volume{#1}}%
\volume{}
%
\def\issue#1{\gdef\@issue{#1}}%
\issue{}%
%
\def\doi#1{\gdef\@doi{#1}}%
\doi{}
%
\def\doiline{\hsize\textwidth\raggedright\firstpage{\thepage}% 
   {\@jname} (\@pubyear)\ {\copyright}\ {Cambridge University Press}\ \ifx\@cpyear\empty{\@pubyear}\else{\@cpyear}\fi\par
   doi:{\@doi}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Part Title  %%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
    \hbox{}\thispagestyle{empty}\newpage\fi\fi}
%
\newcommand\part{\cleardoublepage
                    \thispagestyle{empty}%
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@part\@spart}
%
\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >-2\relax
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
    \markboth{}{}
     \ifnum \c@secnumdepth >-2\relax
       \vspace*{-13.5pt}
       \def\spreadoutfactor{1}%
       \noindent{\PNfont \spreadout{part\ \thepart}\par}%
       \vskip 6\p@
     \fi
     \noindent{\PTfont #2\par}%
     \vskip24.2pt%
     {\box\partquotetbox}
    \@endpart\cleardoublepage}
%
\def\@spart#1{%
    {\centering
     \interlinepenalty \@M
     \Huge \bfseries #1\par}%
    \@endpart}
%
\def\@endpart{\vfil\newpage}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Part Title  %%%%%%%%%%%%%%%%%%%%%%
%
\def\pound{\hbox{\char'243}}      
\def\Pound{\hbox{\char'243}}      
\def\million{\hbox{\char'344}}      
\def\para{\hbox{\char'246}}      
\def\reg{\hbox{\char'250}}      
\def\Ccopyright{\hbox{\char'251}}
\def\trademark{\hbox{\char'252}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Chapter Title  %%%%%%%%%%%%%%%%%%%%%%%%%%
%
\renewenvironment{date}{\vskip-3pt\affilfont(\ignorespaces}{\unskip)\par}
%
\def\sptitle#1{\gdef\@sptitle{#1}}
\sptitle{}
%
\def\review#1{\gdef\@review{#1}}\review{}
\def\title{\@dblarg{\@@title}}
\def\@@title[#1]#2{\gdef\@shorttitle{#1}\gdef\@title{#2}}\title{}
\def\subtitle#1{\gdef\@subtitle{#1}}\subtitle{}
\def\lectureseriestitle#1{\gdef\@lectureseriestitle{#1}}
\def\seriessubtitle#1{\gdef\@seriessubtitle{#1}}
\def\RunningAuthors#1{\markboth{#1}{\@textmarkright}}
\def\RunningTitles#1{\gdef\@textmarkright{#1}\markright{#1}}
\def\shorttitle#1{\subtitle{#1}}\shorttitle{}
%
\def\spchapter{\@dblarg{\@@spchapter}}
\def\@@spchapter[#1]#2{\ifx#1\empty\gdef\@spchaptermark{#2}\else\gdef\@spchaptermark{#1}\fi\gdef\@spchapter{#2}}
\spchapter{}
%
%
\def\@affils{}
%
\newcount\affcount\affcount=\z@
\newcount\aucount\aucount=\z@
\newcount\tempcount\tempcount=\z@
\newcount\tempacount\tempacount=\z@
\newcount\tempbcount\tempbcount=\z@
%
\newcount\affccount
\newcounter{affil}
\renewcommand\theaffil{\protect\textsuperscript{\arabic{affil}}}
%
\def\affil{\@ifnextchar[{\@affil}{\@affil[]}}
\def\@affil[#1]#2{%
    \global\advance\affcount\@ne%
    \global\advance\affccount\@ne%
    \expandafter\gdef\csname Affil\romannumeral\the\affcount\endcsname{\ignorespaces#2}
    \expandafter\xdef\csname Affilcount\romannumeral\the\affccount\endcsname{#1}}
%
\def\lastaffilsep{\par}
\def\affilsep{\par}
%
\def\printaffils{%
   \ifnum\affcount>\z@%FOM
   \gdef\@affils{%FOM
    \tempcount=\affcount
    \tempbcount=\@ne
    \loop
    \ifnum\tempcount>\z@
       \def\@captype{affil}%
       \expandafter\ifx\csname Affilcount\romannumeral\the\tempbcount\endcsname\empty\else%
       \refstepcounter{affil}\protect\label{\csname Affilcount\romannumeral\the\tempbcount\endcsname}\fi%
       \csname Affil\romannumeral\the\tempbcount\endcsname%
       \ifnum\tempcount>1\ifnum\tempcount=2\lastaffilsep\else\affilsep\fi\fi%
         \advance\tempcount\m@ne%
       \advance\tempbcount\@ne%
    \repeat\global\affcount\z@}
  \fi}%FOM
%
\def\getcreatorAddresstype#1#2#3\@nil{\ifthenelse{\equal{#1#2}{id}}{\gdef\numaffil{yes}}{\gdef\numaffil{no}}}
%%
\newcount\aucount
%
\def\authorsep{\unskip,}
\def\lastauthorsep{and}
%
\def\author{\@ifnextchar[{\@@author}{\@@author[]}}
\def\@@author[#1]#2{\global\advance\aucount\@ne%
     \expandafter\gdef\csname author\romannumeral\the\aucount\endcsname{#2}}
%%
\def\printauthors{%FOM
   \ifnum\aucount>\z@%FOM
     \gdef\@authors{%FOM
     \tempcount=\aucount%
     \tempacount=\z@%
     \loop%
     \ifnum\tempcount>\z@%
	\advance\tempacount\@ne%
	\csname author\romannumeral\the\tempacount\endcsname%
	\ifnum\tempcount>1\ifnum\tempcount=2\lastauthorsep\else\authorsep\fi\fi%
	\advance\tempcount\m@ne%
    \repeat\global\aucount\z@}%
   \fi}%FOM
%%End FOM
\def\keywordsep{;}
\def\keywordpunct{}
\gdef\firstkey{yes}
%
\newbox\absbox
\newbox\kwdbox
%
\def\abstractenvhead#1{\sectionfont #1\par}
%
\newenvironment{abstract}{\global\setbox\absbox\vbox\bgroup\abstractfont}%
                          {\egroup}%
%
\newenvironment{keywords}[1][\relax]{\global\setbox\kwdbox\hbox\bgroup\keywordsfont}%
                          {\egroup}%
%
\def\printabskwd{%
\ifvoid\absbox\else
{\noindent\abstractfont\unvbox\absbox\par\vskip21pt}\fi
\ifvoid\kwdbox\else
{\noindent\keywordsfont%
     KEYWORDS:\hskip1em\ignorespaces\unhbox\kwdbox\par\vskip24pt}\fi}
%
\newbox\@spparabox
\newenvironment{sppara}{%\par\addvspace{10pt}%
   \global\setbox\@spparabox\vbox\bgroup\CSTparafont\noindent\ignorespaces%
   }%
   {\par\egroup%
   }%
%
\newskip\@maketitleskip\@maketitleskip30pt
\def\maketitleskip#1{\global\advance\@maketitleskip#1}%FOM
%
\def\@maketitle{%
  \clearpage\bgroup\thispagestyle{plain}\null\parindent0pt\vskip10.5pt%
          \ifx\@sptitle\@empty\else%
             \noindent{\CSTfont\@sptitle\par}\vskip6pt
          \fi
          \ifx\@title\@empty
     		   \else%
               {\CTfont\@title\par}
		        \fi
    		    \printauthors%
                \ifx\@authors\@empty\else{\vskip-20pt\authorfont\vphantom{$^1$}\@authors\par}\fi%
		        \printaffils%
          \ifx\@affils\@empty\else
                {\vskip10pt\noindent\affilfont\@affils\par\vskip.5pt}%
           \fi
   		    \printhistory%FOM
         \ifx\@history\@empty%
              \relax%
         \else%
              \vskip9pt{\@history}%
         \fi%
		   \addvspace{\@maketitleskip}%FOM
     \egroup\gdef\@title{}\gdef\@authors{}\gdef\@affils{}%
}
%%
   \def\maketitle{%
           \@maketitle
	   \aftergroup\printabskwd
	   \renewcommand\thefootnote{\fnsymbol{footnote}}%FOM
	   \@thanks{}\let\@makefnmark\@Makefnmark%
	   \renewcommand\thefootnote{\arabic{footnote}}%FOM
	   \setcounter{footnote}{0}
           \let\maketitle\relax
           \gdef\withinhead{false}%FOM
           \gdef\@title{}\gdef\@authors{}\gdef\@affils{}\gdef\@thanks{}
           \@afterindentfalse\@afterheading}%
\newbox\abbrbox
\newenvironment{abbrev}{\global\setbox\abbrbox\hbox\bgroup}{\egroup}
%
\newenvironment{dedication}{\par\leftskip0pt plus1fill\rightskip0pt}{\par}
\newenvironment{quotation}[1]{\par\addvspace{10pt}}{\par}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Chapter Title  %%%%%%%%%%%%%%%%%%%%%
%%
%
\def\spreadoutfactor{1}

\def\spreadout#1{%
  \gdef\temp{#1}\dimen0 = \spreadoutfactor pt
  \expandafter\dospreadout\temp\endmark}

\def\dospreadout{%
  \afterassignment\findospreadout
  \let\next= }

\def\findospreadout{%
   \ifx\next\endmark
      \let\nextaction = \relax
   \else
      \let\nextaction = \dospreadout
      \next
      \kern\dimen0
   \fi
   \nextaction}
%%%
\def\endmark{endmark}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Sectioning commands  %%%%%%%%%%%%%%%%%%%%
%
\setcounter{secnumdepth}{3}
\newcounter {part}
\newcounter {chapter}
\newcounter {section}[chapter]
\newcounter {subsection}[section]
\newcounter {subsubsection}[subsection]
\newcounter {paragraph}[subsubsection]
\newcounter {subparagraph}[paragraph]
\renewcommand\thepart          {\Roman{part}}
\renewcommand\thechapter       {\arabic{chapter}}
\renewcommand\thesection       {\arabic{section}}
\renewcommand\thesubsection    {\thesection.\arabic{subsection}}
\renewcommand\thesubsubsection {\thesubsection.\arabic{subsubsection}}
\renewcommand\theparagraph     {\thesubsubsection\arabic{paragraph}}
\renewcommand\thesubparagraph  {\theparagraph.\arabic{subparagraph}}
%
%
\newif\ifxhead\xheadfalse
\def\@seccntformat#1{\csname the#1\endcsname}
\def\@secsubcntformat#1{\csname the#1\endcsname\ifxhead\else\fi\hskip7pt}

\def\XtoYhead{\vskip1.5pt}
\def\YtoZhead{\vspace*{-10.5pt}}
%
%
\newcommand\section{\@startsection {section}{1}{0pt}{-24pt \@plus -2pt \@minus -.2pt}{0.001pt}{\sectionfont}}%
\newcommand\subsection{\@startsection{subsection}{2}{0pt}{-12pt \@plus -2pt \@minus -.2pt}{0.001pt}{\subsectionfont}}%
\newcommand\subsubsection{\@startsection{subsubsection}{3}{0pt}{-6pt \@plus -2pt \@minus -.2pt}{-0.001pt}{\subsubsectionfont}}%
\newcommand\paragraph{\@startsection{subsubsection}{4}{0pt}{-6pt \@plus -2pt \@minus -.2pt}{-0.001pt}{\subsubsectionfont}}%
%
\newcommand\XHead{\@startsection{section}{1}{0pt}{-12pt \@plus -2pt \@minus -.2pt}{0.001pt}{\Xheadfont}}%
\newcommand\YHead{\@startsection{subsection}{5}{\bibleftmargin}{-17pt \@plus -2pt \@minus -.2pt}{3.5pt}{\Yheadfont}}%
\newcommand\ZHead{\@startsection{subsubsection}{6}{\bibleftmargin}{-17pt \@plus -2pt \@minus -.2pt}{3.5pt}{\Zheadfont}}%
\newcommand\bibYHead{\@startsection{subsection}{8}{\bibleftmargin}{-16pt \@plus -2pt \@minus -.2pt}{4.5pt}{\bibYheadfont}}%
\newcommand\bibZHead{\@startsection{subsubsection}{9}{\bibleftmargin}{-10.5pt \@plus -2pt \@minus -.2pt}{.001pt}{\bibZheadfont}}%
%
\newif\ifheadcolon\global\headcolonfalse
%
\def\@sect#1#2#3#4#5#6[#7]#8{\ifnum #2>\c@secnumdepth
     \let\@svsec\@empty\else
     \refstepcounter{#1}%
     \let\@@protect\protect
     \def\protect{\noexpand\protect\noexpand}%
     \edef\@svsec{\@seccntformat{#1}.\hskip.5em}%
     \let\protect\@@protect\fi
     \@tempskipa #5\relax
      \ifdim \@tempskipa>\z@
        \begingroup #6\relax%
        \ifnum#2=1
        \ifxhead
          \noindent%{\hskip #3\relax\@svsec}% {\csname #1numfont\endcsname\@svsec}
                    {\interlinepenalty \@M {#8} \par}%
        \else
          \noindent{\hskip #3\relax{\csname #1numfont\endcsname\@svsec}}%
                    {\interlinepenalty \@M {#8} \par}%
        \fi
        \else
          \noindent{\hskip #3\relax{\csname #1numfont\endcsname\@svsec}}%
                    {\interlinepenalty \@M #8 \par}%
        \fi
        \endgroup
       \csname #1mark\endcsname{#7}\addcontentsline
         {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                      \protect\numberline{\csname the#1\endcsname}\fi
                    #7}\else
        \def\@svsechd{#6\hskip #3\relax  %% Use a period(any punc) here for run-in head
                   \@svsec \ifnum#2=4#8\ifheadcolon\global\headcolonfalse\else:\fi\else#8.\fi\ \csname #1mark\endcsname
                      {#7}\addcontentsline
                           {toc}{#1}{\ifnum #2>\c@secnumdepth \else
                           \protect\numberline{\csname the#1\endcsname}%
                                     \fi
                       #7}}\fi
     \@xsect{#5}}
%
\def\@startsection#1#2#3#4#5#6{%
  \if@noskipsec \leavevmode \fi
  \par
  \@tempskipa #4\relax
  \@afterindenttrue
  \ifdim \@tempskipa <\z@
    \@tempskipa -\@tempskipa \@afterindentfalse
  \fi
  \if@nobreak
  \ifnum#2 = 2
  \vskip11pt
  \fi
    \everypar{}%
  \else
    \addpenalty\@secpenalty\addvspace\@tempskipa
  \fi
  \@ifstar
    {\@ssect{#3}{#4}{#5}{#6}}%
    {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Sectioning commands  %%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Lists %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newskip\topsepi \topsepi6\p@ \@plus2\p@ \@minus1\p@
\newskip\topsepii \topsepii0pt% \@plus1\p@ 
\newskip\itemsepi \itemsepi0pt
\newskip\itemsepii \itemsepii0pt
\newdimen\LabelSep \LabelSep5pt
%
\def\@listI{\leftmargin\leftmargini
            \labelwidth\leftmargini
            \advance\labelwidth-\labelsep
            \parsep 0\p@%
            \topsep \topsepi
            \itemsep\itemsepi}%
\let\@listi\@listI
\@listi
\def\@listii {\leftmargin\leftmarginii
              \labelwidth\leftmarginii
              \advance\labelwidth-\labelsep
              \topsep\topsepii
              \parsep 0pt
              \itemsep\itemsepii}
\def\@listiii{\leftmargin\leftmarginiii
              \labelwidth\leftmarginiii
              \advance\labelwidth-\labelsep
              \topsep  0pt
              \parsep    \z@
              \partopsep 0pt
              \itemsep   \topsep}
\def\@listiv {\leftmargin\leftmarginiv
              \labelwidth\leftmarginiv
              \advance\labelwidth-\labelsep}
\def\@listv  {\leftmargin\leftmarginv
              \labelwidth\leftmarginv
              \advance\labelwidth-\labelsep}
\def\@listvi {\leftmargin\leftmarginvi
              \labelwidth\leftmarginvi
              \advance\labelwidth-\labelsep}
%
\setlength\leftmargini  {2.5em}
\setlength\leftmarginii  {2.2em}
\setlength\leftmarginiii {1.87em}
\setlength\leftmarginiv  {1.7em}
\setlength\leftmarginv  {1em}
\setlength\leftmarginvi {1em}
\setlength\leftmargin    {\leftmargini}
%
\setlength  \labelsep  {\LabelSep}
\setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep}
%
\renewcommand\theenumi{\arabic{enumi}}
\renewcommand\theenumii{\alph{enumii}}
\renewcommand\theenumiii{\roman{enumiii}}
\renewcommand\theenumiv{\Alph{enumiv}}
\newcommand\labelenumi{\theenumi.}
\newcommand\labelenumii{(\theenumii)}
\newcommand\labelenumiii{\theenumiii.}
\newcommand\labelenumiv{\theenumiv.}
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\theenumi(\theenumii)}
\renewcommand\p@enumiv{\p@enumiii\theenumiii}
\font\nbull = msam10 at 8.5pt
\font\lcir = lcircle10 at 10pt
\newcommand\newbulls{\raise-2pt\hbox{\nbull\char'04}}
\newcommand\bulls{\raise1.5pt\hbox{\lcir\char'162}}
\def\newtextbullet{\leavevmode\raise2pt\hbox{\hskip-1pt\bulls}}
\def\textbullet{\leavevmode\raise2pt\hbox{\hskip1.75pt\bulls}}
\def\textendash{{\bf--}}
\def\textasteriskcentered{\leavevmode\raise-1.5pt\hbox{*}}
\def\textperiodcentered{\leavevmode\raise1.5pt\hbox{\bulls}}
\newcommand\labelitemi{\newtextbullet}
\newcommand\labelitemii{\normalfont\bfseries \newtextbullet}
\newcommand\labelitemiii{\textasteriskcentered}
\newcommand\labelitemiv{\textperiodcentered}
%
\newenvironment{description}
               {\list{}{\labelwidth\z@ \itemindent-\leftmargin
                        \let\makelabel\descriptionlabel}}
               {\endlist}
\newcommand\descriptionlabel[1]{\hspace\labelsep
                                \normalfont\bfseries #1}
%
\newenvironment{verse}
               {\let\\=\@centercr
                \list{}{\itemsep      \z@
                        \itemindent   -1.5em%
                        \listparindent\itemindent
                        \rightmargin  \leftmargin
                        \advance\leftmargin 1.5em}%
                \item[]}
               {\endlist}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Lists %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\mdash{\unskip~--\ \ignorespaces}
%
\def\BRrule{\par\addvspace{12.5pt}\noindent\vrule height.5pt width14.5pc\par}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Quotes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{quote}{\list{}{\rightmargin\leftmargin}%
                \item[]}
               {\endlist}
%
% space above extract will change: regular by (baselineskip - extract baselineskip)
%
\def\Nextfont{\fontsize{9}{11}\selectfont}
\newenvironment{extract}{\par\addvspace{6pt plus2pt}%
\let\arabiclist\extractarabiclist
\let\endarabiclist\endextractarabiclist
      \extractfont\noindent\ignorespaces 
}{%
  \par\addvspace{6pt plus2pt}}
%
\def\cqsep{\vskip7pt}
\def\cqsfont{}
\def\cqsource#1{\par\vskip2pt{\cqsfont#1\par}}
\newenvironment{cquote}{\par\addvspace{2pt}%
      \cqfont\noindent\ignorespaces%
}{%
      \par\addvspace{19.5pt plus2pt}}%
%
%
\def\firstnote{\item[]\ \vspace*{-32.7pt}} % XML
%%
\def\NoteHead#1{\par\noindent{\bfseries\centering\uppercase{#1}\par}}
\newcounter{notescounter}
\def\Enote{\@ifnextchar[{\@Enote}{\@Enote[]}}
\def\@Enote[#1]#2{\@ifnextchar[{\@@Enote{#1}{#2}}{\@@Enote{#1}{#2}[]}}
%
\def\@@Enote#1#2[#3]{{%
\listtextleftmargin0pt
\listlabelleftskip-2pt\labelsepi2.5pt
\renewcommand\labelenumi{\arabic{enumi}}
\setcounter{enumi}{\arabic{notescounter}}\refstepcounter{notescounter}\ifx#1\empty\item\else\item[#1]\fi#2
}}
%
\def\notefont{\fontsize{8}{10.5}\selectfont}
\newcounter{notecounter}
\newenvironment{Notes}[1][\relax]{\par\notefont%
               \list{$^{\arabic{notecounter}}$}{\usecounter{notecounter}%
               \section*{Notes}\vskip1pt%
               \@smax{#1}%
               \topsep6pt plus2pt%
               \labelsep3pt\leftmargin\enumdimen%
               \advance\leftmargin-.5pt%\labelsep
               \rightmargin0pc%
               \labelwidth\enumdimen%
               \def\makelabel##1{\hbox to \enumdimen{\hss\llap{##1}}}}}
               {\par\endlist}
%
%
\newdimen\ptydim
\def\ptyfont{\fontsize{9}{10}\selectfont\leftskip33pt\rightskip0pt plus1fill}
%%
\newenvironment{poetry}{\reset@font\parindent0pt%
\par\addvspace{7pt plus2pt}%
\ptyfont\parindent-9pt%\noindent\hangindent1em
}{%
\par\addvspace{6pt plus2pt}%
}%
%
\def\poetrysource#1{\hfill{\fontsize{9}{11}\selectfont#1}\hspace*{\ptydim}}
%
%
\def\Afont{\fontsize{10}{10}\scshape\selectfont}
\def\amatterfont{\fontsize{10}{11}\selectfont}
\def\aitem#1#2{\def\spreadoutfactor{1}\par\hangindent20pt{\Afont\spreadout{#1}}\hskip8.5pt{\amatterfont#2\par}}
\newenvironment{aulist}{\parindent0pt%
\par\addvspace{7pt plus2pt}
}{%
\par\addvspace{5.5pt plus2pt}}%
%
%
\def\AP{\hspace*{-10pt}}
\def\amatfont{\fontsize{10}{11}\selectfont\rightskip.5pc plus1fill}
\newdimen\adlength
\def\aditem#1#2{\def\spreadoutfactor{1}\setbox\tempbox\hbox{\Afont\spreadout{#1}\hskip18.5pt}\adlength\wd\tempbox
\parindent0pt\par\hangindent\adlength{\Afont\spreadout{#1}}\hskip8.5pt{\amatfont#2\par}}
\newenvironment{adlist}{\parindent0pt%
\par\addvspace{8pt plus2pt}
}{%
\par\addvspace{5.5pt plus2pt}}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Quotes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Enumerate list %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newskip\listtextleftmargin\listtextleftmargin \z@
\newskip\listtextleftmarginii\listtextleftmarginii 0pt
\newskip\listtextrightmargin
\newskip\listlabelleftskip \listlabelleftskip\z@
\newskip\listlabelleftskipii \listlabelleftskipii0pt%3.3pt
\newskip\abovelistskipi\abovelistskipi5.5pt plus2pt
\newskip\belowlistskipi\belowlistskipi5.5pt plus2pt
\newskip\abovelistskipii\abovelistskipii0pt
\newskip\belowlistskipii\belowlistskipii0pt
\newskip\abovelistskipiii\abovelistskipiii\z@
\newskip\belowlistskipiii\belowlistskipiii\z@
\newskip\labelsepi \labelsepi4pt
\newskip\labelsepii \labelsepii4pt
\newskip\labelsepiii \labelsepiii\z@
\newdimen\enumdimwd
\newif\iflabelrightalign\labelrightaligntrue
%
\def\listdevicefonti{}
\def\listdevicefontii{}
\def\listdevicefontiii{}
\def\textlistlabel{}
%
\newdimen\xheadskip
\newif\ifdashl\dashlfalse
\newif\ifboxed\global\boxedfalse
%
\def\enummax#1{%
  \labelsep\csname labelsep\romannumeral\the\@enumdepth\endcsname
  \ifdim\listtextleftmargin>\z@\ifdim\listlabelleftskip>\z@\labelsepi0pt\fi\fi
  \ifdim\listtextleftmarginii>\z@\ifdim\listlabelleftskipii>\z@\labelsepii0pt\fi\fi
  \setbox\tempbox\hbox{\csname listdevicefont\romannumeral\the\@enumdepth\endcsname#1\hskip\labelsep}%
  \enumdim\wd\tempbox
  \setbox\tempbox\hbox{\csname listdevicefont\romannumeral\the\@enumdepth\endcsname#1}%
  \enumdimwd\wd\tempbox
  \expandafter\global\csname leftmargin\romannumeral\the\@enumdepth\endcsname\enumdim
  \ifdim\listtextleftmargin>\z@
     \leftmargini\listtextleftmargin
     \ifdim\listlabelleftskip>\z@
        \advance\leftmargini-\listlabelleftskip
     \else
        \listlabelleftskip0pt plus1fill
     \fi
  \fi
  \ifdim\listtextleftmarginii>\z@
     \leftmarginii\listtextleftmarginii
     \ifdim\listlabelleftskipii>\z@
        \advance\leftmarginii-\listlabelleftskipii
     \else
        \listlabelleftskip0pt plus1fill
     \fi  
  \fi
  \ifdim\listlabelleftskip>\z@
     \advance\leftmargini\listlabelleftskip
  \fi
  \ifdim\listlabelleftskipii>\z@
     \advance\leftmarginii\listlabelleftskipii
  \fi}
%
\enummax{1.}
%
\def\enumerate{\@ifnextchar[{\@enumerate}{\@enumerate[\csname label\@enumctr\endcsname]}}%% 
%
\def\@enumerate[#1]{\par%
      \ifnum \@enumdepth >3 \@toodeep\else%
      \advance\@enumdepth\@ne%
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
      \setcounter{\@enumctr}{1}\enummax{#1}%
      \list%
      {\csname label\@enumctr\endcsname}{\usecounter{\@enumctr}%
      \topsep\csname abovelistskip\romannumeral\the\@enumdepth\endcsname%
      \itemsep\csname itemsep\romannumeral\the\@enumdepth\endcsname%
      \listfont%\listparindent18.25pt%
      \ifnum \@enumdepth=1% 
         \rightmargin\listtextrightmargin%
         \advance\rightmargin\rightskip%
         \advance\leftmargin\leftskip%
         \tempdimen\leftmargini%
         \ifdim\listtextleftmargin<\z@\leftmargin0pt\labelwidth0pt\itemindent0pt\fi%
         \advance\tempdimen-\labelsep\global\xheadskip\tempdimen\global\advance\xheadskip1.8pt%
         \def\makelabel##1{\hbox to \tempdimen{\hskip\listlabelleftskip{\csname listdevicefont\romannumeral\the\@enumdepth\endcsname\hbox to \enumdimwd{\iflabelrightalign\hss\fi%
         {\textlistlabel##1}\iflabelrightalign\else\hss\fi}}}}%
      \else%
      \ifnum \@enumdepth=2%
         \tempdimen\leftmarginii%
         \advance\tempdimen-\labelsep%
         \def\makelabel##1{\hbox to \tempdimen{\hskip\listlabelleftskipii{\csname listdevicefont\romannumeral\the\@enumdepth\endcsname\hbox to \enumdimwd{\iflabelrightalign\hss\fi##1}}}}%
      \else%
         \def\makelabel##1{\hss\llap{\csname listdevicefont\romannumeral\the\@enumdepth\endcsname##1}}%
      \fi%
      \fi}\fi}%
%
\def\endenumerate{\@topsepadd\csname belowlistskip\romannumeral\the\@enumdepth\endcsname\endlist}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Enumerate%
%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%  Unnumlist %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{unnumlist}{%
    \list{}{%
    \itemindent-10pt
    \leftmargin10pt
    \parsep0pt
    \itemsep0pt
    \topsep5.5pt plus2pt
    \partopsep0pt}
    \def\makelable##1{##1}%
}{\endlist}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%  Macro 2: TheoremLike Env. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newif\ifTheorem
\global\Theoremfalse
%
\newcounter{theorem}[section]
%
\newif\ifExample
\global\Examplefalse
%
%
\newif\ifrunon\runonfalse
%%
\def\theoremenvhead#1#2{\noindent{\expandafter\csname#2headfont\endcsname#1\ \csname the#2\endcsname.}\hskip6pt}%FOM
%
\def\theoremenvunnumhead#1#2{\noindent{\expandafter\csname#2headfont\endcsname#1.}\hskip6pt}%FOM
%
\def\newtheorem#1{\@starthm{#1}\@ifnextchar[{\@othm{#1}}{\@nthm{#1}}}
\def\@starthm#1{\@namedef{#1*}{\@beginstarthm{#1}}%
																\@namedef{end#1*}{\@endstarthm{#1}}}
%
\def\@starthm#1{\@namedef{#1*}{\@beginstarthm{#1}}%
																\@namedef{end#1*}{\@endstarthm}}
%
\def\@beginstarthm#1{\@ifnextchar[{\@opargbeginstarthm{#1}}{\@opargbeginstarthm{#1}[]}}
%
\def\@opargbeginstarthm#1[#2]{\list{}{\topsep6pt plus2pt
 \def\@tempaa{#2}%
	\labelwidth0pt\labelsep9.5pt
	\leftmargin0pt
	\listparindent\parindent
	\def\makelabel##1{##1}}
      \item[]%
\csname#1font\endcsname} 
%
\def\@endstarthm{\endlist}
%
\def\@xnthm#1#2[#3]{%
  \expandafter\@ifdefinable\csname #1\endcsname
    {\@definecounter{#1}\@newctr{#1}[#3]%
     \expandafter\xdef\csname the#1\endcsname{%
       \expandafter\noexpand\csname the#3\endcsname \@thmcountersep
          \@thmcounter{#1}}%
     \global\@namedef{#1}{\@thm{#1}{#2}{#1}}%
     \global\@namedef{end#1}{\@endtheorem}}}
\def\@ynthm#1#2{%
  \expandafter\@ifdefinable\csname #1\endcsname
    {\@definecounter{#1}%
     \expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}%
     \global\@namedef{#1}{\@thm{#1}{#2}{#1}}%
     \global\@namedef{end#1}{\@endtheorem}}}
\def\@othm#1[#2]#3{%
  \@ifundefined{c@#2}{\@nocounterr{#2}}%
    {\expandafter\@ifdefinable\csname #1\endcsname
    {\global\@namedef{the#1}{\@nameuse{the#2}}%
  \global\@namedef{#1}{\@thm{#2}{#3}{#1}}%
  \global\@namedef{end#1}{\@endtheorem}}}}
\def\@thm#1#2#3{%
  \refstepcounter{#1}%
  \@ifnextchar[{\@ythm{#1}{#2}{#3}}{\@xthm{#1}{#2}{#3}}}
%
\def\@xthm#1#2#3{%
  \@opargbegintheorem{#2}{\csname the#1\endcsname}{}{#3}\ignorespaces}
\def\@ythm#1#2#3[#4]{%
  \@opargbegintheorem{#2}{\csname the#1\endcsname}{#4}{#3}\ignorespaces}
%
\def\@endtheorem{\par\addvspace{6pt plus2pt}\endlist}%
%
\newif\ifrunin\global\runinfalse
%
\def\@opargbegintheorem#1#2#3#4{\par\addvspace{6pt plus2pt}%
    \def\@captype{#4}%FOM
   \def\@tempa{#3}%
{\csname #4headfont\endcsname\ifx\@tempa\empty#1\ #2.\hskip6pt\else#1\ #2\ {\reset@font\itshape#3}.\hskip6pt\fi}%
   \csname #4font\endcsname\ignorespaces}%
%
\def\@endtheorem{\par\addvspace{6pt plus2pt}}%
%
\def\examplename{Example}
\newtheorem{example}{\examplename}[chapter]
\def\theexample{\thesection.\arabic{example}}
\def\examplefont{\itshape}
\def\exampleheadfont{\bfseries}
%
\def\theoremname{Theorem}
\newtheorem{theorem}{\theoremname}
\def\thetheorem{\arabic{theorem}}
\def\theoremfont{\itshape}
\def\theoremheadfont{\bfseries}
%
\def\lemmaname{Lemma}
\newtheorem{lemma}{\lemmaname}%[section]
\def\thelemma{\arabic{lemma}}
\def\lemmafont{\itshape}
\def\lemmaheadfont{\bfseries}
%
\def\propositionname{Proposition}
\newtheorem{proposition}{\propositionname}%[section]
\def\theproposition{\arabic{proposition}}
\def\propositionfont{\itshape}
\def\propositionheadfont{\bfseries}
%
\def\corollaryname{Corollary}
\newtheorem{corollary}{\corollaryname}[section]
\def\thecorollary{\arabic{corollary}}
\def\corollaryfont{\itshape}
%\def\corollaryheadfont{\bfseries}
%
\def\definitionname{Def{}inition}
\newtheorem{definition}{\definitionname}[section]
\def\thedefinition{\arabic{definition}}
\def\definitionfont{\itshape}
\def\definitionheadfont{\bfseries}
%
\def\notationname{Notation}
\newtheorem{notation}{\notationname}[section]
\def\thenotation{\thesection.\arabic{notation}}
\def\notationfont{\itshape}
\def\notationheadfont{\bfseries}
%
\def\assumptionname{Assumption}
\newtheorem{assumption}{\assumptionname}[section]
\def\theassumption{\thesection.\arabic{assumption}}
\def\assumptionfont{\itshape}
\def\assumptionheadfont{\bfseries}
%
%
\def\resultname{\scshape Result}
\newtheorem{result}{\resultname}
\def\theremark{\arabic{result}}
\def\resultfont{\itshape}
%
%
\def\hypothesisname{\scshape Hypothesis}
\newtheorem{hypothesis}{\hypothesisname}
\def\theremark{\arabic{hypothesis}}
\def\hypothesisfont{\itshape}
%
\newif\ifQEDlogo
\QEDlogofalse
\font\QEDlogofont=msam10 at 9pt
\def\QEDlogo{\ifQEDlogo
  \else
  \ifvmode
  \vskip-\lastskip\hspace*{\fill}%
  \else
  \unskip\hskip5pt\ignorespaces
  \fi
  %\par
  \hfill{QED}%\QEDlogofont\char'004}\par
  \global\QEDlogofalse
  \fi}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Proof %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\font\QEDlogofont=msam10 at 10pt
\def\QEDlogo{\hbox{\QEDlogofont\char'003}}
\def\QEDblogo{\hbox{\QEDlogofont\char'004}}
\newif\ifnologo\nologofalse
\newif\iflogo
\newif\ifblogo\blogofalse
\newif\iftopprhead\topprheadfalse
\def\prheadfont{\reset@font\normalfont}
\def\prhead#1{\par%\addvspace{6.5pt plus2pt}
\noindent{\prheadfont #1\par}\noindent\aftergroup\ignorespaces}
\def\prooffont{\normalsize}
\newenvironment{proof}{\par\addvspace{6pt plus2pt}%\topprheadtrue\par\iftopprhead\vspace*{-13pt}\else%
\par%\addvspace{6.5pt plus2pt}%\fi%
\prooffont{\itshape Proof.}\hskip6pt\ignorespaces}{%
   \ifblogo\hskip1.2pt
   \QEDblogo
   \else
   \ifnologo
   \else
   \hfill
   \QEDlogo
   \fi\fi
\par\addvspace{6pt plus2pt}\global\topprheadfalse}%
%FOM Start
\newcounter{remark}[section]
\renewcommand\theremark{\thesection.\arabic{remark}}
\newif\ifunnumenv\unnumenvfalse
%FOM End
%
\newenvironment{remark}{\par\addvspace{6pt plus2pt}\nologotrue \prooffont%{\itshape Remark.}\hskip6pt % FCI 24/01/03
 \ifunnumenv\else\refstepcounter{remark}\fi
 \def\@captype{remark}%FOM
 \def\parahead##1{{\itshape ##1}\hskip6pt}%FOM End
\ignorespaces}{\ifblogo\hskip1.2pt
  \QEDblogo
   \else
   \ifnologo
   \else
   \hfill
   \QEDlogo
   \fi\fi
\par\addvspace{6pt plus2pt}\global\topprheadfalse}
\@namedef{remark*}{\begin{remark}} % FCI 24/01/03
\@namedef{endremark*}{\end{remark}} % FCI 24/01/03
%
\newenvironment{Note}{\par\addvspace{6pt plus2pt}\nologotrue \prooffont{\itshape Notes.}\hskip6pt\ignorespaces}{\ifblogo\hskip1.2pt
  \QEDblogo
   \else
   \ifnologo
   \else
   \hfill
   \QEDlogo
   \fi\fi
\par\addvspace{6pt plus2pt}\global\topprheadfalse}
%
\newenvironment{problems}{\par\addvspace{6pt plus2pt}\nologotrue \prooffont{\itshape Problems.}\hskip6pt\ignorespaces}{\ifblogo\hskip1.2pt
  \QEDblogo
   \else
   \ifnologo
   \else
   \hfill
   \QEDlogo
   \fi\fi
\par\addvspace{6pt plus2pt}\global\topprheadfalse}
%
%
\newenvironment{comments}{\par\addvspace{6pt plus2pt}\nologotrue \prooffont{\itshape Comments.}\hskip6pt\ignorespaces}{\ifblogo\hskip1.2pt
  \QEDblogo
   \else
   \ifnologo
   \else
   \hfill
   \QEDlogo
   \fi\fi
\par\addvspace{6pt plus2pt}\global\topprheadfalse}
%
%
\newenvironment{Cases}{\par\addvspace{6pt plus2pt}\nologotrue \prooffont{\itshape Cases.}\hskip6pt\ignorespaces}{\ifblogo\hskip1.2pt
  \QEDblogo
   \else
   \ifnologo
   \else
   \hfill
   \QEDlogo
   \fi\fi
\par\addvspace{6pt plus2pt}\global\topprheadfalse}
%
\def\Nfont{\fontsize{9}{11}\selectfont\leftskip12pt}
\newif\ifnotes\notesfalse
%
\def\DCPR{\normalsize\selectfont\leftskip1pc\mathversion{normal}}
\renewenvironment{DCPR}{\par\addvspace{7pt plus2pt}%
\let\arabiclist\DCPRarabiclist
\let\endarabiclist\endDCPRarabiclist
\normalsize\leftskip11.2pt\noindent\ignorespaces%
}{%
\par\addvspace{7.5pt plus2pt}}%
%
%
\def\dashfill{%
  \leavevmode
  \cleaders \hbox to .44em{\hss-\hss}\hfill
  \kern\z@}
%
%
\def\Dashline#1{\par\vskip-3.1pt\noindent\hbox to #1pt{\dashfill}\par\vskip-.2pt}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% itemize (bullet) %%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newdimen\itemleftmargin \itemleftmargin\z@ % won't be active in enumerate
\newdimen\itemlabelsep \itemlabelsep6.5\p@ % labelsep in itemize for all levels
%
\def\itemize{%
  \ifnum \@itemdepth >3 \@toodeep\else\ifnum\@enumdepth>0\@itemdepth\@enumdepth\fi \advance\@itemdepth \@ne
     \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
     \list{\csname\@itemitem\endcsname}%
        {%
        \topsep\csname abovelistskip\romannumeral\the\@itemdepth\endcsname%\fi
        \itemsep\csname itemsep\romannumeral\the\@itemdepth\endcsname
        \labelsep\itemlabelsep
        \listfont
        \setbox\tempbox\hbox{\csname\@itemitem\endcsname}
        \csname leftmargin\romannumeral\the\@itemdepth\endcsname\wd\tempbox
        \advance\csname leftmargin\romannumeral\the\@itemdepth\endcsname\itemlabelsep
        \ifnum\@itemdepth=\@ne\ifnum\@enumdepth=0 % if not inside an enumerate
           \rightmargin\listtextrightmargin
           \advance\rightmargin\rightskip
           \advance\csname leftmargin\romannumeral\the\@itemdepth\endcsname\itemleftmargin
           \advance\leftmargini\leftskip
        \else
        \advance\csname leftmargin\romannumeral\the\@itemdepth\endcsname\itemleftmargin
           \advance\leftmarginii\leftskip
        \fi\fi
        \ifdim\itemleftmargin<\z@\leftmargini-0pt\labelwidth0pt\itemindent20.9pt\fi%
        \leftmargin\csname leftmargin\romannumeral\the\@itemdepth\endcsname
        \def\makelabel##1{\hss\llap{##1}}}
   \fi}%
%
\def\enditemize{%
\@topsepadd\csname belowlistskip\romannumeral\the\@itemdepth\endcsname%\fi
\endlist}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% npara %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\NPARfont{}
\newcounter{ncount}
\newenvironment{npara}{\par\addvspace{6.5pt plus2pt minus.5pt}%
   \NPARfont
%   \hsize\textwidth%27pc
   \setcounter{ncount}{0}%
   \def\item{\addtocounter{ncount}{1}\Alph{ncount}.\hskip.5em\ignorespaces}%
}{%
   \par\addvspace{6.5pt plus2pt minus.5pt}\@endparenv}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Floats %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setcounter{topnumber}{5}
\renewcommand\topfraction{.9}
\setcounter{bottomnumber}{5}
\renewcommand\bottomfraction{.9}
\setcounter{totalnumber}{5}
\renewcommand\textfraction{.09}
\renewcommand\floatpagefraction{.901}
\setcounter{dbltopnumber}{1}
\renewcommand\dbltopfraction{.9}
\renewcommand\dblfloatpagefraction{.901}
%
\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{9\p@}
\setlength\belowcaptionskip{3\p@}
%
\def\FigName{figure}
%
\long\def\@makecaption#1#2{%
    \ifx\FigName\@captype
      \vskip\abovecaptionskip
      \@makefigurecaption{#1}{#2}%
    \else
      \@maketablecaption{#1}{#2}%
      \vskip\belowcaptionskip
    \fi
}
%%
%%FOM Start
%%
\def\caption{\refstepcounter\@captype \@dblarg{\@caption\@captype}}
\def\unnumcaption{\@dblarg{\@caption\@captype}}
%
\long\def\@caption#1[#2]#3{\par%
 \begingroup
     \@parboxrestore
     \normalsize
     \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
   \endgroup}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Figures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcounter{figure}
\renewcommand\thefigure{\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename\ \thefigure}
\newenvironment{figure}
               {\@float{figure}}
               {\end@float}
\newenvironment{figure*}
               {\@dblfloat{figure}}
               {\end@dblfloat}
%
\def\@makefigurecaption#1#2{#1. \figcaptionfont#2}
%
\def\ArtDir{art/}%
%%\input epsf.sty
%
\newbox\figtempbox
\def\ArtPiece#1{\epsfbox{\ArtDir#1}}%
%
\def\figurebox#1#2{%
    \@ifnextchar[{\@figurebox{#1}{#2}}{\@figurebox{#1}{#2}[]}}
%
\def\@figurebox#1#2[#3]{%
      \gdef\@thirdarg{#3}%
      \ifx\@thirdarg\empty
         \global\figheight=#1
         \global\figwidth=#2
      \else 
         \setbox\figtempbox=\hbox{\epsfbox{\ArtDir\@thirdarg}}%
         \global\figwidth=\wd\figtempbox
         \global\figheight=\ht\figtempbox
      \fi
    \centerline{\figbox}}%
%
\def\figbox{%
     \ifx\@thirdarg\empty
        \vbox{\vskip.3pt\hsize\figwidth
        \hrule\hbox to\figwidth{\vrule\hfill\vbox to\figheight{%
              \hsize\figwidth\vfill}\vrule}\hrule}%
     \else
        \vbox{\hsize\figwidth
 	      \hbox to\figwidth{\vbox to\figheight{\hsize\figwidth\box\figtempbox}}}%
    \fi}
%
\newenvironment{figureSource*}{\endgraf\vspace{6pt}\tiny\itshape}{\endgraf}%FOM
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Tables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcounter{table}[chapter]
\renewcommand\thetable{\@Roman\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{{\tablename\ \thetable}\hskip3.2pt}
\newenvironment{table}
               {\@float{table}}
               {\end@float}
\newenvironment{table*}
               {\@dblfloat{table}}
               {\end@dblfloat}
%
\def\@maketablecaption#1#2{%
    \setbox\tempbox\hbox{\tablecaptionfont#1. #2.\vphantom{y}\par}
     \ifdim\wd\tempbox>2\tablewidth
        {\tablecaptionfont\leftskip\tabledim plus .5fill\rightskip\tabledim plus -.5fill#1. #2.\parfillskip0pt plus 1fill \vphantom{y}\par}
    \else
        \centering{\tablecaptionfont\centering#1. #2.\vphantom{y}\par}
    \fi
}%
%
\newskip\tabnoteleftskip
\newskip\tabnoterightskip
\newdimen\tablewidth
%%
\long\def\tbl{\@ifnextchar[{\@tbl}{\@tbl[]}}%
\def\@tbl[#1]#2#3{%
  \setbox\tempbox\hbox{\tablefont#3}%
  \tablewidth\wd\tempbox
  \tabledim\hsize
  \advance\tabledim-\wd\tempbox
  \ifdim\tabledim>0pt
                      \divide\tabledim2
  \else
  			\global\tabledim0pt
  \fi
  \global\tableleftskip\tabledim %plus1fill 
  \global\tablerightskip\tabledim %plus1fill
  \global\tabnoteleftskip\tabledim
  \global\tabnoterightskip\tabledim
  \ifx\table@numbered\NO%FOM Start
      \caption{#2}%
  \else
      \caption{#2}%
  \fi%FOM End
  \centerline{\box\tempbox}
  }
%%
\def\TCH#1{\TCHfont#1}%
\def\x{@{\extracolsep{\fill}}}
\def\toprule{\Hline\\[-5.5pt]}
\def\colrule{\\[-8.5pt]\Hline\\[-4.5pt]}
\def\Colrule{\\[-8.6pt]\Hline\\[-8.2pt]}
\def\botrule{\\[-7pt]\Hline}
\def\crule#1{\\[-8.5pt]#1\\[-5pt]}
%
%
\def\gridtablefont{\fontsize{9}{10}\selectfont\leftskip\tableleftskip\rightskip\tablerightskip\mathversion{normal}%
     \setbox\strutbox\hbox{%
	   \vrule\@height14.5pt
		 \@depth6pt
		 \@width\z@}}%
\def\tablecolumnfont{\fontsize{9}{10}\selectfont\mathversion{normal}}%
\def\gridTCHfont{\fontsize{9}{10}\selectfont}% Johny 06/26/03
\def\gridcrule#1{#1}%
%
\def\frametoprule{\hline}
\def\framecolrule{\hline}
\def\frameColrule{\hline}
\def\framebotrule{\hline}
%%
\def\TableCaption#1{{\bfseries#1}}
\def\TableHeading#1{{\bfseries#1}\\}
\def\TableSep{\\\\}% space between two table within one tabular
%
\newdimen\moreRowSep
\moreRowSep=-10pt % space betwn rows in grid table
%
%
\def\Hline{%
  \noalign{\ifnum0=`}\fi\hrule \@height .25pt \futurelet%\@height \arrayrulewidth
   \@tempa\@xhline}
%
\def\cline#1{\@cline#1\@nil}
\def\@cline#1-#2\@nil{%
  \omit
  \@multicnt#1%
  \advance\@multispan\m@ne
  \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
  \@multicnt#2%
  \advance\@multicnt-#1%
  \advance\@multispan\@ne
  \leaders\hrule\@height .5pt\hfill
  \cr
  \noalign{\vskip-\arrayrulewidth}}
%
%
\def\CRule (#1-#2)#3\@nil{%
    \if#3.\CLine{#1-#2}\else\CLine{#1-#2}\@CRule#3\@nil\fi}
%
\def\@CRule (#1-#2)#3\@nil{%
    \ifx#3.\CLine{#1-#2}\else\CLine{#1-#2}\@CRule#3\@nil\fi\gdef\@strule{}}
%
\newskip\tcsepa
\def\CLine#1{\@CLine#1\@nil}
\def\@CLine#1-#2\@nil{%
  \omit
  \@multicnt#1%
  \advance\@multispan\m@ne
  \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
  \@multicnt#2%
  \advance\@multicnt-#1%
  \advance\@multispan\@ne
  \ifnum#2=\Cols\tcsepa\z@\else\ifx\table@colsep\ONE\else\tcsepa\tabcolsep\fi\fi
\leaders\hrule\@height\arrayrulewidth\hfill\kern\tcsepa
  \cr
  \noalign{\vskip-\arrayrulewidth}}
%%%
%
\newdimen\@tabnotemax
\def\tabnotemax#1{\setbox\z@\hbox{\tabnotefont#1}\global\@tabnotemax\wd\z@}
\tabnotemax{0}
%
\def\tabnoteentry#1#2{\par\noindent\@hangfrom{\hbox to\@tabnotemax{\hss\textsuperscript{#1}}\hskip2pt}#2\par}
%
\def\notes@label{}
\newcounter{tabnote}[table]
%
\newenvironment{tabnote}{\par\vskip-1pt%
  \ifx\firsttabnote\YES\gdef\firsttabnote{no}\vskip6pt\fi%
  \tabnotemax{\notes@label}\tabnotefont%
  }{\par}
%
\def\PrintTableFoot#1{%
    \ifx#1\empty%
    \else
       \begin{tabnote}
       \@tfoot{}%#1
       \end{tabnote}
    \fi}
%
\def\PrintTableNotes#1{%
    \ifx#1\empty%
    \else
       \begin{tabnote}
       \@tnotes%#1
       \end{tabnote}
    \fi}
%
%
\newenvironment{intexttable}{\par\addvspace{6.3pt plus2pt}
\centering
\noindent%
}{%
\par\addvspace{6.6pt plus2pt}}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Floats %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Math %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\setlength\arraycolsep{1.5\p@}
\setlength\tabcolsep{12\p@}
\setlength\arrayrulewidth{.4\p@}
\setlength\doublerulesep{2\p@}
\setlength\tabbingsep{\labelsep}
\setlength\fboxsep{3\p@}
\setlength\fboxrule{.4\p@}
%
\setlength\columnsep{18\p@}
\setlength\columnseprule{0\p@}
%
\@addtoreset{equation}{chapter}
\renewcommand\theequation{\arabic{equation}}
\def\@eqnnum{{\reset@font\rmfamily (\theequation)}}
%
\def\bstrut{\vrule width0pt depth6pt}
\def\tstrut{\vrule width0pt height9pt}
\jot=6pt
%
%\def\text#1{\hbox{\scriptsize #1}}%
\def\text#1{\mathchoice
{\hbox{\fontsize{\tf@size}{\tf@size}\selectfont#1}}%
{\hbox{\fontsize{\tf@size}{\tf@size}\selectfont#1}}%
{\hbox{\fontsize{\sf@size}{\sf@size}\selectfont#1}}%
{\hbox{\fontsize{\ssf@size}{\ssf@size}\selectfont#1}}}
%
%
\renewcommand\footnoterule{}%
%
\@addtoreset{footnote}{chapter}
\renewcommand\thefootnote{\fnsymbol{footnote}}
%
\def\@fnsymbol#1{\ifcase#1\or$\ast$\or\unskip$\dagger$\or$\ddagger$\or\SS\or%
\|\or\#\or**\or\dagger\dagger\or\ddagger\ddagger\or\SS\SS\or\|\hskip-1pt\|\or\#\#\or***\or\unskip\dagger\dagger\dagger\or\ddagger\ddagger\ddagger\else\@ctrerr\fi\relax}
%
\newdimen\@footmax
\def\footmax#1{%
  \setbox\tempbox\hbox{\footnotesize\textsuperscript{#1}}%
  \global\@footmax\wd\tempbox}
%
\footmax{0}
%
\def\footnote{\@ifnextchar[\@xfootnote{\stepcounter\@mpfn
     \protected@xdef\@thefnmark{\hbox{\thempfn}}%
     \@footnotemark
     \@footnotetext}}
%
\def\@makeFNmark{\hbox{{\@thefnmark}}}
\def\@Makefnmark{\hbox{\textsuperscript{\@thefnmark}}}
%
\def\shfont{\leftskip0pt plus1fill\rightskip\leftskip}
\newif\ifshortfn\shortfnfalse
\long\def\@makefntext#1{\overfullrule0pt\parindent0pt\vskip-1pt%
    \leavevmode{\hbox to \@footmax{\hfill\@makefnmark}\hskip3pt}#1\par}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Footnote %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\quot#1{\par\addvspace{6pt}\leftskip1pc\rightskip1pc\endnotesfont#1\par\addvspace{6pt}}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Page styles  %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\oddfolio{{\foliofont\thepage}}
\def\evenfolio{{\foliofont\thepage}}
\def\bookmark#1{\gdef\@bookmark{#1}}
\def\@bookmark{The mith of morality}
%
\def\newrule{\raise-4.25pt\hbox{\vrule height15pt width.5pt}}

\def\ps@headings{\let\@mkboth\markboth%
    \def\@oddfoot{}%
    \def\@evenfoot{}%
    \def\@evenhead{\evenfolio\hfill{\rhfont\itshape\@shorttitle}}%
    \def\@oddhead{{\rhfont\itshape\@shorttitle}\hfill\oddfolio}%
    \let\@mkboth\markboth
    }
%
\def\ps@indexheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\evenfolio\hfill{\rhrfont\leftmark}}%
    \def\@oddhead{{\rhrfont\rightmark}\hfill\oddfolio}%
    \let\@mkboth\markboth
    \def\chaptermark##1{\markboth{##1}{##1}}%
    }
%
\def\ps@Empty{%
      \def\@oddfoot{\hfill{\fontfamily{QueryPage}\bfseries%
      }\hfill}%
      \let\@evenfoot\@oddfoot
      \def\@evenhead{}%
      \def\@oddhead{}%
      \let\@mkboth\markboth
      \let\chaptermark\@gobble
      \let\sectionmark\@gobble%
}
%
\def\ps@empty{%
      \def\@oddfoot{\hfill\lower\blindfoliodrop\hbox{\thepage}\hfill}
      \let\@evenfoot\@oddfoot
      \def\@evenhead{}%
      \def\@oddhead{}%
      \let\@mkboth\markboth
      \let\chaptermark\@gobble
      \let\sectionmark\@gobble%
}
%
%
\def\ps@plain{%\let\@mkboth\@gobbletwo%
    \let\@evenfoot\@empty%
    \let\@oddfoot\@empty%
    \def\@oddhead{\vbox{\par\rhnfont\doiline}}%
    \let\@evenhead\@empty
    \let\chaptermark\@gobble}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Page styles  %%%%%%%%%%%%%%%%%%%%%%%%
%
%
\newcommand\bibyhead[1]{%
\bibitem{}%
\bibYHead{#1}\vskip.5pt}
%
\newcommand\bibzhead[1]{%
\bibitem{}%
\bibZHead{#1}\vskip5pt}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Bibliography Section   %%%%%%%%%%%%%%%%%%
%
\newdimen\bibindent
\newdimen\bibleftmargin
\newdimen\bibitemsep
\newdimen\bibparsep
\newdimen\bibtext
\newdimen\biblabelsep
\newdimen\bibleftmargini
%
%%%%% TRUE FOR CHAPTER TITLE AND FALSE FOR SECTION TITLE %%%%%%%%
\newif\ifbibchapter
\global\bibchaptertrue
%%%%%%%% Unnumberd References %%%%%%%%%%%
\setlength\bibleftmargin  {0pt}
\setlength\bibitemsep  {0pt}
%\setlength\bibparsep  {1pt}
%%%%%%%% Numbered Within Squre Bracket %%%%%%%%%%%
\newif\ifnumsqure
\global\numsqurefalse
\setlength\biblabelsep  {.5em}
\setlength\bibleftmargini  {5.75pt}
%%%%%%%% Numbered With Dot %%%%%%%%%%%%%%%
\setlength\bibtext  {20pt}
%
%
\setlength\bibleftmargin{4mm}
%
\def\bibenvhead#1{\protect\XHead*{\hspace*{-\leftmargin}#1\vrule height0pt width0pt depth3pt}}%FOM
%
       \newdimen\@bibmax
       \def\bibmax#1{%
       \setbox\tempbox\hbox{{\bibliofont#1.}}%
       \global\@bibmax\wd\tempbox}
        \bibmax{0}
%
\newenvironment{thebibliography}[1]
     {\par\overfullrule0pt%
     \section*{References}%
     \def\@tempa{#1}%
     \ifx\@tempa\@empty
        \bibliofont\list{}%
           {\labelwidth0pt\labelsep0pt
           \def\@biblabel##1{}
           \leftmargin8.5pt
           \itemindent-8.5pt%
           \itemsep\bibitemsep
           \parsep\bibparsep
           \usecounter{enumiv}%
           \let\p@enumiv\@empty
           \renewcommand\theenumiv{\arabic{enumiv}}}%
      \else
         \bibliofont\setbox\tempbox\hbox{\@tempa.}
          \tempdimen\wd\tempbox
          \ifnumsqure
          \else
           \list{\@biblabel{\arabic{enumiv}}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
           \usecounter{enumiv}%
           \labelsep5pt%
           \leftmargin\labelsep\advance\leftmargin\@bibmax
          \def\@biblabel##1{\hbox to \@bibmax{\hss##1.}}%%\hbox to \bibtext{\hbox to \tempdimen{\hfill##1.}\hfil}}\fi%
           \let\p@enumiv\@empty
           \renewcommand\theenumiv{\arabic{enumiv}}}%
     \fi\fi
     \sloppy\clubpenalty4000\widowpenalty4000%
     \sfcode`\.=\@m}
     {\def\@noitemerr
     {\@latex@warning{Empty `thebibliography' environment}}%
     \endlist\par}
\newcommand\newblock{}
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End Bibliography Section %%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand\@pnumwidth{1.55em}
\newcommand\@tocrmarg {2.55em}
\newcommand\@dotsep{4.5}
\setcounter{tocdepth}{2}
%
\newcommand\l@part[2]{%
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}%
    \addvspace{2.25em \@plus\p@}%
    \begingroup
      \setlength\@tempdima{3em}%
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
       \large \bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
       \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}
    \endgroup
  \fi}
\newcommand\l@chapter[2]{%
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}%
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hbox to\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi}
\newcommand\l@section      {\@dottedtocline{1}{1.5em}{2.3em}}
\newcommand\l@subsection   {\@dottedtocline{2}{3.8em}{3.2em}}
\newcommand\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\newcommand\l@paragraph    {\@dottedtocline{4}{10em}{5em}}
\newcommand\l@subparagraph {\@dottedtocline{5}{12em}{6em}}
\let\l@table\l@figure
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  End FM  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Appendix  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcounter{appendix}
\newenvironment{appendix}{\par
  \setcounter{chapter}{0}%
  \setcounter{section}{0}%
  \setcounter{equation}{0}%
  \setcounter{appendix}{0}
   \stepcounter{appendix}
  \renewcommand\theappendix{\Alph{appendix}}
%  \renewcommand\@chapapp{\appendixname}%
  \renewcommand\thechapter{\Alph{chapter}}
  \renewcommand\theequation{\theappendix\arabic{equation}}
  \renewcommand\thesection{\Alph{section}}}{\par}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% End Appendix %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\schapfont{\fontsize{11}{12.5}\selectfont}
\def\stitlefont{\fontsize{10}{11}\selectfont}
\def\ssubtitlefont{\fontsize{10}{11}\selectfont\itshape}
\def\sauthorsfont{\fontsize{10}{11}\selectfont\scshape}
\newdimen\serinwidth
\newcommand\seriexmax[1]{\setbox\tempbox\hbox{\schapfont#1\hskip2.8pt}%
        \serinwidth\wd\tempbox}
%
%
\def\Shead{\thispagestyle{empty}{\fontsize{12}{14}\selectfont\scshape\leftskip2pc\rightskip\leftskip%
\centerline {\def\spreadoutfactor{.5}\spreadout{cambridge studies in romanticism}}}}
%
\seriexmax{10}
%
\newif\ifsempty\semptyfalse
\newcommand\l@series[4]{\def\spreadoutfactor{.5}{\addvspace{5.5pt plus2pt}%
   \noindent\@hangfrom{\hbox to \serinwidth{\stitlefont#1\hfill}}%
   {\sauthorsfont\spreadout{#2}\par}
%   \ifsempty \else
%			{\hskip3pt\ssubtitlefont#3\par}\fi
   \ifx#3\@empty \else
			{\hskip3pt\stitlefont#3\par}\fi
   \ifx#4\@empty\else
			{\hskip3pt\ssubtitlefont#4\par}\fi}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  Index  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\alphabet#1{{\bf#1}\par\vskip.5\baselineskip}
%
\newenvironment{theindex}{\indextrue\cleardoublepage\bookmark{\indexname}%
      \columnseprule \z@
      \columnsep 12\p@
      \indexfont\markboth{\indexname}{\indexname}
      \thispagestyle{plain}
      \tempdimen\normalbaselineskip
      \advance\tempdimen-\baselineskip
      \advance\tempdimen5pt
      \twocolumn[\@makeschapterhead{\hskip1.2ptIndex}\vskip\tempdimen\vskip2.2pt]%
      \parindent\z@
      \let\item\@idxitem
}{%
      \par\global\indexfalse}
\newcommand\@idxitem  {\par\hangindent2em}
\newcommand\subitem   {\par\hangindent2em\hspace*{1em}}
\newcommand\subsubitem{\par\hangindent2em\hspace*{2em}}
\newcommand\indexspace{\par \vskip\baselineskip}
%
%
%
\newdimen\tempdim
\newdimen\presentfigwidth
\newdimen\oldfigwidth
\newdimen\remainingtextwidth
%
%
\gdef\@placewidthart{}
%
\figwidth0pt
\figheight0pt
%
\def\authorname{}
\def\jobno{}
\def\chapno{}
%
\def\changeh#1.#2pt{}
%
\def\ArtPiece#1#2#3{%
\fboxrule.1pt
\fboxsep0pt
 \oldfigwidth\figwidth
  \gdef\figtemp{#1}%
 \gdef\figtempscale{#3}%
 \setbox\tempbox=\vbox{\epsfbox{\ArtDir#1}}%
	\figheight\ht\tempbox
 \setbox\tempbox=\hbox{\epsfbox{\ArtDir#1}}%
 \advance\figwidth\wd\tempbox
 \presentfigwidth\wd\tempbox
 \remainingtextwidth\textwidth 
 \advance\remainingtextwidth-\oldfigwidth
 \advance\remainingtextwidth-\presentfigwidth
 \tempdim\oldfigwidth\advance\tempdim\presentfigwidth
 \ifdim\remainingtextwidth<0pt\par\vskip6pt%
 \else
 \fi 
 \setbox\tempbox=\hbox{\fbox{\epsfbox{\ArtDir#1}\hss}}%
\xdef\@placewidthart{\@placewidthart\unhbox\tempbox}%
  \leavevmode\vbox{\hsize\presentfigwidth\parindent0pt\leftskip0pt plus1fill\rightskip\leftskip{}
      \@placewidthart\par 
      \vskip3pt
      Figure: \figtemp\par
      Reduction: \figtempscale\%\par
						Height:\the\figheight\par
						Width: \the\presentfigwidth\par
     \jobno\quad \chapno \quad\authorname}\unskip\hskip10pt}
%
%%%%%%%%%%%%%%%%%%% End File Version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\def\@outputpage{%
\begingroup           % the \endgroup is put in by \aftergroup
  \let \protect \noexpand
  \@resetactivechars
  \global\let\@@if@newlist\if@newlist
  \global\@newlistfalse
  \@parboxrestore
  \shipout \vbox{%
    \set@typeset@protect
    \aftergroup \endgroup
    \aftergroup \set@typeset@protect
                                % correct? or just restore by ending
                                % the group?
  \if@specialpage
    \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
  \fi
    \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
         \let\@themargin\oddsidemargin
    \else \let\@thehead\@evenhead
       \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
    \fi
  \reset@font
  \normalsize
  \normalsfcodes
  \let\label\@gobble
  \let\index\@gobble
  \let\glossary\@gobble
  \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
    \@begindvi
    \vskip \topmargin
    \moveright\@themargin \vbox {%
      \setbox\@tempboxa \vbox to\headheight{%
        \vfil
        \color@hbox
          \normalcolor
          \hb@xt@\textwidth{\@thehead}%
        \color@endbox
        }%                        %% 22 Feb 87
      \dp\@tempboxa \z@
      \box\@tempboxa
      \vskip \headsep
      \box\@outputbox
      \baselineskip \footskip
      \color@hbox
        \normalcolor
        \hb@xt@\textwidth{\@thefoot}%
      \color@endbox
      }%
    }%
  \global\let\if@newlist\@@if@newlist
  \global \@colht \textheight
  \stepcounter{page}%
  \let\firstmark\botmark
}
%%%
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AtBeginDocument{%
\@ifpackageloaded{amsmath}{}{%
\@namedef{equation*}{$$}
\@namedef{endequation*}{$$}
}}%
%
%History date macro
\def\ADaccepted#1{\gdef\@AD@accepted{#1}}%
\def\ADmiscellaneous#1{\gdef\@AD@miscellaneous{#1}}
\def\ADreceived#1{\gdef\@AD@received{#1}}
\def\ADreviewed#1{\gdef\@AD@reviewed{#1}}
\def\ADrevised#1{\gdef\@AD@revised{#1}}
%
\def\@history{}
\def\printhistory{%
   \@ifundefined{@AD@received}{%
   \gdef\@history{\parindent0pt\receivedfont% 
 	   \@ifundefined{@AD@accepted}{}{%
	      (Accepted \@AD@accepted})\par}
    }{%
   \gdef\@history{\parindent0pt\receivedfont% 
 	(Received in Final Form:\ \@AD@received%
	   \@ifundefined{@AD@accepted}{}{%
	      ; accepted \@AD@accepted})\par}}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{acknowledgements}{\par\ignorespaces}{\par}
%
\AtBeginDocument{%
\@ifpackageloaded{amsmath}{}{%
  \newcommand{\mathfrak}{\protect\pmathfrak}
  \newcommand{\pmathfrak}{\@fontswitch{\relax}{\mfrak}}
}}%% \fi%
\DeclareMathAlphabet\mfrak{U}{eufa}{m}{n}
\SetMathAlphabet\mfrak{normal}{U}{eufa}{m}{n}
\SetMathAlphabet\mfrak{bold}{U}{eufa}{b}{n}
%
%%%%%%%%%%% Initialization  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\pagestyle{headings}
\pagenumbering{arabic}      % Arabic page numbers
\frenchspacing
%
\usepackage{rotating}
%
\hyphenpenalty8000
\clubpenalty10000
\widowpenalty10000
%
%
\sloppy
\medmuskip=4mu
\thickmuskip=5mu
%
\voffset-6.17pc
\hoffset-6.03pc
%
%%
\newenvironment{summary}{\par\section*{SUMMARY}}{\par\vskip12pt}
\renewenvironment{keywords}{\par\parindent0pt KEYWORDS:}{\par\vskip12pt}
%%
\usepackage{amssymb}
\newenvironment{proof*}
  {\proof}
  {\endtrivlist}
%%
\endinput
%%
%% End of file `rob.cls'.
