% report.sty 26-Apr-88
% no longer used Thu 10/4/03
%
% Probably should not use this - just use itchapter.cls now! Wed 20/2/02
%
% for summary see chapternotes.sty
%
% oddhead and evenhead and foot are defined in terms of leftmark and rightmark
% see also chapternotes.sty for foot stuff
% 
% and for exercisa
%
% To DO
% 1) bst: if more than 2 authors then should group together 
%    in an ``etal'' list instead of 

\typeout{Document Style `itchapter' <26 Apr 88>. Modified 11 dec 91, 18 oct 93, 11 96}
\typeout{Change line 75 of reportcit.sty}

% DJCM added 12 96:
% \frenchspacing
% and removed feb 18 99.

\newdimen\mathindent
\mathindent = 6pc %%%%%% this should be put in a size-dependent sty file
\newlength{\varind}
\newlength{\figdepth}
\newlength{\figwidth}
\newlength{\secfigwidth}
\newlength{\digitwidth}
\newlength{\indentedwidth}

% need to include mycaption.sty. stuff has been moved from here to there
\input mycaption.sty
%\newcounter{eqnval}
% DJCM added 14 3 94:
 
\newcommand{\rfootmessage}[1]{\def\@rfootmessage{#1}}
\newcommand{\lfootmessage}[1]{\def\@lfootmessage{#1}}
\newcommand{\footmessage}[1]{\def\@footmessage{#1}}
\newcommand{\foottitle}[1]{\def\@foottitle{#1}}
\newcommand{\headtitle}[1]{\def\@headtitle{#1}}
\newcommand{\shortauthor}[1]{\def\@shortauthor{#1}}

%
% re-defining the plain headings style
% means that the headings work on the contents page.
%

\def\ps@plain{ 
  \let\@mkboth\markboth 
  \def\@oddfoot{
    \footnotesize{ 
      \centerline{\thepage} \hspace*{-\textwidth} \hspace{-5mm} \today \hfill
      \@shortauthor:~\@foottitle}} 
  \def\@oddhead{} 
  \def\@evenfoot{\@oddfoot}
  \def\@evenhead{}
  }

\def\@ptsize{0} \@namedef{ds@11pt}{\def\@ptsize{1}}
\@namedef{ds@12pt}{\def\@ptsize{2}} 
\def\ds@twoside{\@twosidetrue \@mparswitchtrue} \def\ds@draft{\overfullrule
5pt} 
\@options
%
% I moved this here from itchapter11.sty:
%
\def\chaptermark#1{}

% this makes subsections be numbered:
% \setcounter{secnumdepth}{2}
\setcounter{secnumdepth}{3}%%%%%%%% 1 didn't prevent subsubsctions being numbered?

\def\appendix{\par
 \setcounter{chapter}{0}
 \setcounter{section}{0}
 \def\@chapapp{Appendix}
 \def\thechapter{\Alph{chapter}}}


%
% this uses repcit11.sty, changed to itchapter11.sty
% 
\input itchapter1\@ptsize.sty\relax


\def\labelenumi{\theenumi.} 
\def\theenumi{\arabic{enumi}} 
\def\labelenumii{(\theenumii)}
\def\theenumii{\alph{enumii}}
\def\p@enumii{\theenumi}
\def\labelenumiii{\theenumiii.}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\theenumi(\theenumii)}
\def\labelenumiv{\theenumiv.}
\def\theenumiv{\Alph{enumiv}} 
\def\p@enumiv{\p@enumiii\theenumiii}

\def\labelitemi{$\bullet$}
\def\labelitemii{\bf --}
\def\labelitemiii{$\ast$}
\def\labelitemiv{$\cdot$}

\def\verse{\let\\=\@centercr 
 \list{}{\itemsep\z@ \itemindent -1.5em\listparindent \itemindent 
 \rightmargin\leftmargin\advance\leftmargin 1.5em}\item[]}
\let\endverse\endlist
\def\quotation{\list{}{\listparindent 1.5em
 \itemindent\listparindent
 \rightmargin\leftmargin\parsep 0pt plus 1pt}\item[]}
\let\endquotation=\endlist
\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist
% old version of aside was indented at the left and the right.
%\def\aside{\list{}{\rightmargin\leftmargin}\item[]\footnotesize}
\def\aside{\list{}{}\item[]\footnotesize}
\let\endaside=\endlist

\def\descriptionlabel#1{\hspace\labelsep \bf #1}
% this -\leftmargin causes the first line of a description
% to be aligned with the NORMAL left hand side
\def\description{\list{}{\labelwidth\z@ \itemindent-\leftmargin
 \let\makelabel\descriptionlabel}}
\let\enddescription\endlist
\newdimen\descriptionmargin
\descriptionmargin=3em


\def\titlepage{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \else \newpage \fi \thispagestyle{empty}\c@page\z@}
\def\endtitlepage{\if@restonecol\twocolumn \else \newpage \fi}

\arraycolsep 5pt \tabcolsep 6pt \arrayrulewidth .4pt \doublerulesep 2pt 
\tabbingsep \labelsep 
\skip\@mpfootins = \skip\footins
\fboxsep = 3pt \fboxrule = .4pt 

\newcounter{part}
\newcounter {chapter}
\newcounter {section}[chapter]
\newcounter {subsection}[section]
\newcounter {subsubsection}[subsection]
\newcounter {paragraph}[subsubsection]
\newcounter {subparagraph}[paragraph]

\def\thepart {\Roman{part}}
\def\thechapter {\arabic{chapter}}
\def\thesection {\thechapter.\arabic{section}}
\def\thesubsection {\thesection.\arabic{subsection}}
\def\thesubsubsection {\thesubsection .\arabic{subsubsection}}
\def\theparagraph {\thesubsubsection.\arabic{paragraph}}
\def\thesubparagraph {\theparagraph.\arabic{subparagraph}}
\def\@chapapp{Chapter}

% CHANGE THIS BACK TO cleardoublepage
\def\part{\clearpage \thispagestyle{myheadings} \if@twocolumn \onecolumn
\@tempswatrue \else \@tempswafalse \fi \hbox{}\vfil \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{}{}
 {\centering \ifnum \c@secnumdepth >-2\relax \huge\bf Part \thepart \par
\vskip 20pt \fi \Huge \bf #1\par}\@endpart} 
\def\@endpart{\vfil\newpage 
% commented this out DJCM
%\if@twoside 	\hbox{} \thispagestyle{empty}  \newpage  \fi
 \if@tempswa \twocolumn \fi} 
\def\@spart#1{{\centering \Huge \bf #1\par}\@endpart}


\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{4.5}
\setcounter{tocdepth}{2}


\def\tableofcontents{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi
 \chapter*{Contents\@mkboth{Contents}{Contents}}%%%%%%% changed to lc DJCM
 \@starttoc{toc}\if@restonecol\twocolumn\fi}

% allegedly this controls the setting of the contents line
\def\l@part#1#2{\addpenalty{-\@highpenalty}
  \addvspace{2.25em plus 1pt} \begingroup
  \@tempdima 1em \parindent \z@ \rightskip \@pnumwidth \parfillskip
   -\@pnumwidth 
% 18 oct 93 changed this:
  {\Large \bf \leavevmode Part #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
  \nobreak \endgroup}

% was 5.5em
\def\l@chapter#1#2{\pagebreak[3] 
 \vskip 1.0em plus 1pt \@tempdima 2em  
% that number controls both distance to chapter number and distance to chapapp
 \begingroup
  \parindent \z@ \rightskip \@pnumwidth 
  \parfillskip -\@pnumwidth 
% \bf \leavevmode \advance\leftskip\@tempdima \hskip -\leftskip #1\nobreak\hfil
  \bf \leavevmode \advance\leftskip\@tempdima #1\nobreak\hfil
  \nobreak\hbox to\@pnumwidth{\hss #2}\par
 \endgroup}
% \def\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
% \def\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
% \def\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
% \def\l@paragraph{\@dottedtocline{4}{10em}{5em}}
% \def\l@subparagraph{\@dottedtocline{5}{12em}{6em}}
\def\l@section{\@dottedtocline{1}{10.9em}{2.9em}}
\def\l@subsection{\@dottedtocline{2}{13.8em}{3.2em}}
\def\l@subsubsection{\@dottedtocline{3}{17.0em}{4.1em}}
\def\l@paragraph{\@dottedtocline{4}{20em}{5em}}
\def\l@subparagraph{\@dottedtocline{5}{22em}{6em}}

\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi\chapter*{List of Figures\@mkboth
 {LIST OF FIGURES}{LIST OF FIGURES}}\@starttoc{lof}\if@restonecol
 \twocolumn\fi}
\def\l@figure{\@dottedtocline{1}{1.5em}{2.3em}}
\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
 \fi\chapter*{List of Tables\@mkboth
 {LIST OF TABLES}{LIST OF TABLES}}\@starttoc{lot}\if@restonecol
 \twocolumn\fi}
\let\l@table\l@figure


% solutions to exercises and all that
% (see also exercise.sty)
\def\subchapter#1{\chapter*{#1\@mkboth
  {#1}{#1}}%
% \addcontentsline{toc}{chapter}{\protect \numberline{}#1}
}
%
\def\prechapter#1{\addtocounter{chapter}{1}\chapter*{#1 \thechapter\@mkboth
  {#1  \thechapter}{#1 \thechapter}}%
%\addcontentsline{toc}{chapter}{\protect \numberline{}#1 \thechapter}
\addtocounter{chapter}{-1}}
\def\beginprechapter#1{\addtocounter{chapter}{1}\chapter*{#1 \thechapter\@mkboth
  {#1  \thechapter}{#1 \thechapter}}}
%\addcontentsline{toc}{chapter}{\protect \numberline{}#1 \thechapter}}
%
% the sectioning commands should not be used in a prechapter.
\def\endprechapter{\addtocounter{chapter}{-1}}
%
% fakesection included to help out reftex mode
\def\fakesection#1{}%
% this is not integrated:
\def\fakesubsection#1{}%
%
%
%  commented out by DJCM 1997
% \def\thebibliography#1{\chapter*{Bibliography\@mkboth
%  {BIBLIOGRAPHY}{BIBLIOGRAPHY}}\addcontentsline{toc}{chapter}{\protect
%  \numberline{}Bibliography}\list
%  {[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
%  \advance\leftmargin\labelsep
%  \usecounter{enumi}}
%  \def\newblock{\hskip .11em plus .33em minus .07em}
%  \sloppy\clubpenalty4000\widowpenalty4000
%  \sfcode`\.=1000\relax}
% \let\endthebibliography=\endlist
%  
% 
% NB, bibliography is defined in lsalike.sty
%
\newif\if@restonecol
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
\columnsep 35pt\twocolumn[\@makeschapterhead{Index}]%%%%%%% lc by DJCM
 \@mkboth{INDEX}{INDEX}% Tue 13/8/02 cut this: \thispagestyle{plain}
\parindent\z@
 \parskip\z@ plus .3pt\relax\let\item\@idxitem}% end def index
\def\@idxitem{\par\hangindent 40pt}
\def\subitem{\par\hangindent 40pt \hspace*{20pt}}
\def\subsubitem{\par\hangindent 40pt \hspace*{30pt}}
\def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
\def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax}

\def\footnoterule{\kern-3\p@ 
 \hrule width .4\columnwidth 
 \kern 2.6\p@} 
\@addtoreset{footnote}{chapter} 
\long\def\@makefntext#1{\parindent 1em\noindent 
 \hbox to 1.8em{\hss$^{\@thefnmark}$}#1}


\setcounter{topnumber}{2}
\def\topfraction{.7}
\setcounter{bottomnumber}{1}
\def\bottomfraction{.3}
\setcounter{totalnumber}{3}
\def\textfraction{.2}
\def\floatpagefraction{.5}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{.7}
\def\dblfloatpagefraction{.5}


\newcounter{figure}[chapter]
\def\thefigure{\thechapter.\@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{Figure \thefigure}
\def\figure{\@float{figure}}
\let\endfigure\end@float
\@namedef{figure*}{\@dblfloat{figure}}
\@namedef{endfigure*}{\end@dblfloat}
\newcounter{table}[chapter]
\def\thetable{\thechapter.\@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{Table \thetable}
\def\table{\@float{table}}
\let\endtable\end@float
\@namedef{table*}{\@dblfloat{table}}
\@namedef{endtable*}{\end@dblfloat}
% added Wed 4/7/01 
\newcounter{algorithm}[chapter]
\def\thealgorithm{\thechapter.\@arabic\c@algorithm}
\def\fps@algorithm{tbp}
\def\ftype@algorithm{2}
\def\ext@algorithm{lot}
\def\fnum@algorithm{Algorithm \thealgorithm}
\def\algorithm{\@float{algorithm}}
\let\endalgorithm\end@float
\@namedef{algorithm*}{\@dblfloat{algorithm}}
\@namedef{endalgorithm*}{\end@dblfloat}

% REMOVED  28 sept 93 djcm \input titlepage.sty

\mark{{}{}} 

%
% more figure stuff
%
%
% Here are some devices for making real figures
% djcm
% see iop*sty for some not-working ideas
%
% see marginfig.sty for some working

%
%
% DEFINE HEADERS
%
\if@twoside 
 \def\ps@headings{
  \let\@mkboth\markboth
  \def\@oddfoot{\@rfootmessage}
  \def\@evenfoot{\@lfootmessage}
% in my thesis this was slant upper case (See later for the upper case bit)
%  \def\@evenhead{\rm \thepage\hfil \sl	\leftmark}
%  \def\@oddhead{\hbox{}\sl \rightmark \hfil 	\rm\thepage}
% the 1996 style is 
%  \def\@evenhead{\hbox{}{\sl \leftmark} \hfil \thepage\hspace*{-\margindistance}}
%  \def\@oddhead{\thepage \hfil\hbox{}\sl \rightmark\hspace*{-\margindistance}}
  \def\@evenhead{{\sf \thepage} \hfil {\sl \leftmark}\hspace*{-\margindistance}}
  \def\@oddhead{{\sl \rightmark}  \hfil {\sf \thepage}\hspace*{-\margindistance}}
% jan 2000 added the margindistance feature. see also chapternotes
% for the corresponding footer effect.
% added \thepage too
%  \def\@oddhead{\@foottitle} % booktitle
%
% this next bit was changed Dec 97
%
% this is where the oddhead and evenhead's leftmark and rightmark are defined
%   \def\chaptermark##1{\markboth 
% 	{{\@title}}
% 	{{\ifnum \c@secnumdepth >\m@ne \@chapapp\ \thechapter\ --- \ \fi ##1}}}
% %		This makes it say CHAPTER (thechapter). Introduction to ...
% % for my thesis it was: 
% %	{\uppercase{\@title}}
% %	{\uppercase{\ifnum \c@secnumdepth >\m@ne \@chapapp\ \thechapter. \ \fi ##1}}}
% %%		This makes it say CHAPTER (thechapter). Introduction to ...
% jan 2000 I switched off the ``Chapter''
%     \def\chaptermark##1{\markboth{\@chapapp\ \thechapter\ --- ##1}{\thechapter\ --- ##1}}%
     \def\chaptermark##1{\markboth{\thechapter\ --- ##1}{\thechapter\ --- ##1}}%
     \def\sectionmark##1{\markright{\thesection: ##1}}%
     \def\subsectionmark##1{}
 }
\else \def\ps@headings{\let\@mkboth\markboth
	\def\@oddfoot{\@rfootmessage}\def\@evenfoot{\@rfootmessage}\def\@oddhead{\hbox {}\sl \rightmark \hfil
	\rm\thepage}\def\chaptermark##1{\markright {\uppercase{\ifnum \c@secnumdepth
	>\m@ne
%	 \@chapapp\ \thechapter. \ \fi ##1}}}}
	  \thechapter. \ \fi ##1}}}}
\fi
%
\def\ps@myheadings{  % used for new chapter pages
 \let\@mkboth\@gobbletwo
%
% in 1997, I put the title on new chapters
% \def\@oddhead{\hfill {\sc \@title} \hfill}
% \def\@evenhead{{\sc \@title}\hfill}
% but now this is revoked.
 \def\@oddhead{}
 \def\@evenhead{}
% \def\@evenfoot{{\sc \@foottitle}\hfill}
 \def\chaptermark##1{}%
 \def\sectionmark##1{}
 \def\subsectionmark##1{}
}


\def\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}
\@addtoreset{equation}{chapter} 
\def\theequation{\thechapter.\arabic{equation}}


\ps@plain \pagenumbering{arabic} \onecolumn \if@twoside\else\raggedbottom\fi 
%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% added 99 07 27, to make section numbers sit in the left margin
\renewcommand{\@seccntformat}[1]{%
\protect\makebox[0in][r]{%
%\mbox{%
{\csname the#1\endcsname}\hspace{1em}}}
%
