% SECTION.STY
% (c) (1992-1994) Oliver Pretzel (o.pretzel@ma.ic.ac.uk)
% For use with Latex Standard Styles
% Adds control of section heading style to standard LaTeX.
% For LaTeX2.09 (OFSS and NFSS) and LaTeX2e.
%
% Optional features are set to standard.
%
% DOCUMENTATION at end of file
%
% WARNING: conflicts with REFMAN.STY.
%
% ALL RIGHTS RESERVED
%
% This file may be distributed freely.
% It may be modified for local use (please inform me of such modifications)
% Modified versions may only be distributed if
% 1. The name is changed
% 2. A statement acknowledging the modification heads the file.
%
% DO NOT USE \neq in this file
\chardef\neq\the\catcode`\@
\makeatletter\@makeother\"
%
\typeout{`section.sty' <29 Oct 94>}
%*************************
\ifx\reset@font\undefined\let\reset@font\relax\fi
%
% Options
%
\ifx\secindent\undefined
 \newdimen\secindent
 \newskip\secpreskp
 \newskip\secpstskp
 \newdimen\subindent
 \newskip\subpreskp
 \newskip\subpstskp
 \newskip\parpstskp
\fi
\secindent0pt% no indentation
\secpreskp3.5ex plus 1 ex minus.2ex\secpreskp-\secpreskp
\secpstskp2.3ex plus .2ex
\subindent0pt
\subpreskp3.25ex plus 1 ex minus.2ex\subpreskp-\subpreskp
\subpstskp1.5ex plus.2ex
\parpstskp-1em
\ifx\chapter\undefined
 \def\chsize{\Large}\def\hdsize{\huge}\else
 \def\chsize{\huge}\def\hdsize{\Huge}
\fi
\let\ttsize\LARGE
\let\ausize\large
\let\dasize\large
\let\hdpos\raggedright
\let\secsize\Large
\let\subsize\large
\let\fpind\relax
%
\def\nmdot{}
\def\cpdot{:}
\def\hdfnt{\reset@font\bf}
\def\ttfnt{\reset@font\rm}
\def\pgfnt{\reset@font\rm}
\def\mkfnt{\reset@font\sl}
\let\mkcse\uppercase
\def\hddot{}
\def\fefnt{\reset@font\bf}
\def\thfnt{\reset@font\it}
%
\def\fnum@figure{\figurename~\thefigure\cpdot}
\def\fnum@table{\tablename~\thetable\cpdot}
%
%
% theorems
%
\def\@begintheorem#1#2{%
 \trivlist \item[\hskip \labelsep{\fefnt #1\ #2\hddot}]\thfnt}
\def\@opargbegintheorem#1#2#3{\trivlist
 \item[\hskip \labelsep{\fefnt #1\ #2\ (#3)\hddot}]\thfnt}
%
{\@makeother\~
\long\gdef\@ifempty#1#2#3{\if~#1~#2\else#3\fi}
}
\long\def\@gobifnul#1#2{\@ifempty{#1}\@empty{#1#2}}
%
% Figures and Tables
%
\long\def\@makecaption#1#2{\vskip 10\p@
   \setbox\@tempboxa\hbox{#1\ #2}\ifdim \wd\@tempboxa >\hsize
   #1\ #2\par\else\hbox to\hsize{\hfil\box\@tempboxa\hfil}\fi}
%
% Modified LateX Sectioning Commands
%
\ifx\chapter\undefined
%
%Article
%
\def\@part[#1]#2{\ifnum \c@secnumdepth >\m@ne
 \@ifempty\thepart\@empty{\refstepcounter{part}}
 \addcontentsline{toc}{part}{\protect\numberline{\thepart\nmdot}{#1}}\else
 \addcontentsline{toc}{part}{#1}\fi
 {\parindent\z@\hdpos\interlinepenalty\@M\ifnum\c@secnumdepth>\m@ne
 \@ifempty\thepart\@empty{\chsize\hdfnt\partname~\thepart\par\nobreak}\fi
 \hdsize\hdfnt#2\@mkboth{}{}\par}\nobreak\vskip3ex\fpind\@afterheading}
\def\@spart#1{{\parindent\z@\hdpos\interlinepenalty\@M
 \hdsize\hdfnt#1\par}\nobreak\vskip3ex\fpind\@afterheading}
\def\maketitle{\par\begingroup\def\thefootnote{\fnsymbol{footnote}}%
 \def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}%
 \if@twocolumn\twocolumn[\@maketitle]%
 \else\newpage\global\@topnum\z@\@maketitle\fi
 \thispagestyle{empty}\@thanks\endgroup
 \setcounter{footnote}{0}\let\maketitle\relax\let\@maketitle\relax
 \def\@thanks{}\def\@author{}\def\@title{}\let\thanks\relax}
\def\@maketitle{\null \vskip \tw@ em\begin{center}%
 {\ttsize\ttfnt\@title\par}\vskip3.5ex{\ausize\ttfnt\lineskip1.2ex%1.5em .5em
 \begin{tabular}[t]{c}\@author\end{tabular}\par}%
 \vskip2.3ex{\dasize\ttfnt\@date}\end{center}\par\vskip3.5ex}% 1em 1.5em
\if@twoside
 \def\ps@headings{\let\@mkboth\markboth
  \def\@oddfoot{}\def\@evenfoot{}
  \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}%
  \def\@oddhead{\mkfnt\rightmark\hfil\pgfnt\thepage}%
  \def\sectionmark##1{\markboth{\mkcse{\ifnum\c@secnumdepth>\z@\@gobifnul
  \thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}{}}%
  \def\subsectionmark##1{\markright{\ifnum\c@secnumdepth>\@ne\@gobifnul
  \thesubsection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}}
\else
 \def\ps@headings{\let\@mkboth\markboth
  \def\@oddfoot{}\def\@evenfoot{}
  \def\@oddhead{\mkfnt\rightmark\hfil\pgfnt\thepage}%
  \def\sectionmark##1{\markright{\mkcse{\ifnum\c@secnumdepth>\z@
  \@gobifnul\thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}}}
\fi
\def\ps@myheadings{\let\@mkboth\@gobbletwo
 \def\@oddhead{\mkfnt\rightmark \hfil\pgfnt\thepage}\def\@oddfoot{}%
 \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}\def\@evenfoot{}%
 \def\sectionmark##1{}\def\subsectionmark##1{}}
\def\tableofcontents{\makeheading{\contentsname
 \@mkboth{\mkcse{\contentsname}}{\mkcse{\contentsname}}}%
 \@starttoc{toc}}
\def\listoffigures{\makeheading{\listfigurename
 \@mkboth{\mkcse{\listfigurename}}{\mkcse{\listfigurename}}}%
 \@starttoc{lof}}
\def\listoftables{\makeheading{\listtablename\@mkboth
 {\mkcse{\listtablename}}{\mkcse{\listtablename}}}%
 \@starttoc{lot}}
\def\thebibliography#1{\makeheading{\refname\@mkboth
 {\mkcse{\refname}}{\mkcse{\refname}}}\list
 {\@biblabel{\arabic{enumiv}}}{\settowidth\labelwidth{\@biblabel{#1}}%
 \leftmargin\labelwidth\advance\leftmargin\labelsep
 \usecounter{enumiv}\let\p@enumiv\@empty
 \def\theenumiv{\arabic{enumiv}}}%
 \def\newblock{\hskip .11em plus.33em minus.07em}%
 \sloppy\clubpenalty4000\widowpenalty4000\sfcode`\.=\@m\relax}
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
 \columnseprule \z@\columnsep 35\p@\twocolumn[\makeheading{\indexname}]%
 \@mkboth{\mkcse{\indexname}}{\mkcse{\indexname}}%
 \thispagestyle{plain}\parindent\z@
 \parskip\z@ plus.3\p@\relax\let\item\@idxitem}
\def\l@part{\@tocheadline{0}{5.2ex}{3em}{\large\bf}}%2.25em
\def\l@section{\@tocheadline{1}{1em}{1.8em}{\bf}}
\def\makeheading{\section*}
\else
%
%Report/Book
%
\def\@part[#1]#2{\ifnum\c@secnumdepth>-2
 \@ifempty\thepart\@empty{\refstepcounter{part}}
 \addcontentsline{toc}{part}{\protect\numberline{\thepart\nmdot}#1}\else
 \addcontentsline{toc}{part}{#1}\fi\@mkboth{}{}%
 {\parindent\z@\hdpos\ifnum\c@secnumdepth>-2\@ifempty\thepart\@empty
 {\chsize\hdfnt\partname~\thepart\par\vskip 20\p@}\fi
 \hdsize\hdfnt#2\par}\@endpart}
\def\@endpart{\vfil\newpage\if@twoside\hbox{}\thispagestyle{empty}%
 \newpage\fi\if@tempswa\twocolumn\fi}
\def\@spart#1{{\hdpos\hdsize\hdfnt#1\par}\@endpart}%
\def\@makechapterhead#1{\vspace*{50\p@}{\parindent\z@\hdpos
 \ifnum\c@secnumdepth>\m@ne\@ifempty\thechapter\@empty
 {\chsize\hdfnt\@chapapp~\thechapter \par\vskip20\p@}\fi
 \hdsize\hdfnt#1\par\nobreak\vskip40\p@}}
\def\@makeschapterhead#1{\vspace*{50\p@}{\hdpos
 \hdsize\hdfnt#1\par\nobreak\vskip40\p@}}
\def\@chapter[#1]#2{\ifnum\c@secnumdepth>\m@ne\@makesecdot{chapter}%
\typeout{\@chapapp\space\thechapter}\fi\@contmark{chapter}\z@{#1}%
 \addtocontents{lof}{\protect\addvspace{10\p@}}%
 \addtocontents{lot}{\protect\addvspace{10\p@}}
 \if@twocolumn\@topnewpage[\@makechapterhead{#2}]\else\@makechapterhead{#2}\fi
 \fpind\@afterheading}
\def\@schapter#1{\if@twocolumn \@topnewpage[\@makeschapterhead{#1}]%
  \else\@makeschapterhead{#1}\fi\fpind\@afterheading}
\if@twoside
 \def\ps@headings{\let\@mkboth\markboth\def\@oddfoot{}\def\@evenfoot{}%
  \def\@evenhead{\pgfnt\thepage\hfil\mkfnt\leftmark}%
  \def\@oddhead{\hbox{}\mkfnt\rightmark\hfil\pgfnt\thepage}%
  \def\chaptermark##1{\markboth{\mkcse{\ifnum
  \c@secnumdepth>\m@ne\expandafter\@gobifnul\@chapapp\ \@gobifnul
  \thechapter{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}{}}%
  \def\sectionmark##1{\markright{\mkcse{\ifnum \c@secnumdepth >\z@\@gobifnul
  \thesection{\@ifempty{##1}\@empty{\nmdot\quad}}\fi ##1}}}}
\else
 \def\ps@headings{\let\@mkboth\markboth
  \def\@oddfoot{}\def\@evenfoot{}%
  \def\@oddhead{\mkfnt \rightmark \hfil\pgfnt\thepage}%
  \def\chaptermark##1{\markright {\mkcse{\ifnum
  \c@secnumdepth>\m@ne \expandafter\@gobifnul\@chapapp\ \@gobifnul
  \thechapter{\@ifempty{##1}\@empty{\nmdot\quad}}\fi##1}}}}
\fi
\def\ps@myheadings{\let\@mkboth\@gobbletwo
 \def\@oddhead{\mkfnt\rightmark \hfil\pgfnt\thepage}%
 \def\@oddfoot{}\def\@evenhead{\pgfnt \thepage\hfil\mkfnt
 \leftmark}\def\@evenfoot{}%
 \def\chaptermark##1{}\def\sectionmark##1{}%
 \def\subsectionmark##1{}}
\def\maketitle{\begin{titlepage}%
 \let\footnotesize\small \let\footnoterule\relax \setcounter{page}{0}%
 \null \vfil \vskip 60\p@ \begin{center}%
 {\ttsize\ttfnt\@title\par} \vskip7ex {\ausize\ttfnt\lineskip1.75ex%3em .75em
 \begin{tabular}[t]{c}\@author \end{tabular}\par}%
 \vskip 3.5ex {\dasize \ttfnt \@date \par} \end{center} \par%1.5em
 \@thanks \vfil \null \end{titlepage}%
 \setcounter{footnote}{0} \let\thanks\relax
 \def\@thanks{}\def\@author{}\def\@title{}\let\maketitle\relax}%
\def\tableofcontents{\@restonecolfalse
 \if@twocolumn\@restonecoltrue\onecolumn\fi\makeheading{\contentsname
 \@mkboth{\mkcse{\contentsname}}{\mkcse{\contentsname}}}%
 \@starttoc{toc}\if@restonecol\twocolumn\fi}
\def\listoffigures{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
 \makeheading{\listfigurename\@mkboth{\mkcse{\listfigurename}}%
 {\mkcse{\listfigurename}}}\@starttoc{lof}\if@restonecol\twocolumn\fi}
\def\listoftables{\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
 \makeheading{\listtablename\@mkboth{\mkcse{\listtablename}}%
 {\mkcse{\listtablename}}}\@starttoc{lot}\if@restonecol\twocolumn\fi}
\def\thebibliography#1{\makeheading{\bibname\@mkboth
 {\mkcse{\bibname}}{\mkcse{\bibname}}}\list
 {\@biblabel{\arabic{enumiv}}}{\settowidth\labelwidth{\@biblabel{#1}}%
 \leftmargin\labelwidth\advance\leftmargin\labelsep
 \usecounter{enumiv}\let\p@enumiv\@empty
 \def\theenumiv{\arabic{enumiv}}}%
 \def\newblock{\hskip .11em plus.33em minus.07em}%
 \sloppy\clubpenalty4000\widowpenalty4000\sfcode`\.=\@m}
\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
 \columnseprule\z@\columnsep 35\p@\twocolumn\makeheading{\indexname
 \@mkboth{\mkcse{\indexname}}{\mkcse{\indexname}}}%
 \thispagestyle{plain}\parindent\z@
 \parskip\z@ plus .3\p@\relax\let\item\@idxitem}
\def\l@part{\@tocheadline{\z@}{5.2ex}{3em}{\large\bf}}%2.25em
\def\l@chapter{\@tocheadline{\@ne}{1em}{1.8em}{\bf}}
\def\makeheading{\chapter*}
\fi
%
%Article, Book, Report
%
\def\section{\@startsection
{section}{\@ne}{\secindent}{\secpreskp}{\secpstskp}{\secsize\hdfnt}}
\def\subsection{\@startsection
{subsection}{\tw@}{\subindent}{\subpreskp}{\subpstskp}{\subsize\hdfnt}}
\def\subsubsection{\@startsection
{subsubsection}{3}{\subindent}{\subpreskp}{\subpstskp}{\normalsize\hdfnt}}
\def\paragraph{\@startsection{paragraph}{4}{\subindent}%
{\subpreskp}{\parpstskp}{\normalsize\hdfnt}}
\def\subparagraph{\@startsection{subparagraph}%
{5}{\parindent}{\subpreskp}{\parpstskp}{\normalsize\hdfnt}}
%
% section layout
%
\def\@makesecdot#1{\expandafter\let\expandafter\@secdot\csname the#1\endcsname
  \ifx\@secdot\@empty\else\refstepcounter{#1}%
  \edef\@secdot{\expandafter\@gobifnul\csname the#1\endcsname\nmdot}\fi}
					%not \@secdot
\def\@makesvsec#1{\ifdim #1<\z@\def\@svsec{\llap{\@secdot}\hskip-#1}\else
 \def\@svsec{\@gobifnul\@secdot\quad}\fi}
\def\@contmark#1#2#3{\csname #1mark\endcsname{#3}\addcontentsline
 {toc}{#1}{\ifnum #2>\c@secnumdepth\else\protect\numberline{\@secdot}\fi#3}}
\def\@startsection#1#2#3#4#5#6{\if@noskipsec\leavevmode\fi
   \par\@tempskipa #4\@afterindenttrue
   \ifdim\@tempskipa<\z@\@tempskipa-\@tempskipa\@afterindentfalse\fi
   \fpind\if@nobreak\everypar{}\else
     \addpenalty{\@secpenalty}\addvspace{\@tempskipa}\fi\@ifstar
     {\@ssect{#3}{#5}{#6}}{\@dblarg{\@sect{#1}{#2}{#3}{#5}{#6}}}}
\def\@sect#1#2#3#4#5[#6]#7{\let\@svsec\@empty\ifnum#2>\c@secnumdepth\else
 \@makesecdot{#1}\@makesvsec{#3}\fi
 \@tempskipa #4\relax\ifdim\@tempskipa>\z@
 \begingroup#5\@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty
 \@M #7\par}\endgroup\@contmark{#1}{#2}{#6}\else
 \def\@svsechd{\@contmark{#1}{#2}{#6}#5\hskip#3\@svsec
 \@gobifnul{#7}\hddot}\fi\@xsect{#4}}
\def\@ssect#1#2#3#4{\@tempskipa #2\relax\ifdim \@tempskipa>\z@
  \begingroup #3\@hangfrom{\hskip #1}{\interlinepenalty \@M #4\par}\endgroup
  \else \def\@svsechd{#3\hskip #1\@gobifnul{#4}\hddot}\fi\@xsect{#2}}
%
% contents lines
%
\def\@tocheadline#1#2#3#4#5#6{\ifnum#1>\c@tocdepth\else
 \addpenalty\@secpenalty\vskip#2 plus\p@\begingroup
 \interlinepenalty\@M\rightskip\@tocrmarg\parfillskip-\@tocrmarg
 \secindent#3\noindent\leavevmode\hangindent\secindent
 \reset@font\rm#4#5\@tocpagenum{#6}\par\endgroup
 \penalty\@highpenalty\fi}
\def\@dottedtocline#1#2#3#4#5{\ifnum #1>\c@tocdepth \else
  \vskip \z@ plus.2\p@\begingroup\leftskip#2\interlinepenalty\@M
  \rightskip\@tocrmarg\parfillskip-\@tocrmarg\secindent#3%
  \noindent\leavevmode\hangindent\secindent\reset@font\rm#4\nobreak\leaders
  \hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep mu$}\hfill \nobreak
  \hbox to\@pnumwidth{\hfil\reset@font\rm #5}\par\endgroup\fi}
\def\@tocpagenum#1{\nobreak\hfill\nobreak\hbox to\@pnumwidth{\hss#1}}
\def\numberline#1{\hbox to \secindent{#1\hfil} }
%
% REDEFINITIONS here:
%
% This line must be last line of code
\catcode`\@\neq\let\neq\ne\endinput

*******************
  DOCUMENTATION
*******************
Leslie Lamport in writing LaTeX assumed that authors would write
complete .sty (.clo) files to implement the design decisions for their
publications. However, the overwhelming majority of LaTeX publications use the
standard styles supplied by Lamport. These implement a particular set of
typographic conventions, which while consistent are not of universal validity,
for instance many publishers and authors would like a full stop:
`4. Introduction'
rather than
`4 Introduction'.

This file modifies the standard classes so that other conventions can be
more easily implemented. Careful use of the file will allow a greater
variation in the appearance of LaTeX documents.

0. Changes to section implementation.
The file redefines the way LaTeX deals with negative indents for section
headings, placing the number in the margin and the heading itself flush
with the margin.

It also changes the way LaTeX reacts to empty numbers when sections have
non-negative indents, placing the heading where the number would go, rather
than further indented. These two effects can be removed by redefining an
internal macro \@makesvsec.

The indents, pre- and postskips for section headings are placed in registers
so that they are constant throughout a document and (just as the heading sizes)
do not react to surrounding size changes. You can change this back to ordinary
LaTeX behaviour by \def ing them as macros rather than setting the register
values (in that case you should probably use \smaller\larger from
SMALLER.STY for the \...size commands).

WARNING LaTeX typesets headings that run on by manipulating \everypar. If you
make local changes to the heading style of such a section inside braces or a
group you must ensure that a non-empty paragraph occurs before the closing
brace. Otherwise some strange effects may occur, because the \everypar tokens
will be evaluated outside the group (this is a feature of LaTeX, not of
SECTION.STY). If your group ends with an empty section of this type just
follow it with \leavevmode or an explicit space: \ .

A detailed description of the format of LaTeX sectioning commands is given
below (in paragraph 9). This is partially taken from the file LATEX.TEX.
We first list the macros for local control which you can use without knowing
this structure.

The file converts vertical distances expressed in terms of `em's into
equivalent `ex's as `em' is a measure of the horizontal size of a font.
The original `em' values are placed at the end of the line.

1. Sizing commands for Parts, Chapters and Titles etc
These are set to \large or whatever

>> \chsize: Chapter, Part Headings   (\LARGE\large)
>> \hdsize: Chapter, Part Title Text (\Huge\huge\LARGE)
>> \ttsize: Title of Document	     (\Huge\huge\LARGE)
>> \ausize: Author		     (\LARGE\Large)
>> \dasize: Date.		     (\Large\large)
>> \secsize: Section		     (\Large\large)
>> \subsize: Subsection 	     (\large\normalsize)

2. Positioning commands for headings.
>> \hdpos: Positioning of Part Chapter	(\raggedright) (\centering \raggedleft)
>> \fpind: Indenting of first paragraph after \Part \Chapter
     and also to override setting via preskip for sections.
     \let to \@afterindenttrue to indent, \@afterindentfalse for flush,
     \relax: flush after \Part \Chapter, negative preskips indented otherwise
     (LaTeX default behaviour).

3. Fonts
>> \ttfnt: font for title entries.
>> \hdfnt: font for all other headings (Part, Chapter..subparagraph).
>> \fefnt: font for theorem headings and description labels (fe=feature).
>> \thfnt: font for theorem statements.
>> \pgfnt: font for page numbers.
>> \mkfnt: font for page headings (mk-mark).
>> \mkcse: case for page headings.
 These can also be used to add other initial commands such as spaces or
 symbols.

4. Optional punctuation (standard|my preference)
 These marks are transferred via auxiliary files for tables of contents etc.
 They should be \def'd if their current value is to be transferred, and \let
 if the value in force when the file auxiliary is read should be used.

>> \hddot ({}|.) (after inline headings, theorems etc)
>> \cpdot (:|.) (in figure/table captions - also apears in list of figures.
>> \nmdot ({}|.) (after section numbers etc)

If these are \let to a single letter they are not expanded in the
    .toc.. files. So to remove \cpdot from list of figures:
	\let\cpdot\relax\listoffigures\let\cpdot:

5. Spacing parameters for sections in registers:
   \sec.. used for \section
   \subpreskp and \subpstskp used for \subsection and \subsubsection
   \subindent use for \subsection, \subsubsection

   \paragraph uses \subindent \subpreskp \parpstskp
   \subparagraph uses \parindent \subpreskp \parpstskp

>> \secindent \subindent   Heading indentation
>> \secpreskp \subpreskp   Space before
>> \secpstskp \subpstskp \parpstskp  Space after.

6.  Internal modifications

 Sections with negative indents have heading flush with margin.

 If \thesection is \empty
   \let\thesection\empty or \def\thesection{}
 then section not step the section counter.
 If the section produces empty output for a value then
 the section will start flush at the margin or \secindent if it is positive
 and there will be no \nmdot.
 It will produce (flush) headings and a table of contents entry.
 Similarly if \thechapter or \thepart are defined to be empty they will
 suppress the heading line `Chapter..'.
 To restore standard LaTeX behaviour temporarily define \thesection to be
 \empty
 \def\thesection{\empty}
 In that case you can adjust post number spacing in the heading.
	\section[Heading]{\hskip-1em Heading}
 You can also redefine \@makesecdot see paragraph 7.

WARNING \letting \thesection etc to an unexpandable token (like \relax) will
cause strange effects under LaTeX because its value will not be expanded.

 \maketitle suppresses page headings (\thispagestyle{empty}) and only resets
 \@title etc locally. So place in a group if you want to preserve these for
 later reference (eg. in headers).

7. New internal macros
  Place any modifications in the section REDEFINITIONS of the main code

> \@secdot contains section number and \nmdot if the number is non-empty.
> \@makesecdot{NAME} defines \@secdot.
  To make LaTeX step the section counter independently of the definition
  of \thesection and always print \nmdot:
    \def\@makesecdot#1{\refstepcounter{#1}%
        \edef\@secdot{\csname the#1\endcsname}}
  If you want \nmdot suppressed when \thesection produces no output:
    \def\@makesecdot#1{\refstepcounter{#1}%
      \edef\@secdot{\expandafter\@gobifnul\csname the#1\endcsname\nmdot}}
> \@makesvsec{INDENT} defines the \@svsec macro used by LaTeX to typeset the
  section number. Its parameter is the current section indent so that it can
  react differently to negative section indents (it does NOT make the indent).
  To obtain standard LaTeX behaviour:
    \def\@makesvsec#1{\def\@svsec{\@secdot\quad}}
  To make \secindent apply to the heading not the number:
    \def\@makesvsec#1{\def\@svsec{\llap{@secdot\quad}}}
  Do NOT forget the #1.
> \@contmark{NAME}{LEVEL}{HEADING} makes contents line and sectionmark.

 Contents headlines are defined by
> \@tocheadline
 This allows these lines to be adjusted similarly to the \@dottedtocline
 commands for other contents lines. The format of these is defined below (in
 paragraph 11).
>@tocpagenum#1 sets #1 flush right in \@tocheadline.
 Redefine (\let\@tocpagenum\@gobble) to remove page numbers.
 \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble
	      \centering\large\bf}}
 Centres parts lines of contents but leaves chapters unchanged
 \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble
	      \centering\def\numberline##1{\hskip-\secindent
	      \hbox to\secindent{##1\hfil}}\large\bf}}
 Same but centring ignores part number.
 \def\l@part{\@tocheadline{0}{2.25em}{3em}{\let\@tocpagenum\@gobble
	      \centering\def\numberline##1{\hfilneg
	      \hbox to\z@{##1\hss}\hfil}\large\bf}}
 Centres heading with number flush left
 Contents lines use \secindent as a temporary register

>\makeheading (set to \section*, \chapter*)
 Makes headings for contents, index etc.
 To put Contents itself in the contents list, redefine (locally):
     \let\thesection\empty\let\makeheading\section

8. Additional macros
> \@ifempty{test}{yes}{no} like \@ifundefined but tests for empty
  (fails iff test starts with ~ of catcode 12 (other) ).
> \@gobifnul{a}{b} = \@ifempty{a}{}{ab}.

9.  Description of sectioning values

 \@startsection {NAME}{LEVEL}{INDENT}{PRESKIP}{POSTSKIP}{STYLE}
	    optional * [ALTHEADING]{HEADING}
    Generic command to start a section.

    NAME	: e.g., 'subsection' must be the name of a section counter
    LEVEL	: a number, denoting depth of section -- e.g., chapter=1,
		  section = 2, etc.
    INDENT	: Indentation of heading from left margin
    PRESKIP	: Absolute value = skip to leave above the heading.
		  If negative, then paragraph indent of text following
		  heading is suppressed.
    POSTSKIP	: if positive, then skip to leave below heading, else
		  negative of skip to leave to right of run-in heading.
    STYLE	: commands to set style
  If '*' missing, then increments the counter.  If it is present, then
  there should be no [ALTHEADING] argument.
  Uses the counter 'secnumdepth' whose value is the highest section
  level that is to be numbered and entered into \@dottedtocline.

10. Treatment of Section Entries

 NAME  (fixed) Determines the counter to use.

 LEVEL (fixed) If level is greater than \counter{secnumdepth} (default 2) no
 indexentry or number

 INDENTS: \secindent (sections), \subindent (subsections,...,paragraphs).
 Subparagraphs have \parindent fixed. These are dimensions.

 Recommended: +-\parindent or 0pt

 If indent is negative then SECTION.STY causes the section number to be set
 flush right that distance from margin. Heading or text follows at the margin
 itself.

 Unnumbered headings are set at the margin if indent is negative. If the
 indent is non-negative they are set flush left with the number position.

 PRESKIPS \secpreskp (sections), \subpreskp(subsections..subparagraphs)
 POSTSKIPS \secpstskp (sections),\subpstskp(subsections,subsubsections)
           \parpstskp (paragraphs,subparagraphs)

 Recommended: leave PRESKIPS' abs values unchanged, They are set -ve to
 have flush first paragraphs. Use \secpreskp-\secpreskp to indent them.
 Recommended: set POSTSKIPS to -1em or -\parindent to make sections run on.

 By assigning these values to registers SECTION.STY makes them independent of
 the surrounding font and size. Set the registers if you want this, redefine
 them as macros if you want them to be font and size dependent.

 STYLE \secsize \subsize \hdfnt size and fonts.
 \secsize for sections,
 \subsize for subsections.
 Subsubsections and below have \normalsize (fixed).
 \hdfnt is universal for all headings from chapter downwards.
 Any of these can be modified to include \centering for centered sections,
 \hdfnt will center everything, overriding \hdpos.

11. Contents entries.

 \@tocheadline{LEVEL}{PRESKIP}{INDENT}{STYLE}{ENTRY}{PAGENUM}
 \@dottedtocline{LEVEL}{MARGIN}{INDENT}{ENTRY}{PAGENUM}

 LEVEL		: determines if entry made.
 PRESKIP	: vertical gap above.
 INDENT 	: This must leave enough room for the chapter or section number
		: It is added to the margin for the next level.
 MARGIN 	: Left margin inherited from level above (zero for headlines).
 STYLE		: Font sizing and setting.

 LaTeX assumes that the ENTRY for sections be defined by a macro \l@section.
 These are defined in the standard document styles but can be changed.
 All entries of the \l@section commands are fixed. SECTION.STY does not
 change the commands using \@dottedtocline in the style file. Those that do
 not do so (\l@part, \l@chapter) are modified to use \@tocheadline.

 INDENT for sections in {article} and chapters in {report} is rather tight at
 1.5em. If you increase it should also increase the MARGINS for lower
 sections.

12. The following internal LaTeX macros are redefined (mostly harmlessly):

 \@part\@spart\@endpart
 \@chapter\@schapter		(also \fi moved)
 \@makechapterhead
 \@makeschapterhead
 \ps@headings\ps@myheadings
 \section\subsection
 \subsubsection\paragraph
 \subparagraph
 \thebibliography
 \theindex
 \@begintheorem
 \@oparbegintheorem
 \@makecaption			optional style features added
 \@startsection 		\fpind and does not pass #4 to \@sect,\@ssect
 \@sect,\@ssect 		ignored parameter removed
                        	\llap \@secdot used to adjust spacing
				calls \@makesecdot
				\@sect only: \@makesvsec and
				\@contmark, which is moved in
				\@svsechd so that \unskip in \@xsect works).
 \maketitle\@maketitle		suppress page number, reset \@title.. locally
 \numberline			adds space after number, so overfull box if
				too close to heading.




 Memory use < 200 words.
End of SECTION.STY
