% \iffalse      THIS IS A META-COMMENT
%<*dtx>
\ProvidesFile
%========================================================================
                       {NATBIB.DTX}
%========================================================================
%</dtx>
% This is a LaTeX package to modify \cite and \thebibliography for author-year 
%    systems of bibliographic citation; will also work with 
%    numerical systems, allowing simplified style changes for them too.
% Installation:
%    LaTeX this file: creates docstrip installation file natbib.ins
%                         AND the (LaTeX2e) documentation
%    (La)TeX natbib.ins: creates package files natbib.sty, and optionally
%                         ltx209 style natbib.209 and doc driver natbib.drv
%    (natbib.ins may be edited as needed)
% Docstrip options available:
%        package - to produce a (LaTeX2e) package .sty file 
%        driver  - to produce a driver file to print the documentation
%        209     - (with package) for style file that runs under LaTeX 2.09 
%        subpack - (with package) for coding included in other packages
%        all     - (with package) to include all author-year systems
%                   else individually with:
%        apalike, newapa, harvard, authordate, astron
%        agu     - (with package,subpack) for inclusion in aguplus package
%        nlinproc- (with package,subpack) for inclusion in nlinproc package
%--------------------------------------------------------------------------
%<*!subpack>
%<package&209>\def\ProvidesPackage#1#2]
%<package&209>  {\typeout{Style option `#1'#2]}}
%
%  *** Identify the package file:-
%<package&!209>\NeedsTeXFormat{LaTeX2e}[1994/06/01]
%<package>\ProvidesPackage{natbib}
%</!subpack>
%
%  *** Provide command to dislay module version
%<package&subpack>\def\ModuleVersion#1[#2]{}
%<package&subpack>    \ModuleVersion{natbib}
%
%  *** Identify the driver file:-
%<driver>\NeedsTeXFormat{LaTeX2e}
%<driver>\ProvidesFile{natbib.drv}
%
%  *** The DATE, VERSION, and other INFO
%\fi
%\ProvidesFile{natbib}
        [1995/05/18 5.5 (PWD)]
%\iffalse
%<*package>
%<*!subpack>
 %-------------------------------------------------------------------
 % NOTICE:
 % This file may be used for non-profit purposes.
 % It may not be distributed in exchange for money, 
 %   other than distribution costs.
 %   
 % The author provides it `as is' and does not guarantee it in any way.
 % 
%% Copyright (C) 1994, 1995 Patrick W. Daly
 % Max-Planck-Institut f\"ur Aeronomie
 % Postfach 20
 % D-37189 Katlenburg-Lindau
 % Germany
 % 
 % E-mail:
 % SPAN--     nsp::linmpi::daly
 % Internet-- daly@linmpi.dnet.gwdg.de   
 %-----------------------------------------------------------
%</!subpack>
%</package>
%                    END META-COMMENT \fi
% \changes{4.0}{1993 Aug 19}{First documented release}
% \changes{4.1}{1993 Oct 4}{Simplification of \cs{@citeapalk}}
% \changes{4.1a}{1993 Oct 14}{Add \texttt{rev} option for reversed comments 
%                             in \cs{cite}}
% \changes{4.1b}{1993 Oct 18}{Add \cs{bibfont} to list definition =\cs{relax}}
% \changes{4.2}{1993 Oct 22}{Add coding for AGU, NLINPROC}
% \changes{4.2}{1993 Nov 20}{Add more coding for AGU}
% \changes{4.3a}{1994 Feb 24}{First additions for \LaTeXe}
% \changes{5.0}{1994 May 18}{Revised for \LaTeXe{} and 2.09}
% \changes{5.0}{1994 May 18}{Remove obsolete JGR, GRL coding}
% \changes{5.0}{1994 May 18}{Add \cs{citeauthor}, \cs{citeyear}}
% \changes{5.0}{1994 May 18}{Two optional texts for \cs{cite} so \texttt{rev}
%                            option obsolete}
% \changes{5.0}{1994 May 18}{\LaTeXe\ options to select punctuation}
% \changes{5.1}{1994 Jun 22}{Conform to first official release of \LaTeXe}
% \changes{5.1}{1994 Jun 22}{Separate \LaTeX\ and 2.09 files}
% \changes{5.1}{1994 Jun 22}{Put doc driver first}
% \changes{5.2}{1994 Aug 25}{Fix up 2.09 style to run in compatibility mode}
% \changes{5.2}{1994 Aug 25}{\cs{citeauthor}, \cs{citeyear} make BibTeX 
%                             entry in aux file}
% \changes{5.2}{1994 Aug 25}{\cs{@citex} defined as in \LaTeXe}
% \changes{5.2}{1994 Aug 25}{Local config file \texttt{natbib.cfg} read in}
% \changes{5.3}{1994 Sep 13}{Add \cs{citefullauthor}, options \texttt{angle}, 
%                             \texttt{curly}}
% \changes{5.3}{1994 Sep 19}{Add star version of \cs{cite} for full authors}
% \changes{5.3}{1994 Sep 26}{Fix accents in citations with proper definition
%                             of \cs{protect}}
% \changes{5.4}{1994 Nov 24}{Add space in \cs{@citex} for text cites}
% \changes{5.4}{1994 Nov 24}{Replace \cs{if@tempswa} by \cs{ifNAT@swa}}
% \changes{5.4}{1994 Nov 24}{Add superscript citation type to \cs{bibpunct}}
% \changes{5.4}{1994 Nov 24}{Add \cs{@citesuper}, fix up bugs in superscripts}
% \changes{5.4}{1994 Nov 24}{Define \cs{@citexnum} as in \LaTeXe}
% \changes{5.4}{1995 Feb 03}{Add \cs{citestyle} same as \cs{bibstyle}}
% \changes{5.4}{1995 Feb 08}{For repeated years and authors, print just letter}
% \changes{5.5}{1995 Mar 13}{Add \cs{bibhang} and command space in
%      \cs{@cite}}
% \changes{5.5}{1995 Mar 16}{Add \cs{citealt} for citation with no
%      parentheses}
% \changes{5.5}{1995 Mar 24}{Reorganize internal commands, using \cs{NAT@}
%     prefixes}
% \changes{5.5}{1995 Mar 24}{Punctuation selection commands \cs{bibpunct},
%     \cs{citestyle} are now preamble only, whereas previously they had to
%     come after the preamble}
% \changes{5.5}{1995 May 14}{Change names of punctuation commands to
%     \cs{NAT@...}}
%
% \CheckSum{1018}
% \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         \~}
%
% \iffalse
%<*install>
%^^A =============================================
%^^A    Here is the docstrip installation file
%^^A    It is written on first LaTeX run
%^^A =============================================
\begin{filecontents}{natbib.ins}
% Simply TeX or LaTeX this file to extract various files from 
%  the source file `natbib.dtx'
% Comment out the \generateFile lines for any files you do not want.

\def\batchfile{natbib.ins}
\input docstrip

\preamble

Only a few abbreviated comments remain here to describe the usage.

\endpreamble
\postamble
<<<<< End of decommented file <<<<<<

End of file \noexpand\outFileName.
\endpostamble
\keepsilent

\generateFile{natbib.sty}{f}{\from{natbib.dtx}{package,all}}

\preamble

This is the LaTeX 2.09 version of the package.
It will not be maintained forever.
Please upgrade to LaTeX2e so that you may use the proper package.

Only a few abbreviated comments remain here to describe the usage.

\endpreamble

\generateFile{natbib.209}{f}{\from{natbib.dtx}{package,all,209}}

\preamble

This is the driver file to produce the LaTeX documentation from the 
source file \inFileName.
Make changes to it as needed. (Never change the \inFileName file!)
\endpreamble
\postamble

End of documentation driver file \noexpand\outFileName.
\endpostamble

\generateFile{natbib.drv}{f}{\from{natbib.dtx}{driver}}

\obeyspaces
\Msg{*******************************************}%
\Msg{* For documentation, process natbib.dtx   *}%
\Msg{*    or the driver file      natbib.drv   *}%
\Msg{* (LaTeX2e only!)                         *}%
\Msg{*******************************************}
\end{filecontents}
%</install>
%<*driver>
\documentclass[twoside]{ltxdoc}
%<driver>%\documentclass[twoside,a4paper]{ltxdoc}
\raggedbottom

 %** To suppress the detailed explanation of the coding, include
 %**   the next line
%<driver>% \OnlyDescription

 %** To produce a command index: add the following line for one run,
 %**   then run  makeindex -s gind.ist natbib
 %**   and reprocess, with or without this line (much faster without)
%<driver>% \EnableCrossrefs\CodelineIndex 

 %** To produce a change history: add the following line for one run,
 %**   then run  makeindex -s gglo.ist -o natbib.gls natbib.glo
 %**   and reprocess, with or without this line (faster without)
%<driver>% \RecordChanges 

\DisableCrossrefs %May stay; zapped by \EnableCrossrefs
\CodelineNumbered %May stay

\begin{document}
   \DocInput{natbib.dtx}
\end{document}
%</driver>
%\fi
%
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs}
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo}
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage}
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage}
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage}
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions}
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument}
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError}
% \DoNotIndex{\ClassWarning,\PackageWarning,\ClassWarningNoLine}
% \DoNotIndex{\PackageWarningNoLine,\ClassInfo,\PackageInfo,\MessageBreak}
% \DoNotIndex{\space,\protect,\DeclareRobustCommand,\CheckCommand}
% \DoNotIndex{\newcommand,\renewcommand,\providecommand,\newenvironment}
% \DoNotIndex{\renewenvironment,\newif,\newlength,\newcounter,\setlength}
% \DoNotIndex{\setcounter,\if,\ifx,\ifcase,\ifnum,\ifdim,\else,\fi}
% \DoNotIndex{\texttt,\textbf,\textrm,\textsl,\textsc,\reset@font}
% \DoNotIndex{\textup,\textit,\textmd,\textsf,\emph}
% \DoNotIndex{\ttfamily,\rmfamily,\sffamily,\mdseries,\bfseries,\upshape}
% \DoNotIndex{\slshape,\scshape,\itshape,\em,\LaTeX,\LaTeXe}
% \DoNotIndex{\filename,\fileversion,\filedate,\let}
% \DoNotIndex{\@auxout,\@for,\@gobble,\@ifnextchar,\@m,\@mkboth,\@nil}
% \DoNotIndex{\@noitemerr,\@tempa,\@tempswafalse,\@tempswatrue,\@warning}
% \DoNotIndex{\advance,\arabic,\AtBeginDocument,\bf,\bibname,\chapter}
% \DoNotIndex{\citation,\clubpenalty,\CodelineNumbered,\csname}
% \DoNotIndex{\DisableCrossrefs,\do,\edef,\else,\endcsname,\endlist}
% \DoNotIndex{\expandafter,\fi,\gdef,\global,\hbox,\hfill,\hskip,\hspace}
% \DoNotIndex{\if,\if@filesw,\if@tempswa,\ifx,\immediate,\itemindent,\labelsep}
% \DoNotIndex{\labelwidth,\lastskip,\leftmargin,\list,\mbox,\newblock}
% \DoNotIndex{\newpage,\p@enumiv,\parindent,\penalty,\refname}
% \DoNotIndex{\relax,\section,\settowidth,\sfcode,\sloppy,\small,\string}
% \DoNotIndex{\theenumiv,\thepage,\unskip,\uppercase,\usecounter,\vskip}
% \DoNotIndex{\widowpenalty,\write,\xdef,\z@,\catcode,\ifnum,\the}
% \DoNotIndex{\.,\@empty,\@ifundefined,\@latex@warning,\@minus,\@plus,\ }
% \DoNotIndex{\document,\G@refundefinedtrue,\if@openbib}
% \DoNotIndex{\listparindent,\noexpand,\par,\parsep,\pb,\pbf,\pbfseries}
% \DoNotIndex{\pc,\pd,\pem,\pit,\pitshape,\pmdseries,\prm,\prmfamily,\psc}
% \DoNotIndex{\pscshape,\psf,\psffamily,\psl,\pslshape,\ptt,\pttfamily}
% \DoNotIndex{\pupshape,\@iden,\@unexpandable@protect}
% \DoNotIndex{\&,\{,\},\bibitem,\bibindent,\if@draft,\typeout}
% \DoNotIndex{\@ifclassloaded,\@ifstar,\@onlypreamble,\@preamblecmds}
% \DoNotIndex{\addtolength,\endinput}
%
% \setcounter{IndexColumns}{2}
% \setlength{\IndexMin}{10cm}
% \setcounter{StandardModuleDepth}{1}
%
% \hyphenation{par-en-the-ti-cal}
%
% \GetFileInfo{natbib}
%
% \title{{\bfseries Natural Sciences Citations and References}\\
%         (Author--Year and Numerical Schemes)}
%    
% \author{Patrick W. Daly}
%         
% \date{This paper describes package \texttt{\filename}\\
%       version \fileversion{} from \filedate\\[1ex]
%^^A     \textsl{It is part of the \texttt{preprint} collection of packages}\\
%     \textbf{It is intended for \LaTeXe}
%     \\ (but does include a variant for \LaTeX~2.09)
%  }
% 
% \maketitle
%
% \pagestyle{myheadings}
% \markboth{P. W. Daly}{NATURAL SCIENCES CITATIONS AND REFERENCES}
%
% \newcommand{\btx}{\textsc{Bib}\TeX}
% \newcommand{\thestyle}{\texttt{\filename}}
%
%^^A In order to keep all marginal notes on the one (left) side:
%^^A (otherwise they switch sides disasterously with twoside option)
% \makeatletter \@mparswitchfalse \makeatother 
%
% \begin{abstract}
% Journals in the natural sciences tend to use the author--year style of
% literature citations, in contrast to the numerical style supported by
% \LaTeX{} and \btx. A number of style options exist to accommodate this
% scheme, but with various new sets of |\cite| commands and a variety of
% ways of entering the information in the |\bibitem| entry. Instead, 
% \thestyle\texttt{.sty}
% uses the |\cite| command almost exactly as provided in
% original \LaTeX, and yet can read in the |\bibitem| information in all
% the formats available.
% 
% Even those journals that do use numbered citations exhibit a
% variety of styles that are not so easy to reprogram into \LaTeX.
% This style option offers an interface for both author--year and numerical
% styles, with a means to redefine the citation format automatically based
% on the name of the style in the |\bibliographystyle| command. For
% example, by selecting the style \texttt{nature}, then the style of references 
% is that of the journal \textsl{Nature}, i.e., as superscript numbers. It is
% easy to add new definitions to \thestyle\texttt{.sty} for other bibliographic
% styles. Alternatively, these local definitions may be stored in a 
% configuration file \thestyle\texttt{.cfg}.
% 
% Thus \thestyle\texttt{.sty} can act as a single package for most of the
% available bibliographic styles.
% \end{abstract}  
% 
% \section{Introduction}
% The first problem of using author--year literature citations with standard
% \LaTeX{} is that the two forms of citations are not supported. These are:
% \begin{quote}
% textual: \dots\ as shown by Jones et al. (1990) \dots\\
% parenthetical: It has been shown (Jones et al., 1990) that \dots
% \end{quote}
% There is only one |\cite| command to do both jobs.
% 
% A second problem is that the \texttt{thebibliography} environment for
% listing the references insists on including the {\em labels\/} in the
% list. These labels are normally the numbers, needed for referencing. In
% the author--year system, they are superfluous and should be left off.
% Thus, if one were to make up a bibliography with the author--year as
% label, as
% \begin{quote}
% \begin{verbatim}
% \begin{thebibliography}{...}
% \bibitem[Jones et al., 1990]{jon90}
% Jones, P. K., . . .
% \end{thebibliography}
% \end{verbatim}
% \end{quote}
% then |\cite{jon90}| produces the parenthetical citation [Jones et al.,
% 1990], but there is no way to get the textual citation. Furthermore,
% the citation text will also be included in the list of references. 
% 
% The final problem is to find a \btx{} bibliography style that will be
% suitable.
% 
% \section{Previous Solutions}
% Although the author--year citation style is not supported by {\em
% standard\/} \LaTeX, there are a number of private styles around that have
% worked on this problem. The various bibliographic styles (\texttt{.bst}
% files) that exist are usually tailored to be used with a particular
% \LaTeX{} style option.
% 
% I have found a large number of \texttt{.bst} files on file servers that may
% act as indicators of the various systems available.
% 
% \subsection{The \texttt{natsci.bst} Style}
% What gave me my first inspiration was Stephen Gildea's \texttt{natsci.bst}
% for use with his \texttt{agujgr.sty} file. This showed me that the problem
% was solvable. However, Gildea's style formats |\bibitem| just as I
% illustrated above: with an optional label consisting of abbreviated
% authors and year. Thus only parenthetical citations can be accommodated.
% The list of references, however, is fixed up in his style files.
% 
% One serious drawback of \texttt{natsci.bst} is that it has been written for
% \btx{} version~0.98, which is no longer current. It could be converted to
% version~0.99 by replacing every occurrence of |:=| by |swap$ :=|.
% 
% \subsection{The \texttt{apalike.bst} Style}
% Oren Patashnik, the originator of \btx{} and the standard \texttt{.bst}
% files, has also worked on an author--year style, called \texttt{apalike.bst}
% with a corresponding \texttt{apalike.sty} to support it. Again, only the
% parenthetical citation is provided. Except for the fact that his style
% works with version~0.99 of \btx, its functionality is identical to that
% of the \texttt{natsci} files.
% 
% Patashnik does not like author--year citations. He makes this very clear
% in his \btx{} manuals and in the header to \texttt{apalike.bst}.
% Nevertheless, one should respect his work in this area, simply because he
% should be the best expert on matters of \btx. Thus \texttt{apalike.bst}
% could be the basis for other styles.
% 
% The form of the \texttt{thebibliography} entries in this system is
% \begin{quote}
% |\bibitem[Jones et al., 1990]{jon90}...|
% \end{quote}
% the same as I illustrated above. This is the most minimal form that can
% be given. I name it the \texttt{apalike} variant, after Patashnik's 
% \texttt{apalike.bst} and \texttt{apalike.sty}. However, there could be many
% independent \texttt{.bst} files that follow this line.
% 
% The bibliography style files belonging to this group include:
% \begin{quote}
% \texttt{apalike}, \texttt{apalike2}, \texttt{cea}, \texttt{cell}, 
% \texttt{jmb}, \texttt{phapalik}, \texttt{phppcf}, \texttt{phrmp}
% \end{quote}
% 
% \subsection{The \texttt{newapa} Style}
% A major improvement has been achieved with \texttt{newapa.bst} and the
% accompanying \texttt{newapa.sty} files by Stephen N. Spencer and Young U.
% Ryu. Under their system, three separate items of information are included
% in the |\bibitem| label, to be used as required. These are: the full
% author list, the abbreviated list, and the year. This is accomplished by
% means of a |\citeauthoryear| command included in the label, as
% \begin{quote}
% |\bibitem[\protect\citeauthoryear{Jones, Barker,|\\
% |  and Williams}{Jones et al.}{1990}]{jon90}...|
% \end{quote}
% Actually, this only illustrates the basic structure of |\citeauthoryear|;
% the \texttt{newapa} files go even further to replace some words and 
% punctuation
% with commands. For example, the word `and' above is really
% |\betweenauthors|, something that must be defined in the \texttt{.sty} file.
% Of course, |\citeauthoryear| is also defined in that file. A
% number of different |\cite| commands are available to print out the
% citation with complete author list, with the short list, with or without
% the date, the textual or parenthetical form. 
% 
% Thus the |\citeauthoryear| entry in |\bibitem| is very flexible,
% permitting the style file to generate every citation form that one might
% want. It is used by a number of other styles, with corresponding
% \texttt{.sty} files. They all appear to have been inspired by 
% \texttt{newapa.bst}, although they lack the extra punctuation commands. 
% 
% Bibliographic style files belonging to the \texttt{newapa} group include
% \begin{quote}
% \texttt{newapa}, \texttt{chicago}, \texttt{chicagoa}, \texttt{jas99}, 
% \texttt{named}
% \end{quote}
% Note: the last of these, \texttt{named.bst}, uses |\citeauthoryear| in a
% slightly different manner, with only two arguments: the short list and
% year.
% 
% \subsection{The Harvard Family}
% The same effect is achieved by a different approach in the Harvard family
% of bibliographic styles. Here a new substitute for |\bibitem| is used, as
% \begin{quote}
% |\harvarditem[Jones et al.]{Jones, Baker, and|\\
% |   Williams}{1990}{jon90}...|
% \end{quote}
% The accompanying interfacing style file is called \texttt{harvard.sty}
% and is written by Peter Williams and Thorsten Schnier. It
% defines |\harvarditem| as well as the citation commands |\cite|, for
% parenthentical, and |\citeasnoun|, for textual citations. The first
% citation uses the long author list, following ones the shorter list, if
% it has been given in the optional argument to |\harvarditem|.
% 
% Bibliography styles belonging to the Harvard family are
% \begin{quote}
% \texttt{agsm}, \texttt{dcu}, \texttt{kluwer}
% \end{quote}
% 
% This package has been updated for \LaTeXe, with many additions to
% add flexibility. The result is a powerful interface that should meet most
% citation needs. (It does not suppress repeated authors, though,
% as \thestyle{} does.)
%
% \subsection{The Astronomy Style}
% Apparently realizing the limitations of his \texttt{apalike} system, Oren
% Patashnik went on to develop a `true' \texttt{apa} bibliographic style,
% making use of the method already employed by an astronomy journal. This
% is actually very similar to the \texttt{newapa} label but with only the
% short list of authors:
% \begin{quote}
% |\bibitem[\protect\astroncite{Jones et al.}{1990}]{jon90}|\\
% |   ...|
% \end{quote}
% It requires the style file \texttt{astron.sty} (which I have not yet been
% able to obtain), or any other style that defines |\astroncite|
% appropriately.
% 
% Bibliographic styles belonging to the astronomy group are
% \begin{quote}
% \texttt{apa}, \texttt{astron}, \texttt{bbs}, \texttt{cbe}, 
% \texttt{humanbio}, \texttt{humannat}, \texttt{jtb}
% \end{quote}
% 
% This is as good as the |\citeauthoryear| command, although not as
% flexible since the full list of authors is missing.
% 
% \subsection{The \texttt{authordate} Style}
% Finally, I have also found some styles making use of a label command
% called |\citename| in the form
% \begin{quote}
% |\bibitem[\protect\citename{Jones et al., }1990]{jon90}|\\
% |    ...|
% \end{quote}
% 
% This is not a good system since the author list and date are not cleanly
% separated as individual arguments, and since the punctuation is included
% in the label text. It is better to keep the punctuation fully removed, as
% part of the definitions in the \texttt{.sty} file, for complete flexibility.
% 
% Bibliographic styles belonging to this group are
% \begin{quote}
% \texttt{authordate1}, \texttt{authordate2}, \texttt{authordate3}, 
% \texttt{authordate4}, \texttt{aaai-named}
% \end{quote}
% with accompanying style file \texttt{authordate1-4.sty}.
% 
% \section{The \thestyle{} System}
% The form of the |\bibitem| entry that I have used for all my
% bibliographic styles is only slightly more complicated than the minimal
% one, but allows a clean separation between authors and date:
% \begin{quote}
% |\bibitem[Jones et al.(1990)]{jon90}...|\\[1ex]
% or alternatively\\[1ex]
% |\bibitem[Jones et al.(1990)Jones, Baker, |\\
% \hspace*{2em}|and Williams]{jon90}...|
% \end{quote}
% (The second form is new to version~5.3.)
%
% The separation can be done be using the parentheses as delimiters to an
% appropriate command. Parentheses are used no matter what characters are
% actually to surround the citation.  The minimal (\texttt{apalike}) system
% can also have the authors and year separated, but only by assuming that
% the authors are divided from the year by comma and blank. If the author
% list itself contains a comma and blank, the separation will be incorrect.
% 
% I wanted to name the system something like `natural sciences bibliography',
% intending it to be a variant of \texttt{natsci.sty}. Since that name
% was already taken, I resorted to the rather cryptic, and definitely ugly,
% \thestyle.
% 
% The \thestyle\texttt{.sty} package\footnote{Formerly called a \emph{style 
% file} in the older \LaTeX~2.09 terminology.}
% supports not only my own |\bibitem| format, but
% also all the others described here, plus numerical citation styles.
% The additional questions of punctuation (type of brackets, commas or
% semi-colons between citations) can be defined once and for all for each
% \texttt{.bst} file and need never be specified explicitly in the source text.
% The use of |\cite| is the same for all citation styles, meaning that the
% additional features that might be available in the `proper' \texttt{.sty}
% file will be missing. (This could be changed later.) The result is a
% single \LaTeX{} style file to handle {\em all\/} the bibliographic
% citation styles in a uniform manner.
% 
% As of version 5.1 (1994 June 22), the source file contains coding for a
% \LaTeXe{} package file (the new standard) as well as that for an older
% \LaTeX~2.09 style option file. The latter is extracted with the
% \texttt{docstrip} option \texttt{209}. (Version~5.0, issued before the
% official release of \LaTeXe, could run under both 2.09 and the
% preliminary test release, but has some problems with the first official
% version of \LaTeXe.) 
% 
% \section{Usage of this Package}
% 
% \subsection{Basic Citation Commands}
% 
% \DescribeMacro{\cite}
% The \thestyle{} package makes use of the |\cite| command in precisely the
% same manner as in standard \LaTeX, unlike other author--year interface
% packages. The distinction between parenthetical and textual citations is
% made by means of the optional argument to |\cite|, which only has meaning
% in the parenthetical case. Thus a null optional argument indicates a
% citation in parentheses.
% \begin{quote}
% \begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
%   |\cite{jon90}| & Jones et al. (1990)\\
%   |\cite[]{jon90}| & (Jones et al., 1990)\\
%   |\cite[chap.~2]{jon90}| & (Jones et al., 1990, chap.~2)
% \end{tabular}
% \end{quote}
% 
% A new feature not in standard \LaTeX{} is the possibility of adding a
% second optional text, for notes before and after the citation. (In
% earlier versions, I provided a single note either before or after,
% selectable with a \texttt{docstrip} option; this option is no longer
% needed.)
% \begin{quote}
% \begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
%   |\cite[e.g.,][]{jon90}| & (e.g., Jones et al., 1990)\\
%   |\cite[see][pg.~34]{jon90}| & (see Jones et al., 1990, pg.~34)
% \end{tabular}
% \end{quote}
% Beware: a single optional note goes \emph{after} the citation, as in
% normal \LaTeX; with two notes, the first goes \emph{before}, the second
% \emph{after}.
% 
% Multiple citations may be made as usual, by including more than one
% citation key in the |\cite| command argument. \textsl{If adjacent citations
% have the same author designation but different years, then the author
% names are not reprinted.}
% \begin{quote}
% \begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
%   |\cite{jon90,jam91}| & Jones et al. (1990); James et al. (1991)\\
%   |\cite[]{jon90,jam91}| & (Jones et al., 1990; James et al. 1991)\\
%   |\cite[]{jon90,jon91}| & (Jones et al., 1990, 1991)\\
%   |\cite[]{jon90a,jon90b}| & (Jones et al., 1990a,b)
% \end{tabular}
% \end{quote}
% (The last possibility exists only in version 5.4 or later.)
%
% \subsection{Extended Citation Commands}
% 
% Various users have asked me to add further citation possibilities to
% \thestyle, which I have done, even though the new syntaxes and commands
% deviate from \LaTeX\ standard.
% 
% It is possible to print the citation with the full author list,
% if that is supported by the bibliography style, by adding an asterisk,
% as |\cite*|.
% \begin{quote}
%   |\cite*[]{jon90}|\quad$\Rightarrow$\quad
%       \mbox{(Jones, Baker, and Williams, 1990)}
% \end{quote}
% The asterisk can be added to any of the above variations of |\cite|.
% 
% \DescribeMacro{\citep}
% A shorthand for the parenthetical citation is |\citep|, which acts just
% like |\cite[]| or |\cite*[]|.
% \begin{quote}
% |\citep{jon90} |\quad$\Rightarrow$\quad(Jones et al., 1990)\\
% |\citep*{jon90}|\quad$\Rightarrow$\quad
%   \mbox{(Jones, Baker, and Williams, 1990)}
% \end{quote}
% 
% \DescribeMacro{\citealt}
% As an alternative form of citation, |\citealt| produces exactly the same
% results, but \emph{without any parentheses}. Multiple references and the
% asterisk variant also exist.
% \begin{quote}
% \begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
%   |\citealt{jon90}| & Jones et al. 1990\\
%   |\citealt*{jon90}| & Jones, Baker, and Williams 1990\\
%   |\citealt{jon90,jam91}| & Jones et al. 1990; James et al. 1991
% \end{tabular}
% \end{quote}
% There is no parenthetical version of this command, for obvious reasons.
%
% \DescribeMacro{\citeauthor}
% \DescribeMacro{\citeyear}
% \DescribeMacro{\citefullauthor}
% In author--year schemes, it is sometimes desirable to be able to refer to
% the authors without the year, or vice versa. This is provided with three
% extra commands
% \begin{quote}
% \begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
%   |\citeauthor{jon90}| & Jones et al.\\
%   |\citefullauthor{jon90}| & Jones, Baker, and Williams\\
%   |\citeyear{jon90}|   & 1990
% \end{tabular}
% \end{quote}
% If the full author information is missing, then |\citefullauthor| is
% the same as |\citeauthor|, printing only the abbreviated list.
% This also applies to the starred versions of |\cite|.
% 
% The native \thestyle{} form of the |\bibitem| entry now (version~5.3 or
% higher) also supports the full author list.
%
% Multiple citations are \emph{not} allowed with these commands. Also, if they
% are used with a numerical citation scheme, they produce warning messages.
% 
% \subsection{Selecting Citation Punctuation}
%
% \DescribeMacro{\bibpunct}
% The above examples have been printed with the default set of punctuation.
% It is possible to change this, as well as to select numerical or
% author--year style, by means of the |\bibpunct| command, which takes 6
% arguments:
% \begin{enumerate}
% \item the opening bracket symbol, default = `(';
% \item the closing bracket symbol, default = `)';
% \item the punctuation between multiple citations, default = `;';
% \item the letter `n' for numerical style, or `s' for numerical superscript
%       style, any other letter for
%       author--year, default = author--year; note, it is not necessary to
%       specify which author--year interface is being used, for all will be
%       recognized;
% \item the punctuation that comes between the author names and the year
%       (parenthetical case only), default = `,';
% \item the punctuation that comes between years when common author lists
%       are suppressed, default = `,'; if both authors and years are common,
%       the citation is printed as `1994a,b', but if a space is wanted between
%       the extra letters, then include the space in the argument, as |{,~}|.
% \end{enumerate}
% 
% The |\bibpunct| command must be issued in the preamble, that is,
% before |\begin{document}|. (\textbf{Note:} in versions 5.4 or earlier, this
% declaration had to be given after the preamble!)
% 
% Example, |\bibpunct{[}{]}{,}{a}{}{;}| changes the output of
% \begin{quote}
%   |\cite[]{jon90,jon91,jam92}| 
% \end{quote}
% into [Jones et al. 1990; 1991, James et al. 1992].
% 
% \DescribeMacro{\bibstyle@xxx}
% Usually the punctuation style is determined by the journal for which one
% is writing, and is as much a part of the bibliography style as everything
% else. It would therefore make more sense if it could be included in the
% \texttt{.bst} file. This is conceivable, and may be considered as a future
% extension.
% 
% For now, however, in order to avoid having to specify the punctuation
% style explicitly in every document (and possibly having to change it if
% the article is submitted to another journal), \thestyle{} allows
% punctuation definitions to be directly coupled to the
% |\bibliographystyle| command that must always be present when \btx{} is
% used. It is this command that selects the \texttt{.bst} file; by adding such
% a coupling to \thestyle{} for every \texttt{.bst} file that one might
% want to use, it is not necessary to add |\bibpunct| explicitly in the
% document itself, unless of course one wishes to override the preset
% values.
% 
% Such a coupling is achieved by defining a command |\bibstyle@|{\em bst},
% where {\em bst\/} stands for the name of the \texttt{.bst} file. For example,
% the American Geophysical Union (AGU) demands in its publications that
% citations be made with square brackets and separated by semi-colons. I
% have an \texttt{agu.bst} file to accomplish most of the formatting, but such
% punctuations are not included in it. Instead, \thestyle{} has the
% definition
% \begin{quote}
% |\newcommand{\bibstyle@agu}{\bibpunct{[}{]}{;}{a}{,}{,~}}|
% \end{quote}
% 
% These style defining commands may contain more than just |\bibpunct|.
% Some numerical citation scheme require even more changes. For example,
% the journal \textsl{Nature} not only uses superscripted numbers for 
% citations, it also prints the numbers in the list of references without
% the normal square brackets. To
% accommodate this, \thestyle{} contains the style definition
% \begin{quote}\begin{verbatim}
% \newcommand{\bibstyle@nature}{\bibpunct{}{}{,}{s}{}{}%
%      \gdef\NAT@biblabelnum##1{##1.}}
% \end{verbatim}
% \end{quote}
% The redefined |\NAT@biblabelnum| command specifies how the reference numbers
% are to be formatted in the list of references itself.
% The redefinition must be made with |\gdef|, not |\def|.
% 
% The selected punctuation style and other redefinitions will not be in
% effect on the first \LaTeX{} run, for they are stored to the auxiliary
% file for the subsequent run.
% 
% The user may add more such definitions of his own, to accommodate those
% journals and \texttt{.bst} files that he has. He may either add them to
% his local copy of \thestyle\texttt{.sty}, or better put them into a file
% named \thestyle\texttt{.cfg}. This file will be read in if it exists,
% adding any local configurations. Thus such configurations can survive
% future updates of the package. (This is for \LaTeXe{} only.)
% 
% \DescribeMacro{\citestyle}
% A preprogrammed punctuation style is normally invoked by the command
% |\bibliographystyle|, as described above. However, it may be that
% one wants to apply a certain punctuation style to another bibliography
% style. This may be done with |\citestyle|, given \emph{before}
% |\begin{document}|. For example, to use the
% \texttt{plain} bibliography style (for the list of references) with the
% \textsl{Nature} style of citations (superscripts),
% \begin{quote}
% |\documentclass{article}|\\
% |\usepackage{|\thestyle|}|\\
% |. . . . .|\\
% |\citestyle{nature}|\\
% |\begin{document}|\\
% |\bibliographystyle{plain}|\\
% |. . . . .|
% \end{quote}
% 
% \noindent
% \textbf{Note:} for versions 5.5 and later, all changes to the citation
% style, including punctuation, must be made before |\begin{documentation}|,
% which freezes the citation style.
%
% \DescribeMacro{\bibsection}
% The list of references normally appears as a |\section*| or |\chapter*|,
% depending on the main class. If one wants to redesign one's own heading,
% say as a numbered section with |\section|, then |\bibsection| may be
% redefined by the user accordingly.
% 
% \DescribeMacro{\bibfont}
% The list of references is normally printed in the same font size and
% style as the main body. However, it is possible to define |\bibfont|
% to be font commands that are in effect within the \texttt{thebibliography}
% environment.
%
% \DescribeMacro{\bibhang}
% The list of references for author--year styles uses a hanging indentation
% format: the first line of each reference is flush left, the following lines
% are set with an indentation from the left margin. This indentation is 1~em
% by default but may be changed by redefining (with |\setlength|) the 
% length parameter |\bibhang|.
%
% \section{Local Configuration}
% For \LaTeXe, it is possible to add a local configuration file
% \thestyle\texttt{.cfg}, which is read in, if it exists, at
% the end of the package. It may thus contain coding to supecede that in
% the package, although its main purpose is to allow the user to add his
% own |\bibstyle@|\textit{bst} definitions to couple citation punctuation
% with local bibliography styles.
% 
% \section{Options with \LaTeXe}
% One of the new features of \LaTeXe{} is \emph{options} for the packages,
% in the same way as main styles (now called \emph{classes}) can take
% options. This package is now installed with
% \begin{quote}
% |\documentclass[..]{...}|\\
% |\usepackage[|\emph{options}|]{|\thestyle|}|
% \end{quote}
% The options available provide another means of specifying the
% punctuation for citations:
% \begin{description}
% \item[\ttfamily round] (default) for round parentheses;
% \item[\ttfamily square] for square brackets;
% \item[\ttfamily curly] for curly braces;
% \item[\ttfamily angle] for angle brackets;
% \item[\ttfamily colon] (default) to separate multiple citations with
%      colons;
% \item[\ttfamily comma] to use commas as separaters;
% \item[\ttfamily authoryear] (default) for author--year citations;
% \item[\ttfamily numbers] for numerical citations;
% \item[\ttfamily super] for superscripted numerical citations, as in
%      \textsl{Nature};
% \item[\ttfamily nobibstyle] to ignore punctuation style specified by
%      |\bibliographystyle|.
% \end{description}
% 
% The last option, \texttt{nobibstyle}, is necessary if the punctuation
% specified by the options is to dominate over any pre-programmed ones
% given by a |\bibstyle@xxx|. For example, to use the \texttt{plain.bst}
% format for the bibliography with superscripted citations, one gives
% \begin{quote}
% |\documentclass{article}|\\
% |\usepackage[super,nobibstyle]{|\thestyle|}|\\
% |. . . . .|\\
% |\bibliographystyle{plain}|
% \end{quote}
% 
% {\slshape Any punctuation style set with |\bibpunct| always has topmost 
% priority!}
% 
% \section{As Module to Journal-Specific Styles}
% Although \thestyle{} is meant to be an all-purpose bibliographic style
% \emph{package}, it may also be incorporated as a module to other 
% packages for specific journals. In this case, many of the general features may
% be left off. This is allowed for with \texttt{docstrip} options that not
% only leave off certain codelines, but also include extra ones. So far,
% options exist for 
% \begin{description}
% \item[\ttfamily nlinproc] for \textsl{Nonlinear Processes in Geophysics},
% \item[\ttfamily agu] for \textsl{American Geophysical Union} journals.
% \end{description}
% 
% Previous options \texttt{jgr} and \texttt{grl} have become obsolete due
% to revisions in these journals; they have been replaced by the more
% general \texttt{agu} option.
% 
% \section{Future Development}
% 
% At present, the coding to parse the author--year text is fairly tricky,
% in order to work with several different types of |\bibitem| formats.
% Tricky coding may demonstrate how `clever' the programmer is, but it is
% also prone to bugs, and requires extra testing whenever an update is
% made. 
% 
% I am now planning a version~6 to \thestyle{} that will rewrite the
% internal coding, making it more transparent and robust. One side-effect
% will be the possibility to produce numerical citations with \texttt{.bst}
% files that were intended for author--year applications. This means that
% |\citeauthor| and |\citeyear| will function as expected, even when |\cite|
% produces only a number. (In the present versions, they will give warnings
% and print question marks for numerical citations.) The conversion of text
% from author--year to numerical citation styles will be then greatly
% simplified.
% 
% (In reality, I have been asked to add this functionality, which I can
% only do by changing the internal coding drastically; so the improved
% coding is really the side-effect, but I will try to sell it the other way
% round.)
% 
% \section{Summary}
% 
% The following summary is included as commentds at the beginning of the
% \thestyle\texttt{.sty} file, for quick reference. Certain lines are
% dependent on the \texttt{docstrip} options.
% 
% \iffalse
%<*package&!subpack>
% \fi
% \begin{verbatim}
 % This package reimplements the \cite command to be used for various
 % citation styles, both author-year and numerical. It accepts BibTeX
 % output intended for many other packages, and therefore acts as a 
 % general, all-purpose citation-style interface.
 %
 % If author-year style selected, then \bibitem must have one of the
 %   following forms:
 %   \bibitem[Jones et al.(1990)]{key}...
 %   \bibitem[Jones et al.(1990)Jones, Baker, and Williams]{key}...
%<*apalike|authordate|all>
 %   \bibitem[Jones et al., 1990]{key}...
%</apalike|authordate|all>
%<*newapa|all>
 %   \bibitem[\protect\citeauthoryear{Jones, Baker, and Williams}{Jones
 %       et al.}{1990}]{key}...
 %   \bibitem[\protect\citeauthoryear{Jones et al.}{1990}]{key}...
%</newapa|all>
%<*astron|all>
 %   \bibitem[\protect\astroncite{Jones et al.}{1990}]{key}...
%</astron|all>
%<*authordate|all>
 %   \bibitem[\protect\citename{Jones et al., }1990]{key}...
%</authordate|all>
%<*harvard|all>
 %   \harvarditem[Jones et al.]{Jones, Baker, and Williams}{1990}{key}...
%</harvard|all>
 %   
 % This is either to be made up manually, or to be generated by an 
 % appropriate .bst file with BibTeX.
 % 
 % Then, \cite{key}   ==>>  Jones et al. (1990)
 %       \cite[]{key} ==>> (Jones et al., 1990)
 % Multiple citations as normal:
 %       \cite[]{key1,key2} ==>> (Jones et al., 1990; Smith, 1989)
 %                           or  (Jones et al., 1990, 1991)
 %                           or  (Jones et al., 1990a,b)
 % (\citep{key} is shorthand equivalent of \cite[]{key})
 %
 % Full author lists may be forced with \cite*, e.g.
 %       \cite*[]{key}      ==>> (Jones, Baker, and Williams, 1990)
 % Optional notes as:
 %   \cite[chap. 2]{key}    ==>> (Jones et al., 1990, chap. 2)
 %   \cite[e.g.,][]{key}    ==>> (e.g., Jones et al., 1990)
 %   \cite[see][pg. 34]{key}==>> (see Jones et al., 1990, pg. 34)
 %  (Note: in standard LaTeX, only one note is allowed, after the ref.
 %   Here, one note is like the standard, two make pre- and post-notes.)
 %
 %   \citealt{key}          ==>> Jones et al. 1990
 %   \citealt*{key}         ==>> Jones, Baker, and Williams 1990
 %   \citealt{key1,key2}    ==>> Jones et al. 1990; Smith 1989
 %   
 % Additional citation possibilities (author-year only)
 %   \citeauthor{key}     ==>> Jones et al.
 %   \citeyear{key}       ==>> 1990
 %   \citefullauthor{key} ==>> Jones, Baker, and Williams
 % (Multiple keys NOT allowed!)
 % Note: full author lists depends on whether the bib style supports them;
 %       if not, the abbreviated list is printed even when full requested.
 %
 % Defining the citation style of a given bib style:
 % Use \bibpunct (in the preamble only) with 6 arguments:
 %    1. opening bracket for citation
 %    2. closing bracket
 %    3. citation separator (for multiple citations in one \cite)
 %    4. the letter n for numerical styles, s for superscripts
 %        else anything for author-year
 %    5. punctuation between authors and date
 %    6. punctuation between years when common authors missing
 % Example (and default) \bibpunct{(}{)}{;}{a}{,}{,}
 % 
 % To make this automatic for a given bib style, named newbib, say, make
 % a local configuration file, natbib.cfg, with the definition
 %   \newcommand{\bibstyle@newbib}{\bibpunct...}
 % Then the \bibliographystyle{newbib} will cause \bibstyle@newbib to 
 % be called on THE NEXT LATEX RUN (via the aux file).
 %
 % Such preprogrammed definitions may be invoked in the text (preamble only)
 %  by calling \citestyle{newbib}. This is only useful if the style specified
 %  differs from that in \bibliographystyle.
 %
%<*!209>
 % LaTeX2e Options: (for selecting punctuation)
 %   round  -  round parentheses are used (default)
 %   square -  square brackets are used   [option]
 %   curly  -  curly braces are used      {option}
 %   angle  -  angle brackets are used    <option>
 %   colon  -  multiple citations separated by colon (default)
 %   comma  -  separated by comma
 %   authoryear - selects author-year citations (default)
 %   numbers-  selects numerical citations
 %   super  -  numerical citations as superscripts
 %   nobibstyle - deactivates punctuation selection via \bibliographystyle
 % Note: normally the punctuation style defined by \bibstyle@xxx and invoked
 %       with \bibliographystyle{xxx} dominates; give option nobibstyle
 %       if the punctuation options are to dominate over any prestored
 %       citation style.
 % LaTeX2e options are called as, e.g.
 %        \usepackage[square,comma]{natbib}
%</!209>
% \end{verbatim}
% \iffalse
 % LaTeX the source file natbib.dtx to obtain more details.
 %-----------------------------------------------------------
%</package&!subpack>
% \fi
% 
% \section{Options with \texttt{docstrip}}
% The source \texttt{.dtx} file is meant to be processed with
% \texttt{docstrip}, for which a number of options are available:
% \begin{description}
% \item[\ttfamily all] includes all of the other interfaces;
%
% \item[\ttfamily apalike] allows interpretation of minimal \texttt{apalike} 
%    form of |\bibitem|;
%
% \item[\ttfamily newapa] allows |\citeauthoryear| to be in the optional 
%    argument of |\bibitem| along with the punctuation commands of 
%    \texttt{newapa.sty};
%
% \item[\ttfamily harvard] includes interpretation of |\harvarditem|;
%
% \item[\ttfamily astron] allows |\astroncite| to appear in the optional 
%    argument of |\bibitem|;
%
% \item[\ttfamily authordate] adds the syntax of the |\citename| command.
%
% \end{description}
%
% This package file is intended to act as a module for other class files
% written for specific journals, in which case the flexible
% |\bibstyle@|{\em bst\/} commands are not wanted. Punctuation and
% other style features are to be rigidly fixed. These journal options are
% \begin{description}
% \item[\ttfamily agu] for journals of the \textsl{American Geophysical
%   Union};
%
% \item[\ttfamily nlinproc] for \textsl{Nonlinear Processes in Geophysics}.
%
% \end{description}
%
% The remaining options are:
% \begin{description}
% \item[\ttfamily package] to produce a \texttt{.sty} package file with most
%     comments removed;
% 
% \item[\ttfamily 209] (together with \texttt{package}) for a style option 
%     file that will run under the older \LaTeX~2.09;
% 
% \item[\ttfamily subpack] (together with \texttt{package}) for coding that 
%     is to be included inside a larger package; even more comments are 
%     removed, as well as \LaTeXe{} option handling and identification;
%
% \item[\ttfamily driver] to produce a driver \texttt{.drv} file that will
%     print out the documentation under \LaTeXe. The documentation cannot
%     be printed under \LaTeX~2.09.
% 
% \end{description}
% The source file \texttt{\filename.dtx} is itself a driver file and can
% be processed directly by \LaTeXe.
%
% \StopEventually{\PrintIndex\PrintChanges}
% 
% \section{The Coding}
% This section presents and explains the actual coding of the macros.
% It is nested between |%<*package>| and |%</package>|, which
% are indicators to \texttt{docstrip} that this coding belongs to the package 
% file.
%
% The \texttt{docstrip} option |<subpack>| should only be called if the
% coding is to be included as part of another package, in which case the 
% announcement text and \LaTeXe{} options are suppressed.
%
% An inferior version of this coding is provided for running as a 
% style file under \LaTeX~2.09. Code lines belonging to this are
% indicated with guard |<209>|; those for LaTeXe{} only with |<!209>|.
%
% \subsection{Test for Specific Journals}
% This package should not be loaded with the specific journal packages that
% already include it; it is superfluous and can lead to contradictions.
%    \begin{macrocode}
%<*package>
%<*!209&!subpack>
\@ifclassloaded{aguplus}{\PackageError{natbib}
  {The aguplus class already includes natbib coding,\MessageBreak
   so you should not add it explicitly}
  {Type <Return> for now, but then later remove\MessageBreak
   the command \protect\usepackage{natbib} from the document}
  \endinput}{}
\@ifclassloaded{nlinproc}{\PackageError{natbib}
  {The nlinproc class already includes natbib coding,\MessageBreak
   so you should not add it explicitly}
  {Type <Return> for now, but then later remove\MessageBreak
   the command \protect\usepackage{natbib} from the document}
  \endinput}{}
%</!209&!subpack>
%    \end{macrocode}
%
% \subsection{Selection Citation Punctuation and Other Modifications}
% \begin{macro}{\bibstyle@xxx}
% \changes{5.3}{1994 Sep 13}{Add \texttt{agsm} and \texttt{dcu} punctuation 
%    styles from \texttt{harvard} series}
% We begin by defining a number of punctuation styles for specific
% author--year \texttt{.bst} files that I use. 
% They are placed here, near the beginning, so that another
% user can easily find them to add his own. Some comments remain in the
% stripped version too.
%    \begin{macrocode}
%<*!agu&!nlinproc>
 % Define citation punctuation for some author-year styles
 % One may add and delete at this point
%<!209> % Or put additions into local configuration file natbib.cfg
\newcommand\bibstyle@aa{\bibpunct{(}{)}{;}{a}{}{,}}
\newcommand\bibstyle@pass{\bibpunct{(}{)}{;}{a}{,}{,}}
\newcommand\bibstyle@anngeo{\bibpunct{(}{)}{;}{a}{,}{,}}
\newcommand\bibstyle@chicago{\bibpunct{(}{)}{;}{a}{,}{,}}
\newcommand\bibstyle@named{\bibpunct{[}{]}{;}{a}{,}{,}}
%<*all|harvard>
\newcommand\bibstyle@agsm{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
\newcommand\bibstyle@kluwer{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
\newcommand\bibstyle@dcu{\bibpunct{(}{)}{;}{a}{;}{,}\gdef\harvardand{and}}
%</all|harvard>
%    \end{macrocode}
% 
% Here give the explicit punctuation for the specific journals; their
% coding need not contain the punctuation macros |\bibpunct| and
% |\bibstyle@xxx| since the punctuation is fixed for them.
%    \begin{macrocode}
\newcommand\bibstyle@agu{\bibpunct{[}{]}{;}{a}{,}{,~}}
\newcommand\bibstyle@nlinproc{\bibpunct{(}{)}{;}{a}{,}{,}}
%</!agu&!nlinproc>
%<agu>\newcommand\NAT@open{[} \newcommand\NAT@close{]} 
%<agu>\newcommand\NAT@sep{;}
%<agu>\newcommand\NAT@aysep{,} \newcommand\NAT@yrsep{,~}
%<nlinproc>\newcommand\NAT@open{(} \newcommand\NAT@close{)} 
%<nlinproc>\newcommand\NAT@sep{;}
%<nlinproc>\newcommand\NAT@aysep{,} \newcommand\NAT@yrsep{,}
%<*!agu&!nlinproc>
%    \end{macrocode}
% 
% Next, the same thing is done for some numerical styles. A major
% difference here is that the |\@biblabel| and |\@cite| commands must also
% be redefined in many cases. These redefinitions must be made with the
% |\gdef| (global definition) command.
%    \begin{macrocode}
 % Define citation punctuation for some numerical styles
 % One may add and delete at this point
\newcommand\bibstyle@cospar{\bibpunct{/}{/}{,}{n}{}{}%
     \gdef\NAT@biblabelnum##1{##1.}}
\newcommand\bibstyle@esa{\bibpunct{(}{)}{,}{n}{}{}%
     \gdef\NAT@biblabelnum##1{##1.\hspace{1em}}%
     \gdef\NAT@citenum##1##2##3{\NAT@open Ref.~##1\ifNAT@swa,
          ##3\fi\NAT@close}}
\newcommand\bibstyle@nature{\bibpunct{}{}{,}{s}{}{}%
     \gdef\NAT@biblabelnum##1{##1.}}
%    \end{macrocode}
% 
% Finally, the standard \LaTeX{} (numerical) citation styles are included.
%    \begin{macrocode}
 % The standard LaTeX styles
\newcommand\bibstyle@plain{\bibpunct{[}{]}{,}{n}{}{}}
\let\bibstyle@alpha=\bibstyle@plain
\let\bibstyle@abbrv=\bibstyle@plain
\let\bibstyle@unsrt=\bibstyle@plain
%    \end{macrocode}
% \end{macro}
% 
% \subsection{\LaTeXe{} Options}
% \begin{macro}{\ifNAT@numbers}
% \changes{5.5}{1995 Mar 21}{Add flag for switching between cite styles}
% \begin{macro}{\ifNAT@super}
% \changes{5.5}{1995 Mar 21}{Add flag for switching between cite styles}
% Two flags are used to keep track of the citation style. The flag
% |\ifNAT@numbers| is \meta{false} by default (author--year) and switches
% to \meta{true} for numerical citations. The flag |\ifNAT@super| indicates
% if the numerical citation is to be done with superscripts.
%    \begin{macrocode}
\newif\ifNAT@numbers \NAT@numbersfalse
\newif\ifNAT@super \NAT@superfalse
%</!agu&!nlinproc>
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\DeclareOption}
% \changes{5.0}{1994 May 18}{Add \LaTeXe{} options.}
% \changes{5.3}{1994 Sep 13}{Add options \texttt{angle} and \texttt{curly}}
% For \LaTeXe, we can define some options to be used with the |\usepackage|
% command that loads the \thestyle{} package. These are an additional means
% of specifying the citation punctuation and scheme.
%    \begin{macrocode}
%<*!subpack&!209>
\DeclareOption{numbers}{\NAT@numberstrue
   \ExecuteOptions{square,comma}}
\DeclareOption{super}{\NAT@supertrue\NAT@numberstrue}
\DeclareOption{authoryear}{\NAT@numbersfalse
   \ExecuteOptions{round,colon}}
\DeclareOption{round}{%
      \renewcommand\NAT@open{(} \renewcommand\NAT@close{)}}
\DeclareOption{square}{%
      \renewcommand\NAT@open{[} \renewcommand\NAT@close{]}}
\DeclareOption{angle}{%
      \renewcommand\NAT@open{$<$} \renewcommand\NAT@close{$>$}}
\DeclareOption{curly}{%
      \renewcommand\NAT@open{\{} \renewcommand\NAT@close{\}}}
\DeclareOption{comma}{\renewcommand\NAT@sep{,}}
\DeclareOption{colon}{\renewcommand\NAT@sep{;}}
\DeclareOption{nobibstyle}{\let\bibstyle=\@gobble}
%</!subpack&!209>
%    \end{macrocode}
% Note that any punctuation specified with these options will have the
% lowest priority: they can be overwritten by |\bibpunct| (highest
% priority) and by |\bibstyle| in the auxiliary file. The option
% \texttt{nobibstyle} turns off this last feature so that any pre-defined
% punctuation associated with the argument of |\bibliographystyle| will
% have no effect.
% \end{macro}
%
% \subsection{Selecting Citation Punctuation and Other Modifications}
% \begin{macro}{\bibstyle}
% \changes{5.4}{1994 Nov 24}{Move \cs{ProcessOptions} to after definition
%    of \cs{bibstyle}}
% The pre-defined punctuation styles are associated with particular
% \texttt{.bst} files. This is implemented by means of the standard
% |\bibliographystyle| command that specifies the name of the \texttt{.bst}
% file that is to be used by \btx. Some \LaTeX{} manuals erroneously state
% that this command must be issued prior to any |\cite| commands. If that
% were the case, the task of invoking the style definitions would be much
% easier, for they certainly must be issued before the first |\cite|.
% However, I have always called |\bibliographystyle| together with
% |\bibliography|, well after all |\cite| commands. 
% 
% In fact, all that |\bibliographystyle|\marg{bst} does is to write
% |\bibstyle|\marg{bst} to the auxiliary file. This file, and all its
% contents, will be read in at the beginning of the next \LaTeX{} run; to
% be precise, it is read in by |\begin{document}|. The command |\bibstyle| is
% then executed at that point on the next run. However, it is 
% defined to do nothing more than to swallow up its argument! In other
% words, the combination |\bibliographystyle| and |\bibstyle| do absolutely
% nothing to the \LaTeX{} runs. In fact, |\bibstyle| is a command for
% \btx{} alone.
% 
% I have taken advantage of this to redefine |\bibstyle| to execute the
% \texttt{bst}-specific definitions. This definition is made here before
% |\ExecuteOptions| so that options may make use of it; the option
% \texttt{nobibstyle} turns it off, for example.
%    \begin{macrocode}
%<*!agu&!nlinproc>
\renewcommand\bibstyle[1]{\@ifundefined{bibstyle@#1}{\relax}
     {\csname bibstyle@#1\endcsname}}
%    \end{macrocode}
% This is executed only when the auxiliary file is read in, and that is
% when |\begin{document}| is issued. Thus this is well before any |\cite|
% commands. It is for this reason that any definitions in the
% |\bibstyle@xxx| commands must be global.
% 
% A minor problem arises in that the auxiliary file is read in a second
% time, at the end of the run, to check whether any labels have changed. 
% Sometimes, re-executing the |\bibstyle@xxx| command at this point
% produces error messages. To avoid this, |\bibstyle| is reset to its
% normal, do-nothing, definition after |\begin{document}|.
% 
% \LaTeXe{} provides a better way of adding commands to |\document|,
% which is then exploited here. Paradoxically, the problem with re-reading
% the auxiliary file does not seem to arise for this version.
% 
% (|\NAT@set@cites| must also be executed at the start of the document; for
% \LaTeXe, this is added later when the macro is defined.)
%    \begin{macrocode}
%<*209>
\let\ori@document=\document
\renewcommand\document{\ori@document\global\let\bibstyle=\@gobble 
  \NAT@set@cites}
%</209>
%<!209>\AtBeginDocument{\global\let\bibstyle=\@gobble}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\citestyle}
% \changes{5.4}{1995 Feb 03}{Add macro}
% \changes{5.5}{1995 Mar 24}{Make preamble only}
% To allow one to invoke preprogrammed punctuation styles that are
% different from the name of the bibliography style specified by
% |\bibliographystyle|, call |\citestyle| in the preamble. This then
% deactivates |\bibstyle| so that any preprogrammed punctuations become
% ineffective.
% 
% This, and all other punctuation (citation style) declarations, may only
% be used in the preamble, as of version 5.5. (Previously they could only
% be used after the preamble, but the preamble is more logical.)
%    \begin{macrocode}
\let\@citestyle\bibstyle
\newcommand\citestyle[1]{\@citestyle{#1}\let\bibstyle\@gobble}
%<!209>\@onlypreamble{\citestyle}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bibpunct}
% \changes{5.4}{1994 Nov 24}{Add superscript style of citations}
% \changes{5.5}{1995 Mar 21}{Use flags to select citation style}
% \changes{5.5}{1995 Mar 24}{Make preamble only}
% Now |\bibpunct| is defined. It sets various punctuation commands equal to
% its arguments. It also switches to numerical style if that is specified
% by the fourth argument. This is done by setting the citation style
% flag |NAT@numbers| accordingly. The internal cite macros are later
% set to the style-dependent definitions by calling |\NAT@set@cites|.
% 
% The fourth argument can also be \texttt{s} for superscript, which
% sets both the numerical and the |\NAT@super| flags.
%    \begin{macrocode}
\newcommand\bibpunct[6]{\gdef\NAT@open{#1}\gdef\NAT@close{#2}\gdef
   \NAT@sep{#3}\ifx #4n\global\NAT@numberstrue
   \else
   \ifx #4s\global\NAT@numberstrue\global\NAT@supertrue
   \fi\fi
   \gdef\NAT@aysep{#5}\gdef\NAT@yrsep{#6}}
%<!209>\@onlypreamble{\bibpunct}
%<209>\def\do{\noexpand\do\noexpand}
%<209>\edef\@preamblecmds{\@preamblecmds \do\bibpunct \do\citestyle}
%</!agu&!nlinproc>
%    \end{macrocode}
% \end{macro}
% 
% \subsection{Setting the Defaults}
% For \LaTeXe, the defaults (punctuation and scheme type) are set with the
% |\ExecuteOptions| command. For \LaTeX~2.09, the default scheme is
% author--year, and punctuation can only be set with |\bibpunct|.
%
% \begin{macro}{\NAT@open}
% \changes{5.5}{1995 May 14}{Renamed from \cs{@citebegin}}
% \begin{macro}{\NAT@close}
% \changes{5.5}{1995 May 14}{Renamed from \cs{@citeend}}
% \begin{macro}{\NAT@sep}
% \changes{5.5}{1995 May 14}{Renamed from \cs{@citesep}}
% \begin{macro}{\NAT@aysep}
% \changes{5.5}{1995 May 14}{Renamed from \cs{@auyrsep}}
% \begin{macro}{\NAT@yrsep}
% \changes{5.5}{1995 May 14}{Renamed from \cs{@yrsep}}
% The five punctuation characters for citations are the start and stop
% brackets, the character between multiple citations, the character between
% the authors and year (parenthetical only), and the character between
% adjacent years when the common author list is omitted. Define their
% default values. 
%    \begin{macrocode}
%<!agu&!nlinproc>\newcommand\NAT@open{(} \newcommand\NAT@close{)} 
%<!agu&!nlinproc>\newcommand\NAT@sep{;} 
%<*!subpack&!209>
\ExecuteOptions{authoryear}
\ProcessOptions
%</!subpack&!209>
%<!agu&!nlinproc>\newcommand\NAT@aysep{,} \newcommand\NAT@yrsep{,}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
% \subsection{Internal Citing Macros}
% A number of internal macros (|\@citex|, |\@cite|, |\@biblabel|, and
% |\@bibsetup|) need to have different definitions for author--year and
% numerical schemes. They are defined here for the two different styles,
% with different names, and which ones become active depend on the citation
% style flags |\ifNAT@numbers| and |\ifNAT@super|.
% 
% The coding for the journals always defines the internal macros directly
% as the author--year version, since they can never do any switching.
% 
% \begin{macro}{\@cite}
% \changes{5.5}{1995 Mar 21}{Is \cs{let} equal to the numerical or
%      author--year definition}
% \begin{macro}{\NAT@cite}
% \changes{4.2}{1993 Dec 2}{Reversed optional text no longer needs to include
%       a trailing blank}
% \changes{5.0}{1994 May 18}{Add optional notes after as well as before
%      citation.}
% \changes{5.5}{1995 Mar 13}{Add command space in place of space}
% \changes{5.5}{1995 Mar 13}{Use \cs{if}\cs{relax}\texttt{\#2}\cs{relax}
%    in place of \cs{if}\texttt{\#2}\cs{@empty}}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@cite}}
% \begin{macro}{\NAT@citenum}
% \changes{5.0}{1994 May 18}{Add optional notes after as well as before
%      citation.}
% \changes{5.5}{1995 Mar 13}{Add command space in place of space}
% \changes{5.5}{1995 Mar 13}{Use \cs{if}\cs{relax}\texttt{\#2}\cs{relax}
%    in place of \cs{if}\texttt{\#2}\cs{@empty}}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@citenum}}
% \begin{macro}{\NAT@citesuper}
% \changes{5.4}{1994 Nov 24}{Add macro for superscripts}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@citesuper}}
% \changes{5.5}{1995 Mar 27}{Prints post-note only if present}
% Define the internal |\@cite| commands that prints the assembled string
% of citation label texts, plus possible optional notes, before and after.
% The numerical version is almost the same, except that the brackets
% |\NAT@open| and |\NAT@close| are always present. The switch
% |\ifNAT@swa| is \meta{true} if optional arguments were present in the
% calling |\cite| command. For author--year, this distinguishes between
% parenthetical and textual citations.
%
% The superscript citation prints only the following, not the preceding,
% note, and then only if it is present.
%    \begin{macrocode}
%<agu|nlinproc>\renewcommand\@cite%
%<!agu&!nlinproc>\newcommand\NAT@cite%
    [3]{\ifNAT@swa\NAT@open\if\relax#2\relax\else#2\ \fi
        #1\if\relax#3\relax\else, #3\fi\NAT@close\else#1\fi}
%<*!agu&!nlinproc>
\newcommand\NAT@citenum[3]{\NAT@open\ifNAT@swa\if\relax#2\relax\else
   #2\ \fi\fi #1\if\relax#3\relax\else, #3\fi\NAT@close}
\newcommand\NAT@citesuper[3]{\unskip\mbox{$^{\mbox{#1}}$%
   \ifNAT@swa\if\relax#3\relax\else(#3)\fi\fi}}
%</!agu&!nlinproc>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% 
% \begin{macro}{\@citex}
% \changes{5.5}{1995 Mar 21}{Is \cs{let} equal to the numerical or
%      author--year definition}
% \begin{macro}{\NAT@citexnum}
% \changes{5.4}{1994 Nov 24}{Make like \LaTeXe{} definition instead of 2.09}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@citexnum}}
% The original definition of |\@citex| is now used to define |\NAT@citexnum|,
% the version for numerical citations. What it does is to write a
% |\citation| command to the auxiliary file (for \btx), and then parses the
% second argument, the list of citation keys. These keys have to be decoded
% into the actual label text contained in |\b@|{\em key\/} (a number or
% author--year), and put together as the argument of |\@cite|. 
% 
% The temporary command |\@citeb| takes on the value of each of the keys in
% turn; |\@citea| is the separator between multiple citations, initially
% set to nothing, becoming |\NAT@sep| plus line-break suppression
% afterwards. The |\@iden| macro removes any leading blanks in
% |\@citeb|, making |\cite{key1, key2}| possible. If |\b@|{\em key\/} is
% not defined (as on the first run, for example), a warning is printed, and
% a question mark inserted. Finally, the decoded label text is placed into
% an |\hbox| to prevent it from being split.
% 
% Note that here, and in later coding, internal names beginning with
% |\@cite..| are employed; these names are used in the original \LaTeX{}
% coding for the same functions. Therefore, if there are other packages
% that have name conflicts with \thestyle, they will also have conflicts with
% standard \LaTeX\ too.
% 
% \begin{macrocode} 
%<*!agu&!nlinproc>
\newcommand\NAT@citexnum{}
\def\NAT@citexnum[#1][#2]#3{\let\@citea\@empty
  \@cite{\@for\@citeb:=#3\do
    {\@citea\def\@citea{\NAT@sep\penalty\@m\ }%
     \edef\@citeb{\expandafter\@iden\@citeb}%
     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{%
%<209>       {\reset@font\bf ?}\@warning
%<!209>       {\reset@font\bfseries ?}\G@refundefinedtrue\@latex@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
     \hbox{\csname b@\@citeb\endcsname}}}{#1}{#2}}
%</!agu&!nlinproc>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NAT@citex}
% \changes{5.2}{1994 Aug 25}{Make like \LaTeXe{} definition instead of 2.09}
% \changes{5.4}{1994 Nov 24}{Change space to command space for text cites}
% \changes{5.4}{1995 Feb 6}{Add test for adjacent citations having equal
%   authors and years}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@citex}}
% The author--year version of |\@citex| is now defined.
% It starts off much the same as the numerical version. However, it wants
% the authors and year for each decoded label text to be separated into
% |\NAT@name| and |\NAT@date|. This is done by the routine |\NAT@parse|.
% The names of the authors in the previous key are stored in
% |\NAT@last@nm|,
% and if that is the same as the current names, it is not printed again.
% The output citation text is not put into an |\hbox| since line division
% may occur within the author--year citation. The output is formatted
% differently for parenthetical (|\NAT@swa| \meta{true}) and textual
% (|\NAT@swa| \meta{false}) cases.
%    \begin{macrocode}
%<agu|nlinproc>\def\@citex%
%<!agu&!nlinproc>\newcommand\NAT@citex{}
%<!agu&!nlinproc>\def\NAT@citex%
  [#1][#2]#3{\let\@citea\@empty
  \@cite{\let\NAT@name\@empty\let\NAT@year\@empty
    \@for\@citeb:=#3\do
    {\edef\@citeb{\expandafter\@iden\@citeb}%
     \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
     \@ifundefined{b@\@citeb}{\@citea%
%<209>       {\reset@font\bf ?}\@warning
%<!209>       {\reset@font\bfseries ?}\G@refundefinedtrue\@latex@warning
       {Citation `\@citeb' on page \thepage \space undefined}}%
     {\let\NAT@last@nm=\NAT@name\let\NAT@last@yr=\NAT@year
     \NAT@parse{\@citeb}%
%    \end{macrocode}
% Begin parenthetical citation. Check if author names the same as in the
% previous citation, and if so, also check if the years are the same.
% \changes{5.4}{1995 Feb 8}{Add \cs{unskip} to avoid double spacing
%     between years}
% If so, citations are printed `1994a,b'; if a space is wanted between
%  the letters, as `1994a,~b', then give |\NAT@yrsep| as |{,~}|. For this
%  reason, the |\unskip| is needed when the space between years is printed
%  to avoid two spaces.
%    \begin{macrocode}
     \ifNAT@swa
       \ifx\NAT@last@nm\NAT@name\NAT@yrsep
          \ifx\NAT@last@yr\NAT@year \NAT@exlab\else\unskip\ \NAT@date\fi
       \else\@citea{\NAT@name}\NAT@aysep
       \ \NAT@date \fi \def\@citea{\NAT@sep\ }%
%    \end{macrocode}
% Begin textual citation. Do same checks for repeated names and years.
%    \begin{macrocode}
     \else
       \ifx\NAT@last@nm\NAT@name\NAT@yrsep\ifx\NAT@last@yr\NAT@year 
          \NAT@exlab\else \unskip\ \NAT@date\fi
       \else\@citea{\NAT@name}\ \NAT@open\NAT@date\fi
       \def\@citea{\NAT@close\NAT@sep\ }%
     \fi}}\ifNAT@swa\else\NAT@close\fi}{#1}{#2}}
%    \end{macrocode}
% \end{macro}\end{macro}
%
% \begin{macro}{\@biblabel}
% \changes{5.5}{1995 Mar 21}{Is \cs{let} equal to the numerical or
%      author--year definition}
% \begin{macro}{\NAT@biblabel}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@biblabel}}
% \begin{macro}{\NAT@biblabelnum}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@biblabelnum}}
% Similarly for the |\@biblabel| command, that is used to format the
% citation label in the list of references, define the author--year 
% and the numerical versions. For the former, no labels are
% printed in the list of references.
%    \begin{macrocode}
%<agu|nlinproc>\renewcommand\@biblabel[1]{\hfill}
%<*!agu&!nlinproc>
\newcommand\NAT@biblabel[1]{\hfill}
\newcommand\NAT@biblabelnum[1]{[#1]}
%</!agu&!nlinproc>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
% 
% \begin{macro}{\@bibsetup}
% \changes{5.5}{1995 Mar 21}{Is \cs{let} equal to the numerical or
%      author--year definition}
% \begin{macro}{\NAT@bibsetup}
% \changes{5.5}{1995 Mar 13}{Add \cs{bibhang} for variable hanging
%          indentation}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@bibsetup}}
% \begin{macro}{\NAT@bibsetnum}
% \changes{5.1}{1994 Jun 22}{Add \cmd{\if@openbib} as in \LaTeXe}
% \changes{5.5}{1995 Mar 21}{Renamed from \cs{@bibsetnum}}
% The macro |\@bibsetup| is called by |\thebibliography| and contains any
% coding for formatting the list of references that may be different for
% numerical and author--year schemes.  For numerical citations, the
% |\labelwidth| must be set to the size of the longest label (the argument
% of |\thebibliography|), and the |\leftmargin| adjusted accordingly. For
% author--year, there are no labels, so |\labelwidth| is zero, all lines
% after the first are indented by 1~em.
% 
% Since |\thebibliography| is not included in the \textsl{AGU} package,
% this macro is left off here too.
%    \begin{macrocode}
%<*!agu>
%<*!nlinproc>
\newcommand\NAT@bibsetnum[1]{\settowidth\labelwidth{\@biblabel{#1}}%
   \setlength{\leftmargin}{\labelwidth}\addtolength{\leftmargin}{\labelsep}%
%<*!209>
   \if@openbib
     \addtolength{\leftmargin}{\bibindent}%
     \setlength{\itemindent}{-\bibindent}%
     \setlength{\listparindent}{\itemindent}%
     \setlength{\parsep}{0pt}%
   \fi
%</!209>
}
%</!nlinproc>
\newlength{\bibhang}
\setlength{\bibhang}{1em}
%<nlinproc>\newcommand\@bibsetup%
%<!nlinproc>\newcommand\NAT@bibsetup%
   [1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\leftmargin}}
%</!agu>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
% 
% \begin{macro}{\NAT@set@cites}
% \changes{5.5}{1995 Mar 21}{New macro to set the internal macros to
%         numerical or author--year}
% The four internal macros that have different definitions depending on the
% citation style have been defined with different names; now set the macros
% to be executed to that set that is actually wanted. This is determined by
% the flags |\ifNAT@numbers| and |\ifNAT@super|. The setting command 
% |\NAT@set@cites| is executed by |\begin{document}|, after which point,
% the citation style should be frozen.
%    \begin{macrocode}
%<*!agu&!nlinproc>
\newcommand\NAT@set@cites{\ifNAT@numbers
  \ifNAT@super \global\let\@cite\NAT@citesuper \else
     \global\let\@cite\NAT@citenum \fi
  \global\let\@citex\NAT@citexnum
  \global\let\@biblabel\NAT@biblabelnum
  \global\let\@bibsetup\NAT@bibsetnum
 \else
  \global\let\@cite\NAT@cite
  \global\let\@citex\NAT@citex
  \global\let\@biblabel\NAT@biblabel
  \global\let\@bibsetup\NAT@bibsetup
 \fi}
%<!209>\AtBeginDocument{\NAT@set@cites}
%</!agu&!nlinproc>
%<agu|nlinproc>\let\NAT@set@cites\relax
%    \end{macrocode}
% \end{macro}   
%
% \subsection{The Citations}
% \begin{macro}{\cite}
% \changes{5.0}{1994 May 18}{Add a second optional argument.}
% \begin{macro}{\@citex@}
% \changes{5.0}{1994 May 18}{Add to handle second optional argument.}
% \changes{5.3}{1994 Sep 19}{Add starred version to print full author list.}
% \changes{5.4}{1994 Nov 24}{Replace \cmd{\if@tempswa} with \cmd{\ifNAT@swa}.}
% The |\cite| command simply checks if there is an optional argument, and
% then calls |\@citex@|, which in turns checks for a second optional
% then calls the full internal version |\@citex|. The flag |\NAT@swa| is
% set \meta{true} if an optional argument is present. I use this to distinguish
% between parenthetical and textual citations.
% (In standard \LaTeX, and earlier versions of \texttt{natbib}, the switch
% |\if@tempswa| is used here; however, this can conflict with some font
% commands which also use that switch.)
%
% The full author list, if present, is printed with the starred version of
% |\cite|. This is done by setting the flag |\NAT@full|, which is then
% tested by |\NAT@parse|.
%    \begin{macrocode}
\newif\ifNAT@full\NAT@fullfalse
\newif\ifNAT@swa
\renewcommand\cite
    {\@ifstar{\NAT@fulltrue\NAT@cites}{\NAT@fullfalse\NAT@cites}}
\newcommand\NAT@cites{}
\def\NAT@cites{\@ifnextchar [{\NAT@swatrue\NAT@@cites}{\NAT@swafalse
    \NAT@@cites[]}}
\newcommand\NAT@@cites{}
\def\NAT@@cites[#1]{\@ifnextchar [{\@citex[#1]}{\@citex[][#1]}}
%    \end{macrocode}
% \end{macro}\end{macro}
% 
% \begin{macro}{\citealt}
% \changes{5.5}{1995 Mar 16}{Add macro}
% An alternative form of citation is one in which the parentheses are not
% printed. Since the effect of this command is exactly the same as the
% regular |\cite| but with |\NAT@open| and |\NAT@close| set to blank,
% define it just in that way. The starred version for full authors can be
% retained, but the |\cite[]| is not necessary.
% 
% This form has been added at the request of Alexander Holt, who wishes to
% be able to print all three flavours: parenthetical, textual with
% parentheses, and textual without. The |\citealt| command must be able to
% handle multiple references and use the same punctuation scheme as
% |\cite|. For numerical citations, it is the same as |\cite| but without the 
% possibility of adding notes.
% 
% By defining |\citealt| in terms of |\cite|, not only do I save
% considerable programming effort, but David Carlisle's \texttt{showkeys}
% package will work with this command too.
%    \begin{macrocode}
%<*!agu&!nlinproc>
\newcommand{\citealt}{\@ifstar{\NAT@alts}{\NAT@alt}}
\newcommand{\NAT@alt}[1]{{\ifNAT@numbers\else
     \renewcommand\NAT@open{}\renewcommand\NAT@close{}\fi\cite{#1}}}
\newcommand{\NAT@alts}[1]{{\ifNAT@numbers\else
     \renewcommand\NAT@open{}\renewcommand\NAT@close{}\fi\cite*{#1}}}
%</!agu&!nlinproc>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\citep}
% \changes{5.5}{1995 Mar 27}{Add macro as shorthand for \cs{cite[]}}
% I have been requested to supply a shorthand for the parenthetical
% citation; this deviates from my idea of keeping the basic commands as
% much a possible like those in standard \LaTeX, but I guess it can be
% tolerated. No one is compelled to use it.
%    \begin{macrocode}
\newcommand{\citep}{\@ifstar{\cite*[]}{\cite[]}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\citeauthor}
% \changes{5.0}{1994 May 18}{Add means to cite authors only.}
% \changes{5.2}{1994 Aug 25}{Enclose \cs{@citenm} in braces.}
% \changes{5.2}{1994 Aug 25}{Add auxiliary file entry.}
% \begin{macro}{\citeyear}
% \changes{5.0}{1994 May 18}{Add means to cite year only.}
% \changes{5.2}{1994 Aug 25}{Add auxiliary file entry.}
% In an author--year scheme, it is sometimes necessary to refer to the
% authors of a work without the year. It might even be necessary to refer
% to the year alone, but I can hardly imagine that. Both possibilities are
% allowed for here.
%    \begin{macrocode}
\newcommand{\citeauthor}[1]{\if@filesw\immediate\write
     \@auxout{\string\citation{#1}}\fi
%<*!agu&!nlinproc>
\ifNAT@numbers
%<209>       {\reset@font\bf(author?)}\@warning
%<!209>       {\reset@font\bfseries(author?)}\PackageWarning{natbib}
       {Cannot use \protect\citeauthor
%<209>         ^^J
%<!209>         \MessageBreak
        with numerical citations}\else
%</!agu&!nlinproc>
     \@ifundefined{b@#1}{%
%<209>       {\reset@font\bf ?}\@warning
%<!209>       {\reset@font\bfseries ?}\G@refundefinedtrue\@latex@warning
       {Citation `#1' on page \thepage \space undefined}}%
       {\NAT@parse{#1}{\NAT@name}}%
%<!agu&!nlinproc>\fi
}
\newcommand{\citeyear}[1]{\if@filesw\immediate\write
   \@auxout{\string\citation{#1}}\fi
%<*!agu&!nlinproc>
\ifNAT@numbers
%<209>       {\reset@font\bf(year?)}\@warning
%<!209>       {\reset@font\bfseries(year?)}\PackageWarning{natbib}
       {Cannot use \protect\citeyear
%<209>         ^^J
%<!209>         \MessageBreak
        with numerical citations}\else
%</!agu&!nlinproc>
     \@ifundefined{b@#1}{%
%<209>       {\reset@font\bf ?}\@warning
%<!209>       {\reset@font\bfseries ?}\G@refundefinedtrue\@latex@warning
       {Citation `#1' on page \thepage \space undefined}}%
       {\NAT@parse{#1}{\NAT@date}}%
%<!agu&!nlinproc>\fi
}
%    \end{macrocode}
% \end{macro}\end{macro}
% 
% \begin{macro}{\citefullauthor}
% \changes{5.3}{1994 Sep 13}{Add macro for those bib styles with full author
%     list available}
% Some of the author--year bibliography styles supported here (\texttt{harvard}
%   and \texttt{newapa}) allow a citation with the full author list, because
%   they have the necessary information in the |\bibitem| entry. With 
%   version~5.3, I change the native form of this entry to allow
%   full authors too.
%
% Since I now have a starred form of |\cite| for the full author list, it
%  might be reasonable to use a starred |\citeauthor| instead of
% |\citefullauthor|. However, that will conflict with the provisions for
% \thestyle{} to be found in Carlisle's \texttt{showkeys} package. That's life.
%    \begin{macrocode}
\newcommand{\citefullauthor}[1]{\if@filesw\immediate\write
     \@auxout{\string\citation{#1}}\fi
%<*!agu&!nlinproc>
\ifNAT@numbers
%<209>       {\reset@font\bf(author?)}\@warning
%<!209>       {\reset@font\bfseries(author?)}\PackageWarning{natbib}
       {Cannot use \protect\citeauthor
%<209>         ^^J
%<!209>         \MessageBreak
        with numerical citations}\else
%</!agu&!nlinproc>
     \@ifundefined{b@#1}{%
%<209>       {\reset@font\bf ?}\@warning
%<!209>       {\reset@font\bfseries ?}\G@refundefinedtrue\@latex@warning
       {Citation `#1' on page \thepage \space undefined}}%
       {\NAT@parse{#1}{\NAT@all@names}}%
%<!agu&!nlinproc>\fi
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Parsing the Author--Year Entries}
% \begin{macro}{\NAT@parse}
% \changes{5.0}{1994 May 18}{Add parsing command, with additional 
%    font and sub-accent commands relaxed}
% \changes{5.1}{1994 Jun 22}{For \LaTeXe{} of \texttt{1994/06/01}, 
%    can protect font and sub-accents much better}
% \changes{5.2}{1994 Aug 24}{2.09 version to run in compatibility mode}
% \changes{5.3}{1994 Sep 13}{Add full author list}
% \changes{5.3}{1994 Sep 19}{Support starred version of \cs{cite} for full
%    author list}
% \changes{5.3}{1994 Sep 26}{Use \cs{@unexpandable@protect} in place of
%    \cs{noexpand}}
% \changes{5.4}{1995 Feb 6}{Call \cs{@parse@date} to split date into year and
%     extra label}
% \changes{5.5}{1995 May 18}{Rename from \cs{@cite@parse}}
% The |\@citex| command takes each entry in its list and parses them
% individually by calling |\NAT@parse|. This is done this by placing the
% decoded text into |\@tempa|, which is used as the argument of |\NAT@split|,
% which in turn extracts the author and year parts to |\NAT@name| and 
% |\NAT@date| respectively. With version~5.3, |\NAT@all@names| contains
% the full author list, if present, otherwise it is the same as |\NAT@name|.
% The format of the native |\bibitem| label entry is now
% \begin{quote}
% \texttt{[}\emph{short list}\texttt{(}\emph{year}\texttt{)}\relax
%    \emph{full list}\texttt{]}
%  \end{quote}
%    \begin{macrocode}
\newcommand\NAT@parse[1]{{%
%<*209>
      \@ifundefined{documentclass}
       {\let\prm=\relax\let\psf=\relax\let\ptt=\relax\let\pbf=\relax
        \let\psl=\relax\let\psc=\relax\let\pit=\relax\let\pem=\relax
        \let\prmfamily=\relax\let\psffamily=\relax\let\pttfamily=\relax
        \let\pbfseries=\relax\let\pslshape=\relax\let\pscshape=\relax
        \let\pitshape=\relax\let\pmdseries=\relax\let\pupshape=\relax
        \let\pc=\relax \let\pd=\relax \let\pb=\relax}
       {\let\protect=\@unexpandable@protect}%
%</209>
%<!209>     \let\protect=\@unexpandable@protect
     \xdef\@tempa{\csname b@#1\endcsname\relax}}%
     \expandafter\NAT@split\@tempa()()\@nil
     \expandafter\NAT@parse@date\NAT@date??????@@%
     \ifNAT@full\let\NAT@name\NAT@all@names\fi}
%    \end{macrocode}
% Some further notes on the above: for 2.09 it is necessary to turn off all the
% protected font commands |\prm| etc.\ when the label text is expanded into
% |\@tempa|, for otherwise there will be problems with the New Font
% Selection Scheme (NFSS); the protected sub-accent commands (protected
% versions of |\c|, |\d|, and |\b|) also cause troubles on expansion.
% Admittedly, this is not a good solution, for the list of problem commands
% might be much longer, but for the meantime, this will have to do.
% 
% For \LaTeXe, at least after the official release of
% \texttt{1994/06/01}, commands are made robust in a totally different
% manner, no longer by adding a \texttt{p} in front, but by adding a space
% afterwards. This means the commands in the auxiliary files look like the
% protected version once again, and not raw commands. They are infinitely
% protected. The above problem is easily overcome by making |\protect|
% equal to |\@unexpandable@protect|. A definitive list of commands to 
% protect is no longer necessary. (Initially I used |\noexpand|, but
% that only worked for font commands, not accents. Reading the documentation
% in \texttt{ltdefns.dtx} indicated that this is the better redefinition
% of |\protect|.)
%
% This trick is also applied to the 2.09 version for when it is running
% in the compatibility mode of \LaTeXe. This is needed for the 
% journal-specific coding, more than for the normal package.
% 
% The |\relax| added at the end of the |\@tempa|
% expansion is necessary to serve as a pseudo third argument to
% |\citeauthoryear| for the situation where only two arguments are given
% (see below); the additional |()()\@nil| added to the input of |\NAT@split|
% serves to detect the minimal labelling case of the \texttt{apalike} family.
%
% The |\ifNAT@full| flag is tested to see if |\cite| was called with the
% starred version; if so, let |\NAT@name|, the short name list, be equal
% to the full name list.
%
% \end{macro}
% 
% \begin{macro}{\NAT@parse@date}
% \changes{5.4}{1995 Feb 6}{Add macro to split date into year and extra label}
% \changes{5.5}{1995 Mar 24}{Put extra label in braces to localize any font
%      changes}
% \changes{5.5}{1995 May 18}{Rename from \cs{@parse@date}}
% With version 5.4, add the macro |\NAT@parse@date| that splits the date up
% into year and extra label, putting them into |\NAT@year| and |\NAT@exlab|.
% This is used to test if authors and years are equal for two adjacent
% citations, in which case, only the extra label is printed. The 
% macro searches the first 4 characters of the date for a letter 
% (|\catcode|=11) which then becomes the extra label. If there are only
% numerals in the first 4 positions (more precisely, non-letters), the 5th
% character is taken as extra label. If there is none, this will be a 
% question mark.
%    \begin{macrocode}
\newcommand\NAT@parse@date{}
\def\NAT@parse@date#1#2#3#4#5#6@@{%
  \ifnum\the\catcode`#1=11\def\NAT@year{}\def\NAT@exlab{#1}\else
  \ifnum\the\catcode`#2=11\def\NAT@year{#1}\def\NAT@exlab{#2}\else
  \ifnum\the\catcode`#3=11\def\NAT@year{#1#2}\def\NAT@exlab{#3}\else
  \ifnum\the\catcode`#4=11\def\NAT@year{#1#2#3}\def\NAT@exlab{#4}\else
    \def\NAT@year{#1#2#3#4}\def\NAT@exlab{{#5}}\fi\fi\fi\fi}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NAT@split}
% \changes{5.3}{1994 Sep 13}{Changed to support full author list}
% \changes{5.5}{1995 May 14}{Fix coding slightly}
% \changes{5.5}{1995 May 18}{Renamed from \cs{@citez}}
% The author--year information is contained in the \emph{label}, the optional
% argument to |\bibitem|.  To split this label text up into the authors and
% year, the command |\NAT@split| is used. It expects an argument of the form
% \emph{authors}|(|\emph{year}|)|\emph{long authors}, so that \emph{authors} is
% argument |#1|, \emph{year} is |#2|, and \emph{long authors} is |#3|. However,
% if there are no parentheses present in the label, they are provided by the
% calling statement (|\NAT@split\@tempa()()\@nil| above) in which case |#2| is
% blank, and the command |\NAT@apalk| is invoked instead.
% 
% With version~5.3, the \emph{long authors} has been added, along with a fourth
% agument. The third one is now used, so the fourth one becomes the dummy to
% collect the added symbols in the template.
%    \begin{macrocode}
\newcommand\NAT@split{}
\def\NAT@split#1(#2)#3()#4\@nil{\gdef\NAT@name{#1}\gdef\NAT@date{#2}%
  \ifx#3\relax\gdef\NAT@all@names{#1}\else\gdef\NAT@all@names{#3}\fi
%<all|apalike|authordate>  \if\relax#2\relax\expandafter\NAT@apalk#1\@nil\fi
}
%    \end{macrocode}
% Note that \texttt{apalike} is only optionally included, with the
% \texttt{docstrip} options \texttt{all} or \texttt{apalike}. It is also 
% included for the \texttt{authordate} system which reduces to \texttt{apalike}.
% \end{macro}
% 
% \subsection{Other Author--Year Schemes}
% \begin{macro}{\NAT@apalk}
% \changes{4.1}{1993 Oct 4}{Simplify by using comma-space as separator}
% \changes{5.3}{1994 Sep 13}{Full author list equals short list}
% \changes{5.5}{1995 May 18}{Renamed from \cs{@citeapalk}}
% To parse the label text in an \texttt{apalike} style, we assume that the
% year is separated from the abbreviated author list by means of a comma
% and space. If any other punctuation is used, or if the space if left off,
% or if the comma-space appears anywhere within the author list itself,
% then this will not work correctly.  As I mentioned earlier, the minimal
% \texttt{apalike} citation labelling permits separation of authors and year,
% but in a risky manner.
%    \begin{macrocode}
%<*all|apalike|authordate>
\def\NAT@apalk#1, #2\@nil{\gdef\NAT@name{#1}\gdef\NAT@date{#2}%
   \gdef\NAT@all@names{#1}}
%</all|apalike|authordate>
%    \end{macrocode}
% \end{macro}
% 
% The other schemes of citation labelling may also be accommodated, more
% easily than \texttt{apalike}. It is just necessary to define the particular
% commands, like |\citeauthoryear| to format the arguments in the \thestyle{}
% manner, as {\em author\/}|(|{\em year\/}|)|. These commands
% are executed when |\b@|{\em key\/} is expanded into |\@tempa|, so that
% |\NAT@split| only sees the expansion and never the commands themselves.
% 
% The only complication is that |\citeauthoryear| may be given with two or
% three arguments. This is accommodated by adding |\relax| to the |\@tempa|
% expansion, which becomes the dummy third argument in the two-argument
% case, and otherwise does nothing.
% 
% The Harvard family is allowed for simply by defining |\harvarditem| in
% terms of |\bibitem| with the \thestyle{} labelling form.
% 
% \begin{macro}{\citeauthoryear}
% \changes{5.3}{1994 Sep 13}{Allow full authors in citation}
% For \texttt{newapa.bst} itself, the commands |\citestarts|, |\citeends|,
% as well as |\betweenauthors| must be defined; for others in this group,
% these commands are not needed.
%    \begin{macrocode}
%<*newapa|all>
\newcommand{\citeauthoryear}[3]{\ifx#3\relax #1(#2)#1\else #2(#3)#1\fi}
\newcommand{\citestarts}{\NAT@open}
\newcommand{\citeends}{\NAT@close}
\newcommand{\betweenauthors}{and}
%</newapa|all>
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\astroncite}
% The |\astroncite| command is simply defined to produce \thestyle{} 
% format.
%    \begin{macrocode}
%<*astron|all>
\newcommand\astroncite[2]{#1(#2)}
%</astron|all>
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\citename}
% The |\citename| command just reproduces its argument. Since this is
% in the form |{|{\em authors\/}|, }|{\em year\/}, it has the effect 
% of emulating the \texttt{apalike} style. This is because the |{ }| vanish
% during the expansion.
%    \begin{macrocode}
%<*authordate|all>
\newcommand\citename[1]{#1}
%</authordate|all>
%    \end{macrocode}
% \end{macro}
% 
% \begin{macro}{\harvarditem}
% \changes{5.3}{1994 Sep 13}{Allow full authors in citation}
% \changes{5.5}{1995 May 18}{Defined in \LaTeXe\ terms}
% The |\harvarditem| must allow for the optional argument, which is 
% the short author list. Use the short list in |\bibitem| if it is there,
% otherwise the long list must be taken.
% 
%    \begin{macrocode}
%<*harvard|all>
%<!209>\newcommand\harvarditem[4][]%
%<209>\def\harvarditem{\@ifnextchar[{\@harvarditem}{\@harvarditem[]}}
%<209>\def\@harvarditem[#1]#2#3#4%
    {\if\relax#1\relax\bibitem[#2(#3)]{#4}\else
        \bibitem[#1(#3)#2]{#4}\fi }
%    \end{macrocode}
% The command |\citeasnoun| must be defined since \texttt{harvard.bst}
% can add it for cross-referencing.
% \end{macro}
%
% \begin{macro}{\harvardleft}
% \changes{5.3}{1994 Sep 13}{Add macro}
% \begin{macro}{\harvardright}
% \changes{5.3}{1994 Sep 13}{Add macro}
% \begin{macro}{\harvardyearleft}
% \changes{5.3}{1994 Sep 13}{Add macro}
% \begin{macro}{\harvardyearright}
% \changes{5.3}{1994 Sep 13}{Add macro}
% \begin{macro}{\harvardand}
% \changes{5.3}{1994 Sep 13}{Add macro}
% \begin{macro}{\harvardurl}
% \changes{5.3}{1994 Sep 13}{Add macro}
% The \texttt{harvard} package has been updated for \LaTeXe, and includes
% some new punctuation commands in the accompanying \texttt{bst} files.
% (Maybe they were always there and I overlooked them.) In order for
% \thestyle{} to work with these, it needs to define them. The |left| and 
% |right| commands have equivalents already; |\harvardurl| is defined
% as in \texttt{harvard.sty}. It is necessary to define |\harvardand|
% conditionally, and only later, in case it has already been set to
% something else by a |\bibstyle@xxx| (e.g., \texttt{agsm} sets it
% to |\&|.)
%    \begin{macrocode}
\newcommand{\harvardleft}{\NAT@open}
\newcommand{\harvardright}{\NAT@close}
\newcommand{\harvardyearleft}{\NAT@open}
\newcommand{\harvardyearright}{\NAT@close}
%<!209>\AtBeginDocument{\providecommand{\harvardand}{and}}
%<209>\def\harvardand{and}
\newcommand{\harvardurl}[1]{\textbf{URL:} \textit{##1}}
%</harvard|all>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
%
% \subsection{The Bibliography Listing}
% Changes must be made to the \texttt{thebibliography} environment for
% author--year citations. This is done be defining the environment with the
% features common to both schemes, and then by invoking |\@bibsetup|, which
% is either the author--year or numerical version.
% 
% \begin{macro}{\bibsection}
% \changes{4.2}{1993 Oct 22}{Make specific for JGR, GRL, NLINPROC}
% \changes{5.5}{1995 May 18}{Use \cs{renewcommand}}
% First, |\bibsection| is defined according to the main style: if chapters
% exist, then the bibliography is a numberless chapter, otherwise a
% numberless section. For the specific journals, |\bibsection| takes on
% special definitions.
%    \begin{macrocode}
%<*!agu&!nlinproc>
%<!209>\providecommand\bibsection{}
%<209>\def\bibsection{}
\@ifundefined{chapter}%
  {\renewcommand\bibsection{\section*{\refname
    \@mkboth{\uppercase{\refname}}{\uppercase{\refname}}}}}
  {\renewcommand\bibsection{\chapter*{\bibname
   \@mkboth{\uppercase{\bibname}}{\uppercase{\bibname}}}}}
%</!agu&!nlinproc>
%<nlinproc>\def\bibsection{\if@draft\newpage\fi
%<nlinproc>    \noappendix\section*{\refname}}
%    \end{macrocode}
% \end{macro}
% 
% \begin{environment}{thebibliography}
% \changes{4.1b}{1993 Oct 18}{Add \cmd{\bibfont}, defaulted
%                to \cmd{\relax}}
% \changes{4.2}{1993 Oct 22}{Add coding for JGR, GRL, NLINPROC}
% \changes{4.2}{1993 Nov 20}{Remove coding for AGU, since AGU-supplied
%         coding is adequate but different}
% \changes{5.1}{1994 Jun 22}{Put \cmd{\bibfont} at start so \cmd{\list}
%     uses list parameters appropriate for the font size}
% \changes{5.1}{1994 Jun 22}{Add \cmd{\if@openbib} as in \LaTeXe}
% \changes{5.5}{1995 Mar 27}{Add special cross-ref citations for compatibility
%     with \texttt{harvard}, \texttt{chicago}, and \texttt{named}}
%
% The \texttt{thebibliography} environment is defined much as normal, except
% that |\bibsetup| contains the special features for numerical or
% author--year styles. The command |\bibfont| permits permits different
% font sizes or styles to be used in the list. For example, for 
% \textsl{Nonlinear Processes} it is |\small|. This means |\bibfont| must
% be issued before the |\list| command, since the list parameters depend
% on the current font size. For \textsl{AGU}, the whole
% |\thebibliography| is left off, since the AGU-supplied coding will
% do. It is only necessary to add |\noappendix| to the AGU coding.
%    \begin{macrocode}
%<*!agu>
\renewenvironment{thebibliography}[1]
 {\bibfont\bibsection\parindent \z@\list
   {\@biblabel{\arabic{enumiv}}}{\@bibsetup{#1}%
    \usecounter{enumiv}\let\p@enumiv\@empty
    \renewcommand{\theenumiv}{\arabic{enumiv}}}%
%<*!209>
    \if@openbib
      \renewcommand\newblock{\par}
    \else
      \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%
    \fi
%</!209>
%<209>      \def\newblock{\hskip .11em plus.33em minus.07em}%
    \sloppy\clubpenalty4000\widowpenalty4000
    \sfcode`\.=1000\relax
%    \end{macrocode}
% The files \texttt{chicago.bst} and \texttt{named.bst} can add the
% commands |\citeN| and |\shortcite| respectively to the \texttt{.bbl}
% files, for cross-referencing. Similarly, \texttt{harvard.bst} can add
% |\citeasnoun|. These commands must therefore be accommodated, 
% as least within the |thebibliography| environment.
%    \begin{macrocode}
%<newapa|all>    \let\citeN\cite \let\shortcite\cite
%<harvard|all>    \let\citeasnoun\cite
 }{\def\@noitemerr{%
%<209>  \@warning
%<!209>  \@latex@warning
     {Empty `thebibliography' environment}}%
  \endlist\vskip-\lastskip}
%<!nlinproc>\let\bibfont=\relax
%<nlinproc>\let\bibfont=\small
%</!agu>
%<agu>\let\aguthebib=\thebibliography
%<agu>\def\thebibliography#1{\noappendix\aguthebib{#1}}
%    \end{macrocode}
% \end{environment}
% 
% \subsection{Compatibility Commands}
% \begin{macro}{\reset@font}
% \begin{macro}{\refname}
% \begin{macro}{\bibname}
% For older implementations of \LaTeX~2.09 (before December, 1991) the
% |\reset@font| command does not exist. It is defined to be |\relax| under
% normal \LaTeX{}, but does more under NFSS. In case it is not defined, add
% it here. The naming commands |\bibname| and |\refname| are similarly
% unknown for this old \LaTeX.
%    \begin{macrocode}
%<*209>
\@ifundefined{reset@font}{\let\reset@font=\relax}{}
%<!agu&!nlinproc>\@ifundefined{bibname}{\newcommand\bibname{Bibliography}}{}
\@ifundefined{refname}{\newcommand\refname{References}}{}
%</209>
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
%
% \subsection{Local Configuration}
% \changes{5.2}{1994 Aug 25}{Add reading in of \texttt{natbib.cfg}}
% \changes{5.5}{1995 Mar 21}{Local configuration read in at end}
% To accommodate local additional |\bibstyle@| definitions, 
% or any other modifications to the coding, read in
% configuration file \texttt{natbib.cfg} if it exists. 
%    \begin{macrocode}
%<*!subpack&!209>
\InputIfFileExists{natbib.cfg}
       {\typeout{Local config file natbib.cfg used}}{}
%</!subpack&!209>
%    \end{macrocode}
% 
% \Finale
