% ISO DOCUMENT STYLE <91/05/02>
%    for LaTeX version 2.09

% @(#)iso.sty	2.6 dated 91/05/02 at 09:57:23

% File:       iso.sty
% Author:     Nicolas North
% Email:      ndn@seg.npl.co.uk
% Date:       91/05/02
%
% A rewrite of article.doc to typeset in ISO central secretariat-approved
% style.

 \typeout{Document Style `iso' <91/05/02>.}


% CHOOSING THE TYPE SIZE:
%
%  The iso style only copes with 9pt and 10pt at present, so gives error
%  messages for larger sizes and reads iso10.sty.
%
%  Unfortunately, many style files expect \@ptsize to be 0, 1 or 2 so it is
%  set to 0 as the closest approximation to 9pt.
%  But setting \@ptsize to 0 means we need another flag to say whether 10pt
%  has been specified - we use \@tenpoint.

\def\@ptsize{0}		% To keep other style files happy

\newif\if@tenpoint \@tenpointfalse
\@namedef{ds@9pt}{}
\@namedef{ds@10pt}{\@tenpointtrue}
\@namedef{ds@11pt}{\typeout{11pt not available. Using 10pt.}\@tenpointtrue}
\@namedef{ds@12pt}{\typeout{12pt not available. Using 10pt.}\@tenpointtrue}

%  Two-side printing.
\@twosidetrue  	%  Defines twoside option.
\@mparswitchtrue   %    Marginpars go on outside of page.
%  draft option
%
% \overfullrule = 0pt             % Default is don't mark overfull hboxes.
\def\ds@draft{\overfullrule 5pt}  % Causes overfull hboxes to be marked.

% One-column printing
% NDN: default ISO style is to print in two columns; the following allows
% the user to do \documentstyle[onecolumn]{iso} and get the document printed
% in one column.
% Note that this cannot be implemented using the \@twocolumn conditional
% because the first part (contents etc) of an ISO document is printed
% in onecolumn mode, so we need a new conditional to carry the user's choice
% through to the \maketitle.
\newif\if@isoonecolumn \@isoonecolumnfalse
\def\ds@onecolumn{\@isoonecolumntrue}

% NDN: we also define \ds@twocolumn to prevent twocolumn.sty being read.
\def\ds@twocolumn{}

% The \@options command causes the execution of every command \ds@FOO 
% which is defined and for which the user typed the FOO option in his
% \documentstyle command.  For every option BAR he typed for which
% \ds@BAR is not defined, the file BAR.sty will be read after the present
% (main) .STY file is executed.

\@options
\input\if@tenpoint iso10.sty\else iso9.sty\fi\relax


%    ****************************************
%    *                LISTS                 *
%    ****************************************
%

% LABELS
%  In the iso style, list labels are aligned with the list contents 
%  i.e. the label is indented by \leftmargin. To achieve this we redefine
%  \makelabel in \enumerate and \itemize (see latex.tex).
\def\enumerate{\ifnum \@enumdepth >3 \@toodeep\else
      \advance\@enumdepth \@ne 
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}\list
      {\csname label\@enumctr\endcsname}{\usecounter
        {\@enumctr}\def\makelabel##1{##1}}\fi}

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


% ENUMERATE
%  Enumeration is done with four counters: enumi, enumii, enumiii
%  and enumiv, where enumN controls the numbering of the Nth level
%  enumeration.  The label is generated by the commands \labelenumi 
%  ... \labelenumiv.  The expansion of \p@enumN\theenumN defines the 
%  output of a \ref command.  
%
% NDN: define \p@enumi to be the current label when the list environment
% began (listi etc do \let\isoclauseref\@currentlabel (see iso9.sty)).
% Thus list item d) in section 4.1 gives a \label of 4.1d.

\def\labelenumi{\theenumi)}    
\def\theenumi{\alph{enumi}}     
\def\p@enumi{\isoclauseref}
 
\def\labelenumii{\theenumii)}
\def\theenumii{\arabic{enumii}}
\def\p@enumii{\p@enumi}

% No ISO guidelines for deeper nesting of lists
\def\labelenumiii{\theenumiii)}
\def\theenumiii{\roman{enumiii}}
\def\p@enumiii{\p@enumii}

\def\labelenumiv{\theenumiv)}
\def\theenumiv{\Alph{enumiv}}     
\def\p@enumiv{\p@enumiii}

% ITEMIZE
% Itemization is controlled by four commands: \labelitemi, \labelitemii,
% \labelitemiii, and \labelitemiv, which define the labels of the various 
% itemization levels.

\def\labelitemi{---}
% No ISO guidelines for deeper nesting so use the same symbol
\def\labelitemii{---}
\def\labelitemiii{---}
\def\labelitemiv{---}


% VERSE
%   The verse environment is defined by making clever use of the
%   list environment's parameters.  The user types \\ to end a line.
%   This is implemented by \let'in \\ equal \@centercr.
%
\def\verse{\let\\=\@centercr  
  \list{}{\itemsep\z@ \itemindent -1.5em\listparindent \itemindent 
          \rightmargin\leftmargin\advance\leftmargin 1.5em}\item[]}
\let\endverse\endlist

% QUOTATION
%   Fills lines
%   Indents paragraph
%   
\def\quotation{\list{}{\listparindent 1.5em
    \itemindent\listparindent
    \rightmargin\leftmargin \parsep 0pt plus 1pt}\item[]}
\let\endquotation=\endlist

% QUOTE -- same as quotation except no paragraph indentation,
%
\def\quote{\list{}{\rightmargin\leftmargin}\item[]}
\let\endquote=\endlist

% DESCRIPTION 
%
%  To change the formatting of the label, you must redefine 
%  \descriptionlabel.  

\def\descriptionlabel#1{{#1} ---}
\def\description{\list{}{
       \let\makelabel\descriptionlabel}}

\let\enddescription\endlist

%\newdimen\descriptionmargin
%\descriptionmargin=3em

%    ****************************************
%    *         OTHER ENVIRONMENTS           *
%    ****************************************
%
%
% THEOREM 
% \@begintheorem ... \@endtheorem are the commands executed at the
% beginning and end of a (user-defined) theorem-like environment.
% Except \@opargbegintheorem is executed when an optional argument is
% given.  Cf. LATEX.TEX.
%
% \def\@begintheorem#1#2{\it \trivlist \item[\hskip \labelsep{\bf #1\ #2}]}
% \def\@opargbegintheorem#1#2#3{\it \trivlist
%       \item[\hskip \labelsep{\bf #1\ #2\ (#3)}]}
% \def\@endtheorem{\endtrivlist}


% EQUATION and EQNARRAY 
%
% \newcounter{equation}    
%  Default is for left-hand side of equations to be flushleft.
%  To make them flushright, do:
%  \let\@eqnsel = \hfil
%

\def\theequation{\arabic{equation}}

% \jot = 3pt      % Extra space added between lines of an eqnarray environment

% The macro \@eqnnum defines how equation numbers are to appear in equations.
%
% \def\@eqnnum{(\theequation)} 
% 

% TITLEPAGE
%  In the normal environments, the titlepage environment does nothing but 
%  start and end a page, and inhibit page numbers.  It also resets the
%  page number to zero.
%  I don't know if this should be in the iso style, but I'll leave it
%  until someone complains.

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

\def\endtitlepage{\if@restonecol\twocolumn \else \newpage \fi}

% NOTES
%  There are three notes environments: `note' for producing a single note,
%  `notes' for producing multiple notes and `versionnotes' for producing
%  a note which only prints for a particular version number.
%  Each is printed in typesize small.
%  Single notes have an optional argument which is the number of the note
%  for a series of isolated notes in a section.

\newenvironment{note}{\@ifnextchar[{\@isonote}{\@isonote[]}}{\par\normalsize}
\def\@isonote[#1]{\small\par NOTE #1 --- }

\newcounter{notes}
\newenvironment{notes}{\par\small NOTES
  \begin{list}{\arabic{notes}}{
    \usecounter{notes}\setlength{\leftmargin}{0pt}
    \setlength{\labelwidth}{0pt}
    \setlength{\listparindent}{0pt}}}{
  \end{list}\normalsize}

% The `versionnote' environment takes an argument which is a version number.
% This is compared with the current version number (as set by \version).
% If they are identical, the note is typeset, with an indication of the
% version number.
% Otherwise the contents are placed in a convenient sized minipage which is
% placed in an hbox and discarded. (Use of the minipage prevents overfull/
% underfull hbox messages).

\newbox\iso@box
\newenvironment{versionnote}[1]{\def\@tmp{#1}%
\ifx\theversion\@tmp\@vnotea{#1}\else\@vnoteb\fi}{\@endvnote}

% \@vnotea sets the version note as a note.
\def\@vnotea#1{\gdef\@endvnote{\end{note}}\begin{note}[(version #1)]}

% \@vnoteb puts the version note into \iso@box and discards it.
\def\@vnoteb{\gdef\@endvnote{\end{minipage}\hfil\egroup}%
\setbox\iso@box=\hbox to\textwidth\bgroup\begin{minipage}{\textwidth}}

% ARRAY AND TABULAR
%

\arraycolsep 5pt     % Half the space between columns in an array environment.
\tabcolsep 6pt       % Half the space between columns in a tabular environment.
\arrayrulewidth .4pt % Width of rules in array and tabular environment.
\doublerulesep 2pt   % Space between adjacent rules in array or tabular env.

% TABBING
%
\tabbingsep \labelsep   % Space used by the \' command.  (See LaTeX manual.)

% MINIPAGE
%  \@minipagerestore is called upon entry to a minipage environment to
%  set up things that are to be handled differently inside a minipage
%  environment. In the current styles, it does nothing.

% \skip\@mpfootins : plays same role for footnotes in a minipage as
%                    \skip\footins does for ordinary footnotes

\skip\@mpfootins = \skip\footins

% FRAMEBOX
%
\fboxsep = 3pt    % Space left between box and text by \fbox and \framebox.
\fboxrule = .4pt  % Width of rules in box made by \fbox and \framebox.


%    ****************************************
%    *             SECTIONS                 *
%    ****************************************
%
%  Note that the LaTeX section names have been changed to comply with
%  ISO naming conventions.
%
% DEFINE COUNTERS:
%
% \newcounter{NEWCTR}[OLDCTR] : Defines NEWCTR to be a counter, which is 
%                               reset to zero when counter OLDCTR is stepped.  
%                               Counter OLDCTR must already be defined.

% Redefine \@stpelt so that stepping a counter recursively resets all
% lower level counters, not just the level one below.
\def\@stpelt#1{\global\csname c@#1\endcsname \z@ \csname cl@#1\endcsname}

\newcounter{part}
\newcounter {section}[part]
\newcounter {clause}[section]
\newcounter {definition}[section]
\newcounter {subclause}[clause]
\newcounter {subsubclause}[subclause]
\newcounter {namelesssubsubclause}[subclause]
\newcounter {subsubsubclause}[subsubclause]
\newcounter {namelesssubsubsubclause}[subsubclause]

% For any counter CTR, \theCTR is a macro that defines the printed version
% of counter CTR.  It is defined in terms of the following macros:
%
%  \arabic{COUNTER} : The value of COUNTER printed as an arabic numeral.
%  \roman{COUNTER}  : Its value printed as a lower-case roman numberal.
%  \Roman{COUNTER}  : Its value printed as an upper-case roman numberal.
%  \alph{COUNTER}   : Value of COUNTER printed as a lower-case letter:
%                         1 = a, 2 = b, etc.
%  \Alph{COUNTER}   : Value of COUNTER printed as an upper-case letter:
%                           1 = A, 2 = B, etc.
%

\def\thepart{\arabic{part}} % Roman numeral part numbers.
\def\thesection       {\arabic{section}}
\def\theclause    {\thesection.\arabic{clause}}
\def\thedefinition{\thesection.\arabic{definition}}
\def\thesubclause {\theclause .\arabic{subclause}}
\def\thesubsubclause     {\thesubclause.\arabic{subsubclause}}
\def\thenamelesssubsubclause     {\thesubclause.\arabic{namelesssubsubclause}}
\def\thesubsubsubclause  {\thesubsubclause.\arabic{subsubsubclause}}
\def\thenamelesssubsubsubclause{
     \thesubsubclause.\arabic{namelesssubsubsubclause}}

% ANNEX
%
% The \annex command must do the following:
%    -- add an `Annexes' heading to the table of contents
%    -- reset the section counter to zero
%    -- redefine the section counter to produce appendix numbers
%    -- add the section number to figure and table captions
%    -- ensure that figure and table numbers start anew for each annex
%    -- redefine the \section command if appendix titles and headings are
%       to look different from section titles and headings.
% All ISO annexes should be introduced with \normative or \informative, but
%   \section is retained for those who don't like the ISO annex headings.

\def\annex{\par
  \addtocontents{toc}{\protect{\section*{Annexes}}}
  \setcounter{section}{0}
  \def\thesection{\Alph{section}}
  \def\thefigure{\thesection.\arabic{figure}}
  \def\thetable{\thesection.\arabic{table}}
  \@addtoreset{table}{section} \@addtoreset{figure}{section}
  \def\section{\clearpage\@startsection {section}{1}{\z@}{3ex plus 1ex minus 
    .2ex}{.1ex plus .1ex}{\Large\bf}}}

% \normative and \informative start normative and informative annexes
%   respectively.
\def\normative#1{\@startannex{#1}{normative}}
\def\informative#1{\@startannex{#1}{informative}}

% \@startannex{TITLE}{TYPE} starts the annex called TITLE. TYPE is either
%   "normative" or "informative".
% This is a sort of very cut down \@startsection.
\def\@startannex#1#2{
    \clearpage
    \refstepcounter{section}
    \if@twocolumn\twocolumn[\@annextitle{#1}{#2}]
    \else\@annextitle{#1}{#2}
    \fi
    \addcontentsline{toc}{section}{\ifnum1>\c@secnumdepth \else
	\protect\numberline{\thesection}\fi #1}
}

% \@annextitle{TITLE}{TYPE} centres the title in LArge font.
\def\@annextitle#1#2{%
\begin{center}\LArge%
{\bf Annex \thesection}\\(#2)\\{\bf #1}\vspace*{2ex}\end{center}}


%    ****************************************
%    *         TABLE OF CONTENTS, ETC.      *
%    ****************************************
%
% A \clause command writes a 
%       \contentsline{clause}{TITLE}{PAGE}
% command on the .toc file, where TITLE contains the contents of the
% entry and PAGE is the page number.  If clauses are being numbered,
% then TITLE will be of the form
%       \numberline{NUM}{HEADING}
% where NUM is the number produced by \theclause.  Other sectioning
% commands work similarly.  
%
% A \caption command in a 'figure' environment writes
%    \contentsline{figure}{\numberline{NUM}{CAPTION}}{PAGE}
% on the .lof file, where NUM is the number produced by \thefigure and
% CAPTION is the figure caption.  It works similarly for a 'table' environment.
%
% The command \contentsline{NAME} expands to \l@NAME.  So, to specify
% the table of contents, we must define \l@section, 
% \l@clause, ... ; to specify the list of figures, we must define
% \l@figure; and so on.  Most of these can be defined with the
% \@dottedtocline command, which works as follows.
%
% \@dottedtocline{LEVEL}{INDENT}{NUMWIDTH}{TITLE}{PAGE}
%    LEVEL    : An entry is produced only if LEVEL < or = value of 
%               'tocdepth' counter.  Note that \section is level 1, 
%               \clause is level 2, etc.
%    INDENT   : The indentation from the outer left margin of the start of 
%               the contents line.
%    NUMWIDTH : The width of a box in which the section number is to go,
%               if TITLE includes a \numberline command.
%   
% This command uses the following three parameters, which are set
% with a \def (so em's can be used to make them depend upon the font).
%   \@pnumwidth : The width of a box in which the page number is put.
%   \@tocrmarg  : The right margin for multiple line entries.  One
%                 wants \@tocrmarg > or = \@pnumwidth
%   \@dotsep    : Separation between dots, in mu units.  Should be \def'd to
%                 a number like 2 or 1.7

% \numberline{NUMBER} : For use in a \contentsline command.
%   It puts NUMBER flushleft in a box of width \@tempdima 
%   (Before 25 Jan 88 change, it also added \@tempdima to the hanging 
%   indentation.)
%   In the ISO style, sets the number in bold.

\def\numberline#1{\hbox to\@tempdima{\bf#1\hfil}}

\def\@pnumwidth{1.55em}
\def\@tocrmarg {2.55em}
\def\@dotsep{2.8}
\setcounter{tocdepth}{5}


% TABLEOFCONTENTS
%
% \cameraready is in force, sets the copyright notice at the foot of the
% first contents page.
\def\tableofcontents{
  \if@cameraready\thispagestyle{copyrightheadings}\fi
  \vspace*{49mm}
  \hbox to \textwidth{{\LArge\bf Contents}\hfil\small Page}
  \begingroup
  \parskip\z@
  \@starttoc{toc}
  \endgroup}

%  \l@part is as in latex.tex - I haven't considered parts yet
%
\def\l@part#1#2{\addpenalty{\@secpenalty}
   \addvspace{2.25em plus 1pt}  % space above part line
   \begingroup
   \@tempdima 3em         % width of box holding part number, used by 
     \parindent \z@ \rightskip \@pnumwidth             %% \numberline
     \parfillskip -\@pnumwidth   
     {\large \bf          % set line in \large boldface
     \leavevmode          % TeX command to enter horizontal mode.       
     #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
     \nobreak             % Never break after part entry
   \endgroup}

\def\l@section#1#2{\addpenalty{\@secpenalty}  % good place for page break
   \addvspace{1.0em plus 1pt}  % space above toc entry
   \@tempdima 1.5em            % width of box holding section number
   \begingroup
     \parindent \z@ \rightskip \@pnumwidth 
     \parfillskip -\@pnumwidth   
     {\bf                 % Boldface for section title.
     \leavevmode          % TeX command to enter horizontal mode.       
     #1}\nobreak\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep 
        mu$}\hfill \nobreak \hbox to\@pnumwidth{\hss #2}\par
   \endgroup}
      
% Some of these parameters may have to be increased if a document division
% has more than 9 sub-parts (a two-digit subpart may encroach upon the
% following text).
\def\l@clause{\@dottedtocline{2}{1.5em}{2.3em}}
\def\l@subclause{\@dottedtocline{3}{3.8em}{3.2em}}
\def\l@subsubclause{\@dottedtocline{4}{7.0em}{4.1em}}
\def\l@namelesssubsubclause{\@gobbletwo}
\def\l@subsubsubclause{\@dottedtocline{5}{10em}{5em}}
\def\l@namelesssubsubsubclause{\@gobbletwo}

% Definitions produce no table of contents entry, so \l@definition just drops
%  its arguments
\def\l@definition{\@gobbletwo}

% Special table of contents command used by Introduction and Foreword.
\def\l@iso@intro{
   \addvspace{1.0em plus 1pt}  % space above toc entry
   \@dottedtocline{1}{\z@}{\z@}}

% LIST OF FIGURES
%
\def\listoffigures{\section*{Figures}\@starttoc{lof}}

\def\l@figure{\@dottedtocline{1}{0em}{2.3em}}

% LIST OF TABLES
%
\def\listoftables{\section*{Tables}\@starttoc{lot}}
\let\l@table\l@figure



%    ****************************************
%    *             BIBLIOGRAPHY             *
%    ****************************************
%
% The thebibliography environment is left over from article.sty; the iso
% style uses the references environment but I've left thebibiliography
% in for old times' sake.
% Note that the \@cite command is changed later on, so citations look
% different to those of article.sty.
%
% The thebibliography environment executes the following commands:
%
%  \def\newblock{\hskip .11em plus .33em minus -.07em} --
%      Defines the `closed' format, where the blocks (major units of 
%      information) of an entry run together.
%
%  \sloppy  -- Used because it's rather hard to do line breaks in 
%      bibliographies,
% 
%  \sfcode`\.=1000\relax --
%      Causes a `.' (period) not toproduce an end-of-sentence space.

\def\thebibliography#1{\section*{References\@mkboth
  {REFERENCES}{REFERENCES}}\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

% \def\@biblabel#1{[#1]\hfill}  % Produces the label for a \bibitem[...]
                                % command. 
% \def\@cite#1{[#1]}            % Produces the output of the \cite command.


%    ****************************************
%    *             REFERENCES               *
%    ****************************************
%
% The references environment is the iso style equivalent of the
% thebibliography environment.
%
% The references environment executes the following commands:
%
%  \def\newblock{\hskip .11em plus .33em minus -.07em} --
%      Defines the `closed' format, where the blocks (major units of 
%      information) of an entry run together.
%
%  \sloppy  -- Used because it's rather hard to do line breaks in 
%      bibliographies,
% 
%  \sfcode`\.=1000\relax --
%      Causes a `.' (period) not to produce an end-of-sentence space.

\def\references{\list
  {}{\labelwidth\z@\leftmargin\z@\labelsep\z@\itemindent\z@
    \def\newblock{\hskip .11em plus .33em minus -.07em}
    \def\@biblabel##1{
	{\rm##1,\hskip .5em\relax}}}  % Produces the label for \bibitem[...]
    \sloppy\clubpenalty4000\widowpenalty4000
    \sfcode`\.=1000\relax
    \it}

\let\endreferences=\endlist

% Produces the output of the \cite command.
% NDN: If a \cite is the first item in a paragraph, it is called in vmode
%   and its argument is set in an hbox and appended to the vertical list.
%   This doesn't happen in article.sty etc because the first character of
%   a citation is '[', which starts a new paragraph. However, iso.sty has
%   to put in a \leavevmode to fix things.
\def\@cite#1#2{\leavevmode{#1\if@tempswa , #2\fi}}


%    ****************************************
%    *              THE INDEX               *
%    ****************************************
%
% THE THEINDEX ENVIRONMENT
% Produces double column format, with each paragraph a separate entry.
% The user commands \item, \subitem and \subsubitem are used to
% produce the entries, and \indexspace adds an extra vertical space
% that's the right size to put above the first entry with a new letter
% of the alphabet.
% NDN: ISO guidelines say nothing about indices so I've left this alone.

\newif\if@restonecol

\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
\columnsep 35pt\twocolumn[\section*{Index}]
    \@mkboth{INDEX}{INDEX}\thispagestyle{plain}\parindent\z@
    \parskip\z@ plus .3pt\relax\let\item\@idxitem}

\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}

% A standard should be indexed by clause number so we redefine \index
% to give the option of indexing by page or by clause number.
% This is accomplished by redefining \@wrindex and adding commands to
% change the indexing style.
% Unfortunately, makeindex doesn't work with clause numbers, so the default
% is to index by page.
%
\def\@wrindex#1{\let\thepage\relax
   \xdef\@gtempa{\write\@indexfile{\string
      \indexentry{#1}{\@indexlabel}}}\endgroup\@gtempa
   \if@nobreak \ifvmode\nobreak\fi\fi\@esphack}
\def\pageindex{\def\@indexlabel{\thepage}}
\def\clauseindex{\def\@indexlabel{\@currentlabel}}
\pageindex



%    ****************************************
%    *             FOOTNOTES                *
%    ****************************************
%
% \footnoterule is a macro to draw the rule separating the footnotes from
% the text.  It should take zero vertical space, so it needs a negative
% skip to compensate for any positive space taken by the rule.  (See
% PLAIN.TEX.)

\def\footnoterule{\kern-3\p@   
  \hrule width .4\columnwidth 
  \kern 2.6\p@}                 % The \hrule has default height of .4pt .

% ISO have the footnote counter reset after every page.
% \newcounter{footnote}
\@addtoreset{footnote}{page}

% The numbering style (arabic, alph, etc.) for ordinary footnotes
% is defined by the macro \thefootnote.
\def\thefootnote{\arabic{footnote})}
\def\thempfootnote{\arabic{mpfootnote})}

%   \@makefntext{NOTE} :
%        Must produce the actual footnote, using \@thefnmark as the mark 
%        of the footnote and NOTE as the text.  It is called when effectively
%        inside a \parbox of width \columnwidth (i.e., with \hsize = 
%        \columnwidth).  
%
%        The following macro indents all lines of the footnote by 10pt, and 
%        indents the first line of a new paragraph by 1em.  To change these 
%        dimensions, just substitute the desired value for '10pt' [in both 
%        places] or '1em'.  The mark is flushright against the footnote. 
%          \long\def\@makefntext#1{\@setpar{\@@par\@tempdima \hsize 
%             \advance\@tempdima-10pt\parshape \@ne 10pt \@tempdima}\par
%             \parindent 1em\noindent \hbox to \z@{\hss$^{\@thefnmark}$}#1}
%
%        A simpler macro is used, in which the footnote text is
%        set like an ordinary text paragraph, with no indentation.
%	 I am not sure whether \hss is useful or not.

\long\def\@makefntext#1{\noindent 
            \hbox to 1.8em{\hss$^{\@thefnmark}$}#1}

% \@makefnmark : A macro to generate the footnote marker that goes
%                in the text.  Default definition used.




%    ****************************************
%    *         FIGURES AND TABLES           *
%    ****************************************
% 
% Float placement parameters.  See LaTeX manual for their definition.
%
\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}

% \@makecaption{NUMBER}{TEXT} : Macro to make a figure or table caption.  
%      NUMBER : Figure or table number--e.g., 'Figure 3.2' 
%      TEXT   : The caption text.
%  Macro should be called inside a \parbox of right width, with \normalsize.
% changed 25 Jun 86 to fix according to Howard Trickey:
% instead of \unhbox\@tempboxa\par we do #1: #2\par
% ISO wants the number separated from the text by a long dash so we put that
% rather than a colon.
% We also put the \vskip after the caption rather than before, as ISO titles
% go above their tables/figures rather than below.

\long\def\@makecaption#1#2{
   \setbox\@tempboxa\hbox{\bf#1 --- #2}
   \ifdim \wd\@tempboxa >\hsize   % IF longer than one line:
       {\bf#1 --- #2}\par         %   THEN set as ordinary paragraph.
     \else                        %   ELSE  center.
       \hbox to\hsize{\hfil\box\@tempboxa\hfil}
   \fi
   \vskip 10pt}

% To define a float of type TYPE (e.g., TYPE = figure), the document style 
% must define the following.
%
%  \fps@TYPE   : The default placement specifier for floats of type TYPE.
%
%  \ftype@TYPE : The type number for floats of type TYPE.  Each TYPE has
%                associated a unique positive TYPE NUMBER, which is a power 
%                of two.  E.g., figures might have type number 1, tables type 
%                number 2, programs type number 4, etc.
%
%  \ext@TYPE   : The file extension indicating the file on which the 
%                contents list for float type TYPE is stored.  For example, 
%                \ext@figure = 'lof'.
%
%  \fnum@TYPE  : A macro to generate the figure number for a caption.
%                For example, \fnum@TYPE == Figure \thefigure.
%
%  The actual float-making environment commands--e.g., the commands
%  \figure and \endfigure--are defined in terms of the macros \@float
%  and \end@float, which are described below.
%
%  \@float{TYPE}[PLACEMENT] : Macro to begin a float environment for a 
%     single-column float of type TYPE with PLACEMENT as the placement 
%     specifier.  The default value of PLACEMENT is defined by \fps@TYPE.   
%     The environment is ended by \end@float.  
%     E.g., \figure == \@float{figure}, \endfigure == \end@float.


% FIGURE

\newcounter{figure}
\def\thefigure{\@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}

% TABLE
%
\newcounter{table}
\def\thetable{\@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}


%    ****************************************
%    *         TITLE AND ABSTRACT           *
%    ****************************************
%

% \maketitle ==
%  BEGIN
%    \newpage
%    \iso@setmargins  % Set margins for body of standard
%    \begingroup
%      redefine \@makefnmark so footnote marks take zero space (this makes
%        centering look better)
%      \thefootnote == \fnsymbol{footnote} % to number by *, dagger, etc.
%    \if@isoonecolumn       % If user has given onecolumn style option
%    \onecolumn               %  set in single column.
%    \global\@topnum\z@        % Prevents figures from going at top of page.
%    \@maketitle
%    \else \twocolumn[\@maketitle] \fi
%   \thispagestyle{firstpage}
%   \@thanks   % \thanks defines \@thanks to have \footnotetext commands for
%              % producing footnotes.
%   \endgroup
%   \pagenumbering{arabic}  % Earlier pages use Roman
%  END

\def\maketitle{
 \newpage
 \iso@setmargins
 \begingroup
   \def\thefootnote{\fnsymbol{footnote}}
   \def\@makefnmark{\hbox   
       to 0pt{$^{\@thefnmark}$\hss}}   
   \if@isoonecolumn
     \onecolumn
     \global\@topnum\z@        % Prevents figures from going at top of page.
     \@maketitle
     \else \twocolumn[\@maketitle] \fi
   \thispagestyle{firstpage}\@thanks
 \endgroup
 \setcounter{footnote}{0}
 \pagenumbering{arabic}
 \let\maketitle\relax
 \let\@maketitle\relax
 \gdef\@thanks{}\gdef\@author{}\gdef\@title{}\let\thanks\relax}

\def\@maketitle{
 \null
 \vskip 2em                 % Vertical space above title.
 \begin{flushleft}
  {\LARGE\bf \@title \par}     % Title set in \LARGE size and bold font.
  \vskip 1.5em                % Vertical space after title.
\end{flushleft}}

% Camera-ready copy.
% The \cameraready macro alters page numbers so that the table of contents
%   starts on page ii, a page is skipped before the introduction if there
%   is no foreword and the copyright notice is printed.
% This macro should only be used in the preamble as it will mess up page
%   numbering and page sizes if used elsewhere.
% If \cameraready is used, \tableofcontents should also be used as it resets
%   the page size.
\newif\if@cameraready \@camerareadyfalse
\def\cameraready{\@camerareadytrue\stepcounter{page}%
    \global\advance\textheight by -\@copyrightheight%
    \global\advance\footskip by \@copyrightheight}

% Copyright text
% This gets set at the foot of the first page of tables of contents, if
% \cameraready is in force.
\def\@copyrighttext{
\copyright\quad ISO/IEC\quad \theyear\newline
All rights reserved.
Unless otherwise specified, no part of this publication may be reproduced
or utilized in any form or by any means, electronic or mechanical,
including photocopying and microfilm, without permission in writing from
the publisher.\newline
\makebox[\textwidth][r]{%
ISO/IEC Copyright Office $\bullet$ Case Postale 56 $\bullet$
CH-1211 Gen{\`e}ve 20 $\bullet$ Switzerland}\newline
Printed in Switzerland}
% Height of box in which to place copyright text
\def\@copyrightheight{1.5in}

% \abstract removed as inappropriate to the iso style
%\def\abstract{\if@twocolumn
%\section*{Abstract}
%\else \small 
%\begin{center}
%{\bf Abstract\vspace{-.5em}\vspace{0pt}} 
%\end{center}
%\quotation 
%\fi}
%
%\def\endabstract{\if@twocolumn\else\endquotation\fi}


%    ****************************************
%    *            PAGE STYLES               *
%    ****************************************
%
% The page style 'foo' is defined by defining the command \ps@foo.  This
% command should make only local definitions.  There should be no stray
% spaces in the definition, since they could lead to mysterious extra
% spaces in the output.
%
% The \ps@... command defines the macros \@oddhead, \@oddfoot,
% \@evenhead, and \@evenfoot to define the running heads and
% feet---e.g., \@oddhead is the macro to produce the contents of the
% heading box for odd-numbered pages.  It is called inside an \hbox of
% width \textwidth.
%
% To make headings determined by the sectioning commands, the page style
% defines the commands \sectionmark, ... , where
% \sectionmark{TEXT} is called by \section to set a mark, and so on.
% The \...mark commands and the \...head macros are defined with the
% help of the following macros.  (All the \...mark commands should be
% initialized to no-ops.)
%
% MARKING CONVENTIONS:
% LaTeX extends TeX's \mark facility by producing two kinds of marks
% a 'left' and a 'right' mark, using the following commands:
%     \markboth{LEFT}{RIGHT} : Adds both marks.
%     \markright{RIGHT}      : Adds a 'right' mark.
%     \leftmark  : Used in the \@oddhead, \@oddfoot, \@evenhead or \@evenfoot
%                  macro, gets the current 'left'  mark.  Works like TeX's 
%                  \botmark command.
%     \rightmark : Used in the \@oddhead, \@oddfoot, \@evenhead or \@evenfoot
%                  macro, gets the current 'right'  mark.  Works like TeX's 
%                  \firstmark command.
% The marking commands work reasonably well for right marks 'numbered 
% within' left marks--e.g., the left mark is changed by a \section command and
% the right mark is changed by a \clause command.  However, it does
% produce somewhat anomalous results if two \bothmark's occur on the same page.
% 
% Commands like \tableofcontents that should set the marks in some page styles
% use a \@mkboth command, which is \let by the pagestyle command (\ps@...)
% to \markboth for setting the heading or \@gobbletwo to do nothing.

\mark{{}{}}   % Initializes TeX's marks

% \ps@empty and \ps@plain defined in LATEX.TEX

% Definition of 'headings' page style 
%  Note the use of ##1 for parameter of \def\sectionmark inside the
%  \def\ps@headings.
% NDN: another one that's left in for old times' sake.
%

\if@twoside         % If two-sided printing.
\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{}\def\@evenfoot{}%       No feet.
\def\@evenhead{\rm \thepage\hfil \sl \leftmark}%        Left heading.
\def\@oddhead{\hbox{}\sl \rightmark \hfil \rm\thepage}% Right heading.
\def\sectionmark##1{\markboth {\uppercase{\ifnum \c@secnumdepth >\z@
    \thesection\hskip 1em\relax \fi ##1}}{}}%
\def\clausemark##1{\markright {\ifnum \c@secnumdepth >\@ne
          \theclause\hskip 1em\relax \fi ##1}}}
\else               % If one-sided printing.
\def\ps@headings{\let\@mkboth\markboth
\def\@oddfoot{}\def\@evenfoot{}%     No feet.
\def\@oddhead{\hbox {}\sl \rightmark \hfil \rm\thepage}% Heading.
\def\sectionmark##1{\markright {\uppercase{\ifnum \c@secnumdepth >\z@
    \thesection\hskip 1em\relax \fi ##1}}}}
\fi

% Definition of 'myheadings' page style.  
% NDN: another one that's left in for old times' sake.
%
\def\ps@myheadings{\let\@mkboth\@gobbletwo
\def\@oddhead{\hbox{}\sl\rightmark \hfil \rm\thepage}%
\def\@oddfoot{}\def\@evenhead{\rm \thepage\hfil\sl\leftmark\hbox {}}%
\def\@evenfoot{}\def\sectionmark##1{}\def\clausemark##1{}}

% Definition of the 'isoheadings' page style.
% We allow the user to redefine the running header and running footer,
%   should they wish.
\def\runninghead#1{\def\@runninghead{{#1}}}
\runninghead{{\thestandard\ : \theyear(E)}}	% default running header
\def\runningfoot#1{\def\@runningfoot{{#1}}}
\runningfoot{}					% empty default running footer
\def\ps@isoheadings{\let\@mkboth\@gobbletwo
\def\@oddhead{\hfil{\Large\bf\@runninghead}}
\def\@evenhead{{\Large\bf\@runninghead}\hfil}
\def\@oddfoot{{\Large\bf\@runningfoot\hfil\thepage}}
\def\@evenfoot{{\Large\bf\thepage\hfil\@runningfoot}}
\def\sectionmark##1{}\def\clausemark##1{}}

% Definition of the 'firstpage' style. Used for the titlepage.
% Allow the user to redefine the banner thingy.
\def\documenttype#1{\def\@documenttype{{#1}}}
\documenttype{{INTERNATIONAL STANDARD}}		% default document type
\def\ps@firstpage{\let\@mkboth\@gobbletwo
\def\@oddhead{\vbox{\hrule height.3mm\vskip7pt\vfil
{\hbox to \textwidth{\Large\bf\@documenttype\hfil
\@runninghead}
}\vskip5pt\vfil\hrule height.3mm}}
\def\@evenhead{\vbox{\hrule height.3mm\vskip5pt\vfil
{\hbox to \textwidth{\Large\bf\@documenttype\hfil
\@runninghead}
}\vfil\hrule height.3mm}}
\def\@oddfoot{{\Large\bf\@runningfoot\hfil\thepage}}
\def\@evenfoot{{\Large\bf\thepage\hfil\@runningfoot}}
\def\sectionmark##1{}\def\clausemark##1{}}

% Definition of the 'copyrightheadings' style. Used for the copyright notice.
% Puts the copyright notice in the footer and then resets the page size.
% The \makebox[0pt] prevents an overfull \hbox warning from LaTeX.
\def\ps@copyrightheadings{\let\@mkboth\gobbletwo
\def\@oddhead{\hfil{\Large\bf\@runninghead}}
\def\@evenhead{{\Large\bf\@runninghead}\hfil}
\def\@oddfoot{\hfil\makebox[0pt][r]{\begin{minipage}[b]{\textwidth}%
    {\@copyrightsize\@copyrighttext}\\[0.3in]%
    {\Large\bf\@runningfoot\hfil\thepage}%
    \end{minipage}}%
    \global\advance\footskip by -\@copyrightheight%
    \global\advance\textheight by \@copyrightheight%
    \pagestyle{isoheadings}}
\def\@evenfoot{\makebox[0pt][l]{\begin{minipage}[b]{\textwidth}%
    {\@copyrightsize\@copyrighttext}\\[0.3in]%
    {\Large\bf\thepage\hfil\@runningfoot}%
    \end{minipage}}\hfil%
    \global\advance\footskip by -\@copyrightheight%
    \global\advance\textheight by \@copyrightheight%
    \pagestyle{isoheadings}}
\def\sectionmark##1{}\def\clausemark##1{}}


%    ****************************************
%    *            MISCELLANEOUS             *
%    ****************************************
%
% DATE
%
\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}

\def\theyear{\number\year}

%
% STANDARD NUMBER
%
\def\standard#1{\def\@standard{{#1}}
   \def\thestandard{ISO/IEC \@standard}}
\standard{XXXX}                      % default standard number

%
% VERSION NUMBER
%
\def\version#1{\def\theversion{#1}}
\version{XXXX}                       % default version number

%
% PS-LaTeX COMPATIBILITY
%
% If running under PS-LaTeX, we change a few character codes and reset the
% spaceskip to reduce hyphenation.
% The former is done below; the latter at the end of this file.
%
% So that we can detect whether we are running PS-LaTeX, define the
% following:
\def\@pslfmtname{pslplain}

% Some useful characters
\ifx\fmtname\@pslfmtname
    \chardef\bslash="5C			  % gives \
    \chardef\lquote="C1                   % gives `
    \chardef\rquote="C2                   % gives '
\else
    % We protect \bslash so that it can be redefined by \prog and still appear
    % in section headings and the like, without being expanded too early.
    \def\bslash{\protect\pbslash}
    \def\pbslash{\mbox{$\mathchar"026E$}}
    \chardef\lquote="12                   % gives `
    \chardef\rquote="13                   % gives '
\fi

%
% USEFUL CHARACTERS
%
\chardef\caret=`\^
\chardef\tilde="7E

%
% PROG
%
% The prog environment sets its contents in typewriter font, redefines
% \bslash to give a typewriter backslash and allows interword spaces to
% flex a little if in two-column mode (this is because setting typewriter
% font with fixed spaces in two-column mode gives awful line breaks).
% We protect \prog so that it can be used in section headings and the like; in
% particular, the definitions of \prog and \bslash are designed so that
% \section{\prog{Here is a \bslash}} produces a typewriter font backslash in
% the table of contents.
% This definition also works in PS-LaTeX since it does not use \pbslash, but
% gives the character code directly.
% The \relax prevents errors such as \prog{\bslash 70} which produces an
% invalid character code error.
\def\prog{\protect\pprog}
\def\pprog#1{{%
    \def\pbslash{\char"5C\relax}%
    \tt #1}}

%
% NEWVERBATIM
%
% \newverbatim{foo} creates a new environment, foo, which behaves exactly
% like the verbatim environment except that it is delimited by
% \begin{foo} ... \end{foo}.
% See the VERBATIM section of latex.tex for the inspiration behind this.
%

% Redefine \@verbatim so that \spaceskip manipulations can be undone.
\let\iso@verb\@verbatim
\def\@verbatim{\iso@verb\@verbspace}

\def\newverbatim#1{\expandafter\def\csname #1\endcsname{%
\@verbatim \frenchspacing\@vobeyspaces%
\csname @x#1verbatim\endcsname}
\expandafter\let\csname end#1\endcsname=\endtrivlist
\new@xverbatim{#1}}

\begingroup \catcode `|=0 \catcode `[= 1
\catcode`]=2 \catcode `\{=12 \catcode `\}=12
\catcode`\\=12
|gdef|new@xverbatim#1[
|expandafter|def|csname @x#1verbatim|endcsname##1\end{#1}[##1|end[#1]]]
|endgroup

%
% IDENTIFICATION
%
% Documents may need to know what style they are using so we provide
% \stylename to tell them (by analogy with \fmtname).
% Other styles like article, report, ucthesis etc should also define
% this macro for it to be useful. Perhaps, one day, who knows...
%
\def\stylename{iso}

%
% LINE BREAKING
%
% Typesetting in two-column mode can give terrible line breaks so define
% a macro to let TeX be more lax about things.
% \verysloppy relaxes things considerably.
% \unverysloppy reverts to default values.
\def\verysloppy{%
    \exhyphenpenalty=0%
    \adjdemerits=100%
    \finalhyphendemerits=0}
\def\unverysloppy{%
    \exhyphenpenalty=50%
    \adjdemerits=10000%
    \finalhyphendemerits=5000}


%    ****************************************
%    *           INITIALIZATION             *
%    ****************************************
%
% Default initializations

\ps@isoheadings             % 'isoheadings' page style
\pagenumbering{roman}       % Roman page numbers (changed to Arabic by
			    %   \maketitle)
\onecolumn                  % Single column (for table of contents etc.)
			    %   changed to twocolumn by \maketitle)

% If running PS-LaTeX, then improve spacing somewhat.
\ifx\fmtname\@pslfmtname%
    \xdef\@defaultspaceskip{\the\spaceskip}
    \def\defaultspacing{\spaceskip=\@defaultspaceskip}
    {\tt \xdef\@verbskip{\the\spaceskip}}% Find out the typewriter \spaceskip
    \def\@verbspace{\spaceskip=\@verbskip}% Use it in verbatim mode
    \spaceskip=4pt plus 4pt minus 1.6pt% Increase default spacing
\else
    \def\defaultspacing{}
    \def\@verbspace{}
\fi

\sloppy
%\verysloppy
\flushbottom
\if@twoside\else\raggedbottom\fi % Ragged bottom unless twoside option.
