% \section{Document preambles}
%
%    \begin{macrocode}
%<nrc1|nrc2>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%<*dtx>
\ProvidesFile            {nrc.dtx}
%</dtx>
%<nrc1cls>\ProvidesClass  {nrc1}
%<nrc1sty>\ProvidesPackage{nrc1}
%<nrc2cls>\ProvidesClass  {nrc2}
%<nrc2sty>\ProvidesPackage{nrc2}
%<balance>\ProvidesPackage{baltools}
%<*nrc1|nrc2|balance>
                 [2013/02/02 v2.01a
%</nrc1|nrc2|balance>
%<nrc1cls>       NRC single-column journal class%
%<nrc1sty>       NRC single-column journal compatibility package%
%<nrc2cls>       NRC 2-column journal class%
%<nrc2sty>       NRC 2-column journal compatibility package%
%<balance>       NRC 2-column balancing tools%
%<*dtx>
                 NRC macros source file%
%</dtx>
%<*nrc1|nrc2|balance>
]% $Id: nrc.dtx,v 2.143 2013/02/02 17:45:07 ct $
%</nrc1|nrc2|balance>
%    \end{macrocode}
%
% \iffalse
%
% Note that the RCS version relates to the number of times the file
% has been checked-in, which relates to a development process taking
% place on several machines, rather than the incidence of significant
% change; the definitive version number is that in the \Provides*
% things, while the RCS Id may provide a clue as to the latest date
% the documentation was worked on.
%
% Code to compile the thing using LaTeX2e
%
%    \begin{macrocode}
%<*driver>
\documentclass{ltxdoc}
%
%
\begin{document}
 \GetFileInfo{nrc.dtx}
 \title{The \textsf{nrc} macros\thanks{This file
        has version number \fileversion, last
        revised \filedate}}
    \author{Robin Fairbairns\\\small\texttt{rf10@cam.ac.uk}}
 \date{Printed \today}
 \maketitle
 \tableofcontents
 \begin{center}
   \fboxsep1.5mm
   \framebox{\bfseries
     \begin{minipage}{4.5in}
       Copyright \copyright\
       Her Majesty the Queen in Right of Canada (1999--\\
       \hphantom{Copyright \copyright\ }%
         2002) as represented by the Minister responsible\\
       \hphantom{Copyright \copyright\ }%
         for the National Research Council of Canada.
     \end{minipage}}
 \end{center}
 \DocInput{nrc.dtx}
\end{document}
%</driver>
%    \end{macrocode}
% 
% \fi
% \CheckSum{4586}
%
% \StopEventually{}
% \section{Introduction}
%
% This file generates class files that provide macros for use with
% \LaTeXe{} to typeset journals published by the National Research
% Council of Canada, in both one- (\textsf{nrc1}) and two-column
% (\textsf{nrc2}) formats.
%
% \subsection{Class options}
%
% \begin{macro}{\NRC@clsname}
% \begin{macro}{\NRC@warning}
% \begin{macro}{\hb@xt@}
% \begin{macro}{\NRC@xlap}
% \begin{macro}{\NRC@footer@centre}
% \begin{macro}{\NRC@tpheader@centre}
% \begin{macro}{\NRC@tpfooter@centre}
% First, a few utility definitions, etc.
%
% \cs{hb@xt@} is in modern \LaTeX{} kernels, but \cs{providecommand}
% was there from the very start of \LaTeXe.
%
% \cs{NRC@clsname} is self-explanatory and \cs{NRC@warning} is a
% warning for the class.  \cs{NRC@xlap} is a centred lap (a zero-width
% box, like \cs{llap} and \cs{rlap}); the name comes from the
% \textsl{TUGboat} macros.  \cs{NRC@footer@centre} is used in the
% footer of pages; it may be blank~--- hence pre-emptive declaration
% here.  \cs{NRC@tpfooter@centre} (old style) or
% \cs{NRC@tpheader@centre} (new style) contains the same information on
% the title page, and may also therefore be blank.
%
%    \begin{macrocode}
%<*nrc1cls|nrc2cls>
\newcommand{\NRC@clsname}%
%<nrc1>{nrc1}
%<nrc2>{nrc2}
\newcommand{\NRC@warning}[1]{\ClassWarning\NRC@clsname{#1}}
\providecommand{\hb@xt@}{\hbox to}
\newcommand{\NRC@xlap}[1]{\hb@xt@\z@{\hss#1\hss}}
\let\NRC@footer@centre\@empty
%<newtplayout>\let\NRC@tpheader@centre\@empty
%<!newtplayout>\let\NRC@tpfooter@centre\@empty
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{environment}{landscape}
% \begin{environment}{11pt}
% \begin{environment}{12pt}
% \begin{environment}{a5paper}
% \begin{environment}{b5paper}
% Kill off all actively irrelevant options.  (Landscape anything, and
% the standard 5-size papers are too small\dots)  Unless we do this,
% we will inherit those options (which are defined by
% \textsf{article.cls}) and cause potential confusion.
%    \begin{macrocode}
\DeclareOption{landscape}{\NRC@warning{Option \CurrentOption\space
    ignored}}
\DeclareOption{11pt}{\ds@landscape}
\DeclareOption{12pt}{\ds@landscape}
\DeclareOption{a5paper}{\ds@landscape}
\DeclareOption{b5paper}{\ds@landscape}
%    \end{macrocode}
% \end{environment}
% \end{environment}
% \end{environment}
% \end{environment}
% \end{environment}
%
% \begin{environment}{cmfonts}
% \begin{environment}{type1fonts}
% \begin{environment}{type1rest}
% Font usage: this provides the mechanism to test the class without
% access to the specialised (and rather expensive) fonts used at the
% NRC.
%
% Option \verb|usecmfonts| replaces text Times and Helvetica by
% Computer Modern family fonts.  Option \verb|type1rest| uses Times
% and Helvetica, but restricts the set of Helvetica available by
% replacing Helvetica Light by Helvetica (Medium: the regular weight
% of the font), and Helvetica Black by Helvetica Bold.
%
% Option \verb|type1fonts| (the default) uses the complete set of
% Times and Helvetica fonts available in the production process.
%    \begin{macrocode}
\newif\if@usecmfonts
\newif\if@restrictedtypeone
\DeclareOption{cmfonts}{\@usecmfontstrue}
\DeclareOption{type1fonts}{\@usecmfontsfalse
  \@restrictedtypeonefalse}
\DeclareOption{type1rest}{\@usecmfontsfalse
  \@restrictedtypeonetrue}
%    \end{macrocode}
% \end{environment}
% \end{environment}
% \end{environment}
%
% \begin{environment}{YandY}
% \begin{environment}{genTeX}
% Option \verb|YandY| specifies that \verb|LY1| encoding should be
% used.  Otherwise (option |genTeX|~--- `generic' \TeX{}) we use
% whatever encoding the user specifies (by default, |OT1|).  We make
% no moves on input encoding: that's up to the user, regardless\dots
%    \begin{macrocode}
\newif\if@yandy
\DeclareOption{YandY}{\@yandytrue}
\DeclareOption{genTeX}{\@yandyfalse}
%    \end{macrocode}
% \end{environment}
% \end{environment}
%
% \begin{environment}{breakaddress}
% \begin{environment}{nobreakaddress}
% These control an aspect of the layout of the address information box
% at the bottom of the title page.
%
% Option \verb|breakaddress| arranges that the address is printed on a
% new line after the list of authors whose address it is.  Option
% \verb|nobreakaddress| (the default) arranges that the address runs
% on after the list of authors.
%    \begin{macrocode}
\DeclareOption{breakaddress}{\let\if@breakaddress\iftrue}
\DeclareOption{nobreakaddress}{\let\if@breakaddress\iffalse}
%    \end{macrocode}
% \end{environment}
% \end{environment}
%
% \begin{environment}{twocolid}
% \begin{environment}{twocolid*}
% \begin{environment}{onecolid}
% Options \verb'twocolid' and \verb'twocolid*' arrange that the IDbox
% at the bottom of the title page is set over both columns, rather
% than over one column only (which is the default, and which the
% nervous can select by option \verb'onecolid').  The IDbox can be set
% internally in a single column over the entire width of the page
% (option \verb'twocolid'), or in two columns (option
% \verb'twocolid*').
%    \begin{macrocode}
%<*nrc2>
\newif\if@onecolid
\newif\if@multcolid
\DeclareOption{twocolid}{\@onecolidfalse\@multcolidfalse}
\DeclareOption{twocolid*}{\@onecolidfalse\@multcolidtrue}
\DeclareOption{onecolid}{\@onecolidtrue}
%</nrc2>
%    \end{macrocode}
% \end{environment}
% \end{environment}
% \end{environment}
%
% \begin{environment}{leqno}
% \begin{environment}{reqno}
% \begin{macro}{\iflefteqnos}
% The option \verb'leqno' (the default) has the same meaning (in
% effect) as does the \verb'article' class option (which in fact loads
% its view of the world through a \verb'.clo' file).  The option
% \verb'reqno' restores the standard \TeX{} view of the matter, which
% is sometimes needed in \verb'nrc2'-class papers.
%    \begin{macrocode}
\newif\iflefteqnos
\DeclareOption{leqno}{\lefteqnostrue}
\DeclareOption{reqno}{\lefteqnosfalse}
%    \end{macrocode}
% \end{macro}
% \end{environment}
% \end{environment}
%
% Now control of the labels in the bibliography.
%
% \begin{environment}{numbib}
% \begin{environment}{nonumbib}
% \begin{macro}{\ifNRC@numbib}
% These options merely switch
%    \begin{macrocode}
\newif\ifNRC@numbib
\DeclareOption{numbib}{\NRC@numbibtrue}
\DeclareOption{nonumbib}{\NRC@numbibfalse}
%    \end{macrocode}
% \end{macro}
% \end{environment}
% \end{environment}
%
%
% \begin{environment}{author}
% \begin{macro}{\ifNRC@author@use}
% If the class is being used by an author to prepare a paper, there
% are things that can't be entered: for example, final volume, issue,
% or page number, and NRC file number.  The |author| class option
% (which will almost never be executed other than by way of
% \cs{ExecuteOptions}) forewarns the class that such commands should
% not be expected.
%    \begin{macrocode}
\newif\ifNRC@author@use
\NRC@author@usefalse
\DeclareOption{author}{\NRC@author@usetrue}
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
%
% The next two control the preprint/production state of the paper.
%
% \begin{environment}{preprint}
% \begin{environment}{production}
% \begin{macro}{\ifNRC@preprint}
% Option \verb|preprint| causes the page styles to change (omit dates,
% page numbers, etc.), while option \verb|production| (the default)
% sets page styles as required in the production process.  Note that
% \verb|preprint| is really `incompatible' (i.e., makes no sense) with
% \verb|trimmarks|, but we don't diagnose the two together.
%    \begin{macrocode}
\newif\ifNRC@preprint
\DeclareOption{preprint}{\NRC@preprinttrue}
\DeclareOption{production}{\NRC@preprintfalse}
%    \end{macrocode}
% \end{macro}
% \end{environment}
% \end{environment}
%
% Then two that control decorations in page footers.
%
% \begin{environment}{proof}
% \begin{environment}{pagnf}
% \begin{macro}{\NRC@footer@defd}
% Notices that this is a proof printing only, or that it is a printing
% (e.g., on the web) whose pagination differs from the final
% pagination in the journal.
%
% \cs{NRC@footer@defd} records which of these options has been given
% (0 for neither, 1 for |proof|, 2 for |pagnf|); it's used for
% diagnostics here, and (in `original' style) when deciding whether to
% set up the title page footer centre, later.
%    \begin{macrocode}
\newcommand{\NRC@footer@defd}{0}
\DeclareOption{proof}{\ifcase\NRC@footer@defd
    \renewcommand\NRC@footer@centre{%
      \fontsize{14}{16}%
      \usefont\f@encoding\sfdefault cn%
      \NRC@text@proof
    }%
%<newtplayout> \let\NRC@tpheader@centre\NRC@footer@centre
%<!newtplayout> \let\NRC@tpfooter@centre\NRC@footer@centre
    \renewcommand{\NRC@footer@defd}{1}%
  \or
    \NRC@warning{"\CurrentOption" option repeated}%
  \or
    \NRC@warning{"\CurrentOption" option inconsistent
                                  with "pagnf" option}%
  \fi
}
\DeclareOption{pagnf}{\ifcase\NRC@footer@defd
    \renewcommand\NRC@footer@centre{%
      \fontsize\@xpt\@xiipt%
      \usefont\f@encoding\sfdefault mn%
      \NRC@text@pagination
    }%
%<newtplayout> \let\NRC@tpheader@centre\NRC@footer@centre
%<!newtplayout> \let\NRC@tpfooter@centre\NRC@footer@centre
    \renewcommand{\NRC@footer@defd}{2}%
  \or
    \NRC@warning{"\CurrentOption" option inconsistent
                                  with "proof" option}%
  \or
    \NRC@warning{"\CurrentOption" option repeated}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{environment}
% \end{environment}
%
% \begin{environment}{finalverso}
% \begin{environment}{nofinalverso}
% Option |finalverso| specifies that the paper should end on a recto
% page (creating a blank, unnumbered page if the text doesn't for
% itself; the blank page does \emph{not} appear in the paper's page
% count).
%    \begin{macrocode}
\newif\if@finalverso
\DeclareOption{finalverso}{\@finalversotrue}
\DeclareOption{nofinalverso}{\@finalversofalse}
%    \end{macrocode}
% \end{environment}
% \end{environment}
%
% 
%
% \begin{environment}{notrimmarks}
% \begin{environment}{trimmarks}
% \begin{macro}{\NRC@toptrim}
% \begin{macro}{\NRC@bottomtrim}
% The next two options control the creation of trim marks.
%
% Option \verb|trimmarks| enables output of trim marks, which are
% needed in the final production process.  Option \verb|notrimmarks|
% (the default) suppresses the trim marks.
%    \begin{macrocode}
\DeclareOption{notrimmarks}{%
  \let\NRC@toptrim\relax
  \let\NRC@bottomtrim\relax
}
\DeclareOption{trimmarks}{%
  \AtEndOfClass{%
    \let\NRC@toptrim\NRC@dotoptrim
    \let\NRC@bottomtrim\NRC@dobottomtrim
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{environment}
% \end{environment}
%
% \begin{environment}{english}
% Languages: we recognise the possibility English and French words in
% the structural text of the paper.  First, the English variants
% (option \verb|english|, the default):
%    \begin{macrocode}
\DeclareOption{english}{%
%    \end{macrocode}
%
% \begin{macro}{\ifNRC@french}
% General flag for odds and ends
%    \begin{macrocode}
\let\ifNRC@french\iffalse
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@DeclareText}
% Establish the declaration of texts
%    \begin{macrocode}
\def\NRC@DeclareText#1#2#3{\def#1{#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@text@journal}
% Name of the journal for use in page headers and footers
% \emph{Note}: this value is no longer preset; in the days when there
% was \emph{only} a \texttt{cjp} class, the value was preset to `Can.\
% J.\ Phys.', but that setting is inappropriate in a class that can be
% used for several different journals.
% \end{macro}
%
% \begin{macro}{\refname}
% \begin{macro}{\tablename}
% These are \LaTeX\ original commands~--- the name for the references
% section of the paper, and the names to use in float captions; these
% have to be deferred to begin document, to avoid the ravages both of
% \textsf{article.cls} and (if the user loads it) of
% \textsf{babel.sty}:
%    \begin{macrocode}
  \AtBeginDocument{\renewcommand\refname{References}%
    \renewcommand\tablename{Table}}
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{environment}
%
% \begin{environment}{french}
% And now the same thing for French (option \verb|french|); note that
% since option |english| is executed by default, all the names defined
% by \cs{newcommand} in that option have to be redefined by
% \cs{renewcommand} here\dots
%    \begin{macrocode}
\DeclareOption{french}{%
%    \end{macrocode}
%
% \begin{macro}{\ifNRC@french}
% General flag for odds and ends
%    \begin{macrocode}
\let\ifNRC@french\iftrue
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@DeclareText}
% Establish the declaration of texts
%    \begin{macrocode}
\def\NRC@DeclareText#1#2#3{\def#1{#3}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\refname}
% \begin{macro}{\tablename}
%    \begin{macrocode}
  \AtBeginDocument{\renewcommand\refname{Bibliographie}%
    \renewcommand\tablename{Tableau}%
  }
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{environment}
%
% Execute the options that define our defaults:
%    \begin{macrocode}
%<editors>\ExecuteOptions{type1fonts,YandY}
%<*authors>
\IfFileExists{times.sty}%
  {\ExecuteOptions{type1rest,genTeX,author}}%
  {\ExecuteOptions{cmfonts,genTeX,author}}%
%</authors>
\ExecuteOptions{nobreakaddress,notrimmarks,english,%
  numbib,nofinalverso%
}
%<nrc2>\ExecuteOptions{onecolid,leqno}
%<nrc1>\ExecuteOptions{reqno}
%</nrc1cls|nrc2cls>
%    \end{macrocode}
%
% \begin{environment}{finalbalance}
% \begin{environment}{nofinalbalance}
% \begin{macro}{\ifNRC@finalbalance}
% For the \textsf{baltools} package, we provide just one option, and
% its negation: whether or not to balance columns at the end of the
% document.  The default is to balance.
%    \begin{macrocode}
%<*balance>
\newif\ifNRC@finalbalance
\DeclareOption{finalbalance}{\NRC@finalbalancetrue}
\DeclareOption{nofinalbalance}{\NRC@finalbalancefalse}
\DeclareOption*{\PackageError{baltools}%
  {Option \CurrentOption\space not recognised}}
\ExecuteOptions{finalbalance}
\ProcessOptions
\ifNRC@finalbalance
  \AtEndDocument{\if@twocolumn\BalanceColumns\fi}
\fi
%</balance>
%    \end{macrocode}
% \end{macro}
% \end{environment}
% \end{environment}
%
% Finally (back with the classes), dispose of any remaining options via
% \textsf{article.cls}, tell it to use |leqno| if necessary, and
% |fleqn|, and load it:
%    \begin{macrocode}
%<*nrc1cls|nrc2cls>
\DeclareOption*{\PassOptionsToClass\CurrentOption{article}}
\ProcessOptions
\iflefteqnos
  \PassOptionsToClass{leqno}{article}
\fi
\LoadClass[fleqn,twoside]{article}
%    \end{macrocode}
%
% \subsection{Tidying up after options}
%
% The \textsf{babel} package has the unfortunate habit of changing all
% the structural text elements when the language changes:
% `unfortunate' because we need to use text other than \textsf{babel}
% chooses\dots
%
% We therefore have to arrange that enthusiasm of some of
% \textsf{babel}'s commands is somewhat curtailed.  However, at the
% present stage we don't even know if \textsf{babel} is going to be
% loaded, so we dump stuff into the token stream at begin document to
% do the job for us.
%
% For English, the list is relatively straightforward:
%    \begin{macrocode}
\AtBeginDocument{\NRC@stripdef{english}\figurename}
%    \end{macrocode}
%
% For French, the situation is complicated by the existence of three
% different established language definition files: one distributed
% with current babel itself (\textsf{frenchb}), one distributed with
% the previous edition of babel (\textsf{francais}), and the one
% distributed with the GUTenberg French language support bundle
% (\textsf{french}).  At this stage, the only way of determining
% what's going to be loaded, if it does get loaded, is to look for the
% file it will be loaded from: so we have three paths through the code,
% distinguishing on the existence of the various \texttt{*.ldf} files.
%
% The GUTenberg \textsf{french} style does various unamendable things
% that clash with the NRC's requirements, so we warn of the
% possibility of slight confusion if it proves to be present.  (The
% NRC themselves do not use the GUTenberg style in production, but
% potential authors may.)
%    \begin{macrocode}
\IfFileExists{french.ldf}{%
  \def\NRC@french@lang{french}%
  \NRC@warning{GUTenberg Babel french style detected --
    \MessageBreak
    some corruption of NRC-defined format may occur\@gobble
  }%
}{%
  \IfFileExists{frenchb.ldf}{%
    \def\NRC@french@lang{frenchb}%
%    \end{macrocode}
%
% \textsf{frenchb.ldf} has these other odd ideas about how lists
% should be formatted.  
%    \begin{macrocode}
    \AtBeginDocument{%
      \@nameuse{bbl@nonfrenchlistspacing}%
    }%
  }{%
    \IfFileExists{francais.ldf}{%
      \def\NRC@french@lang{francais}%
    }{%
      \NRC@warning{No Babel french style detected --
        \MessageBreak
        French sections of paper will not be correctly formatted\@gobble}%
      \let\NRC@french@lang\@empty
    }%
  }%
}
\ifx\NRC@french@lang\@empty
\else
  \AtBeginDocument{%
    \expandafter\NRC@stripdef{\NRC@french@lang}\figurename
    \expandafter\NRC@stripdef{\NRC@french@lang}\tablename
    \expandafter\NRC@stripdef{\NRC@french@lang}\abstractname
    \expandafter\NRC@stripdef{\NRC@french@lang}\refname
%    \end{macrocode}
%
% We define our own list spacing and item label layouts, thank you
% very much; this ensures that \textsf{babel}'s |french| option
% doesn't interfere.
%    \begin{macrocode}
    \@ifpackageloaded{babel}{%
      \expandafter\addto\csname extras\NRC@french@lang\endcsname
        {\bbl@nonfrenchitemize}%
    }{}%
  }
\fi
%    \end{macrocode}
%
%
% \subsection{Auxiliary package requirements}
%
% Current thinking (at least) is that the \textsf{nrc2} class needs to
% load the \textsf{multicol} package, so (in default of a better place)
% we do that here.
%    \begin{macrocode}
%<nrc2>\RequirePackage[infoshow]{multicol}
%    \end{macrocode}
%
%
% \subsection{Declaring texts}
%
% A lot of `fixed' texts are used in the classes, and these are
% declared using a \cs{NRC@DeclareText} command, which is established
% during option processing to select the appropriate language for the
% substitution text.
%
% \begin{macro}{\NRC@DeclareText}
% Syntax: \cs{NRC@DeclareText}\marg{\cs{cmd}}\marg{english text}%
%                                            \marg{french text}
%
% Declares `\cs{cmd}' to have English or French substitution text.
% This section of the classes makes use of the command.
% \end{macro}
%
% \begin{macro}{\NRC@text@and}
% Err, a conjunction
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@and}{and}{et}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@text@NRC}
% The name for the National Research Council Canada, for use in page
% footers
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@NRC}{Published by NRC Research Press}%
                               {Publi\'e par NRC Research Press}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@text@vol}
% The name for `volume', for use in page footers
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@vol}{Vol.}{Vol.}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@text@correspondAll}
% The name for the author for correspondence, when no other
% information is given
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@correspondAll}{Author to whom all
    correspondence should be addressed.}{Auteur correspondant.}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@text@correspond}
% The text for the author for correspondence, when extra address, or
% whatever, is given
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@correspond}%
                  {Corresponding author (e-mail: \@tempa).}%
                  {Auteur correspondant (courriel~\string: \@tempa).}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@text@present}
% The text for the author's present address
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@present}{Present Address:}%
                                   {Adresse actuelle~\string:}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@text@telephone}
% \begin{macro}{\NRC@text@fax}
% \begin{macro}{\NRC@text@telefax}
% \begin{macro}{\NRC@text@email}
% Texts for telephone, fax, `telefax' and email
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@telephone}{Telephone:}%
                  {T\'el\'ephone\protect~\string:}
\NRC@DeclareText{\NRC@text@fax}{FAX:}%
                  {t\'el\'ecopie\protect~\string:}
\NRC@DeclareText{\NRC@text@telefax}{Telephone/FAX:}%
                  {T\'el\'ephone/t\'el\'ecopie\protect~\string:}
\NRC@DeclareText{\NRC@text@email}{e-mail:}%
                  {courriel\protect~\string:}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@text@received}
% \begin{macro}{\NRC@text@accepted}
% \begin{macro}{\NRC@text@revreceived}
% \begin{macro}{\NRC@text@revaccepted}
% Texts for `received' and `accepted'
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@received}{Received}%
                                    {Re\c{c}u le}
\NRC@DeclareText{\NRC@text@accepted}{Accepted}%
                                    {Accept\'e le}
\NRC@DeclareText{\NRC@text@revreceived}{Revision received}%
                                       {R\'{e}vision re\c{c}u le}
\NRC@DeclareText{\NRC@text@revaccepted}{Revision accepted}%
                                       {R\'{e}vision accepte\'{e} le}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@text@webpub}
% \begin{macro}{\NRC@text@assoced}
% \begin{macro}{\NRC@text@corred}
% \begin{macro}{\NRC@text@commdate}
% The web publication notice
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@webpub}%
                {Published on the NRC Research Press Web site at
                 \@tempa{} on \@tempb}%
                {Publi\'{e} sur le site Web des Presses
                 scientifiques du CNRC, \`a \@tempa, le \@tempb}
\NRC@DeclareText{\NRC@text@assoced}%
                {Paper handled by Associate Editor:}%
                {Production de l'article coordonn\'{e}e par
                 le directeur scientifique associ\'{e}~\string:}
\NRC@DeclareText{\NRC@text@corred}%
                {Corresponding Editor:}%
                {Directeur scientifique correspondant~\string:}
\NRC@DeclareText{\NRC@text@commdate}%
                {Written discussion of this article is welcomed and
                 will be received by the Editor until}%
                {Les commentaires sur le contenu de cet article
                 doivent \^{e}tre envoy\'{e}s au directeur
                 scientifique de la revue avant le}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@text@abbreviations}
% Text for `abbreviations'
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@abbreviations}{Abbreviations}%
                                         {Abbr\'eviations}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@text@proof}
% \begin{macro}{\NRC@text@pagination}
% These two appear with both languages in their representation for
% each language mode; doing them in this way makes it possible,
% however, for us to change them to single-language forms with little
% difficulty.
%    \begin{macrocode}
\NRC@DeclareText{\NRC@text@proof}{Proof/\'Epreuve}%
                                 {Proof/\'Epreuve}
\NRC@DeclareText{\NRC@text@pagination}{Pagination not final/%
                                       Pagination non finale}%
                                      {Pagination not final/%
                                       Pagination non finale}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@text@citation}
% Citation information: used in the title page footer (in new title
% page layout).
%    \begin{macrocode}
%<*newtplayout>
\NRC@DeclareText{\NRC@text@citation}%
                  {Citation information:}%
                  {Citation information\protect~\string:}%
%</newtplayout>
%    \end{macrocode}
% \end{macro}
%
%
% \section{Font usage}
%
% The switch \texttt{@usecmfonts} tells us which fonts are to be used.
% If we're going to use {\small CM} fonts (\cs{@usecmfontstrue}), we
% need to define various things that enable us to use them at sizes
% and in weights required for the use of Helvetica.  If we're using
% Times and Helvetica, we merely have to change the default families
% to use (we assume that the |.fd| files carry all the weights we have
% available, or at least those we need to use).
%    \begin{macrocode}
\if@usecmfonts
  \DeclareFontShape{OT1}{cmss}{m}{n}
      {
        <5><6><7><8>cmss8
        <9>cmss9
        <10><10.95>cmss10
        <12><14.4><16>cmss12
        <17.28><18><20.74><24.88>cmss17
       }{}
  \DeclareFontShape{OT1}{cmss}{l}{n}
         {<->ssub*cmss/m/n}{}
  \DeclareFontShape{OT1}{cmss}{m}{sl}
      {
        <5><6><7><8>cmssi8 <9> cmssi9
        <10><10.95>cmssi10
        <12><14.4><16>cmssi12
        <17.28><18><20.74><24.88>cmssi17
        }{}
  \DeclareFontShape{OT1}{cmss}{m}{it}
         {<->ssub*cmss/m/sl}{}
  \DeclareFontShape{OT1}{cmss}{l}{sl}
         {<->ssub*cmss/m/sl}{}
  \DeclareFontShape{OT1}{cmss}{l}{it}
         {<->ssub*cmss/m/sl}{}
  \DeclareFontShape{OT1}{cmss}{bx}{n}
       {
         <5> <6> <7> <8> <9> cmssbx10
         <10> <10.95> <12> <14.4> <16> <17.28> <18> <20.74> <24.88> cmssbx10
        }{}
  \DeclareFontShape{OT1}{cmss}{c}{n}
         {<->ssub*cmss/bx/n}{}
  \DeclareFontShape{OT1}{cmss}{bx}{sl}
         {<->sub*cmss/m/sl}{}
  \DeclareFontShape{OT1}{cmss}{bx}{it}
         {<->sub*cmss/m/sl}{}
  \DeclareFontShape{OT1}{cmss}{c}{sl}
         {<->sub*cmss/m/sl}{}
  \DeclareFontShape{OT1}{cmss}{c}{it}
         {<->sub*cmss/m/sl}{}
\else
  \renewcommand\rmdefault{ptm}
  \renewcommand\sfdefault{phv}
  \if@yandy
    \RequirePackage[LY1]{fontenc}
    \RequirePackage[LY1,mtbold]{mathtime}
%    \end{macrocode}
%
% we add the following here, for convenience:
%    \begin{macrocode}
    \PassOptionsToPackage{dvipsone}{graphics}
    \PassOptionsToPackage{dvipsone}{color}
  \fi
%    \end{macrocode}
%
% If we're using a restricted Type 1 set, establish substitutions that
% can be used by those who haven't released any arms or legs for
% Adobe's use\dots
%    \begin{macrocode}
  \if@restrictedtypeone
    \AtBeginDocument{{\sf
      \DeclareFontShape{OT1}{phv}{c}{n}%
         {<->ssub*phv/b/n}{}%
      \DeclareFontShape{OT1}{phv}{c}{sl}%
         {<->ssub*phv/b/sl}{}%
      \DeclareFontShape{OT1}{phv}{c}{it}%
         {<->ssub*phv/b/sl}{}%
      \DeclareFontShape{OT1}{phv}{l}{n}%
         {<->ssub*phv/m/n}{}%
      \DeclareFontShape{OT1}{phv}{l}{sl}%
         {<->ssub*phv/m/sl}{}%
      \DeclareFontShape{OT1}{phv}{l}{it}%
         {<->ssub*phv/m/sl}{}%
    }}%
%    \end{macrocode}
%
% If we're using restricted Type1, we assume we're in a puckah PSNFSS
% system, and play safe with \cs{textcopyright}
%    \begin{macrocode}
    \providecommand\textcopyright{\textcircled{c}}
  \else
%    \end{macrocode}
%
% We'll assume that full Type1 is using the PC\TeX{} font encodings,
% and  proceed to declare symbols on that basis.  Sadly, there are no
% standard \LaTeX-style font encoding command sets for this
% encoding\dots
%    \begin{macrocode}
    \DeclareTextSymbol{\textcopyright}{OT1}{169}
    \DeclareTextSymbolDefault{\textcopyright}{OT1}
    \DeclareTextSymbol{\textguillemetleft}{OT1}{171}
    \DeclareTextSymbolDefault{\textguillemetleft}{OT1}
    \DeclareTextSymbol{\textguillemetright}{OT1}{187}
    \DeclareTextSymbolDefault{\textguillemetright}{OT1}
  \fi
\fi
\providecommand\textcopyright{\textcircled{c}}
%    \end{macrocode}
%
% \section{General information}
%
% \begin{macro}{\volyear}
% \begin{macro}{\NRC@volume}
% \begin{macro}{\NRC@year}
% \begin{macro}{\NRC@copyrightyear}
% \begin{macro}{\NRC@years}
% Syntax: \cs{volyear}\marg{volume}\oarg{copyright year}\marg{year}
%
% This volume's number (presumably derivable from the year\dots), 
% the year of publication and (optionally) the copyright year (which
% may validly differ from the year of publication, but defaults to
% that year if the optional argument isn't given).
%    \begin{macrocode}
\newcommand*\NRC@volume{99}
\newcommand*\NRC@year{}
\edef\NRC@year{\the\year}
\newcommand*\NRC@copyrightyear{}
\let\NRC@copyrightyear\NRC@year
\newcommand\volyear[1]{%
  \renewcommand*\NRC@volume{#1}%
  \@dblarg\NRC@years
}
\newcommand\NRC@years[2][]{%
  \renewcommand*\NRC@copyrightyear{#1}
  \renewcommand*\NRC@year{#2}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\journal}
% \begin{macro}{\NRC@text@journal}
% \begin{macro}{\ifNRC@journalcommand}
% \begin{macro}{\ifNRC@knownjournal}
% Syntax: \cs{journal}\marg{journal-name}
%
% Sets up the journal name for use in running feet, etc.  If we've
% already had a \cs{journalcode} command that gave us a known journal code, we
% now check for consistency between our journal name and the 
% journal code.  This command (and \cs{journalcode}) sets up
% \cs{ifNRC@journalcommand} to say at least one of them has been
% processed, and \cs{ifNRC@knownjournal} to say that the argument was
% acceptable.
%    \begin{macrocode}
\newif\ifNRC@journalcommand  \NRC@journalcommandfalse
\newif\ifNRC@knownjournal
\newcommand*{\journal}[1]{%
  \NRC@journalcommandtrue
  \renewcommand*\NRC@text@journal{#1}%
  \@ifundefined{NRC@jlist@text@journal}%
    {%
      \NRC@knownjournalfalse
      \expandafter\NRC@checkonejournal\NRC@journallist
      \ifNRC@knownjournal
        \edef\NRC@journal@linenumber{\the\inputlineno}%
      \else
        \NRC@warning{Journal "\NRC@text@journal" not recognised}%
      \fi
    }%
    {%
      \ifx\NRC@text@journal\NRC@jlist@text@journal
      \else
        \NRC@warning{Journal name inconsistent between\MessageBreak
            \string\journalcode\space command on line
            \NRC@journalcode@linenumber\space and\MessageBreak
            \string\journal\space command}%
      \fi
    }%
}
\newcommand*{\NRC@text@journal}{}
\@onlypreamble\journal
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\filenumber}
% \begin{macro}{\NRC@a@filenumber}
% \begin{macro}{\NRC@filenumber}
% \begin{macro}{\ifNRC@pagewithfile}
% \begin{macro}{\ifNRC@hadfilenumber}
% \begin{macro}{\NRC@tpfooter@centre}
% Syntax: \cs{NRCfilenumber}\texttt{[*]}\marg{file number string}
%
% Sets the file number to be used in the title page footer and
% (optionally) in printed page numbers.  Authors aren't expected to
% know this, so we provide a default; diagnostic code to spot that
% editors haven't provided the command is not yet available.
%
% If the optional \texttt{*} is present, page numbers in the paper
% will be prefixed by the file number.
%    \begin{macrocode}
\newif\ifNRC@pagewithfile
\newif\ifNRC@hadfilenumber
\newcommand*{\filenumber}{\@ifstar
  {\NRC@pagewithfiletrue\NRC@a@filenumber}%
  {\NRC@pagewithfilefalse\NRC@a@filenumber}%
}
\newcommand*{\NRC@a@filenumber}[1]{%
  \NRC@hadfilenumbertrue
  \renewcommand*{\NRC@filenumber}{#1}%
}
\newcommand*{\NRC@filenumber}{\emph{Zxx-xxx}}
%    \end{macrocode}
%
% in case we're not doing a \texttt{proof} or \texttt{pagnf} paper,
% define the centre item of the title page footer; the only
% significant information in it is the file number\dots
%    \begin{macrocode}
%<*!newtplayout>
\ifcase\NRC@footer@defd
  \renewcommand*{\NRC@tpfooter@centre}{%
    \fontsize\@viiipt\@xpt
    \usefont\f@encoding\rmdefault mn%
    DOI:\ 10.1139/\NRC@filenumber
  }%
\fi
%</!newtplayout>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\journalcode}
% \begin{macro}{\jcode}
% \begin{macro}{\NRC@journalcode}
% Syntax: \cs{journalcode}\marg{journal code}, or
% \par\noindent\phantom{Syntax: }\cs{jcode}\marg{journal code}
%
% Defines the code of the journal this paper is aimed at.
%    \begin{macrocode}
\newcommand*{\journalcode}[1]{%
  \NRC@journalcommandtrue
  \renewcommand*{\NRC@journalcode}{#1}%
  \NRC@knownjournalfalse
  \expandafter\NRC@checkonejournalcode\NRC@journallist
  \ifNRC@knownjournal
    \ifx\NRC@text@journal\@empty
      \let\NRC@text@journal\NRC@jlist@text@journal
      \edef\NRC@journalcode@linenumber{\the\inputlineno}%
    \else
      \ifx\NRC@text@journal\NRC@jlist@text@journal
      \else
        \NRC@warning{Journal name inconsistent between\MessageBreak
          \string\journal\space command on line
          \NRC@journal@linenumber\space and \MessageBreak
          \string\journalcode\space command%
        }%
      \fi
    \fi
  \else
    \NRC@warning{Journal code \NRC@journalcode\space not recognised}%
  \fi
}
\newcommand{\jcode}{}
\let\jcode\journalcode
\newcommand*{\NRC@journalcode}{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\issuenumber}
% \begin{macro}{\NRC@issuenumber}
% \begin{macro}{\NRC@issuenumber@parens}
% Syntax: \cs{issuenumber}\marg{issue number}
%
% The issue number is used in new-style citation information
%    \begin{macrocode}
%<*newtplayout>
\newcommand*{\issuenumber}[1]{%
  \renewcommand{\issuenumber}{#1}%
}
\newcommand*{\NRC@issuenumber}{}
\newcommand{\NRC@issuenumber@parens}{%
  \ifx\NRC@issuenumber\@empty
  \else
    (\NRC@issuenumber)%
  \fi
}
%</newtplayout>
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\NRC@journallist}
% A list of journal names, their journal codes and web site addresses.
% Each journal appears as a triple:
% \begin{center}
%   \marg{journal code}\marg{English site address}%
%\marg{French site address}\marg{Journal abbrev.}
% \end{center}
% The ``addresses'' here are the first component of the journal's web
% site, to be quoted (by default) in \cs{webpub}
%    \begin{macrocode}
\newcommand{\NRC@journallist}{%
  {bcb}{bcb}{bbc}{Biochem. Cell Biol.}%
  {cgj}{cgj}{rcg}{Can. Geotech. J.}%
  {cjb}{canjbot}{revcanbot}{Can. J. Bot.}%
  {cjc}{canjchem}{revcanchim}{Can. J. Chem.}%
  {cjce}{cjce}{rcgc}{Can. J. Civ. Eng.}%
  {cjes}{cjes}{rcst}{Can. J. Earth Sci.}%
  {cjfas}{cjfas}{jcsha}{Can. J. Fish. Aquat. Sci.}%
  {cjfr}{cjfr}{rcrf}{Can. J. For. Res.}%
  {cjm}{cjm}{rcm}{Can. J. Microbiol.}%
  {cjp}{cjp}{rcp}{Can. J. Phys.}%
  {cjpp}{cjpp}{rcpp}{Can. J. Physiol. Pharmacol.}%
  {cjz}{cjz}{rcz}{Can. J. Zool.}%
  {er}{er}{de}{Environ. Rev.}%
  {gen}{genome}{genome}{Genome}%
  {jees}{jees}{rgse}{J. Environ. Eng. Sci.}%
  {}{}{}{}%
}
\@onlypreamble\NRC@journallist
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\NRC@checkonejournal}
% \begin{macro}{\NRC@checkonejournalcode}
% \begin{macro}{\NRC@jlist@text@journal}
% \begin{macro}{\NRC@def@webaddress}
% Syntax: \cs{NRC@checkonejournal}\marg{journal short code}%
%\marg{english web addr}\par\noindent
%\phantom{Syntax: \cs{NRC@checkonejournal}}\marg{french web addr}%
%\marg{running foot abbrev.}\par\noindent
%\phantom{Syntax: }\cs{NRC@checkonejournalcode} identical
%
% The \cs{check*} commands are actually called with a sequence of
% short codes, web addresses and abbreviations, and munches through
% the lot.  This isn't as efficient as it might be, but it's no big
% deal when the job only happens at most three times\dots
%    \begin{macrocode}
\newcommand{\NRC@checkonejournal}[4]{%
  \def\reserved@a{#4}%
  \ifx\reserved@a\@empty
  \else
    \ifx\reserved@a\NRC@text@journal
      \NRC@knownjournaltrue
      \def\NRC@jlist@journalcode{#1}%
      \def\NRC@def@webaddress{%
        http://\ifNRC@french#3.cnrc\else#2.nrc\fi.ca/%
      }%
    \fi
    \expandafter\NRC@checkonejournal
  \fi
}
\newcommand{\NRC@checkonejournalcode}[4]{%
  \def\reserved@a{#1}%
  \ifx\reserved@a\@empty
  \else
    \ifx\reserved@a\NRC@journalcode
      \NRC@knownjournaltrue
      \def\NRC@jlist@text@journal{#4}%
      \def\NRC@def@webaddress{%
        http://\ifNRC@french#3.cnrc\else#2.nrc\fi.ca/%
      }%
    \fi
    \expandafter\NRC@checkonejournalcode
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@setupdefaults}
% Now diagnose the absence of either sort of journal command, and
% provide default values; also diagnose missing \cs{filenumber}
% command here, for good measure
%    \begin{macrocode}
\AtBeginDocument{\NRC@setupdefaults}
\newcommand*{\NRC@setupdefaults}{%
  \providecommand\NRC@def@webaddress{%
    http://www.\ifNRC@french cnrc\else nrc\fi.ca/%
  }%
  \ifNRC@journalcommand
  \else
    \NRC@warning{No \string\journal\space or \string\journalcode\space
      command given\@gobble
    }%
  \fi
  \ifx\NRC@text@journal\@empty
    \def\NRC@text@journal{\texttt{\emph{unknown}}}%
  \fi
%<*!newtplayout>
  \ifx\NRC@journalcode\@empty
    \def\NRC@journalcode{???}%
  \fi
%</!newtplayout>
  \ifNRC@hadfilenumber
  \else
    \ifNRC@author@use
    \else
      \NRC@warning{No \string\filenumber\space command given\@gobble}%
    \fi
  \fi
}
\@onlypreamble{\journalcode}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@tpfooter@centre}
% \begin{macro}{\NRC@tpfooter@left}
% \emph{\textbf{Note:}} This code is for the proposed title page
% layout: it is not used in current papers.
%
% Define the footer texts for use on the title page, in terms of
% the things that have been defined in the commands above.
%    \begin{macrocode}
%<*newtplayout>
\newcommand*{\NRC@tpfooter@centre}{%
  \fontsize\@viiipt\@xpt
  \usefont\f@encoding\rmdefault mn%
    DOI:\ 10.1139/\NRC@filenumber.%
}%
\newcommand*{\NRC@tpfooter@left}{%
  \fontsize\@viiipt\@xpt
  \usefont\f@encoding\rmdefault mn%
  \NRC@text@citation\ \NRC@text@journal\ %
  \textbf{\NRC@volume}\NRC@issuenumber@parens:\ %
  (\NRC@year).%
}
%</newtplayout>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \section{Page layout, etc.}
% \subsection{Page dimensions}
%
% \begin{macro}{\hoffset}
% \begin{macro}{\voffset}
% We cancel the curious enforced one-inch-margins\dots
%    \begin{macrocode}
\hoffset -1in
\voffset -1in
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@columnwidth}
% Horizontal layout: we treat this fairly `trivially',
%    \begin{macrocode}
%<nrc1> \textwidth 34pc
%<*nrc2>
\newdimen\NRC@columnwidth
\paperwidth        51pc
\textwidth         43pc
\NRC@columnwidth   20.75pc
\columnsep         1.5pc
\columnseprule     \z@
%</nrc2>
\hsize             \textwidth
\@tempdima         \paperwidth
\advance           \@tempdima   -\textwidth
\evensidemargin    0.5\@tempdima
\oddsidemargin     0.5\@tempdima
%    \end{macrocode}
% \end{macro}
%
% Height of text on page is unambiguously defined in NRC1 class:
%    \begin{macrocode}
%<nrc1> \textheight 49.5pc
%    \end{macrocode}
%
% but is a bit of an ephemeral concept in NRC2 class, since it's
% supposed to be variable within a quoted range.  The specification
% says 56pc \ensuremath{\pm} 0.5pc; but \TeX{} doesn't have a concept
% of a limited stretch so we make the basic height 55.5pc, and then
% add a 1pc skip that can shrink to zero at the bottom of the page.
%    \begin{macrocode}
%<*nrc2>
\textheight 55.5pc
\def\@textbottom{\vskip 1pc \@minus 1pc}
%</nrc2>
%    \end{macrocode}
%
% The head height and separation, and foot skip are set `wrongly' for
% us in \textsf{size10.clo}:
% \begin{macro}{\headheight}
% \begin{macro}{\headsep}
% \begin{macro}{\footskip}
%    \begin{macrocode}
\setlength\headheight{10\p@}
%<nrc1>\setlength\headsep {14\p@}
%<nrc2>\setlength\headsep {17\p@}
\setlength\footskip  {20\p@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% We don't change \cs{topskip} and \cs{maxdepth} (which \LaTeX{}
% inscrutably relates to one another\dots)
%
% Now, generate \cs{topmargin}
%    \begin{macrocode}
\setlength\topmargin{\paperheight}
\addtolength\topmargin{-\headheight}
\addtolength\topmargin{-\headsep}
\addtolength\topmargin{-\textheight}
\addtolength\topmargin{-\footskip}
\addtolength\topmargin{-.5\topmargin}
%    \end{macrocode}
%
% However, that's not quite good enough for letter paper (where we
% seem only to have about \ensuremath{\frac{1}{12}''} to spare when the
% trim marks are there)\dots
%
% Therefore, we boil some sugar, cream and butter to create this nice
% little fudge:
%    \begin{macrocode}
\addtolength\topmargin{7.5pt}
%    \end{macrocode}
%
% \begin{macro}{\textfloatsep}
% \begin{macro}{\dbltextfloatsep}
% Float separations are quoted relative to the baseline.  We achieve
% this using a notional value for \cs{baselineskip}: this is fairly
% safe, given the NRC's style of setting tables, which more-or-less
% guarantees that floats have zero depth.  There \emph{is} the slight
% problem of the section head (with attendant larger skip) immediately
% below a float, but there's nothing we can do about that.
%    \begin{macrocode}
\setlength{\textfloatsep}
%<nrc1>{3pc}
%<nrc2>{20\p@}
\addtolength{\textfloatsep}{-10\p@}
%<nrc2>\setlength{\dbltextfloatsep}{\textfloatsep}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@restore@dbltextfloatsep}
% Syntax: \cs{NRC@restore@dbltextfloatsep}
%
% For use in pagestyle commands to restore the text float separation
% (currently, just for the first page, where it has been zapped by
% two-column version of \cs{maketitle}
%    \begin{macrocode}
%<*nrc2>
\edef\NRC@restore@dbltextfloatsep{%
  \global\noexpand\dbltextfloatsep \the\dbltextfloatsep}
%</nrc2>
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Page Styles}
%
% \begin{macro}{\ps@nrctitlepage}
% Syntax: \cs{thispagestyle}|{nrctitlepage}|
%
% Establishes the page layout for the title page of a paper.  The
% definition is not needed for \verb'nrc1' preprints, but (because the
% page style is used when creating one-column IDboxes) it is defined
% for \verb'nrc2' preprints, in a form that doesn't differ much from
% the body style \cs{ps@nrc}
%    \begin{macrocode}
\ifNRC@preprint
  \newcommand\ps@nrctitlepage{%
    \let\@evenhead\@empty
    \let\@oddhead\@empty
    \def\@evenfoot{%
      {%
%    \end{macrocode}
%
% pull the one-column IDbox into the text area if necessary
%    \begin{macrocode}
%<*nrc2>
        \if@onecolid\else
          \NRC@restorefootskip
          \raise\footskip\hb@xt@\z@{%
            \vbox to\z@{\vss\box\NRC@theIDbox}%
            \hss
          }%
        \fi
%</nrc2>
%<newtplayout> \rlap{\NRC@tpfooter@left}%
        \hfill\NRC@xlap{\NRC@tpfooter@centre}%
        \hfill\llap{%
          \fontsize\@viiipt\@xpt
          \usefont\f@encoding\rmdefault mn%
          \NRC@text@NRC%
        }%
      }%
    }%
    \let\@oddfoot\@evenfoot
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    \let\appendixmark\@gobble
  }
\else
  \newcommand\ps@nrctitlepage{%
    \renewcommand\@oddhead{%
      {%
        \NRC@toptrim
        \hfill
        {%
%<*newtplayout>
          \hfill
          \NRC@xlap{\NRC@tpheader@centre}%
          \hfill\llap{%
%</newtplayout>
            \fontsize\@ixpt\@xiipt
            \usefont\f@encoding\sfdefault ln%
            \ifNRC@pagewithfile\NRC@filenumber-\fi\thepage
%<newtplayout> }%
        }%
%<nrc2> \NRC@restore@dbltextfloatsep
      }%
    }%
    \renewcommand\@evenhead{%
      {%
        \NRC@toptrim
        {%
%<newtplayout> \rlap{%
            \fontsize\@ixpt\@xiipt
            \usefont\f@encoding\sfdefault ln%
            \ifNRC@pagewithfile\NRC@filenumber-\fi\thepage
%<*newtplayout>
          }%
          \hfill
          \NRC@xlap{\NRC@tpheader@centre}%
          \hfill
%</newtplayout>
        }%
%<nrc2> \NRC@restore@dbltextfloatsep
      }%
    }%
    \renewcommand\@oddfoot{%
      {%
        \NRC@bottomtrim
%<*nrc2>
%    \end{macrocode}
%
% If we have a column-spanning ID box, we insert it here, raised into
% the position it would (ought to) be if it had appeared as a bottom
% float\dots
%    \begin{macrocode}
        \if@onecolid\else
          \NRC@restorefootskip
          \raise\footskip\hb@xt@\z@{%
            \vbox to\z@{\vss\box\NRC@theIDbox}%
            \hss
          }%
        \fi
%</nrc2>
%<newtplayout> \rlap{\NRC@tpfooter@left}%
%<*!newtplayout>
        \rlap{%
          \fontsize\@viiipt\@xpt
          \usefont\f@encoding\rmdefault mn%
          \NRC@text@journal\ \textbf{\NRC@volume}%
          \ifNRC@french\ \fi:
          \ifNRC@pagewithfile\NRC@filenumber-\fi
          \pageref{\jobname.start.page}--%
          \ifNRC@pagewithfile\NRC@filenumber-\fi
          \pageref{\jobname.end.page}
          (\NRC@year)%
        }%
%</!newtplayout>
        \hfill\NRC@xlap{\NRC@tpfooter@centre}%
        \hfill\llap{%
          \fontsize\@viiipt\@xpt
          \usefont\f@encoding\rmdefault mn%
          \NRC@text@NRC%
        }%
      }%
    }%
    \let\@evenfoot\@oddfoot
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    \let\appendixmark\@gobble
  }
\fi
%    \end{macrocode}
% \end{macro}
%
% The above uses two labels, one each for the start and the end of the
% paper.  We need to arrange that they get defined (note that the
% start page has to be defined \cs{AtBeginDocument} because typically
% the start page isn't even set until then, and in any case its number
% has to be written to the \verb'.aux' output which isn't open until
% just before \cs{AtBeginDocument}).
%
%    \begin{macrocode}
\AtBeginDocument{\immediate\write\@auxout{\string\newlabel
    {\jobname.start.page}{{}{\thepage}}}}
\AtEndDocument{\clearpage
  \@tempcnta\c@page
  \advance\@tempcnta-1
  \immediate\write\@auxout{\string\newlabel{\jobname.end.page}%
    {{}{\number\@tempcnta}}}%
  \if@finalverso\thispagestyle{nrcempty}\cleardoublepage\fi
}
%    \end{macrocode}
%
% [The code for the last page is derived from \texttt{lastpage.sty} by
% Jeff Goldberg, which is available on CTAN.]
%
% \begin{macro}{\ps@nrc}
% Syntax: \cs{pagestyle}|{nrc}|
%
% Establishes the page layout for the body of a paper (or, in the case
% of a preprint, for all of a paper, since a preprint has no
% distinctions\dots)
%    \begin{macrocode}
\ifNRC@preprint
  \newcommand\ps@nrc{%
    \def\@evenhead{%
      {%
        \fontsize\@ixpt\@xiipt
        \usefont\f@encoding\sfdefault ln%
        \hfill
        \NRC@text@journal
      }%
    }%
    \def\@oddhead{%
      {%
        \fontsize\@ixpt\@xiipt
        \usefont\f@encoding\sfdefault ln%
        \@shortauthor\hfill
      }%
    }%
    \def\@evenfoot{%
      {%
        \hfill\NRC@xlap{\NRC@footer@centre}%
        \hfill\llap{%
          \fontsize\@viiipt\@xpt
          \usefont\f@encoding\rmdefault mn%
          \NRC@text@NRC%
        }%
      }%
    }%
    \let\@oddfoot\@evenfoot
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    \let\appendixmark\@gobble
  }
\else
  \newcommand\ps@nrc{%
    \def\@evenhead{%
      {%
        \NRC@toptrim
        \fontsize\@ixpt\@xiipt
        \usefont\f@encoding\sfdefault ln%
        \ifNRC@pagewithfile\NRC@filenumber-\fi\thepage\hfill
        \NRC@text@journal\ \NRC@text@vol\ \NRC@volume, \NRC@year
      }%
    }%
    \def\@oddhead{%
      {%
        \NRC@toptrim
        \fontsize\@ixpt\@xiipt
        \usefont\f@encoding\sfdefault ln%
        \@shortauthor\hfill
        \ifNRC@pagewithfile\NRC@filenumber-\fi\thepage
      }%
    }%
    \def\@evenfoot{%
      {%
        \NRC@bottomtrim
        \hfill\NRC@xlap{\NRC@footer@centre}%
        \hfill\llap{%
          \fontsize\@viiipt\@xpt
          \usefont\f@encoding\rmdefault mn%
          \NRC@text@NRC%
        }%
      }%
    }%
    \let\@oddfoot\@evenfoot
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    \let\appendixmark\@gobble
  }
\fi
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ps@nrcplain}
% Syntax: \cs{pagestyle}|{nrcplain}|
%
% The page style for special title (only) pages (i.e., those
% containing a \cs{specialtitle*} command).
%    \begin{macrocode}
\ifNRC@preprint
  \newcommand\ps@nrcplain{%
    \let\@evenhead\@empty
    \let\@oddhead\@evenhead
    \def\@evenfoot{%
      {%
        \hfill
        \fontsize\@ixpt\@xiipt
        \usefont\f@encoding\rmdefault mn%
        \ifNRC@pagewithfile\NRC@filenumber-\fi\thepage
        \hfill
      }%
    }%
    \let\@oddfoot\@evenfoot
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    \let\appendixmark\@gobble
  }
\else
  \newcommand\ps@nrcplain{%
    \def\@evenhead{%
      \NRC@toptrim
      \hfill
    }%
    \let\@oddhead\@evenhead
    \def\@evenfoot{%
      {%
        \NRC@bottomtrim
        \hfill
        \fontsize\@ixpt\@xiipt
        \usefont\f@encoding\rmdefault mn%
        \ifNRC@pagewithfile\NRC@filenumber-\fi\thepage
        \hfill
      }%
    }%
    \let\@oddfoot\@evenfoot
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    \let\appendixmark\@gobble
  }
\fi
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\ps@nrcempty}
% Syntax: \cs{pagestyle}|{nrcempty}|
%
% The page style for blank final (uncounted) verso pages
%    \begin{macrocode}
\ifNRC@preprint
  \let\ps@nrcempty\ps@empty
\else
  \newcommand\ps@nrcempty{%
    \def\@evenhead{%
      \NRC@toptrim
      \hfill
    }%
    \let\@oddhead\@evenhead
    \def\@evenfoot{%
      \NRC@bottomtrim
      \hfill
    }%
    \let\@oddfoot\@evenfoot
    \let\@mkboth\@gobbletwo
    \let\sectionmark\@gobble
    \let\subsectionmark\@gobble
    \let\appendixmark\@gobble
  }
\fi
%    \end{macrocode}
% \end{macro}
% 
% 
%
% The default page style is that for the body of journal\dots
%    \begin{macrocode}
\pagestyle{nrc}
%    \end{macrocode}
%
% \subsection{Trim marks}
%
% \begin{macro}{\NRC@dotoptrim}
% \begin{macro}{\NRC@dobottomtrim}
%
% These commands generate the trim marks, and are for use
% (respectively) in the headers and footers of pages
%    \begin{macrocode}
\newcommand\NRC@dotoptrim{%
  \hb@xt@\z@{%
    \vbox to\z@{%
      \vss
      \hb@xt@\textwidth{%
        \llap{%
          \NRC@left@trimrule
          \NRC@up@trimrule
          \hskip\NRC@trimhsep
        }%
        \hss
        \rlap{%
          \hskip\NRC@trimhsep
          \NRC@up@trimrule
          \NRC@right@trimrule
        }%
      }%
      \vskip\NRC@trimtopsep
    }%
    \hss
  }%
}
\newcommand\NRC@dobottomtrim{%
  \hb@xt@\z@{%
    \vbox to\z@{%
      \vskip\NRC@trimbotsep
      \hb@xt@\textwidth{%
        \llap{%
          \NRC@left@trimrule
          \NRC@down@trimrule
          \hskip\NRC@trimhsep
        }%
        \hss
        \rlap{%
          \hskip\NRC@trimhsep
          \NRC@down@trimrule
          \NRC@right@trimrule
        }%
      }%
      \vss
    }%
    \hss
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@trimhsep}
% \begin{macro}{\NRC@trimtopsep}
% \begin{macro}{\NRC@trimbotsep}
%
% These macros define separations of the trim marks from the body of
% the text of the page.  Note that \cs{NRC@trimhsep} is as specified,
% but \cs{NRC@trimtopsep} and \cs{NRC@trimbotsep} are specified in
% terms of distances from the text body, and so have \cs{headsep} and
% \cs{footskip} (respectively) subtracted from them.
%    \begin{macrocode}
\newcommand\NRC@trimhsep{4pc}
\newcommand\NRC@trimtopsep{54pt}
\newcommand\NRC@trimbotsep{30pt}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@up@trimrule}
% \begin{macro}{\NRC@down@trimrule}
% \begin{macro}{\NRC@left@trimrule}
% \begin{macro}{\NRC@right@trimrule}
%
% These macros construct the constituent bits of the trim marks
%    \begin{macrocode}
\newcommand\NRC@up@trimrule{%
  \vrule\@height\NRC@trimvsize
        \@depth\NRC@trimvgap
        \@width\NRC@trimthickness
}
\newcommand\NRC@down@trimrule{%
  \vrule\@height\NRC@trimvgap
        \@depth\NRC@trimvsize
        \@width\NRC@trimthickness
}
\newcommand\NRC@left@trimrule{%
  \vrule\@height\NRC@trimhalfthick
        \@depth\NRC@trimhalfthick
        \@width\NRC@trimhsize
  \hskip\NRC@trimhgap        
}
\newcommand\NRC@right@trimrule{%
  \hskip\NRC@trimhgap        
  \vrule\@height\NRC@trimhalfthick
        \@depth\NRC@trimhalfthick
        \@width\NRC@trimhsize
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@trimhsize}
% \begin{macro}{\NRC@trimvsize}
% \begin{macro}{\NRC@trimhalfthick}
% \begin{macro}{\NRC@trimthickness}
% \begin{macro}{\NRC@trimhgap}
% \begin{macro}{\NRC@trimvgap}
%
% These macros specify the dimensions of trim marks; requirements are:
% \begin{itemize}
% \item \cs{NRC@trimhalfthick} should be half \cs{NRC@trimthickness}
% \item \cs{NRC@trim*size} are \emph{nominally} 3pc each
% \item \cs{NRC@trimvsize} should incorporate \cs{NRC@trimvgap}
% \end{itemize}
%    \begin{macrocode}
\newcommand\NRC@trimhsize{36\p@}
\newcommand\NRC@trimvsize{39\p@}
\newcommand\NRC@trimhalfthick{0.1\p@}
\newcommand\NRC@trimthickness{0.2\p@}
\newcommand\NRC@trimhgap{3\p@}
\newcommand\NRC@trimvgap{-3\p@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsection{Parallel setting of multilingual text}
%
% \begin{environment}{par-text}
% \begin{macro}{\NRC@enclosingenv}
% Syntax: \cs{begin}\verb|{par-text}|\oarg{right language}\oarg{left
%         width}\oarg{separation}\oarg{right width}
%
% Set parallel (bilingual) text.
%
% If \meta{right language} is present, it will be selected as a
% language (using Babel commands) in the right column.  If \meta{left
% width} is present, it will be used as the width of the left column;
% otherwise the width will be set to \texttt{15.5pc} (nrc1), or
% \texttt{20.75pc} (nrc2).  If
% \meta{separation} is present, it will be used as the separation
% between the two columns; otherwise that separation will be set to
% \texttt{1.5pc}.  If \meta{right width} is present, it will be used as
% the width of the right column; otherwise the width will be set to
% \cs{textwidth}\(-\)\meta{left width}\(-\)\meta{separation}.
%
% Thus the two `standard' ways of using the environment start with the
% commands:
% \begin{itemize}
% \item\verb|\begin{par-text}[french]|
%
% Which assumes that Babel has been loaded, and that the main language
% in the document is English.  In this case, the left column will be
% in English, the right column in French.
% \item\verb|\begin{par-text}[english][17pc]|
%
% Which assumes that Babel has been loaded, and the surrounding text
% is in French.  En ce cas, la colonne gauche se presente en fran\c cais,
% la colonne droite en anglais.
% \end{itemize}
%
% We start by grabbing the first argument.  If it's present, we
% transform it to a \textsf{babel} \cs{select@language} command.
% (Note that the `natural' \cs{selectlanguage} command would write
% language selection guff to the \verb|.aux| file, which causes havoc
% with box alignment, so we use the internal command instead.)
%    \begin{macrocode}
\newenvironment{par-text}[1][]{%
%    \end{macrocode}
%
% If we're in a two-column class, ensure we've got the full width
% available to us\dots
%    \begin{macrocode}
%<*nrc2>
  \if@twocolumn
    \BalanceColumns[0.5]%
  \fi
%</nrc2>
  \def\@rightlanguage{#1}%
  \ifx\@rightlanguage\@empty
  \else
    \edef\@rightlanguage{%
      \noexpand\select@language{\@rightlanguage}%
    }%
  \fi
%    \end{macrocode}
%
% Now we set \cs{NRC@enclosingenv} and look for the second, third and
% fourth optional arguments.  This is boring code indeed\dots
%    \begin{macrocode}
  \let\NRC@enclosingenv\@currenvir
  \@ifnextchar[%]
     \NRC@partext@a
%<nrc1>   {\NRC@partext@a[15.5pc][1.5pc][17pc]}%
%<nrc2>   {\NRC@partext@a[20.75pc][1.5pc][20.75pc]}%
}%
{\par}
%    \end{macrocode}
%
% \cs{NRC@enclosingenv} is set either to \cs{relax} or to the
% enclosing \verb|par-text| environment name.
%    \begin{macrocode}
\let\NRC@enclosingenv\relax
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
% Three syntax support commands follow.
%
% \begin{macro}{\NRC@partext@a}
% \begin{macro}{\NRC@par@leftwidth}
% Syntax: \cs{NRC@partext@a}\oarg{left
%             width}\oarg{separation}\oarg{right width}
%    \begin{macrocode}
\def\NRC@partext@a[#1]{%
  \def\NRC@par@leftwidth{#1}%
  \@ifnextchar[%]
     \NRC@partext@b
    {\NRC@partext@b[1.5pc][\z@]}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@partext@b}
% \begin{macro}{\NRC@par@separation}
% Syntax: \cs{NRC@partext@b}\oarg{separation}\oarg{right width}
%    \begin{macrocode}
\def\NRC@partext@b[#1]{%
  \def\NRC@par@separation{#1}%
  \NRC@partext@c
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@partext@c}
% \begin{macro}{\NRC@par@rightwidth}
% \begin{macro}{\NRC@warning@inconpar}
% Syntax: \cs{NRC@partext@c}\oarg{right width}
%    \begin{macrocode}
\newcommand\NRC@partext@c[1][\z@]{%
  \@tempdima#1\relax
  \ifdim\@tempdima>\z@
    \def\NRC@par@rightwidth{#1}%
    \@tempdima #1\relax
    \advance\@tempdima \NRC@par@separation\relax
    \advance\@tempdima \NRC@par@leftwidth\relax
    \ifdim\@tempdima > \textwidth
      \NRC@warning@inconpar
    \fi
  \else
    \@tempdima\textwidth
    \advance\@tempdima -\NRC@par@leftwidth\relax
    \advance\@tempdima -\NRC@par@separation\relax
    \ifdim\@tempdima>\z@
    \else
      \NRC@warning@inconpar
    \fi
    \edef\NRC@par@rightwidth{\the\@tempdima}%
  \fi
  \NRC@last@parparafalse
  \par
}
\def\NRC@warning@inconpar{%
  \NRC@warning{Inconsistent parameters for environment par-text}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\ifNRC@last@parpara}
% \begin{macro}{\NRC@last@parparatrue}
% \begin{macro}{\NRC@last@parparafalse}
% Controlling vertical spacing in between blocks of parallel
% paragraphs
%    \begin{macrocode}
\def\NRC@last@parparatrue{\global\let\ifNRC@last@parpara\iftrue}
\def\NRC@last@parparafalse{\global\let\ifNRC@last@parpara\iffalse}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\parallelparsep}
% \begin{macro}{\NRC@parpara@sep}
% Syntax: \cs{parallelparsep}\marg{paragraph separation}
%
% Sets the separation between paragraphs in a \verb|par-text|
% environment to the argument (which is a rubber length)
%    \begin{macrocode}
\newcommand\parallelparsep[1]{\gdef\NRC@parpara@sep{#1}}
\parallelparsep{1pc}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% Now the original environments for setting left and right columns
% separately.
%
% \begin{environment}{leftcolumn}
% \begin{macro}{\ifNRC@firstleftcolumn}
% \begin{macro}{\NRC@checknesting}
% Set the left-hand column of the bilingual text.  The left column is
% presumed to be in the base language of the document.
%    \begin{macrocode}
\newif\ifNRC@firstleftcolumn  \global\NRC@firstleftcolumntrue
\newenvironment{leftcolumn}{%
  \ifNRC@last@parpara
    \vskip\NRC@parpara@sep\relax
  \else
    \NRC@last@parparatrue
  \fi
  \NRC@checknesting
  \noindent
  \begin{minipage}[t]{\NRC@par@leftwidth}%
  \NRC@sectragged
  \usefont\f@encoding\sfdefault mn%
  \ifNRC@firstleftcolumn
    \global\NRC@firstleftcolumnfalse
  \else
    \hspace*{\NRC@par@parindent}%
  \fi
  \strut\ignorespaces
}{%
  \strut
  \end{minipage}%
  \NRC@insertignore\NRC@colsepskip
}%
\def\NRC@checknesting{%
  \def\@tempa{par-text}%
  \ifx\@tempa\NRC@enclosingenv
  \else
    \NRC@warning{\@currenvir\space environment may only be used%
      \MessageBreak
      within a \@tempa\space environment}%
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{environment}
%
% \begin{environment}{rightcolumn}
% \begin{macro}{\ifNRC@firstrightcolumn}
% Set the right-hand column of the bilingual text.  This is set either
% in the \meta{right language} (if that argument was given), or in the
% base language.
%    \begin{macrocode}
\newif\ifNRC@firstrightcolumn  \global\NRC@firstrightcolumntrue
\newenvironment{rightcolumn}{%
  \NRC@checknesting
  \noindent
  \begin{minipage}[t]{\NRC@par@rightwidth}%
  \NRC@sectragged
  \usefont\f@encoding\sfdefault mn%
  \@rightlanguage
  \ifNRC@firstrightcolumn
    \global\NRC@firstrightcolumnfalse
  \else
    \hspace*{\NRC@par@parindent}%
  \fi
  \strut\ignorespaces
}{%
  \strut
  \end{minipage}%
  \NRC@insertignore\par
}%
%    \end{macrocode}
% \end{macro}
% \end{environment}
%
%
% \begin{macro}{\NRC@par@parindent}
% Simply defined to be the `paragraph' indentation in parallel text
%    \begin{macrocode}
\def\NRC@par@parindent{\@xiipt\p@}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@colsepskip}
% Syntax: \cs{NRC@colsepskip}
%
% Skip to separate the columns in a 2-column section.  Default is
% \texttt{2pc}: this value is programmed into \cs{NRC@par@separation}
% at the time the arguments to the \verb|par-para| environment are
% decoded
%    \begin{macrocode}
\def\NRC@colsepskip{\hskip\NRC@par@separation\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{par-para}
% \begin{macro}{\othercol}
% \begin{macro}{\NRC@leftbox}
% \begin{macro}{\NRC@rightbox}
% Syntax: \cs{begin}\verb|{par-para}| \meta{left text} \cs{othercol}
%           \meta{right text} \cs{end}\verb|{par-para}|
%
% Set a pair of paragraphs of parallel text
%    \begin{macrocode}
\newbox\NRC@leftbox
\newbox\NRC@rightbox
\newenvironment{par-para}{%
  \ifNRC@last@parpara
    \vskip\NRC@parpara@sep\relax
  \else
    \NRC@last@parparatrue
  \fi
  \NRC@checknesting
  \NRC@ignorespacesandpars\NRC@gatherleft
}%
%    \end{macrocode}
% So here we are, with the left paragraph in \cs{NRC@leftbox} and an
% unterminated right paragraph being set into \cs{NRC@rightbox}
%    \begin{macrocode}
{%
    \unskip
  \egroup
%    \end{macrocode}
%
% Now we've got both paragraphs in their boxes, so we have to play
% them out into single lines of parallel text.
%    \begin{macrocode}
  {%
    \vbadness\@M
    \vfuzz5ex
    \let\@tempa\p@
    \par
    \loop
      \ifvoid\NRC@leftbox
        \ifvoid\NRC@rightbox
          \let\@tempa\z@
        \fi
      \fi
      \ifdim\@tempa>\z@
        \hb@xt@\textwidth{%
          \vbox{\ifvoid\NRC@leftbox
              \hrule\@width\NRC@par@leftwidth\@height\z@\@depth\z@
            \else
              \setbox\@tempboxa\vsplit\NRC@leftbox to\p@
              \unvbox\@tempboxa
            \fi}%
          \NRC@colsepskip
          \vbox{\ifvoid\NRC@rightbox
              \hrule\@width\NRC@par@rightwidth\@height\z@\@depth\z@
            \else
              \setbox\@tempboxa\vsplit\NRC@rightbox to\p@
              \unvbox\@tempboxa
            \fi}%
        }%
    \repeat
  }%
  \par
}
%    \end{macrocode}
%
% \begin{macro}{NRC@gatherleft}
% \cs{NRC@gatherleft} sets up gathering the left column paragraph of a
% \verb|par-para| environment into its box.  The process is terminated
% in \cs{othercol}
%    \begin{macrocode}
\newcommand\NRC@gatherleft{%
  \setbox\NRC@leftbox\vbox\bgroup
    \hsize\NRC@par@leftwidth\relax
    \usefont\f@encoding\sfdefault mn%
    \noindent
    \ifNRC@firstleftcolumn
      \global\NRC@firstleftcolumnfalse
    \else
      \hspace*{\NRC@parallelparindent}%
    \fi
    \NRC@sectragged
  }%
%    \end{macrocode}
%
% \begin{macro}{\othercol}
% \cs{othercol} terminates the collection that \cs{NRC@gatherleft}
% started, and then initiates the collection of the right column via
% \cs{NRC@gatherright}
% paragraph (which collection is completed in the
% \cs{end}\verb|{par-para}| `macro').
%    \begin{macrocode}
\newcommand\othercol{%
    \unskip
  \egroup
  \NRC@ignorespacesandpars\NRC@gatherright
}
%    \end{macrocode}
%
% \begin{macro}{\NRC@gatherright}
% \cs{NRC@gatherright} completes the |par-para| environment, by
% initiating collection of the right hand column of the pair, which
% collection is terminated in the \cs{end}|{par-para}| `macro'
%    \begin{macrocode}
\newcommand\NRC@gatherright{%
  \setbox\NRC@rightbox\vbox\bgroup
    \hsize\NRC@par@rightwidth\relax
    \usefont\f@encoding\sfdefault mn%
    \@rightlanguage
    \noindent
    \ifNRC@firstrightcolumn
      \global\NRC@firstrightcolumnfalse
    \else
      \hspace*{\NRC@parallelparindent}%
    \fi
    \NRC@ignorespacesandpars\NRC@sectragged
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{environment}
%
% \begin{macro}{\NRC@parallelparindent}
% Simply defined to be the `paragraph' indentation in parallel text
%    \begin{macrocode}
\def\NRC@parallelparindent{10\p@}
%    \end{macrocode}
% \end{macro}
%
%
% \subsection{Full-width intervals in two-column papers}
%
% Naturally, this code is not provided in the one-column class, just
% the 2-column class and the column-balancing package.
%    \begin{macrocode}
%</nrc1cls|nrc2cls>
%<*nrc2cls|balance>
%    \end{macrocode}
%
% \begin{macro}{\BalanceColumns}
% \begin{macro}{\@tempboxb}
%
% Syntax: \cs{BalanceColumns}\oarg{epsilon}
%
% Balances what's left as contributions to the final page, subject to
% fudge-factor \emph{epsilon} in the final balancing: the default
% factor is \texttt{0.5}, and it's multiplied by \cs{baselineskip} and
% then added to the `target' height of the left column which is passed
% to the \cs{vsplit} primitive
%
% A spare temporary box, needed for \cs{BalanceColumns}~\dots\ or could
% we use \cs{@holdpg}?
%    \begin{macrocode}
\newbox\@tempboxb
%    \end{macrocode}
%
%    \begin{macrocode}
\newcommand\BalanceColumns[1][0.5]{%
%    \end{macrocode}
%
% ensure we're in vertical mode
%    \begin{macrocode}
  \par
%    \end{macrocode}
%
% insert a zero penalty to ensure that the penultimate page is output
% properly
%    \begin{macrocode}
  \penalty\z@
%    \end{macrocode}
%
% define a dummy output routine for gathering up what's left at the
% end of the last page:
%    \begin{macrocode}
  \def\@dummy@balance@output{%
    \if@firstcolumn
      \ifx\@toplist\@empty
        \global\setbox\@tempboxa \vbox{\unvbox\@cclv}%
      \else
        % 1. (?) get rid of \topskip glue at the top of \@cclv
        % 2. insert the top float(s) and the appropriate separations
        % 3. adjust \@colroom and so on
        \global\setbox\@tempboxa \vbox{%
          \@tempswatrue
          \NRC@return@floats\@toplist\@toproom\@topnum\@empty
          \vspace\textfloatsep
          \unvbox\@cclv
        }%
        % 4. (?) warn about potential problems?
        % ... or ...
        % moan about the thing being there in the first place?
      \fi
    \else
%    \end{macrocode}
%
% we were in the right-hand column, so box 255 has (at this stage) got
% a \cs{topskip} glue in it (which we definitely don't want), so we
% stick in a penalty and \cs{vsplit} if off again, which loses the
% glue for us\dots
%    \begin{macrocode}
      \setbox\@cclv \vbox{%
        \penalty-\@M
        \unvbox\@cclv}%
      \splittopskip\topskip
      \splitmaxdepth\maxdepth
      \setbox\@tempboxa \vsplit\@cclv to\z@
%    \end{macrocode}
%
% now reassemble the two columns into one, in \cs{@tempboxa}
%    \begin{macrocode}
      \ifx\@toplist\@empty
      % insert top floats in the right column here?
      % ... or ...
      \else
      % moan at their very existence?
%<balance> \PackageWarning{baltools}{%
%<nrc2> \NRC@warning{%
          Top float(s) (2nd column) lost in balancing}%
        \@tempswafalse
        \NRC@return@floats\@toplist\@toproom\@topnum\@empty
      \fi
      \global\setbox\@tempboxa \vbox{%
        \unvbox\@leftcolumn
        \unskip
        \unvbox\@cclv}%
    \fi
  }%
%    \end{macrocode}
%
% now check if there are outstanding floats, and moan if so (I'm not
% in the slightest particular sure whether the presence of floats can
% be dealt with at all without major restructuring, so we complain
% instead\dots).
%
% Note, we \emph{don't}, now, complain about deferred floats (they're
% the user's problem), but bottom floats have me stumped.  (In-text
% floats have already been committed by the time we get to this stage,
% and it's acceptable simply to return them):
%    \begin{macrocode}
  \ifx\@botlist\@empty\else
%<balance> \PackageWarning{baltools}{%
%<nrc2> \NRC@warning{%
      Bottom floats outstanding when balancing may be lost\MessageBreak
      What's more, balancing may be invalid}%
  \fi
  \xdef\@freelist{\@freelist\@midlist}
%    \end{macrocode}
%
% Acquire the output contributions so far, by exercising our little
% dummy output routine
%    \begin{macrocode}
  {%
    \output{\@dummy@balance@output}%
    \eject
  }%
%    \end{macrocode}
%
% Establish the total height of the boxes we've thereby acquired
%    \begin{macrocode}
  {%
    \@tempdima .5\ht\@tempboxa
    \advance\@tempdima .5\dp\@tempboxa
    \splittopskip\topskip
    \splitmaxdepth\maxdepth
%<balance> \PackageInfo{baltools}{%
%<nrc2> \ClassInfo\NRC@clsname{%
      \string\BalanceColumns: total height of page is
      \the\@tempdima\space--\MessageBreak
      \string\vsplit\space to half of that
      (plus #1\string\baselineskip)}%
    \advance\@tempdima #1\baselineskip
    \vbadness\@M
    \setbox\@tempboxb \vsplit\@tempboxa to\@tempdima
%    \end{macrocode}
%
% Log what we've done\dots
%    \begin{macrocode}
%<balance> \PackageInfo{baltools}{%
%<nrc2> \ClassInfo\NRC@clsname{%
      Column balance: left column height
                      \the\ht\@tempboxb+\the\dp\@tempboxb
      \MessageBreak
      right column height \the\ht\@tempboxa+\the\dp\@tempboxa}%
%    \end{macrocode}
%
% Reassemble the two columns we now have into the `top of the page'
%    \begin{macrocode}
    \@tempdima \ht\@tempboxa
    \advance\@tempdima \dp\@tempboxa
    \dimen@    \ht\@tempboxb
    \advance\dimen@    \dp\@tempboxb
    \ifdim \dimen@ < \@tempdima
      \dimen@ \@tempdima
    \fi
    \global\setbox\@tempboxa \vbox {%
      \ifx\@dbltoplist\@empty
      \else
        \@tempswatrue
        \NRC@return@floats\@dbltoplist\@dbltoproom\@dbltopnum{dbl}%
        \vspace\dbltextfloatsep
      \fi
      \hb@xt@\textwidth {%
        \hb@xt@\columnwidth {%
          \vbox to\dimen@{%
            \unvbox\@tempboxb
            \vfill
          }%
          \hss
        }%
        \hfill
        \vrule \@width\columnseprule
        \hfill
        \hb@xt@\columnwidth {%
          \vbox to\dimen@{%
            \unvbox\@tempboxa
            \vfill
          }%
          \hss
        }%
      }%
    }%
%    \end{macrocode}
%
% Preserve the value of the \cs{columnwidth} for use in the
% \cs{*ColumnBar} commands
%    \begin{macrocode}
    \xdef\NRC@narrow@width{\the\columnwidth}
%    \end{macrocode}
%
% We now have the two columns, nestling happily together, in (global)
% \cs{@tempboxa}, so we simulate a \cs{onecolumn} command, so that we
% can proceed as if we've now given up on this two column game\dots
%    \begin{macrocode}
    \global\columnwidth\textwidth
    \global\hsize\columnwidth
    \global\linewidth\columnwidth
    \global\@twocolumnfalse
    \col@number \@ne
%    \end{macrocode}
%
% Finally, dump the contents of the \@tempboxa we prepared earlier
% into this new one-columned environment
%    \begin{macrocode}
    \unvbox\@tempboxa
  }%
}
%    \end{macrocode}
%
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@return@floats}
% Syntax: \cs{NRC@return@floats}\marg{flt list}\marg{flt room}^^A
%                               \marg{flt cnt}\marg{dbl ind}
%
% `Return' a list of floats that existed for the present page, and
% recover the space they would have occupied in the present column;
% note that since this operation redefines the float list \cs{@elt}
% macro, it operates inside a group, and all its external actions need
% to be done \cs{global}.  \cs{if@tempswa}, the body(ies) of the
% float(s) is(are) inserted; otherwise they're simply lost.  It is the
% responsibility of the calling routine to add \cs{textfloatsep} (or
% whatever), where necessary, to ensure the floats are properly
% positioned with respect to the rest of the matter in the column.
%
% The \meta{dble ind} parameter is either \verb'dbl' (if we're
% returning a double-top list) or empty (it's used to determine which
% separation to use in calculations (and in the case of returning
% multiple floats, even when making inter-float skips)
%    \begin{macrocode}
\newcommand{\NRC@return@floats}[4]{{%
%    \end{macrocode}
%
% \cs{@elt} macro for returning the first float in the list.  Note
% that it doesn't insert any separation of its own\dots
%    \begin{macrocode}
    \def\@elt##1{%
      \global\advance#3\@ne
      \global\advance\@colnum\@ne
      \@tempdima\ht##1%
      \advance\@tempdima\dp##1%
      \advance\@tempdima\csname#4textfloatsep\endcsname
      \csname NRC@advance@#4colspace\endcsname{#2}%
      \if@tempswa\vbox{\unvbox##1}\fi
%    \end{macrocode}
%
% now the \cs{@elt} macro for returning subsequent floats in the
% list.  Since we know that at least one float has already been added,
% we insert \cs{\#4floatsep} before inserting the float's actual body.
%    \begin{macrocode}
      \def\@elt####1{%
        \global\advance#3\@ne
        \global\advance\@colnum\@ne
        \@tempdima\ht####1%
        \advance\@tempdima\dp####1%
        \advance\@tempdima\csname#4floatsep\endcsname
        \csname NRC@advance@#4colspace\endcsname{#2}%
        \if@tempswa
          \vskip\csname#4floatsep\endcsname%
          \vbox{\unvbox####1}%
        \fi
      }%
    }%
%    \end{macrocode}
%
% Now we simply execute the list, and it will self-insert.
%    \begin{macrocode}
    #1%
  }%
%    \end{macrocode}
%
% Having closed the group in which \cs{@elt} was defined, we can
% safely do the following to return the list to the free list, since
% \cs{@elt} \emph{should} always be \cs{let} to \cs{relax}
%    \begin{macrocode}
  \let\@elt\relax
  \xdef\@freelist{\@freelist#1}%
  \xdef#1{}%
  \global\vsize\@colroom
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\NRC@advance@colspace}
% \begin{macro}{\NRC@advance@dblcolspace}
%
% Add \cs{@tempdima} to the space available in the column(s).  The
% version for double-column floats also restores space to \cs{@colht}.
%    \begin{macrocode}
\newcommand{\NRC@advance@colspace}[1]{%
  \global\advance\@colroom\@tempdima
  \global\advance#1\@tempdima
}
\newcommand{\NRC@advance@dblcolspace}[1]{%
  \global\advance\@colroom\@tempdima
  \global\advance#1\@tempdima
  \global\advance\@colht\@tempdima
%    \end{macrocode}
%
% \cs{@topnum} gets advanced in the \cs{@elt} macros and shouldn't be
% in this case
%    \begin{macrocode}
  \global\advance\@topnum\m@ne
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% Now code for restarting double columns\dots
%
% \begin{macro}{\RestartDouble}
%
%    \begin{macrocode}
\newcommand{\RestartDouble}{%
  \penalty\z@
  {%
    \output{\NRC@gather@top}
    \vfill
    \eject
  }%
  \twocolumn[\unvbox\@tempboxb]%
  \NRC@restorefootskip
}
%    \end{macrocode}
% \end{macro}
%
% \begin{environment}{FullWidth}
% Syntax: \cs{begin}\verb'{FullWidth}'\oarg{epsilon}
%
% This environment encapsulates \cs{BalanceColumns} and
% \cs{RestartDouble} in a single user-friendly, hyper-buzz-word,
% package.
%
% The optional \emph{epsilon} argument is the same as that to
% \cs{BalanceColumns} and should not ordinarily be required.
%    \begin{macrocode}
\newenvironment{FullWidth}[1][0.5]%
  {\BalanceColumns[#1]}%
  {\RestartDouble}
%    \end{macrocode}
% \end{environment}
%
% \begin{macro}{\NRC@gather@top}
%
% Another dummy output routine, whose sole task is to salt away the
% contents of a (nominally) single-column output-page-so-far
%    \begin{macrocode}
\newcommand{\NRC@gather@top}{%
  \global\setbox\@tempboxb\vbox{\unvbox\@cclv}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LeftColumnBar}
% \begin{macro}{\RightColumnBar}
%
% \cs{LeftColumnBar} and \cs{RightColumnBar} place bars across
% columns, as are required to separate the two-column portion of the
% text from interposed full-width material.  They are to be used
% \emph{within} the full-width material, in vertical mode
%    \begin{macrocode}
\newcommand{\LeftColumnBar}{%
  \addvspace{0.75\baselineskip}%
  \hbox{\rule{\NRC@narrow@width}{\p@}}%
  \addvspace{0.75\baselineskip}%
}
\newcommand{\RightColumnBar}{%
  \par
  \addvspace{0.75\baselineskip}%
  \hb@xt@\textwidth{\hfill\rule{\NRC@narrow@width}{\p@}}%
  \addvspace{0.75\baselineskip}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{environment}{WideText}
% \begin{macro}{\NRC@widetext@i}
% \begin{macro}{\NRC@widetext@ii}
%
% Syntax: \verb'\begin{WideText}'\oarg{left indent}\oarg{right indent}
%
% The \verb'WideText' environment allows variation of the text margins
% for a short period.  It will typically be used to narrow the right
% margin of full-width text in the two-column style, hence the default
% values for the argument of \emph{left}:~\verb'0pc',
% \emph{right}:~\verb'3pc'.
%
%    \begin{macrocode}
\newenvironment{WideText}{%
  \@testopt{\NRC@widetext@i}{\z@}%
}{%
  \endlist
}
\def\NRC@widetext@i[#1]{%
  \@testopt{\NRC@widetext@ii{#1}}{3pc}%
}
\def\NRC@widetext@ii#1[#2]{%
  \list{}{%
    \topsep\z@
    \leftmargin#1\relax
    \rightmargin#2\relax
    \listparindent\parindent
    \parsep\parskip
  }%
  \item[]%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{environment}
%
% \noindent At the going down of the sun, and in the morning, we will
% remember them.
%
% \noindent 11:02 {\small GMT\@}, 8\textsuperscript{th} November
% 1998 (Remembrance Sunday).
%    \begin{macrocode}
%</nrc2cls|balance>
%<*nrc1cls|nrc2cls>
%    \end{macrocode}
%
%
% \subsection{Other miscellaneous layout}
%
% \begin{macro}{\frenchspacing}
% We use \cs{frenchspacing} throughout.  Fortunately, \textsf{babel}
% respects our wishes, and doesn't reset \cs{nonfrenchspacing} every
% time we select English from within French.  (\textsf{babel} accords
% English a haughty position whereby every other language is required
% to restore the original English state, so that the selection of
% English doesn't give us a problem here.)
%    \begin{macrocode}
\frenchspacing
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\parindent}
% Paragraph indentation is smaller than normal in the the two-column
% classes:
%    \begin{macrocode}
%<*nrc2>
\parindent 10pt
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\parskip}
% And the inter-paragraph skip contributes to the stretchability of
% vertical lists:
%    \begin{macrocode}
\parskip 0pt plus 2pt
%</nrc2>
%    \end{macrocode}
% \end{macro}
%
%
% \section{Support macros}
%
% Pseudo-counters are implemented in \cs{NRC@c@*} macros.  The
% following bits of code manipulate these macros.  We refer to these
% things via the name part (the |*|, as it were).
%
% \begin{macro}{\NRC@definecounter}
% Syntax: \cs{NRC@definecounter}\marg{macro-name}
%
% \cs{NRC@definecounter} creates and zeroes a counter macro |#1|:
%    \begin{macrocode}
\newcommand\NRC@definecounter[1]{%
  \global\expandafter\newcommand\csname NRC@c@#1\endcsname{0}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\NRC@addtocounter}
% Syntax: \cs{NRC@addtocounter}\marg{macro-name}\marg{increment}
%
% \cs{NRC@addtocounter} adds |#2| to counter macro |#1|:
%    \begin{macrocode}
\newcommand\NRC@addtocounter[2]{\bgroup
  \expandafter\@tempcnta\csname NRC@c@#1\endcsname\relax
  \advance\@tempcnta#2\relax
  \expandafter\xdef\csname NRC@c@#1\endcsname{\the\@tempcnta}%
  \egroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@stepcounter}
% Syntax: \cs{NRC@stepcounter}\marg{counter-name}
%
% Advance a counter by 1
%    \begin{macrocode}
\newcommand\NRC@stepcounter[1]{\NRC@addtocounter{#1}1}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\if@NRCcounter}
% Syntax:
% \cs{if@NRCcounter}\marg{counter-name}\meta{condition}\meta{integer-value}
%
% \cs{if@NRCcounter} establishes an \cs{ifnum} test on the contents of
% a counter
%    \begin{macrocode}
\newcommand\if@NRCcounter[1]{\expandafter\ifnum\csname
  NRC@c@#1\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@valcounter}
% Syntax: \cs{NRC@valcounter}\marg{counter-name}
%
% \cs{NRC@valcounter} simply inserts the value of a counter into the
% token stream
%    \begin{macrocode}
\newcommand\NRC@valcounter[1]{\csname NRC@c@#1\endcsname}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@condgobble}
% Syntax: \cs{NRC@condgobble}\marg{ignore}, or just
% \cs{NRC@condgobble}
%
% \cs{NRC@condgobble} looks to see if it's got an `argument' and if
% so, gobbles it
%    \begin{macrocode}
\def\NRC@condgobble{\futurelet\reserved@a\NRC@relayto@gobble}
\def\NRC@relayto@gobble{\ifx\reserved@a\bgroup\expandafter\@gobble\fi}
%    \end{macrocode}
% \end{macro}
%
% A few odds and ends for the parallel-text setting\dots
%
% \begin{macro}{\NRC@insertignore}
% \begin{macro}{\@@ignorespaces}
% Syntax: \cs{NRC@insertignore}\marg{execute next}
%
% Insert \cs{NRC@ignorespacesandpars}\marg{execute next} after the
% current environment by mucking about with \cs{if@ignore} and
% \cs{ignorespaces}
%    \begin{macrocode}
\newcommand\NRC@insertignore[1]{%
  \@ignoretrue
  \gdef\ignorespaces{%
    \global\let\ignorespaces\@@ignorespaces
    \def\@tempa{\NRC@ignorespacesandpars{#1}}%
    \expandafter\@tempa
  }%
}
\let\@@ignorespaces\ignorespaces
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@ignorespacesandpars}
% Syntax: \cs{NRC@ignorespacesandpars}\marg{execute next}
%
% Ignore any blank space following the present environment, then
% ignore any \cs{par} tokens, then execute our argument
%    \begin{macrocode}
\newcommand\NRC@ignorespacesandpars[1]{%
  \def\@tempb\par{\@tempa}%
  \def\@tempa{\@long@ifnextchar\par\@tempb{#1}}%
  \@tempa
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@long@ifnextchar}
% Syntax: \cs{@long@ifnextchar}\marg{token}\marg{match}\marg{no match}
%
% As \cs{@ifnextchar} (from which the code is derived), but
% \marg{token} is allowed to be \cs{par}\dots
%    \begin{macrocode}
\long\def\@long@ifnextchar#1#2#3{%
  \let\reserved@d=#1%
  \def\reserved@a{#2}\def\reserved@b{#3}%
  \futurelet\@let@token\@ifnch}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@stripdef}
% \begin{macro}{\NRC@stripdef@}
% Syntax: \cs{NRC@stripdef}\cs{\emph{defining}}\cs{\emph{defined}}
%
% Strip the defnition of \cs{\emph{defined}} from the definition of
% \cs{captions\meta{defining}}, if it proves that
% \cs{captions\meta{defining}} actually exists
%    \begin{macrocode}
\newcommand\NRC@stripdef[2]{%
  \@ifundefined{captions#1}{}{%
    \def\NRC@stripdef@##1\def#2##2##3\NRC@stripdef@{%
      \@namedef{captions#1}{##1##3}%
    }%
    \edef\@tempa{\noexpand\expandafter
      \noexpand\NRC@stripdef@
      \expandafter\noexpand\csname captions#1\endcsname
      \noexpand\NRC@stripdef@
    }%
    \@tempa
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \section{Titles and origins}
%
% \subsection{Title material}
%
% The number of authors is a counter macro; it is used as an index in
% the author number definitions, too:
%    \begin{macrocode}
\NRC@definecounter{author}
%    \end{macrocode}
%
% \begin{macro}{\author}
% \begin{macro}{\@NRC@dblauthor}
% Syntax: \cs{author}\oarg{author initials}\marg{author name}
%
% A new author is defined by the \cs{author} macro.  The mandatory
% argument is the author's `full' name; the optional argument gives
% the author's name in abbreviated form, which will be used in the
% IDbox on the title page in place of the full name.\footnote{In
%   principal, this short name could be used to derive an author
%   `list' for the running head (saving the editor the use of the
%   \cs{shortauthor} command if there are sufficiently few authors)
%   but this facility has not yet been implemented.}
%    \begin{macrocode}
\renewcommand\author{\@dblarg\@NRC@dblauthor}
\newcommand\@NRC@dblauthor[2][]{%
  \if@NRCcounter{author}>0
    \expandafter\ifx\csname NRC@addr\NRC@c@author\endcsname\relax
%    \end{macrocode}
%
% If no address was given for the previous author, things are going to
% fall apart unless we allocate a (spurious) one.
%    \begin{macrocode}
      \NRC@warning{No address given for author \NRC@c@author}%
      \address{(\emph{\texttt{address missing}})}%
    \fi
  \fi
  \let\NRC@tempb\NRC@c@author%
  \NRC@stepcounter{author}%
  \NRC@definecounter{AN\NRC@c@author}
  \@namedef{NRC@author\NRC@c@author}{#2}%
  \@namedef{NRC@initialsonly\NRC@c@author}{#1}%
  \ifnum\NRC@tempb=0
%    \end{macrocode}
%
% We explicitly \cs{let} the first address to \cs{relax}, in case that
% we're on the second or subsequent paper of an issue of the journal:
% otherwise, we're in danger of picking up an address from the
% previous paper in the error case where the address has been omitted.
%    \begin{macrocode}
    \expandafter\let\csname NRC@addr\NRC@c@author\endcsname\relax
  \else
%    \end{macrocode}
%
% Otherwise, we start by assuming that the address is the same as that
% of the previous author.  An explicit address command is needed
% somewhere or other, though.  (Of course\dots)
%    \begin{macrocode}
    \expandafter\edef\csname NRC@addr\NRC@c@author\endcsname
      {\csname NRC@addr\NRC@tempb\endcsname}
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\shortauthor}
% \begin{macro}{\@shortauthor}
% Syntax: \cs{shortauthor}\marg{author-spec}
%
% Defines the reference to be made to the authors in the running
% heads, in the case where it's not derivable from the author
% specifications.\footnote{There's currently no provision for deriving
%   `\cs{shortauthor}' from the names given (in either argument) to
%   \cs{author} commands.}
%    \begin{macrocode}
\newcommand\shortauthor[1]{\newcommand\@shortauthor{#1}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% An author's address is defined by the \cs{address} macro.  The
% mandatory argument is the address defined; the optional argument (if
% present) allows the address to be tagged for future reference from
% other authors.
%
% For each author \meta{n} there's an \cs{NRC@addr\meta{n}} which
% expands to the address label.  If an address is defined by
% \cs{address}\marg{address}, the label is simply `the current author
% number'; otherwise, it's \cs{address}'s optional argument.  If an
% author isn't given an explicit address, she is assumed to be at the
% same place as the previous author (which all falls apart if there's
% been no author defined yet).
%
% For each address \meta{label}, there's an
% \cs{NRC@addr@\meta{label}} that expands to the actual address.
%    \begin{macrocode}
\newcommand\address{\@ifnextchar[%]
  \NRC@address@l  \NRC@address@nl
}
%    \end{macrocode}
%
% If there's no optional argument, the command simply defines the
% current author's address to be that in the argument:
%    \begin{macrocode}
\newcommand\NRC@address@nl[1]{%
%    \end{macrocode}
%
% First, define the address for label `author number'
%    \begin{macrocode}
  \@namedef{NRC@addr@\NRC@c@author}{#1}%
%    \end{macrocode}
%
% And then allocate `this author's number' as this author's label
%    \begin{macrocode}
  \expandafter\edef\csname NRC@addr\NRC@c@author\endcsname
    {\NRC@c@author}%
%    \end{macrocode}
%
% Finally, register the empty tree of
% author\ensuremath{\rightarrow}address mappings:
%    \begin{macrocode}
  \NRC@allocaddr\NRC@c@author%
}
%    \end{macrocode}
%
% The optional argument could represent two forms, according to
% whether the `mandatory' (-seeming) argument is present.  Preserve
% the optional (label) argument and split on whether we're actually
% defining an address, or merely referring to one.  Whatever, we
% define the current author's address label.
%    \begin{macrocode}
\def\NRC@address@l[#1]{%
  \@namedef{NRC@addr\NRC@c@author}{#1}%
  \def\NRC@tempa{#1}%
  \futurelet\reserved@a\NRC@address@lsw
}
%    \end{macrocode}
%
% If we now enter with \cs{reserved@a} the same as \cs{bgroup}, we've
% got an address definition, and a label definition to go with it.
% Otherwise, we merely have a label reference
%    \begin{macrocode}
\def\NRC@address@lsw{%
  \ifx\reserved@a\bgroup
    \expandafter\NRC@address@ldef
  \fi
}
%    \end{macrocode}
%
%
% Address with label definition: set up the address itself, and
% allocate an entry in the tree of addresses
%    \begin{macrocode}
\def\NRC@address@ldef#1{%
  \@namedef{NRC@addr@\NRC@tempa}{#1}%
  \NRC@allocaddr\NRC@tempa%
}
%    \end{macrocode}
%
% \begin{macro}{\NRC@addresses}
% \begin{macro}{\NRC@allocaddr}
% Syntax: \cs{NRC@allocaddr}\marg{addr-label}
%
% Allocate a root of a tree and register it in the list \cs{NRC@addresses}
%    \begin{macrocode}
\gdef\NRC@addresses{}
\newcommand\NRC@allocaddr[1]{%
  \expandafter\gdef\csname NRC@addrlist#1\endcsname{}%
  \NRC@definecounter{addr@#1}%
  \NRC@addtolist\NRC@addresses{#1}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@addtolist}
% Syntax: \cs{NRC@addtolist}\marg{list-cs-name}\marg{list-element}
%
% Adds an element |#2| to list |#1|
%    \begin{macrocode}
\newcommand\NRC@addtolist[2]{\bgroup
  \let\do\relax
  \xdef#1{#1\do{#2}}%
  \egroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@addauthortoaddress}
% Syntax: \cs{NRC@addauthortoaddress}\marg{author-count}
%
% Adds the author specified by the \emph{count} to the relevant
% address list, and counts the author in the counter
% \texttt{@addr@\meta{addr-label}}
%    \begin{macrocode}
\newcommand\NRC@addauthortoaddress[1]{%
  \expandafter\edef\expandafter\@tempa\expandafter{%
    \csname NRC@addr#1\endcsname}%
  \expandafter\NRC@addtolist
                  \csname NRC@addrlist\@tempa\endcsname{#1}%
  \NRC@stepcounter{addr@\@tempa}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\correspond}
% \begin{macro}{\@correspond}
% \begin{macro}{\@correspond@a}
% Syntax: \cs{correspond}\marg{correspondence-details} (argument,
% despite looking as if it's mandatory, is in fact optional)
%
% Designate one author as the target for correspondence:
%    \begin{macrocode}
\newcommand\correspond{%
  \futurelet\reserved@a\@correspond
}
%    \end{macrocode}
%
% Now, if there actually is an argument, \cs{reserved@a} will contain an
% opening brace
%    \begin{macrocode}
\newcommand\@correspond{%
  \ifx\reserved@a\bgroup
    \expandafter\@correspond@a
  \else
    \AddressNote{\NRC@text@correspondAll}%
  \fi
}
%    \end{macrocode}
%
% Deal with a \cs{correspond} command with arguments
%    \begin{macrocode}
\newcommand\@correspond@a[1]{%
  \def\@tempa{#1}%
  \protected@xdef\@tempa{\noexpand\AddressNote{\NRC@text@correspond}}
  \@tempa
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\present}
% Syntax: \cs{present}\marg{address}
%
% Record that this author has an alternative address.
%    \begin{macrocode}
\newcommand\present[1]{%
  \AddressNote{\NRC@text@present\ #1}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\AddressNote}
% \begin{macro}{\IDnote}
% Syntax: \cs{AddressNote}\marg{note}
%
% Define an anonymous address note (\cs{IDnote} is a synonym).
%    \begin{macrocode}
\newcommand\AddressNote[1]{%
  \NRC@stepcounter{AN\NRC@c@author}
  \bgroup
    \@NRC@AddressCommands
    \expandafter\protected@xdef
      \csname NRC@AN\NRC@c@author.%
        \@nameuse{NRC@c@AN\NRC@c@author}\endcsname{%
      \noexpand\NRC@addrfnote{#1}%
    }%
  \egroup
}
\let\IDnote\AddressNote
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@NRC@AddressCommands}
% \begin{macro}{\phone}
% \begin{macro}{\fax}
% \begin{macro}{\telefax}
% \begin{macro}{\email}
%
% Define the auxiliary address commands for use in the arguments of
% \cs{AddressNote} and \cs{address} commands.  The commands are
% themselves declared as null robust commands, and their expansions
% are only declared within the groups where the commands are going to
% be used
%    \begin{macrocode}
\def\@NRC@AddressCommands{%
  \expandafter\def\csname phone \endcsname##1{%
    \NRC@text@telephone\protect~##1}%
  \expandafter\def\csname fax \endcsname##1{|%
    \NRC@text@fax\protect~##1}%
  \expandafter\def\csname telefax \endcsname##1{%
    \NRC@text@telefax\protect~##1}%
  \expandafter\def\csname email \endcsname##1{%
    \mbox{\NRC@text@email}\protect~##1}%
}
\DeclareRobustCommand\phone[1]{}
\DeclareRobustCommand\fax[1]{}
\DeclareRobustCommand\telefax[1]{}
\DeclareRobustCommand\email[1]{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\received}
% \begin{macro}{\NRC@received}
% \begin{macro}{\NRC@received@sep}
% \begin{macro}{\accepted}
% \begin{macro}{\revreceived}
% \begin{macro}{\revaccepted}
% Syntax: \cs{received}\marg{received date}~\dots~\cs{accepted}\marg{accepted
%   date} \dots\ \cs{revreceived}\marg{date revision received}
%   \dots\ \cs{revaccepted}\marg{date revision accepted}
%
% Preserve the `received' and  `accepted' dates (two sorts of each).
%
% The \cs{received} |[...| \cs{accepted}|]| |[...| \cs{revreceived}|]|
% |[...| \cs{revaccepted}|]| form is now preferred.
%    \begin{macrocode}
\newcommand\NRC@received@sep{}
\def\NRC@received{}
\newcommand\received[1]{%
  \protected@xdef\NRC@received{\NRC@received\NRC@received@sep
    \protect\NRC@text@received\ #1.%
  }%
  \let\NRC@received@sep\space
}
\newcommand\accepted[1]{%
  \protected@xdef\NRC@received{\NRC@received\NRC@received@sep
    \protect\NRC@text@accepted\ #1.%
  }%
  \let\NRC@received@sep\space
}
\newcommand\revreceived[1]{%
  \protected@xdef\NRC@received{\NRC@received\NRC@received@sep
    \protect\NRC@text@revreceived\ #1.%
  }%
  \let\NRC@received@sep\space
}
\newcommand\revaccepted[1]{%
  \protected@xdef\NRC@received{\NRC@received\NRC@received@sep
    \protect\NRC@text@revaccepted\ #1.%
  }%
  \let\NRC@received@sep\space
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\IDdates}
% \begin{macro}{\IDdate}
% Syntax: \cs{IDdates}\marg{Date text}
%
% Provides the means of entering a more freely-specified date entry.
% If present, it's tagged on the end of the \cs{accepted} stuff, with
% a separating space if appropriate.  Repeated \cs{IDdates} commands
% are acceptable, and their arguments are tagged on, one after
% another, with a separating space.  (\cs{IDdate} is an alias for
% \cs{IDdates}.)
%    \begin{macrocode}
\newcommand{\IDdates}[1]{%
  \protected@xdef\NRC@received{\NRC@received\NRC@received@sep#1}%
  \let\NRC@received@sep\space
}
\let\IDdate\IDdates
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\dedication}
% \begin{macro}{\NRC@dedication}
% \begin{macro}{\ifNRC@dedication}
% Syntax: \cs{dedication}\marg{pious words}
%
% Preserve a dedicatory text to be printed in the ident box at the
% bottom of the title page
%    \begin{macrocode}
\newif\ifNRC@dedication  \NRC@dedicationfalse
\newcommand\dedication[1]{\gdef\NRC@dedication{#1}%
  \NRC@dedicationtrue
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\assoced}
% \begin{macro}{\NRC@assoced}
% \begin{macro}{\ifNRC@assoced}
% Syntax: \cs{assoced}\marg{details of associate editor}
%
% Preserve details of the associate editor, to be printed in the ident
% box at the bottom of the title page
%    \begin{macrocode}
\newif\ifNRC@assoced  \NRC@assocedfalse
\newcommand\assoced[1]{\gdef\NRC@assoced{\NRC@text@assoced{} #1.}%
  \NRC@assocedtrue
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\corred}
% \begin{macro}{\NRC@corred}
% \begin{macro}{\ifNRC@corred}
% Syntax: \cs{corred}\marg{details of corresponding editor}
%
% Preserve details of the corresponding editor, to be printed in the ident
% box at the bottom of the title page
%    \begin{macrocode}
\newif\ifNRC@corred  \NRC@corredfalse
\newcommand\corred[1]{\gdef\NRC@corred{\NRC@text@corred{} #1.}%
  \NRC@corredtrue
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\commdate}
% \begin{macro}{\NRC@commdate}
% \begin{macro}{\if@NRCcommdate}
% Syntax: \cs{commdate}\marg{comment date}
%
% Preserve the date by which comments should be received, to be
% printed in the ident box at the bottom of the title page
%    \begin{macrocode}
\newif\ifNRC@commdate  \NRC@commdatefalse
\newcommand\commdate[1]{\gdef\NRC@commdate{\NRC@text@commdate{} #1.}%
  \NRC@commdatetrue
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\webpub}
% \begin{macro}{\NRCurl}
% \begin{macro}{\NRC@a@webpub}
% \begin{macro}{\NRC@webpub}
% \begin{macro}{\ifNRC@webpub}
% \begin{macro}{\NRC@def@webaddress}
% \begin{macro}{\NRC@url}
% \begin{macro}{\NRC@url@command}
% Syntax: \cs{webpub}\marg{web address}\marg{date of web publication}\par
% \noindent\phantom{Syntax: }\cs{NRCurl}\marg{url command name}
%
% \cs{webpub} preserves the location and date of publication on the WWW, to be
% printed in the ident box at the bottom of the title page.  The
% \emph{first} `mandatory' argument may in fact be omitted: the
% presence of two such arguments is determined by there being a ``{'' % }
% immediately after the first argument.
%    \begin{macrocode}
\newif\ifNRC@webpub  \NRC@webpubfalse
\newcommand\webpub[1]{\@ifnextchar\bgroup
  {\def\@tempa{#1}\NRC@a@webpub}%
  {%
    \def\@tempa{\protect\NRC@url{\protect\NRC@def@webaddress}}%
    \NRC@a@webpub{#1}%
  }%
}
\newcommand\NRC@a@webpub[1]{%
  \def\@tempb{#1}%
  \protected@xdef\NRC@webpub{\NRC@text@webpub.}%
  \NRC@webpubtrue
}
\newcommand*{\NRC@def@webaddress}{\emph{unknown}}
%    \end{macrocode}
%
% \cs{NRCurl} sets up typesetting of URLs in \cs{webpub}; there's a
% complicated sequence of protections and non-expansions and things
% whose real purpose is to ensure that \cs{NRC@def@webaddress} doesn't
% get expanded until the web address is actually put into the IDbox.
%    \begin{macrocode}
\DeclareRobustCommand\NRCurl[1]{\expandafter\let\expandafter
  \NRC@url@command\csname#1\endcsname}
\NRCurl{@firstofone}
\newcommand\NRC@url[1]{{%
  \let\protect\@empty
  \edef\@tempa{\noexpand\NRC@url@command{#1}}%
  \@tempa
}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\abbreviations}
% \begin{macro}{\@abbreviations}
% \begin{macro}{\if@abbreviations}
% Syntax: \cs{abbreviations}\marg{set of abbrev.\ specs}
%
% Preserve a set of abbreviations to be printed in the ident box,
% between the dedication and list of authors.
%    \begin{macrocode}
\newif\if@abbreviations  \@abbreviationsfalse
\newcommand\abbreviations[1]{\gdef\@abbreviations{#1}%
  \@abbreviationstrue
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Support code for \cs{maketitle}}
%
% Make a list of all the authors
%    \begin{macrocode}
\newcommand\NRC@defaultauthorlist{\bgroup
  \let\correspond\NRC@condgobble
  \expandafter\@tempcnta\NRC@c@author\relax
  \advance\@tempcnta -2
  \@tempcntb 0
  \loop
    \ifnum\@tempcnta>0
      \advance\@tempcntb 1
      \NRC@addauthortoaddress{\the\@tempcntb}%
      \ignorespaces\csname NRC@author\number\@tempcntb\endcsname\unskip,
      \advance\@tempcnta -1
  \repeat
  \expandafter\@tempcnta\NRC@c@author\relax
  \advance\@tempcnta -\@tempcntb
  \expandafter\ifnum\NRC@c@author>0
    \ifnum\@tempcnta>1
      \expandafter\@tempcnta\NRC@c@author\relax
      \advance\@tempcnta -1
      \NRC@addauthortoaddress{\the\@tempcnta}%
      \ignorespaces\csname NRC@author\number\@tempcnta\endcsname\unskip
      \expandafter\ifnum\NRC@c@author>2
        \ifNRC@french\else,\fi
      \fi\ \NRC@text@and\
    \fi
    \NRC@addauthortoaddress\NRC@c@author
    \ignorespaces\csname NRC@author\NRC@c@author\endcsname\unskip
  \fi
\egroup
}
%    \end{macrocode}
%
% \begin{macro}{\NRC@default@authaddlist}
% Output the list of authors sorted by address, as in the ident box on
% the title page
%    \begin{macrocode}
\newcommand\NRC@default@authaddlist{\bgroup
  \let\do\NRC@output@authorline
  \NRC@addresses
  \egroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@output@authorline}
% Syntax: \cs{NRC@output@authorline}\marg{addr-label}
%
% Outputs all the authors associated with that address, then a full
% stop (having put the correspondence mark in place if required), then
% the address
%    \begin{macrocode}
\newcommand\NRC@output@authorline[1]{\bgroup
  \@tempswafalse
  \expandafter\@tempcnta\NRC@valcounter{addr@#1}\relax
%    \end{macrocode}
%
% Decide how to do separators between author names on the basis of how
% many there are: case 0 can't happen, and in case 1 the separator
% never gets used
%    \begin{macrocode}
  \ifcase\@tempcnta
  \or
%    \end{macrocode}
%
% in case 2, there's only one separator `` and ''
%    \begin{macrocode}
  \or \def\NRC@authorseparator{\NRC@optfnmark{} \NRC@text@and\ }%
%    \end{macrocode}
%
% in case of 3 or more authors at the same address, we need an
% intelligent separator
%    \begin{macrocode}
  \else
    \def\NRC@authorseparator{%
      \ifnum\@tempcnta>0\relax
        \ifNRC@french
          \NRC@optfnmark,
        \else
          ,\NRC@optfnmark{}
        \fi
        \advance\@tempcnta-1\relax
      \else
        \ifNRC@french
          \NRC@optfnmark\ \NRC@text@and{}
        \else
          ,\NRC@optfnmark{} \NRC@text@and{}
        \fi
      \fi
    }%
    \advance\@tempcnta-2\relax
  \fi
  \let\do\NRC@output@oneauthor
  \noindent{\usefont\f@encoding\rmdefault {bx}n%
            \csname NRC@addrlist#1\endcsname
            \ifNRC@french
              \NRC@optfnmark.%
            \else
              .\NRC@optfnmark
            \fi}
  \if@breakaddress\par\noindent\fi
  \csname NRC@addr@#1\endcsname\par
  \egroup
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@output@oneauthor}
% Syntax: \cs{NRC@output@oneauthor}\marg{author-number}
%
% Outputs one author: for use during processing lists of authors at
% one address.  Switch |@tempswa| set true by first author, and
% subsequent ones get separated by a comma.
%    \begin{macrocode}
\newcommand\NRC@output@oneauthor[1]{%
  \if@tempswa\NRC@authorseparator\else\@tempswatrue\fi
  \csname NRC@initialsonly#1\endcsname
  \def\NRC@optfnmark{\NRC@processAN{#1}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@addrfnote}
% \begin{macro}{\NRC@addrfnbody}
% Syntax: \cs{NRC@addrfnote}\marg{address footnote matter}
%
% This code (rather closely modelled on \cs{thanks}) saves up any
% `footnotes' (i.e., corresponding or present addresses) that may
% occur during typesetting of the ident box
%    \begin{macrocode}
\newcommand\NRC@addrfnote[1]{%
  \NRC@addrfnmark
  \protected@xdef\NRC@addrfnbody{\NRC@addrfnbody
    \protect\NRC@addrfntext[\the\c@footnote]{#1}\protect\par}%
}
\def\NRC@addrfnbody{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@addrfnmark}
% For use by \cs{NRC@addrfnote}; differs from standard
% \cs{footnotemark} only in that it uses current body font for the
% superscripted character.
%    \begin{macrocode}
\newcommand{\NRC@addrfnmark}{%
  {%
    \stepcounter{footnote}%
    \protected@xdef\@thefnmark{\thefootnote}%
  }%
  \leavevmode
  \edef\@x@sf{\the\spacefactor}%
  \nobreak
  \hbox{\textsuperscript{\@thefnmark}}%
  \spacefactor\@x@sf\relax
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\thanks}
% Syntax: \cs{thanks}\marg{comment}
%
% This redefinition of the standard \LaTeX{} command puts the notes
% into the IDbox.
%    \begin{macrocode}
\let\thanks\NRC@addrfnote
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@addrfntext}
% Syntax: \cs{NRC@addrfntext}\oarg{mark}\marg{body}
%
% Does the slightly gutted footnotes we have in the ident block
%    \begin{macrocode}
\def\NRC@addrfntext[#1]#2{%
  \begingroup
    \csname c@\@mpfn\endcsname #1\relax
    \unrestored@protected@xdef\@thefnmark{\thempfn}%
  \endgroup
  \@makefntext{%
    \rule\z@\footnotesep
    \NRC@sectragged\ignorespaces
    #2%
    \@finalstrut\strutbox}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@processAN}
% Syntax: \cs{NRC@processAN}\marg{author number}
%
% Generate the \cs{AddressNote}s for this author; takes account of
% multiple notes for one author (placing a comma between the note
% numbers superscripted after the author's name)
%    \begin{macrocode}
\newcommand\NRC@processAN[1]{%
  \@tempcntb 0\relax
  \loop
    \if@NRCcounter{AN#1}>\@tempcntb
      \advance\@tempcntb 1\relax
      \csname NRC@AN#1.\the\@tempcntb\endcsname
%    \end{macrocode}
%
% Note, we can't use \cs{if@NRCcounter} here, because we need to have
% something that the parser will cope with as being a conditional
% command
%    \begin{macrocode}
      \expandafter\ifnum\csname NRC@c@AN#1\endcsname>\@tempcntb
        \textsuperscript{,}%
      \fi
  \repeat
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\specialtitle}
% \begin{macro}{\@specialtitle}
% \begin{macro}{\if@specialtitle}
% \begin{macro}{\if@specialonly}
% Syntax: \cs{specialtitle}\marg{title}, or
% \cs{specialtitle*}\marg{title}
%
% Declares a boxed reversed-colour box at the top of the page.  The
% \marg{title} appears in the box.  If the \texttt{*}-form of the
% command is used, no `regular' title block is expected, and the
% reversed box is the only title for this item; otherwise, a normal
% title box exists, with the special title block included within it.
%    \begin{macrocode}
\newcommand\specialtitle{\@ifstar
  {\@specialonlytrue\@specialtitle}%
  {\@specialonlyfalse\@specialtitle}}
\newcommand\@specialtitle[1]{\gdef\@special@title{#1}\@specialtitletrue}
\newif\if@specialtitle  \@specialtitlefalse
\newif\if@specialonly
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \subsection{Setting the title}
%
% \begin{macro}{\NRC@titleoffset}
% \cs{NRC@titleoffset} holds the offset of titles from the left margin
% (note, this is larger than the distance between the heavy left bar
% and the title, and is also the left margin used for the abstract/
% r\'esum\'e)
%    \begin{macrocode}
\def\NRC@titleoffset{5pc\relax}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifNRC@IDbox}
% \begin{macro}{\NRC@theIDbox}
% \cs{ifNRC@IDbox} is globally set to determine whether an IDbox is
% needed (initially false: may be set true inside \cs{NRC@maketitle}).
% If we're doing a two-column IDbox, it gets set into \cs{NRC@theIDbox}
%    \begin{macrocode}
\newif\ifNRC@IDbox
\global\NRC@IDboxfalse
%<nrc2>\newbox\NRC@theIDbox
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\maketitle}
% \begin{macro}{\ifNRC@closingrule}
% Syntax: \cs{maketitle}\meta{optional-asterisk}
%
% Simply use what's gone before.  If the \meta{optional-asterisk} is
% present (two-column classes only), a 1pc rule is placed after the
% abstract/r\'esum\'e: this is required if the whole is so long that
% it runs over to a second page.
%
% First, let's define a flag for this closing rule
%    \begin{macrocode}
%<*nrc2>
\newif\ifNRC@closingrule
\NRC@closingrulefalse
%</nrc2>
%    \end{macrocode}
%
% Start the definition.  There's not actually much code in common for
% the 1-column and the 2-column cases.  The 1-column case is in
% fact \emph{much} simpler.
%    \begin{macrocode}
\renewcommand\maketitle{%
%    \end{macrocode}
%
% For 1-column setting, we start by adjusting the skip from the base of
% the headline (consisting, in this case, merely of the folio) to the
% baseline of the title.  Flying blind (calculation doesn't seem to
% get this right, so this is an empirical separation)\dots
%    \begin{macrocode}
%<*nrc1>
  \NRC@maketitle
  \vspace*{2pc}%
  \ifNRC@IDbox\NRC@makeIDbox{\textwidth}\fi
}
%</nrc1>
%    \end{macrocode}
%
% The other (2-column) journals set themselves with a title at the
% top, and the rest in 2 columns.  First detect (and save the flag
% for) the closing rule; then continue 
%    \begin{macrocode}
%<*nrc2>
  \@ifstar{\NRC@closingruletrue\NRC@iimaketitle}{\NRC@iimaketitle}%
}
\newcommand{\NRC@iimaketitle}{%
  \NRC@maketitle
  \ifNRC@IDbox\NRC@makeIDbox{%
    \if@onecolid\NRC@columnwidth\else\textwidth\fi}%
  \fi
  \ifx\NRC@abstract@i\@undefined
    \NRC@warning{Neither abstract nor resume given}%
  \else
    \begingroup
      \the\NRC@abstract@i
      \@topsepadd\z@
      \endtrivlist
    \endgroup
    \ifx\NRC@abstract@ii\@undefined
      \NRC@warning{One of abstract and resume missing}%
    \else
      \gdef\NRC@absressep{8}%
      \begingroup
        \the\NRC@abstract@ii
        \@topsepadd\z@
        \endtrivlist
        \endgroup
    \fi
  \fi
%    \end{macrocode}
%
% Now we insert the closing rule, if the user asked for it.  The space
% above and below the rule is to be \texttt{1pc} nominal, but in a
% properly formatted paper, the abstract or r\'esum\'e (whichever
% came second) will have added \texttt{8pt} by way of \cs{topsep} at
% the bottom of the list.  We therefore only add \texttt{4pt} above
% the rule.
%
% The spacing in the absence of the rule is still that derived from
% \texttt{nrc1.cls} --- it may need adjustment.
%    \begin{macrocode}
  \ifNRC@closingrule
    \vskip 4\p@
    \noindent\rule{\textwidth}{\p@}
    \vskip 1pc
  \else
    \vspace*{8\p@}%
  \fi
  \global\dbltextfloatsep \z@
  \RestartDouble
  \if@onecolid
    \ifNRC@IDbox
      \@float{figure}[b!]
        \box\NRC@theIDbox
      \end@float
    \fi
  \fi
}
%</nrc2>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@maketitle}
% Syntax: \cs{NRC@maketitle}
%
% Makes the title of a paper, which will reside at the top of the
% first page of the paper.
%
% First, do we have a reversed-box special title?  If we do, and it's
% the only title we have, we create it now.
%    \begin{macrocode}
\newcommand{\NRC@maketitle}{%
  \vspace*{-6\p@}%
  \if@specialtitle
    \if@specialonly
      \bgroup
        \fboxsep\z@
        \noindent\hspace{\NRC@titleoffset}%
        \colorbox{black}{%
          \hskip 1pc\relax
%<*nrc2>
          \parbox[t]{37pc}{%} match extra parbox opening
            \fontsize{18}{28}%
%</nrc2>
%<*nrc1>
          \parbox[t]{28pc}{%
            \fontsize{16}{24}%
%</nrc1>
            \usefont\f@encoding\sfdefault mn%
            \NRC@sectragged
            \advance\rightskip 1pc\relax
            \textcolor{white}{%
              \vrule \@height21\p@ \@depth\z@  \@width\z@
              \@special@title
              \vrule \@height\z@   \@depth9\p@ \@width\z@}%
          }%
        }%
        \par
        \pagestyle{nrcplain}%
        \thispagestyle{nrcplain}%
      \egroup
%    \end{macrocode}
%
% This article \emph{only} has a special title, so we're now
% done\dots\par\noindent\dots\ but how do we signal that?  Pro tem,
% we'll do a touch of the \cs{if@tempswa} diddling
%    \begin{macrocode}
      \@tempswafalse
    \else
      \@tempswatrue
    \fi
  \else
    \@tempswatrue
  \fi
%    \end{macrocode}
%
% Now, we know whether we're to do an `ordinary' paper title (possibly
% in addition to a reversed-box special title); this knowledge is
% encoded in \cs{if@tempswa}, which we now use.
%
% Thereafter, we're generating an `ordinary title'.  Evaluate width
% for box to hold the title (allowing for indent but not left rule)
%    \begin{macrocode}
  \if@tempswa
    \@tempdima\textwidth
    \advance\@tempdima -\NRC@titleoffset
    \setbox\@tempboxa\vbox{%
      \hsize\@tempdima
%    \end{macrocode}
%
% Is there an `ordinary' special title?  If so, we put it in now, so
% as to get it into the bit with a vertical bar along its side
%    \begin{macrocode}
      \if@specialtitle
        \bgroup
          \fboxsep\z@
          \noindent
          \colorbox{black}{%
            \hskip 1pc\relax
%<*nrc2>
            \parbox[t]{37pc}{%} match extra parbox opening
              \fontsize{18}{28}%
%</nrc2>
%<*nrc1>
            \parbox[t]{28pc}{%
              \fontsize{16}{24}%
%</nrc1>
              \usefont\f@encoding\sfdefault mn%
              \NRC@sectragged
              \advance\rightskip 1pc\relax
              \textcolor{white}{%
                \vrule \@height21\p@ \@depth\z@  \@width\z@
                \@special@title
                \vrule \@height\z@   \@depth9\p@ \@width\z@}%
            }%
          }%
          \par
          \vspace*{2pc}%
        \egroup
      \fi
%    \end{macrocode}
%
% Now the common-or-garden `ordinary' title
%    \begin{macrocode}
      \fontsize{18}{24}%
      \usefont\f@encoding\sfdefault cn%
      \NRC@sectragged
      \noindent\@title\par
      \@tempdima 2.5pc
      \advance\@tempdima -\prevdepth
      \advance\@tempdima -11pt% *** pragmatic value ***
      \vspace\@tempdima
      \fontsize{11}\@xiipt
      \selectfont\NRC@sectragged
      \noindent\NRC@defaultauthorlist\par
      \@tempdima 17\p@% 1.5pc - 1pt
      \advance\@tempdima -\prevdepth
      \vspace\@tempdima
      }%
    \@tempdima \NRC@titleoffset
    \advance\@tempdima -4\p@
    \bgroup
      \noindent\hb@xt@\hsize{%
        \vrule \@width4\p@
        \kern \@tempdima
        \vbox{\box\@tempboxa}%
        }%
      \parskip\z@skip
      \par
      \noindent\hrule \@height\p@
    \egroup
    \global\NRC@IDboxtrue
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@makeIDbox}
% Syntax: \cs{NRC@makeIDbox}\marg{width}
%
% Makes an `ident box' for a paper, in the given width (which will
% typically be \cs{textwidth} or \cs{columnwidth})
%
% If we are doing the original sort of ID box (either for the 1-column
% case, or the 2-column classes in the  one-column-only case), we set
% the box into a float at the bottom of the page.  It being an
% unknown sort of float, we could allocate it a float classification,
% but that seems a little \emph{de trop}, so we call it a figure.
%    \begin{macrocode}
\newcommand{\NRC@makeIDbox}[1]{%
%<!nrc2>\@float{figure}[b!]
%<*nrc2>
%    \end{macrocode}
%
% For the 2-column classes, we
% simply stick the ID box into a (\TeX) box, for later use by the
% title-page page style (if it's a 2-column-wide box), or for putting
% into a float \emph{after} two-column typesetting has been
% established.
%    \begin{macrocode}
  \setbox\NRC@theIDbox\vbox\bgroup
    \hsize #1
%</nrc2>
    \noindent\hrule \@height\p@
    \@tempdima #1
    \advance\@tempdima -1pc
    \setbox\@tempboxa\hbox{%
      \smallt\NRC@received
    }%
    \setbox\@tempboxa\vbox{%
      \hsize \@tempdima
      \@tempdima 1pc
      \advance\@tempdima -\ht\@tempboxa
      \vspace{\@tempdima}%
%    \end{macrocode}
%
% If the IDbox is going to be set in two columns internally, start up
% multicols now; we zero the multicolumn separator to avoid excessive
% vertical spacing at the top of the IDbox (note that since we're
% inside a \cs{vbox} at this stage we can rely on grouping to restore
% the value for us)
%    \begin{macrocode}
%<*nrc2>
      \if@onecolid\else
        \if@multcolid
          \linewidth \hsize
          \multicolsep\z@skip
          \columnsep 1.5pc
          \begin{multicols}{2}
        \fi
      \fi
%</nrc2>
%    \end{macrocode}
%
% Insert the received/accepted/`other ID dates'/`published on the web
% site' line(s).  The [rev]received/[rev]accepted commands sort out their
% own internal spacing, and a global marker (\cs{NRC@received@sep}) says
% whether a space is needed before the next thing in the ID box.
%    \begin{macrocode}
      \noindent
      {%
        \smallt
        \NRC@received
        \ifNRC@webpub
          \NRC@received@sep
          \NRC@webpub
        \fi
        \par
      }%
      \vspace{7\p@}% *** pragmatic value ***
%    \end{macrocode}
%
% Change font size for the next few things
%    \begin{macrocode}
      \smallt
%    \end{macrocode}
%
% Insert the associate editor's name, if there is one
%    \begin{macrocode}
      \ifNRC@assoced
        \noindent\NRC@assoced\par
        \vspace{7\p@}% *** pragmatic value ***
      \fi
%    \end{macrocode}
%
% Insert the corresponding editor's name, if there is one
%    \begin{macrocode}
      \ifNRC@corred
        \noindent\NRC@corred\par
        \vspace{7\p@}% *** pragmatic value ***
      \fi
%    \end{macrocode}
%
% Insert the dedication, if there is one
%    \begin{macrocode}
      \ifNRC@dedication
        \bgroup
          \NRC@sectragged
          \noindent
          \textit{\NRC@dedication}\par
          \vspace{7\p@}% *** pragmatic value ***
        \egroup
      \fi
%    \end{macrocode}
%
% Insert the list of abbreviations, if there is one
%    \begin{macrocode}
      \if@abbreviations
        \bgroup
          \NRC@sectragged
          \noindent
          \textbf{\NRC@text@abbreviations\ifNRC@french~\fi\string:}%
                        \ \@abbreviations\par
          \vspace{7\p@}% *** pragmatic value ***
        \egroup
      \fi
%    \end{macrocode}
%
% Now the list of authors and their
% addresses
%    \begin{macrocode}
      {%
        \@NRC@AddressCommands
        \NRC@default@authaddlist
%    \end{macrocode}
%
% Add the comment deadline note
%    \begin{macrocode}
        \ifNRC@commdate
          \vspace{7\p@}% pragmatic
          \noindent\NRC@commdate\par
        \fi
%    \end{macrocode}
%
% and finally the footnote bodies, if there are any
%    \begin{macrocode}
        \ifx\NRC@addrfnbody\@empty
        \else
          \vspace{7\p@}% *** pragmatic value ***
          \NRC@addrfnbody
        \fi
      }%
%<*nrc2>
      \if@onecolid\else
        \if@multcolid
          \end{multicols}
        \fi
      \fi
%</nrc2>
    }%
%    \end{macrocode}
% (That brace closes the assignation to \cs{@tempboxa}.)
%
% And now finish off the float that makes up the ID box
%    \begin{macrocode}
    \@tempdima 1pc
    \advance\@tempdima -4\p@
    \noindent\hb@xt@#1{%
      \vrule \@width4\p@
      \kern \@tempdima
      \vbox{\box\@tempboxa}%
      }
%<!nrc2>\end@float
%<*nrc2>
    \egroup
  \if@onecolid
  \else
%   \typeout{\string\NRC@theIDbox: ht=\the\ht\NRC@theIDbox,
%      dp=\the\dp\NRC@theIDbox}%
    \@tempdima \ht\NRC@theIDbox
    \advance\@tempdima \dp\NRC@theIDbox
    \advance\@tempdima \textfloatsep
    \global\advance\@colht -\@tempdima
    \global\@colroom \@colht
    \global\vsize    \@colht
    \global\pagegoal \@colht
    \global\advance\footskip \@tempdima
  \fi
%</nrc2>
  \thispagestyle{nrctitlepage}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@restorefootskip}
% Used to restore \cs{footskip} after mucking about with it in
% case we're going to encounter a huge great monster
% abstract/r\'esum\'e; can be used anywhere at any time, since it's
% restoring a default value\dots
%    \begin{macrocode}
\xdef\NRC@restorefootskip{%
  \global\noexpand\footskip\the\footskip}%
%    \end{macrocode}
% \end{macro}
%
% \subsection{Abstract and R\'esum\'e}
%
% \begin{environment}{abstract}
% \begin{environment}{resume}
% \begin{macro}{\NRC@absressep}
% \begin{macro}{\NRC@extract@name}
% The abstract and r\'esum\'e are specified as simple list
% environments, and preserved in a token register.  Nothing special is
% done about their body, and no effort is made to enforce the order
% (i.e., English or French first) that they appear.  Apart from the
% name (and the fact that the abstract environment already exists, so
% that it must needs be redefined) they are implemented by identical
% code.  If Babel is loaded with the appropriate language, each
% environment safely (i.e., without writing the \verb|.aux| file)
% selects the appropriate language within itself.
%
% In the case of the nrc1 class, the token register is immediately
% typeset.  In the case of the nrc2 class, the token registers are
% stored for use when a \cs{maketitle} command is issued.
%
% \cs{NRC@absressep} is the value to use for \cs{topsep} for the
% \emph{top} only of the \texttt{trivlist} implementation of the
% environments (\cs{z@} is used at the bottom of the environments:
% things get out of hand otherwise\dots).  It gets multiplied by
% \cs{p@}.
%
% The other skips are played fast and loose with, too, inside the
% environments' groups.  \cs{partopsep} is set zero, since we want
% absolute control of separation, and the stretchability of
% \cs{parskip} is also stamped upon while we execute the \cs{trivlist}
% command that establishes our `list'.
%    \begin{macrocode}
\newcommand\NRC@absressep{18}
\renewenvironment{abstract}{%
  \NRC@gather@env{\expandafter\topsep\NRC@absressep\p@
    \partopsep\z@
    \parskip\z@
    \trivlist
    \parskip0\p@ \@plus\p@
    \leftmargin \NRC@titleoffset
    \advance\linewidth -\leftmargin
    \advance\linewidth -\rightmargin
    \advance\@totalleftmargin \leftmargin
    \parshape \@ne \@totalleftmargin \linewidth
    \item[]%
    \let\NRC@extract@name\@firstoftwo
    \ifx\extrasenglish\@undefined
    \else
      \select@language{english}%
    \fi
    \smalll
    \textbf{\abstractname}:%
    \NRC@sectragged
    \ \ignorespaces}}%
%<*nrc1>
  {%
    \the\NRC@gather@toks
    \@topsepadd\z@
    \endtrivlist
    \gdef\NRC@absressep{8}}
%</nrc1>
%    \end{macrocode}
%
% In the two-column classes, we don't typeset the abstract (or
% r\'esum\'e) as we come to it, merely relying on having saved it in
% \cs{NRC@abstract@i(i)} and dumping it out in the course of
% \cs{maketitle}'s ``full-width'' phase.
%    \begin{macrocode}
%<nrc2>  {}
%    \end{macrocode}
%
% Now the analagous things for the French r\'esum\'e
%    \begin{macrocode}
\newenvironment{resume}{%
  \NRC@gather@env{\expandafter\topsep\NRC@absressep\p@
    \partopsep\z@
    \parskip\z@
    \trivlist
    \parskip0\p@ \@plus\p@
    \leftmargin \NRC@titleoffset
    \advance\linewidth -\leftmargin
    \advance\linewidth -\rightmargin
    \advance\@totalleftmargin \leftmargin
    \parshape \@ne \@totalleftmargin \linewidth
    \item[]%
    \let\NRC@extract@name\@secondoftwo
    \ifx\extrasfrench\@undefined
    \else
      \select@language{french}%
    \fi
    \smalll
    \textbf{\nomresume}\,:%
    \NRC@sectragged
    \ \ignorespaces}}%
%<*nrc1>
  {%
    \the\NRC@gather@toks
    \@topsepadd\z@
    \endtrivlist
    \gdef\NRC@absressep{8}}
%</nrc1>
%<nrc2>  {}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{environment}
% \end{environment}
%
% \begin{macro}{\nomresume}
% \begin{macro}{\traduit}
% \begin{macro}{\Traduit}
% \begin{macro}{\translation}
% \begin{macro}{\keywords}
% \begin{macro}{\motscles}
% \begin{macro}{\PACS}
% \begin{macro}{\NRC@PACS@en}
% \begin{macro}{\NRC@PACS@ens}
% \begin{macro}{\NRC@PACS@fr}
% \begin{macro}{\NRC@PACS@frs}
% Various small supporting macros for the above.
%
% \cs{traduit} is used at the end of a r\'esum\'e when the author
% hasn't provided a French version: the editors have translated the
% English abstract, and \cs{traduit} records this fact.  Similarly,
% \cs{translation} is used at the end of an abstract that has been
% translated for a French-writing author.
%
% \cs{Traduit} is as \cs{traduit}, but with a capital letter for
% r\'edaction\dots
%
% \cs{keywords} and \cs{motscles} may also be used within an abstract
% or resume (respectively) environment.  If used, they should appear
% immediately after the body of the abstract and above any
% \cs{traduit} or \cs{translation} command.
%
% \cs{PACS} generates PACS code entries for the end of abstracts or
% resum\'es; it ``knows'' which language to use, from the setting of
% \cs{NRC@extract@name}.
%    \begin{macrocode}
\newcommand\nomresume{R\'esum\'e}
\newcommand\traduit{\par\vspace{4\p@}\noindent
  [Traduit par la r\'edaction]%
}
\newcommand\Traduit{\par\vspace{4\p@}\noindent
  [Traduit par la R\'edaction]%
}
\newcommand\translation{\par\vspace{4\p@}\noindent
  [Journal translation]%
}
\newcommand\keywords[1]{\par\vspace{4\p@}\noindent
  \emph{Key words:}\ #1.%
}
\newcommand\motscles[1]{\par\vspace{4\p@}\noindent
  \emph{Mots cl\'es\,:}\ #1.%
}
\newcommand\PACS{%
  \par\vspace{4\p@}%
  \noindent PACS\ %
  \@ifstar{%
    \NRC@extract@name\NRC@PACS@ens\NRC@PACS@frs
  }{%
    \NRC@extract@name\NRC@PACS@en\NRC@PACS@fr
  }%
}
\newcommand\NRC@PACS@ens[1]{No.:\ #1}
\newcommand\NRC@PACS@en[1]{Nos.:\ #1}
\newcommand\NRC@PACS@frs[1]{N\textsuperscript{o}\,:\ #1}
\newcommand\NRC@PACS@fr[1]{N\textsuperscript{os}\,:\ #1}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@abstract@toks}
% \begin{macro}{\NRC@resume@toks}
% \begin{macro}{\NRC@gather@toks}
% In the two-column classes, \cs{NRC@abstract@toks} and
% \cs{NRC@resume@toks} are used to gather the abstract or r\'esum\'e;
% in the physics class both are gathered in \cs{NRC@gather@toks}
%    \begin{macrocode}
%<nrc2>\newtoks\NRC@abstract@toks
%<nrc2>\newtoks\NRC@resume@toks
%<nrc1>\newtoks\NRC@gather@toks
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@gather@env}
% Syntax: \cs{NRC@gather@env}\marg{preamble}
%
% Gather the contents of a text environment into the corresponding
% token register.  The routine assumes that it's gathering an
% abstract's content, and inserts the \meta{preamble} in front of the
% gathered text (this will be language selection, `Abstract' or
% `R\'esum\'e', and the start of the doings of the abstract
% environment itself).  (There's no need of a postamble, since the
% same termination is used in both cases.  This is a bit of a relief,
% since it would be dead tricky to program.)
%
% The routine has the side effect of setting up \cs{NRC@abstract@i}
% (to the token register containing the first abstract gathered) and
% \cs{NRC@abstract@ii} (to the second one)
%
% This code uses what (now) seems a Usual trick (it originally
% derives, in my experience, from David Carlisle's tabularx package).
%    \begin{macrocode}
\newcommand\NRC@gather@env[1]{%
  \let\NRC@gathering\@currenvir
%<*nrc2>
  \expandafter\let\expandafter\NRC@gather@toks
    \csname NRC@\NRC@gathering @toks\endcsname
%</nrc2>
  \global\NRC@gather@toks{#1}%
  {\ifnum0=`}\fi
  \NRC@gather@body
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@gather@body}
% Syntax: \cs{NRC@gather@body}\marg{body-portion}\cs{end}
%
% Gathers the body of an environment up to the next instance of
% \cs{end}
%    \begin{macrocode}
\long\def\NRC@gather@body#1\end{%
  \global\NRC@gather@toks\expandafter{\the\NRC@gather@toks#1}%
  \NRC@gather@findend
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@gather@findend}
% Syntax: \cs{NRC@gather@findend}\marg{end-arg}
%
% Checks the `argument' that the user thought she was giving to the
% \cs{end} `command' that terminated the argument of a
% \cs{NRC@gather@body}
%    \begin{macrocode}
\newcommand\NRC@gather@findend[1]{%
  \def\@tempa{#1}%
  \ifx\@tempa\NRC@gathering
    \expandafter\NRC@gather@end
  \else
    \global\NRC@gather@toks\expandafter{\the\NRC@gather@toks\end{#1}}%
    \expandafter\NRC@gather@body
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@gather@end}
% \begin{macro}{\NRC@abstract@i}
% \begin{macro}{\NRC@abstract@ii}
% Syntax: \cs{NRC@gather@end}
%
% Terminates a gathering operation, by closing the group it's operated
% in, setting up the appropriate \cs{NRC@abstract@i(i)} if necessary
% and finally issuing an `end \meta{gather-environment}' command.
%    \begin{macrocode}
\newcommand\NRC@gather@end{%
  \ifnum0=`{\fi}%
%    \end{macrocode}
%
% we only need preserve the token registers if we're in a two-column
% class
%    \begin{macrocode}
%<*nrc2>
  \ifx\NRC@abstract@i\@undefined
    \global\let\NRC@abstract@i \NRC@gather@toks
  \else
    \global\let\NRC@abstract@ii\NRC@gather@toks
  \fi
%</nrc2>
  \expandafter\end\expandafter{\NRC@gathering}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
% \section{Font size definitions}
%
% \begin{macro}{\easebaselines}
% \begin{macro}{\ifNRC@easedbaselines}
% \begin{macro}{\ifNRC@relaxedspacing}
% Syntax: \cs{easebaselines}
%
% An editorial command for two-column papers: if a decision is taken
% to ease the baselines of the paper, this command is issued: the
% effect is very slightly to ease the values for \cs{baselineskip}
% used for \cs{normalsize}, \cs{small} and \cs{footnotesize} font
% selections.  A preamble command, only.
%
% \cs{ifNRC@relaxedspacing} allows the extended relaxation of skips
% (above sectioning commands, around floats, and around equations)
% that seems to be necessary in some cases.  The switch is a separate
% on from \cs{ifNRC@easedbaselines}, at present, though implemented
% (as it were) as a sub-switch; however it always has the same value
% as the main switch.
%    \begin{macrocode}
\newif\ifNRC@easedbaselines  \NRC@easedbaselinesfalse
\newif\ifNRC@relaxedspacing  \NRC@relaxedspacingfalse
\newcommand*{\easebaselines}{%
  \ifNRC@author@use
    \NRC@warning{\string\easebaselines\space is an editor command}
  \fi
  \NRC@easedbaselinestrue
% \NRC@relaxedspacingtrue
  \AtBeginDocument{\renewcommand{\arraystretch}{1.05}}%
}
\@onlypreamble\easebaselines
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\normalsize}
% The user level command for the main size is |\normalsize|.
% Internally \LaTeX{} uses |\@normalsize| when it refers to the
% main size. |\@normalsize| will be defined to work like
% |\normalsize| if the latter is redefined from its default
% definition (that just issues an error message). Otherwise
% |\@normalsize| simply selects a \texttt{10pt}/\texttt{12pt} size.
% 
% The |\normalsize| macro also sets new values for\\
% |\abovedisplayskip|, |\abovedisplayshortskip| and
% |\belowdisplayshortskip|.
%    \begin{macrocode}
\renewcommand{\normalsize}{%
%<nrc2> \ifNRC@easedbaselines
    \@setfontsize\normalsize\@xpt\@xiipt
%<*nrc2> 
  \else
    \@setfontsize\normalsize\@xpt{11}%
  \fi
%</nrc2>
  \ifNRC@relaxedspacing
    \abovedisplayskip 10\p@ \@plus0.0003fil \@minus5\p@
  \else
    \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
  \fi
  \abovedisplayshortskip \z@ \@plus3\p@
  \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
%    \end{macrocode}
%
% The |\belowdisplayskip| is always equal to the
% |\abovedisplayskip|. The parameters of the first level list at
% \cs{normalsize} are always given by |\@listI|.
%    \begin{macrocode}
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI}
%    \end{macrocode}
%
% We initially choose the normalsize font (article class does this,
% but it's also done in \cs{begin}|{document}|, so it's not entirely
% clear what the point is\dots).
%    \begin{macrocode}
\normalsize
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\small}
% This is similar to |\normalsize|.
%    \begin{macrocode}
\renewcommand{\small}{%
%<nrc2> \ifNRC@easedbaselines
    \@setfontsize\small\@ixpt{11}%
%<*nrc2>
  \else
    \@setfontsize\small\@ixpt\@xpt
  \fi
%</nrc2>
  \ifNRC@relaxedspacing
    \abovedisplayskip 8.5\p@ \@plus0.0003fil \@minus4\p@
  \else
    \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@
  \fi
  \abovedisplayshortskip \z@ \@plus2\p@
  \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
  \def\@listi{\leftmargin\leftmargini
    \topsep 4\p@ \@plus2\p@ \@minus2\p@
    \parsep 2\p@ \@plus\p@ \@minus\p@
    \itemsep \parsep}%
  \belowdisplayskip \abovedisplayskip
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\smalll}
% \begin{macro}{\smallt}
% These are variants of \cs{small} for use where the baseline spacing
% is fixed regardless of the state of \cs{easedbaselines}; \cs{smalll}
% (loose small) has 11pt baseline skip; \cs{smallt} (tight small) has
% 10pt baseline skip.
%    \begin{macrocode}
\newcommand{\smalll}{%
  \@setfontsize\small\@ixpt{11}%
  \abovedisplayshortskip \z@ \@plus2\p@
  \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
  \def\@listi{\leftmargin\leftmargini
    \topsep 4\p@ \@plus2\p@ \@minus2\p@
    \parsep 2\p@ \@plus\p@ \@minus\p@
    \itemsep \parsep}%
  \belowdisplayskip \abovedisplayskip
}
\newcommand{\smallt}{%
  \@setfontsize\small\@ixpt\@xpt
  \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@
  \abovedisplayshortskip \z@ \@plus2\p@
  \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
  \def\@listi{\leftmargin\leftmargini
    \topsep 4\p@ \@plus2\p@ \@minus2\p@
    \parsep 2\p@ \@plus\p@ \@minus\p@
    \itemsep \parsep}%
  \belowdisplayskip \abovedisplayskip
}
 %    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\footnotesize}
% This is similar to |\normalsize|.
%    \begin{macrocode}
\renewcommand{\footnotesize}{%
%<nrc2> \ifNRC@easedbaselines
    \@setfontsize\footnotesize\@viiipt{9.5}%
%<*nrc2>
  \else
    \@setfontsize\footnotesize\@viiipt\@ixpt
  \fi
%</nrc2>
  \ifNRC@relaxedspacing
    \abovedisplayskip 6\p@ \@plus0.0003fil \@minus4\p@
  \else
    \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@
  \fi
  \abovedisplayshortskip \z@ \@plus\p@
  \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@
  \def\@listi{\leftmargin\leftmargini
    \topsep 3\p@ \@plus\p@ \@minus\p@
    \parsep 2\p@ \@plus\p@ \@minus\p@
    \itemsep \parsep}%
  \belowdisplayskip \abovedisplayskip
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\scriptsize}
% \begin{macro}{\tiny}
% \begin{macro}{\large}
% \begin{macro}{\Large}
% \begin{macro}{\LARGE}
% \begin{macro}{\huge}
% \begin{macro}{\Huge}
% These are all much simpler than the previous macros: they just
% select a new fontsize, but leave the parameters for displays and
% lists alone.
%    \begin{macrocode}
\renewcommand{\scriptsize}{\@setfontsize\scriptsize\@viipt\@viiipt}
\renewcommand{\tiny}{\@setfontsize\tiny\@vpt\@vipt}
\renewcommand{\large}{\@setfontsize\large\@xiipt{14}}
\renewcommand{\Large}{\@setfontsize\Large\@xivpt{18}}
\renewcommand{\LARGE}{\@setfontsize\LARGE\@xviipt{22}}
\renewcommand{\huge}{\@setfontsize\huge\@xxpt{25}}
\renewcommand{\Huge}{\@setfontsize\Huge\@xxvpt{30}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \section{Divisions of the paper}
%
% \begin{macro}{\NRC@sectragged}
% All the section titles that aren't run-in (as well as a whole bunch
% of other things) are set ragged right, which we define as:
%    \begin{macrocode}
\newcommand{\NRC@sectragged}{\hyphenpenalty\@M
  \rightskip\z@ \@plus 5em
  \parfillskip\z@ \@plus 1fil
  \spaceskip=0.3333em\relax
  \xspaceskip=0.5em\relax
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{\LaTeX{} `sections'}
%
% \begin{macro}{\section}
% \begin{macro}{\Asection}
% \begin{macro}{\subsection}
% \begin{macro}{\Bsection}
% \begin{macro}{\subsubsection}
% \begin{macro}{\Csection}
% \begin{macro}{\subsubsubsection}
% \begin{macro}{\Dsection}
% \begin{macro}{\paragraph}
% \begin{macro}{\Esection}
%
% The following definitions all incorporate the baseline-baseline
% skips of the specification in a slightly cavalier way: the skip is
% calculated out in points, and the font size of the following text is
% subtracted.  This is inaccurate because (1) the depth of the text
% above is ignored (how would one find it?), and (2) the font size is
% only rather loosely related to the typical height of a line of
% text.  However, the results prove acceptable, so let's not worry!
%    \begin{macrocode}
\renewcommand\section{%
               \@startsection{section}%
                             \@ne
                             \z@
%<*nrc1>
                             {12\p@ \@plus4.5\p@ \@minus1.5\p@}%
                             {6\p@}%
%</nrc1>
%<*nrc2>
                             {18\p@ \@plus6\p@}%
                             {6\p@ \@plus3\p@}%
%</nrc2>
                             {\fontsize{11}{12}%
%<nrc2>                       \let\@hangfrom\@firstofone\noindent
                              \usefont\f@encoding\sfdefault cn%
                              \NRC@sectragged}%
                            }
\let\Asection\section
\renewcommand\subsection{%
               \@startsection{subsection}%
                             \tw@
                             \z@
%<*nrc2>
                             {12\p@ \@plus6\p@}%
                             {.1\p@ \@plus2\p@}%
%</nrc2>
%<*nrc1>
                             {14\p@ \@plus4.5\p@ \@minus1.5\p@}%
                             {2\p@ \@plus \p@}%
%</nrc1>
                             {\reset@font\bfseries
%<nrc2>                       \let\@hangfrom\@firstofone\noindent
                              \NRC@sectragged}%
                            }
\let\Bsection\subsection
\renewcommand\subsubsection{%
               \@startsection{subsubsection}%
                             \thr@@
                             \z@
%<*nrc2>
                             {9\p@ \@plus3\p@}%
                             {.1\p@ \@plus2\p@}%
%</nrc2>
%<*nrc1>
                             {14\p@ \@plus4.5\p@ \@minus1.5\p@}%
                             {2\p@ \@plus \p@}%
%</nrc1>
                             {\reset@font\bfseries\itshape
%<nrc2>                       \let\@hangfrom\@firstofone\noindent
                              \NRC@sectragged}%
                            }
\let\Csection\subsubsection
\newcommand\subsubsubsection{%
               \@startsection{paragraph}%
                             4%
                             \z@
%<*nrc2>
                             {7\p@ \@plus2\p@}%
                             {.1\p@ \@plus2\p@}%
%</nrc2>
%<*nrc1>
                             {14\p@ \@plus4.5\p@ \@minus1.5\p@}%
                             {2\p@ \@plus \p@}%
%</nrc1>
                             {\reset@font\itshape
%<nrc2>                       \let\@hangfrom\@firstofone\noindent
                              \NRC@sectragged}%
                            }
\let\Dsection\subsubsubsection
% \renewcommand\paragraph{%
%                \@startsection{subparagraph}%
%                              5%
%                              \z@
%                              {3.25ex \@plus1ex \@minus.2ex}%
%                              {-1em}%
%                              {\normalfont\normalsize\bfseries}%
%                           }
\renewcommand\paragraph{%
               \@startsection{subparagraph}%
                             4%
                             \z@
                             {8\p@ \@plus2.5\p@ \@minus\p@}%
                             {-0.5em}%
                             {\reset@font\itshape}%
                            }
\let\Esection\paragraph
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@seccntformat}
% \begin{macro}{\NRC@seccnt@paragraph}
%
% Section counters have a trailing full stop.
%    \begin{macrocode}
\renewcommand\@seccntformat[1]{%
  \@ifundefined{NRC@seccnt@#1}%
    {\@nameuse{the#1}.\hskip0.5em\relax}%
    {\@nameuse{NRC@seccnt@#1}}%
}
\newcommand\NRC@seccnt@paragraph{\theparagraph.\ }
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{environment}{secnumdepth}
%
% For the above to have the effect we require, we must allow
% \cs{paragraph}'s section number to appear\dots
%    \begin{macrocode}
\setcounter{secnumdepth}{4}
%    \end{macrocode}
% \end{environment}
%
%
% \subsection{Appendices}
%
% We introduce a minor extension of the \LaTeX{} \cs{appendix}
% command.  (Used as in \LaTeX{}, the command behaves in the standard
% way.)
%
% \begin{macro}{\appendix}
% \begin{macro}{\NRC@appendix}
% \begin{macro}{\NRC@@appendix}
% \begin{macro}{\NRC@seccnt@section}
% Syntax: \cs{appendix}\meta{optional-asterisk}
%
% Used as in `bare' \LaTeX{}, the command merely does the \LaTeX{}
% thing, \emph{viz}., reset section numbering and change the form of
% the section counter.  In the form \cs{appendix*}, the command
% additionally prepends section headings with `Appendix'.
%    \begin{macrocode}
\let\NRC@@appendix\appendix
\renewcommand{\appendix}{\@ifstar \NRC@appendix\NRC@@appendix}
\newcommand{\NRC@appendix}{\NRC@@appendix
  \gdef\NRC@seccnt@section{\appendixname\ %
    \thesection\ifNRC@french~\string:\else:\fi\hskip0.5em\relax
  }%
}
%    \end{macrocode}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%    \end{macro}
%
%
% \section{Miscellaneous typesetting}
%
% \subsection{Footnotes}
%
% The footnotes used within the ident box on the title page are dealt
% with separately; here we specify footnotes for the body text.
%
% \begin{macro}{\footnoterule}
% The skip allows for 3pt (nrc1) or 4pt (nrc2) between the rule and
% the text of the footnote (the \cs{footnoterule} command adds nothing
% to the vertical spacing, as is proper).
%    \begin{macrocode}
%<*nrc1>
\skip\footins20\p@
\renewcommand\footnoterule{\kern-4\p@
  \hrule \@height\p@
  \kern3\p@
}
%</nrc1>
%<*nrc2>
\skip\footins14\p@\@plus10\p@
\renewcommand\footnoterule{\kern-5\p@
  \hrule \@height\p@
  \kern4\p@
}
%</nrc2>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@footnotetext}
% Since we use a non-standard size for footnotes, we reproduce the
% whole of the \cs{@footnotetext} command here, with the size
% changed.  The size used is ``tight'' small (9/10pt).
%    \begin{macrocode}
\long\def\@footnotetext#1{%
  \insert\footins{%
    \reset@font\smallt
    \interlinepenalty\interfootnotelinepenalty
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
    \protected@edef\@currentlabel{%
       \csname p@footnote\endcsname\@thefnmark
    }%
    \color@begingroup
      \@makefntext{%
        \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox
      }%
    \color@endgroup
  }%
}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@makefntext}
% And the body of footnotes looks as follows:
%    \begin{macrocode}
\renewcommand\@makefntext[1]{%
  \@hangfrom{%
    \ifNRC@french
      \@thefnmark.\hskip0.3333em%
    \else
      \hb@xt@4\p@{\@makefnmark\hss}%
    \fi
  }%
  #1%
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Mathematics}
%
% \begin{macro}{\mathindent}
% We set \cs{mathindent} according to which side the equations are
% going to appear (it can be either side in either class, nowadays).
%    \begin{macrocode}
\iflefteqnos
  \mathindent32pt
\else
  \mathindent\z@
\fi
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifNRC@amsmath}
% In case that \verb'amsmath' has been loaded, things are going to be
% somewhat different.  So, first of all, we need to detect whether
% this is the case\dots
%    \begin{macrocode}
\newif\ifNRC@amsmath
\NRC@amsmathfalse
\AtBeginDocument{%
  \@ifundefined{tagform@}\relax{%
    \NRC@amsmathtrue
%    \end{macrocode}
%
% If we are indeed under the sway of \verb'amsmath', we need to patch a
% different skip for margin adjustment.  If equation numbers are to be
% set on the left, this will be set non-zero because of the allowance
% needed for the equation tag.
%    \begin{macrocode}
    \iflefteqnos
      \@mathmargin32\p@\relax
    \else
      \@mathmargin\z@skip
    \fi
  }
}
%    \end{macrocode}
% \end{macro}
%
% In case \verb'amsmath' is going to be loaded (we don't know at this
% stage, of course), we ensure it gets told about equations being set
% flush left; we also tell it about left-positioned equation numbers
% if we're doing those:
%    \begin{macrocode}
\iflefteqnos
  \PassOptionsToPackage{fleqn,leqno}{amsmath}
\else
  \PassOptionsToPackage{fleqn}{amsmath}
\fi
%    \end{macrocode}
%
%
% \begin{macro}{\@eqnnum}
% Set an equation number, potentially at the left (this will be zapped
% by amsmath if it's loaded)
%    \begin{macrocode}
\renewcommand{\@eqnnum}{%
  \iflefteqnos
    \hb@xt@1sp{}%
    \rlap{\normalfont\normalcolor
      \hskip -\displaywidth \eqnoformat\theequation}%
  \else
    {%
      \normalfont\normalcolor \eqnoformat\theequation
    }%
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\eqnoformat}
% Syntax: \cs{eqnoformat}\marg{equation number}
%
% Defines the layout of an equation tag; by default this is
% \verb'[number]' (except in \verb'nrc1', in its default state of
% equation numbers being on the right, when it's \verb'(number)'), but
% the user may redefine\dots
%    \begin{macrocode}
%<nrc1> \iflefteqnos
  \newcommand{\eqnoformat}[1]{[\ignorespaces#1\unskip\@@italiccorr]}
%<*nrc1>
\else
  \newcommand{\eqnoformat}[1]{(\ignorespaces#1\unskip\@@italiccorr)}
\fi
%</nrc1>
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tagform@}
% If \verb'amsmath' has been loaded, we need to redo the above when the
% document is actually `starting'.  We also note that \cs{@eqnnum}
% will have been hacked, but that the thing that makes the difference
% is \cs{tagform@}, so we also redo that at this stage.
%    \begin{macrocode}
\AtBeginDocument{\ifNRC@amsmath
    \def\tagform@#1{%
      \maketag@@@{\eqnoformat{#1}}}
  \fi
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@displaymath}
% \begin{macro}{\NRC@@displaymath}
% \begin{macro}{\NRC@enddisplaymath}
% \begin{macro}{\NRC@@enddisplaymath}
% In the first version of the \textsf{nrc2} class, we had the
% \texttt{displaymath} environment ($\equiv$ \cs{[}\cs{]}) as a
% non-indented un-numbered version.  The NRC's editors have come to
% rely on this, even though it provoked problems following a change in
% specification of the maths margins; we therefore restore the
% original functionality here, in a safe way.
%    \begin{macrocode}
%<nrc1>\iflefteqnos
\def\NRC@displaymath{\begingroup
  \ifNRC@amsmath
    \@mathmargin\z@skip
  \else
    \mathindent\z@skip
  \fi
  \NRC@@displaymath
}
\def\NRC@enddisplaymath{\NRC@@enddisplaymath\endgroup}
\AtBeginDocument{\let\NRC@@displaymath\[%
  \let\[\NRC@displaymath
  \let\NRC@@enddisplaymath\]%
  \let\]\NRC@enddisplaymath}%
%<nrc1>\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% Maths sizes affect sub- and superscripts done in text mode, too.
% Specifications exist for all text sizes we actually use: we declare,
% below, only for those sizes that differ from what is in the \LaTeX{}
% kernel.
%    \begin{macrocode}
\DeclareMathSizes  {18}   {18}   \@xiipt \@xpt
\DeclareMathSizes  {16}   {16}   \@xiipt \@xpt
\DeclareMathSizes  {15}   {15}   \@xpt   {8}
\DeclareMathSizes  \@xipt \@xipt \@ixpt  {7}
\DeclareMathSizes  \@ixpt \@ixpt {6}     {5}
%    \end{macrocode}
%
% \begin{macro}{\numberby}
% Syntax: \cs{numberby}\marg{counter}\marg{division-name}
%
% Arrange that \meta{counter} is reset every time \meta{division-name}
% is stepped, and that \cs{the\meta{counter}} is represented as
% `\meta{division-name}.\meta{counter}'
%    \begin{macrocode}
\newcommand\numberby[2]{%
  \@ifundefined{c@#1}{\@nocounterr{#1}}%
  \@ifundefined{c@#2}{\@nocounterr{#2}}%
  \@addtoreset{#1}{#2}%
  \expandafter\gdef\csname the#1\expandafter\endcsname
    \expandafter{\csname the#2\endcsname.\arabic{#1}}%
}
%    \end{macrocode}
% \end{macro}
%
% \emph{Note}: \cs{numberby} is in this section because of its only
% present expected use for number equations by section.
%
% \subsection{Tables}
%
% We need to provide a simple handle on overweight rules.  This we do
% by a modification of the \textsf{variline} package I wrote for the
% TUG'95 proceedings.
%
% \begin{macro}{\hline}
% \begin{macro}{\@shline}
% \begin{macro}{\arrayrulewidth}
% Syntax: \cs{hline}\meta{optional-asterisk}
%
% \cs{hline} and \cs{@shline} are a division into two parts of the
% kernel's \cs{hline}; we set \cs{arrayrulewidth}, too, since it has
% a non-standard value
%    \begin{macrocode}
\renewcommand\hline{%
  \noalign{\ifnum0=`}\fi\@ifstar
    {\@shline{2\p@}}%
    {\@shline{\arrayrulewidth}}}
\newcommand\@shline[1]{\hrule \@height #1\relax
   \futurelet \reserved@a \@xhline}
\arrayrulewidth\p@
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{environment}{tabular}
% \begin{environment}{NRC@@tabular}
% Syntax: unchanged
%
% We save the \LaTeX{} \textsf{tabular} environment definition, and
% sneak a size setting into our redefinition.  We have to do this
% \cs{AtBeginDocument}, since useful packages (such as \textsf{array})
% mangle the definition of \textsf{tabular}
%    \begin{macrocode}
\AtBeginDocument{%
  \let\NRC@@tabular\tabular
  \let\endNRC@@tabular\endtabular
  \renewenvironment{tabular}%
    {\smalll\NRC@@tabular}%
    {\endNRC@@tabular}%
}
%    \end{macrocode}
% \end{environment}
% \end{environment}
%
% \subsection{Text subscripts}
%
% \LaTeX{} itself provides a \cs{textsuperscript} command, but nothing
% for subscripts.
%
% \begin{macro}{\textsubscript}
% \begin{macro}{\@textsubscript}
% Syntax: \cs{textsubscript}\marg{subscripting text}
%
% The code comes from |subscript.sty| on CTAN (written by the author
% of the NRC classes).
%    \begin{macrocode}
\DeclareRobustCommand*\textsubscript[1]{%
  \@textsubscript{\selectfont#1}}
\def\@textsubscript#1{%
  {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \section{Lists, etc.}
%
% Specialised versions of the \texttt{list} environment.
%
%
% \begin{environment}{flenumerate}
% \begin{environment}{flitemize}
% Syntax: \emph{As \texttt{enumerate}/\texttt{itemize}}
%
% We make no provision for the nesting of these lists: they must be
% the outermost list of a nested set (though the specification makes
% no mention of nesting at all).
%    \begin{macrocode}
\newenvironment{flenumerate}%
  {%
    \ifnum \@enumdepth>\z@
      \@toodeep
    \else
      \advance\@enumdepth\@ne
      \def\@enumctr{enumi}%
      \leftmargini1.5pc\relax
      \labelwidth\leftmargini
      \labelsep\z@
      \list
        \labelenumi
        {%
          \usecounter\@enumctr
          \def\makelabel##1{##1\hss}%
        }%
    \fi
  }%
  \endlist
\newenvironment{flitemize}%
  {%
    \ifnum \@itemdepth>\z@
      \@toodeep
    \else
      \advance\@itemdepth\@ne
      \def\@itemitem{labelitemi}%
      \leftmargini10\p@
      \labelwidth\leftmargini
      \labelsep\z@
      \list
        \labelitemi
        {\def\makelabel##1{##1\hss}}%
    \fi
  }%
  \endlist
%    \end{macrocode}
% \end{environment}
% \end{environment}
%
%
% \subsection{Captions and general float handling}
%
% \begin{macro}{\caption}
% \begin{macro}{\topcaption}
% \begin{macro}{\if@topcaption}
% \begin{macro}{\NRC@@caption}
% \begin{macro}{\NRC@topcaptcounter}
% Syntax: \cs{caption} unchanged; \cs{topcaption} the same
%
% \cs{caption} and \cs{topcaption} set their version of
% \cs{if@topcaption} and relay to the saved copy \cs{NRC@@caption}.
% \cs{caption} does nothing else, but \cs{topcaption} also sets up for
% remembering the width of the following table.
%    \begin{macrocode}
\let\NRC@@caption\caption
\renewcommand\caption{\@topcaptionfalse\NRC@caption}
\newcommand\topcaption{\@topcaptiontrue
  \global\advance\NRC@topcaptcounter\@ne
  \NRC@caption
}
\newif\if@topcaption
\@topcaptionfalse
\newcount\NRC@topcaptcounter
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@caption}
% \begin{macro}{\NRC@capt@left}
% \begin{macro}{\NRC@capt@right}
% \cs{NRC@caption} relays from \cs{caption}/\cs{topcaption} to
% \cs{NRC@@caption} (the preserved copy of the kernel \cs{caption}),
% making note of the values of \cs{leftskip} and \cs{rightskip} as we
% go. 
%    \begin{macrocode}
\newcommand{\NRC@caption}{%
  \edef\NRC@capt@left{\the\leftskip}%
  \edef\NRC@capt@right{\the\rightskip}%
  \NRC@@caption
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@makecaption}
% \begin{macro}{\figurename}
% \begin{macro}{\captionwidth}
% \begin{macro}{\@makecaption}
% Syntax: unchanged from \cs{@makecaption}, but takes account of
% \cs{if@topcaption}
%
% None of the fancy centring code found in standard \LaTeX, and we use
% a fixed size (though the size \emph{is} adjustable by the user).
% The above caption skip is adjusted if in a \cs{topcaption}, to take
% account of effects arising from different font sizes in different
% columns.
%
% We have to defer our definition of \cs{@makecaption} to the start of
% the document, since \textsf{babel} has taken to mucking up our
% definition, if we're usuing `french'.
%
% The width in which to set the caption is \cs{captionwidth} if that's
% set non-zero; otherwise, if this is a topcaption which is followed
% by a tabular whose width we've recorded, we use that; failing both
% conditions we use \cs{hsize}
%    \begin{macrocode}
\newcommand\NRC@makecaption[2]{%
  \if@topcaption \@tempdima\belowcaptionskip \advance\@tempdima 3.5\p@
  \else \@tempdima\abovecaptionskip \fi \vskip\@tempdima
  \@tempdima\captionwidth
  \ifdim\@tempdima=\z@
    \if@topcaption
      \expandafter\let\expandafter\@tempa
        \csname NRC@tabwd@\the\NRC@topcaptcounter\endcsname
      \@tempdima\ifx\@tempa\relax
        \hsize
      \else
        \@tempa
      \fi
    \else
      \@tempdima\hsize
    \fi
  \fi
  \hb@xt@\hsize{%
    \hskip\NRC@capt@left
    \vbox{%
      \hsize\@tempdima
%<nrc2> \NRC@sectragged
      \smalll
      \textbf{#1.}\enspace\ignorespaces#2\unskip\par
    }%
    \hskip\NRC@capt@right
  }%
  \@tempdima\if@topcaption
    \abovecaptionskip
    \advance\@tempdima -6\p@ % pragmatic value from NRC experience
  \else
    \belowcaptionskip
  \fi
  \vskip\@tempdima
}
\renewcommand\figurename{Fig.}
\newdimen\captionwidth
\captionwidth\z@
\AtBeginDocument{\let\@makecaption\NRC@makecaption}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\endtabular}
% \begin{macro}{\endtabular*}
% \begin{macro}{\NRC@@endtabular}
% Termination of tabulars, with code to preserve the width of the
% table just set.  Again, this needs to be done \cs{AtBeginDocument}
% (for the same reason that the size change for tabulars has to be).
%    \begin{macrocode}
\AtBeginDocument{%
  \let\NRC@@endtabular\endtabular
  \def\endtabular{\NRC@@endtabular
    \if@topcaption
      \if@filesw
        \setbox\z@\lastbox
        \immediate\write\@auxout{%
          \string\NRC@tabwd{\the\NRC@topcaptcounter}%
                           {\the\wd\z@}%
        }%
        \box\z@
      \fi
    \fi
  }%
  \expandafter\let\csname endtabular*\endcsname\endtabular
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\NRC@tabwd}
% \begin{macro}{\NRC@tabwd@atend}
% Syntax: \cs{NRC@tabwd}\marg{topcaption number}\marg{table width}
%
% \verb|.aux| file command for processing table widths.  (Note, we set
% up a dummy version of the command in the file, for the usual
% precautionary reason.)
%
% \cs{NRC@tabwd@atend} is the version of the command to be used in
% end-document \verb|.aux| processing.
%    \begin{macrocode}
\newcommand\NRC@tabwd[2]{%
  \global\@namedef{NRC@tabwd@#1}{#2}%
}
\AtBeginDocument{\immediate\write\@auxout{%
    \noexpand\providecommand\noexpand\NRC@tabwd{%
      \noexpand\@gobbletwo}%
  }%
}
\newcommand\NRC@tabwd@atend[2]{%
  \edef\@tempa{\@nameuse{NRC@tabwd@#1}}%
  \def\@tempb{#2}%
  \ifx\@tempa\@tempb\else\@tempswatrue\fi
}
\AtEndDocument{\let\NRC@tabwd\NRC@tabwd@atend}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\sepcaption}
% Syntax: \cs{sepcaption}\oarg{\texttt{.lo\emph{x}} text}\marg{caption}
%
% Produce a caption that's to be separated from its figure or table.
% This requires the caption to be of a fixed width, and that there
% should be a full-width rule underneath the caption.  The caption
% makes up the whole of a float.
%    \begin{macrocode}
\newcommand{\sepcaption}{%
  \ifdim \textwidth=\hsize
    \def\@tempa{{\NRC@sepcaption{0.8}}}%
  \else
    \def\@tempa{{\NRC@sepcaption{0.7}}}%
  \fi
  \expandafter\@dblarg\@tempa
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NRC@sepcaption}
% Syntax: \cs{NRC@sepcaption}\marg{fraction of width}\oarg{caption opt}%
%                            \marg{caption}
%
% Orchestrate \cs{sepcaption}
%    \begin{macrocode}
\def\NRC@sepcaption#1[#2]#3{%
  \setlength{\captionwidth}{#1\columnwidth}%
  \topcaption[#1]{#2}%
  \vrule \@depth.5\p@ \@height.5\p@ \@width\hsize
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@fptop}
% \begin{macro}{\@dblfptop}
%
% We set these two to prevent floats from dribbling down float pages
%    \begin{macrocode}
\setlength\@fptop{\z@}
\setlength\@dblfptop{\z@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \subsection{The bibliography}
%
% \begin{environment}{thebibliography}
% \begin{macro}{\thebibliography}
% \begin{macro}{\NRC@thebibliography}
% \begin{macro}{\NRC@thebib@brace}
% \begin{macro}{\NRC@thebib@nobrace}
% \begin{macro}{\endthebibliography}
% \begin{macro}{\NRC@bibitem}
% Syntax: \cs{begin}|{thebibliography}|\marg{widest label}
% 
% \noindent\phantom{Syntax: }\cs{begin}|{thebibliography}| (in the
% presence of the |nonumbib| class option)
%
% First, the bibliography environment, which we repeat, patched in a
% minor way, from \textsf{article.cls} (we suppress the open
% bibliography switch)
%    \begin{macrocode}
\ifNRC@numbib
\renewenvironment{thebibliography}[1]{%
  \section*{\refname}%
  \smalll
  \list{\@biblabel{\@arabic\c@enumiv}}%
       {%
         \settowidth\labelwidth{#1.}%
         \leftmargin 1.5pc
         \labelsep \leftmargin
         \advance\labelsep -\labelwidth 
         \usecounter{enumiv}%
         \let\p@enumiv\@empty
         \renewcommand\theenumiv{\@arabic\c@enumiv}
        }%
  \sloppy
%<!nrc2> \NRC@sectragged
  \clubpenalty4000
  \@clubpenalty \clubpenalty
  \widowpenalty4000
%<nrc1> \itemsep\z@
%<nrc2> \itemsep\z@ \@plus\p@
  \parsep\z@
  \parskip\z@
}{%
  \def\@noitemerr{%
    \@latex@warning{Empty `thebibliography' environment}%
  }%
  \endlist
}
%    \end{macrocode}
%
% If we're not numbering bibliography items, we need to be careful in
% a number of areas.  First, we make the ``label width'' argument to
% the environment (sort of) optional.  Second, if (as is usually the
% case) there's no citation name, we generate a spurious one so as to
% avoid masses of ``repeated label'' error messages.
%
% Note we define the environment as two commands, as the tricks with
% the ``optional'' argument might come unstuck otherwise; of course,
% \cs{endthebibliography} can't be defined with \cs{newcommand}\dots
%    \begin{macrocode}
\else
\renewcommand{\thebibliography}{%
  \futurelet\reserved@a\NRC@thebibliography
}
\newcommand{\NRC@thebibliography}{%
  \ifx\reserved@a\bgroup
    \expandafter\NRC@thebib@brace
  \else
    \expandafter\NRC@thebib@nobrace
  \fi
}
\newcommand{\NRC@thebib@brace}[1]{%
  \NRC@thebib@nobrace
}
\newcommand{\NRC@thebib@nobrace}{%
  \section*{\refname}%
  \smalll
  \list{}%
       {%
         \let\bibitem\NRC@bibitem
         \leftmargin 10\p@
         \labelwidth \z@
         \labelsep   \z@
         \itemindent -\leftmargin
         \usecounter{enumiv}%
         \let\p@enumiv\@empty
         \renewcommand\theenumiv{\@arabic\c@enumiv}
        }%
  \sloppy
%<!nrc2> \NRC@sectragged
  \clubpenalty4000
  \@clubpenalty \clubpenalty
  \widowpenalty4000
%<nrc1> \itemsep\z@
%<nrc2> \itemsep\z@ \@plus\p@
  \parsep\z@
  \parskip\z@
}
\def\endthebibliography{%
  \def\@noitemerr{%
    \@latex@warning{Empty `thebibliography' environment}%
  }%
  \endlist
}
\newcommand{\NRC@bibitem}[2][\the\value{\@listctr}]{%
  \item
  \if@filesw
    \def\@tempa{#2}%
    \ifx\@tempa\@empty
      \edef\@tempa{bibitem\the\value{\@listctr}}%
    \fi
    \immediate\write\@auxout{%
      \string\bibcite{\@tempa}{#1}%
    }%
  \fi
  \ignorespaces
}
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{environment}
%
% \begin{macro}{\@biblabel}
% The label for a |\bibitem[...]| command is produced by this
% macro. This version marginally modifies that defined in the \LaTeX{}
% kernel.
%    \begin{macrocode}
\renewcommand*{\@biblabel}[1]{\hb@xt@\labelwidth{\hfill#1.}}
%</nrc1cls|nrc2cls>
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
%<*nrc1cls|nrc2cls|balance>
\endinput
%</nrc1cls|nrc2cls|balance>
%    \end{macrocode}
%
% \Finale
%
%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
