% \iffalse THIS IS A META-COMMENT
%<*dtx>
\ProvidesFile
%========================================================================
{NATBIB.DTX}
%========================================================================
%
%% Copyright 1993-2007 Patrick W Daly
%% Max-Planck-Institut f\"ur Sonnensystemforschung
%% Max-Planck-Str. 2
%% D-37191 Katlenburg-Lindau
%% Germany
%% E-mail: daly@mps.mpg.de
%
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.
%
% This is a contributed file to the LaTeX system.
% -------------------------------------------------
% 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 documentation
% (La)TeX natbib.ins: creates package file natbib.sty
% and optionally documentation driver natbib.drv
% (natbib.ins may be edited as needed)
% Docstrip options available:
% package - to produce a package .sty file
% notes - to produce a reference sheet for natbib usage
% driver - to produce a driver file to print the documentation
% all - (with package) to include all author-year systems
% else individually with:
% apalike, newapa, chicago, harvard, authordate, astron
%--------------------------------------------------------------------------
%
% *** Identify the package file:-
%\NeedsTeXFormat{LaTeX2e}[1995/06/01]
% (Need LaTeX2e release 3 for option definition with single #)
%\ProvidesPackage{natbib}
%
% *** Provide command to identify reference sheet (notes)
%\NeedsTeXFormat{LaTeX2e}
%\def\DescribesFile#1 [#2 #3 #4]
% {\def\filename{#1}\def\filedate{#2}\def\fileversion{#3}}
%\DescribesFile{natbib}
%
% *** Identify the driver file:-
%\NeedsTeXFormat{LaTeX2e}
%\ProvidesFile{natbib.drv}
%
% *** The DATE, VERSION, and other INFO
%\fi
%\ProvidesFile{natbib}
[2007/10/30 8.1 (PWD)]
% \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@...}}
% \changes{6.0}{1995 Sep 4}{Allow numerical styles with author-year
% \texttt{bst} files}
% \changes{6.0}{1995 Sep 21}{Add automatic indexing of citations}
% \changes{6.0}{1995 Sep 29}{Accommodate \texttt{index} package}
% \changes{6.1}{1995 Nov 22}{Fixed for \LaTeXe\ \texttt{1995/12/01}}
% \changes{6.1}{1995 Dec 4}{Make more robust against changes to internals}
% \changes{6.1a}{1995 Dec 19}{Fix test for changed citations}
% \changes{6.2}{1996 Jan 10}{Replace all \cs{uppercase}}
% \changes{6.2}{1996 Jan 11}{Add \cs{citet}}
% \changes{6.2}{1996 Feb 2}{Fix superscript size}
% \changes{6.2}{1996 Mar 05}{Add length \cs{bibsep} for linespacing between
% references}
% \changes{6.2}{1996 Apr 15}{Fix clash with \texttt{amsart} and
% \texttt{amsbook}}
% \changes{6.3}{1996 Jun 10}{Allow \texttt{showkeys} to be loaded first}
% \changes{6.3}{1996 Jun 17}{Fix punctuation for \texttt{plainnat}}
% \changes{6.3}{1996 Jun 17}{Suppress extra labels with numericals}
% \changes{6.4}{1996 Jun 18}{Provide \cs{bibname} and \cs{refname}}
% \changes{6.4}{1996 Jun 27}{Change \texttt{nlinproc} option to \texttt{egs}}
% \changes{6.4}{1996 Sep 1}{Make compatible with \texttt{chapterbib.sty}}
% \changes{6.4}{1996 Sep 12}{Fix spacing for superscripts}
% \changes{6.4}{1996 Sep 12}{Extra letter printed with \cs{citeyear}}
% \changes{6.4}{1996 Sep 13}{Add compression and sorting of numerical citations}
% \changes{6.4}{1996 Oct 2}{Make compatible with \texttt{hyperref.sty}}
% \changes{6.5}{1996 Dec 11}{KOMA script compatibility}
% \changes{6.5}{1997 Jan 10}{For EGS, no blank line between references}
% \changes{6.5}{1997 Jan 30}{Recode notes so they work with \cs{citet} and
% \cs{citep}; change documentation to stress these commands over \cs{cite}}
% \changes{6.5}{1997 Feb 5}{Fix KOMA script properly}
% \changes{6.6}{1997 Apr 6}{Fix \cs{nocite} to work with \texttt{chapterbib}}
% \changes{6.6}{1997 May 26}{Let \cs{citealt} have full \cs{cite} syntax}
% \changes{6.6}{1997 Jun 4}{Add \cs{citeyearpar}}
% \changes{6.6}{1997 Jun 4}{Add sorting of author--year citations}
% \changes{6.6}{1997 Jun 12}{Add \cs{citealp} like \cs{citep} without parentheses}
% \changes{6.6}{1997 Jun 24}{Fix \texttt{showkeys} functionality}
% \changes{6.6}{1997 Jun 25}{Improve \texttt{hyperref} functionality}
% \changes{6.6}{1997 Jun 30}{Fix bug in \cs{NAT@citex}}
% \changes{6.7}{1997 Jul 14}{Add \texttt{longnamesfirst} option}
% \changes{6.7}{1997 Sep 12}{Fix interface with \texttt{showkeys}}
% \changes{6.7}{1997 Nov 10}{Fix interface with \texttt{babel}}
% \changes{6.7}{1997 Nov 11}{Add reference sheet extraction}
% \changes{6.8}{1997 Dec 1}{Permit \cs{@biblabel} to be user modified}
% \changes{6.8}{1998 Feb 19}{Fix hyperref bug in \cs{citep}}
% \changes{6.8a}{1998 Mar 6}{Correct wrong name for \texttt{longnamesfirst}
% in the documentation}
% \changes{6.8a}{1998 May 14}{\cs{@biblabel} only redefinable for numerical
% mode}
% \changes{6.8b}{1998 July 6}{Hyperref: to work with \texttt{chapterbib} and
% breaks links in textual citations}
% \changes{6.8c}{1998 July 14}{Hyperref: remove opening brace and notes from
% link}
% \changes{6.8d}{1998 Nov 23}{Fix bug in \texttt{super} option; suppress brackets}
% \changes{6.9}{1999 Jan 22}{Fix bug with \cs{makeindex}}
% \changes{6.9}{1999 Feb 23}{Update copyright notice}
% \changes{6.9}{1999 Mar 26}{Babel test made more general}
% \changes{7.0}{1999 May 7}{With empty year, act like \cs{citeauthor}}
% \changes{7.0}{1999 May 21}{Correct \cs{bibsection} for \texttt{amsbook}}
% \changes{7.0a}{2000 Jul 24}{Argument of \cs{citenumfont} always in braces}
% \changes{7.0b}{2002 Feb 27}{Fix bug with superscripts}
% \changes{7.1}{2003 June 6}{Add test for missing extra letter in multi-cites}
% \changes{7.2}{2006 Jan 12}{Allow \texttt{hyperref} with compression}
% \changes{7.2}{2006 Jan 12}{Add compression without sorting}
% \changes{7.2}{2006 Jan 12}{Add compatibility with \texttt{citeref} package}
% \changes{7.3}{2006 Mar 22}{Revise and update the manual documentation}
% \changes{7.4}{2006 Aug 18}{Add \cs{NAT@nmfmt} to names in \cs{NAT@test}}
% \changes{7.4a}{2006 Sep 6}{Fix bug with compress option and hyperref with dvips}
% \changes{7.5}{2007 Feb 2}{Add \cs{citenum} to print (non-superscripted) number}
% \changes{7.5}{2007 Feb 2}{Superscripted braces raised in textual citation too}
% \changes{7.5}{2007 Feb 2}{Change notes for textual numerical citations to be outside}
% \changes{8.0}{2007 Feb 2}{Allow changes in cite style, for chapterbib; remove \texttt{nopreonly} option}
% \changes{8.0}{2007 Feb 5}{Remove 2.09 support}
% \changes{8.0}{2007 Feb 5}{Remove subpackage option (and agu, egs options)}
% \changes{8.1}{2007 Oct 30}{Replace some \cs{edef}s with \cs{protected@edef}}
%
% \CheckSum{2381}
% \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 if it
%^^A does not already exist
%^^A =============================================
\begin{filecontents*}{natbib.ins}
% File: natbib.ins
% Copyright 2006 Patrick W. Daly
%
% This is the natbib installation file for extracting package and driver
% files from the original source file. Simply process it under
% TeX or LaTeX.
%
% This installation works with docstrip 2.4 or later.
\def\batchfile{natbib.ins}
\input docstrip
\preamble
=============================================
IMPORTANT NOTICE:
This program can be redistributed and/or modified under the terms
of the LaTeX Project Public License Distributed from CTAN
archives in directory macros/latex/base/lppl.txt; either
version 1 of the License, or any later version.
This is a generated file.
It may not be distributed without the original source file \inFileName.
Full documentation can be obtained by LaTeXing that original file.
Only a few abbreviated comments remain here to describe the usage.
=============================================
\endpreamble
\postamble
<<<<< End of generated file <<<<<<
\endpostamble
\keepsilent
\declarepreamble\refsheet
=============================================
IMPORTANT NOTICE:
This program can be redistributed and/or modified under the terms
of the LaTeX Project Public License Distributed from CTAN
archives in directory macros/latex/base/lppl.txt; either
version 1 of the License, or any later version.
This is a generated file.
It may not be distributed without the original source file \inFileName.
This is a Reference Sheet for natbib. It consists of excerpts from the
original source file.
For more details, LaTeX the source \inFileName.
==============================================
\endpreamble
\declarepostamble\refsheetq
End of Reference Sheet file
\endpostamble
\declarepreamble\driver
============================================
This is the driver file to produce the LaTeX documentation
from the original source file \inFileName.
Make changes to it as needed. (Never change the file \inFileName!)
============================================
\endpreamble
\declarepostamble\driverq
End of documentation driver file.
\endpostamble
\askforoverwritefalse
\generate{\file{natbib.sty}{\from{natbib.dtx}{package,all}}
\file{natnotes}{\usepreamble\refsheet\usepostamble\refsheetq
\from{natbib.dtx}{notes}}
\file{natbib.drv}{\usepreamble\driver\usepostamble\driverq
\from{natbib.dtx}{driver}}
}
\obeyspaces
\Msg{*********************************************}%
\Msg{* For documentation, process natbib.dtx *}%
\Msg{* or the driver file natbib.drv *}%
\Msg{* For reference sheet, process natnotes.tex *}
\Msg{*********************************************}
\end{filecontents*}
%
%<*driver>
\documentclass{ltxdoc}
%%\documentclass[twoside]{ltxdoc}
%%\documentclass[a4paper]{ltxdoc}
%%\documentclass[twoside,a4paper]{ltxdoc}
\raggedbottom
%** To include the detailed explanation of the coding, comment out
%** the next line
\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)
%% \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)
%% \RecordChanges
\DisableCrossrefs %May stay; zapped by \EnableCrossrefs
\CodelineNumbered %May stay
\begin{document}
\DocInput{natbib.dtx}
\end{document}
%
%<*notes>
%^^A ***************************
%^^A Preamble to the Reference Sheet
%^^A ***************************
\documentclass{article}
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}
\setlength{\textwidth}{\paperwidth}
\addtolength{\textwidth}{-2in}
\setlength{\oddsidemargin}{0pt}
\setlength{\textheight}{\paperheight}
\addtolength{\textheight}{-\headheight}
\addtolength{\textheight}{-\headsep}
\addtolength{\textheight}{-\footskip}
\addtolength{\textheight}{-2in}
\makeatletter
\def\@listI{\leftmargin\leftmargini
\topsep\z@ \parsep\parskip \itemsep\z@}
\let\@listi\@listI
\@listi
\makeatother
\newcommand{\head}[1]{\subsubsection*{#1}}
\pagestyle{headings}
\markright{Reference sheet: \texttt{natbib}}
\usepackage{shortvrb}
\MakeShortVerb{\|}
\begin{document}
\thispagestyle{plain}
%
%\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,\futurelet}
% \DoNotIndex{\ttfamily,\rmfamily,\sffamily,\mdseries,\bfseries,\upshape}
% \DoNotIndex{\slshape,\scshape,\itshape,\em,\LaTeX,\LaTeXe}
% \DoNotIndex{\filename,\fileversion,\filedate,\let,\makeindex}
% \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,\@namedef,\@listi,\markboth,\or,\p@}
% \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,\@firstofone,\@unexpandable@protect}
% \DoNotIndex{\&,\{,\},\bibitem,\bibindent,\if@draft,\typeout}
% \DoNotIndex{\@ifclassloaded,\@ifstar,\@onlypreamble,\@preamblecmds}
% \DoNotIndex{\addtolength,\endinput,\@bsphack,\begingroup,\@wrindex}
% \DoNotIndex{\@listctr,\bibname,\enddocument,\hfil,\ignorespaces,\item}
% \DoNotIndex{\NAT@temp,\refname,\stepcounter,\@ifpackageloaded}
% \DoNotIndex{\@gobbletwo,\index,\itemsep,\markright,\scriptsize}
% \DoNotIndex{\textsuperscript,\@undefined}
% \DoNotIndex{\@celt,\@cite@list,\@citea,\@citeb,\@compress@cite}
% \DoNotIndex{\@bsphack,\@esphack,\@h@ld,\@make@cite@list,\@ne}
% \DoNotIndex{\@sort@celt,\@tempcnta,\@tempcntb,\delimiter,\endgroup}
% \DoNotIndex{\ifcat,\m@ne,\number,\kern,\protected@edef}
% \DoNotIndex{\@markboth,\@mkboth,\nobreak,\SK@,\SK@@citex}
% \DoNotIndex{\SK@@label,\SK@@ref,SK@def,\SK@lbibitem,\bbl@redefine}
% \DoNotIndex{\@safe@activesfalse,\@save@activestrue,\active@prefix}
%
% \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.
% }
%
% \maketitle
%
% \pagestyle{myheadings}
% \markboth{P. W. Daly}{NATURAL SCIENCES CITATIONS AND REFERENCES}
%
% \iffalse % The following lines belong to both the documentation and notes
%<*notes>
% \fi
\newcommand{\btx}{\textsc{Bib}\TeX}
\newcommand{\thestyle}{\texttt{\filename}}
% \iffalse % These lines belong only to the notes
\begin{center}{\bfseries\Large
Reference sheet for \thestyle\ usage}\\
\large(Describing version \fileversion\ from \filedate)
\end{center}
\begin{quote}\slshape
For a more detailed description of the \thestyle\ package, \LaTeX\ the
source file \thestyle\texttt{.dtx}.
\end{quote}
%
% \fi
%
%^^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}
% \iffalse % First line is Reference Sheet only, rest for both doc and Ref. Sheet
%<*notes>
\head{Overview}
% \fi
The \thestyle\ package is a reimplementation of the \LaTeX\ |\cite| command,
to work with both author--year and numerical citations. It is compatible with
the standard bibliographic style files, such as \texttt{plain.bst}, as well as
with those for \texttt{harvard}, \texttt{apalike}, \texttt{chicago},
\texttt{astron}, \texttt{authordate}, and of course \thestyle.
% \iffalse
%
% \fi
% In contrast to the packages listed above, the \thestyle{} package supports not
% only the various author--year bibliography styles, but also those for standard
% numerical citations. In fact, it can also produce numerical citations even
% with an author--year bibliographic style, something that permits easy
% switching between the two citation modes. To this end, replacements for the
% standard \LaTeX\ \texttt{.bst} files are also provided.
%
% It is possible to define the citation \emph{style} (type of brackets and
% punctuation between citations) and even to associate it with the name of
% the bibliographic style so that it is automatically activated. Citation
% styles can be defined for local \texttt{.bst} files by means of a
% configuration file \thestyle\texttt{.cfg}.
%
% It is compatible with the packages: \texttt{babel}, \texttt{index}, \texttt{citeref},
% \texttt{showkeys}, \texttt{chapterbib}, \texttt{hyperref}, \texttt{koma} and
% with the classes \texttt{amsbook} and \texttt{amsart}. It can also emulate the
% sorting and compressing functions of the \texttt{cite} package (with which it
% is otherwise incompatible).
%
% Note that the \texttt{citeref} package (for adding citation page numbers in the
% bibliography) must be loaded after \thestyle. (The \texttt{hyperref} package with
% the option \texttt{pagebackref} also provides this feature, but with hyperlinks.)
%
% The \thestyle\ package therefore acts as a single, flexible interface for
% most of the available bibliographic styles.
%
% \end{abstract}
%
% \newpage\tableofcontents\newpage
%
% \section{Introduction}
%
% The \thestyle{} package is an extension to \LaTeX\ to allow author--year
% citations along with numerical citations. Standard \LaTeX\ permits only
% numerical, whereas all extensions for author--year prior to the release of
% \thestyle{} in 1993 were limited to just that. Since they normally added new
% commands (as \thestyle{} does too), documents written with them could only be
% used with numerical citations after extensive editing.
%
% The \thestyle{} package has changed that; switching from author--year to
% numerical citations is a matter of an option, with no alterations to the
% source text. It has now become part of the standard \LaTeX\ installations,
% and is supported (demanded) by many journals. It is the citation package of
% choice by most of the \LaTeX\ community, mainly because of its flexibility
% and configurability.
%
% Like all packages, it is loaded in the document preamble, with possible options,
% with, e.g.\
% \begin{quote}
% |\usepackage[sectionbib,square]{natbib}|
% \end{quote}
% The option \texttt{sectionbib} specifies that, when used with the package
% \texttt{chapterbib}, the bibliography will appear as a section at the end of
% each chapter (Section~\ref{sec:chapbib}). The \texttt{square} option says
% that references are to be enclosed in square bracket rather than round
% parentheses. See Section~\ref{sec:opts} for a complete list of options.
%
% The document text itself begins with, e.g.
% \begin{quote}
% \begin{verbatim}
% \begin{document}
% \bibliographystyle{plainnat}
% \end{verbatim}
% \end{quote}
% which specifies \texttt{plainnat} to be the bibliography style used by the
% \btx\ program that generates the actual bibliography from a database. The
% style \texttt{plainnat} is the \thestyle{} version of the standard \texttt{plain}
% (numerical only) style. See Section~\ref{sec:plainnat} for other styles, or
% search the installation for \texttt{.bst} files.
%
% The |\bibliographystyle| command can be given anywhere in the document, but
% it makes sense to add it at the start where it can be easily identified (and
% modified).
%
% To make a citation in the text, use
% \begin{quote}
% |\citep{jon90}| for a \emph{parenthetical} citation (Jones et al.,
% 1990),\\
% |\citet{jon90}| for a \emph{textual} one, as Jones et al. (1990).
% \end{quote}
% Both |\citep| and |\citet| are defined by \thestyle{} and are thus not
% standard. The standard \LaTeX\ command |\cite| should be avoided, because it
% behaves like |\citet| for author--year citations, but like |\citep| for
% numerical ones. There are many other commands for other special effects
% (Section~\ref{sec:excite}).
%
% In the above examples, \texttt{jon90} is the identifying key for the
% reference, as found in the \btx\ database, or in the \texttt{thebibliography}
% environment, Section~\ref{sec:bibitem}:
% \begin{quote}
% \begin{verbatim}
% \begin{thebibliography}{1}
% \bibitem[Jones et al.(1990)]{jon90}
% . . . . .
% \end{thebibliography}
% \end{verbatim}
% \end{quote}
% This environment prints the actual bibliography, and the |\bibitem| commands
% link the entries to the citations via the key, here \texttt{jon90}. The key
% may be perfectly arbitrary as long as it is unique. The text in square
% brackets contains the pieces of citation information, the authors \texttt{Jones et
% al.} and the year \texttt{1990}. Note that these are two pieces of text that
% may be packaged together in several different ways, depending on the citation
% command. In fact, if numerical citations are selected, they are (almost)
% ignored and only the sequence number is used as citation.
%
% The \texttt{thebibliography} environment can be made by hand, but it is
% better and safer to let \btx\ do it. For this, one needs the
% |\bibliographystyle| command already mentioned, and near the end of the
% document:
% \begin{quote}
% \begin{verbatim}
% \bibliography{mybib}
% \end{document}
% \end{verbatim}
% \end{quote}
% Here \texttt{mybib} is the root name of the \btx\ database file
% (\texttt{mybib.bib}) containing the data for the references needed in the
% document.
%
% The rest of this document presents all the gorey details about everything
% possible with \thestyle.
%
% \section{Using this Package}\label{sec:usage}
%
% \iffalse
%<*notes>
\head{Loading}
Load with |\usepackage[|\emph{options}|]{|\thestyle|}|. See list of
\emph{options} at the end.
%
% \fi
% In this paper, I distinguish between the citation \emph{mode} (author--year
% or numerical) and citation \emph{style} (the type of punctuation used for
% citations). The citation style is something that is independent of the
% bibliography style and is not programmed in the \texttt{.bst} files.
%
% \subsection{New Bibliography Styles}\label{sec:plainnat}
%
% \iffalse
%<*notes>
\head{Replacement bibliography styles}
% \fi
I provide three new \texttt{.bst} files to replace the standard \LaTeX\
numerical ones:
\begin{quote}\ttfamily
plainnat.bst \qquad abbrvnat.bst \qquad unsrtnat.bst
\end{quote}
% \iffalse
%
% \fi
% These produce reference lists in the same style as the corresponding
% standard \texttt{.bst} file, but work with \thestyle{}. The
% advantage is that they can be used in both numerical and author--year
% mode.
%
% These \texttt{.bst} files are not meant to be exhaustive by any means. Other
% style files conforming to the \thestyle{} format exist, or may be generated
% with my \texttt{custom-bib} (also known as \texttt{makebst}) program.
%
%
% \subsection{The Syntax of the \texttt{thebibliography}}
% \label{sec:bibitem}
%
% The information on the cited author names and year are given as part of the
% |\bibitem| commands within the \texttt{thebibliography} environment. The
% \thestyle{} package expects that information to be in a certain format, which
% is maintained by the above bibliography styles. (It will also be able to
% interpret formats used by some earlier packages, such as \texttt{harvard} and
% \texttt{chicago}.) If one wishes to bypass \btx, one must make up the
% \texttt{thebibliography} oneself, such that it conforms to \thestyle.
%
% This syntax looks as follows:
% \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 text in square brackets contains the pieces of citation texts, the short
% author list, \texttt{Jones et al.}, the year \texttt{1990}, and the optional long
% author list \texttt{Jones, Baker and Williams}. If the long list is missing,
% the short list will be used instead. The parentheses around the year are
% \emph{not} part of the text, but merely delimit the year from the author
% lists. Round parentheses must always be used, even if square brackets are
% wanted for the citations. And there must be no space before or after the year
% parentheses, else it will become part of the author list.
%
% \medskip\noindent
% \textbf{Note:} if any single |\bibitem| entry does not conform to a syntax that
% \thestyle{} understands, it switches stubbornly to numerical mode, since it
% otherwise has no idea what the author and year texts could be.
%
% \subsection{Basic Citation Commands}
%
% The \thestyle{} package can be used with bibliography styles that were
% intended for other, older packages, like \texttt{harvard}. However,
% the commands described in this and the next sections are defined by
% \thestyle{} and must be used even with those other bibliography styles.
%
% \DescribeMacro{\citet}
% \DescribeMacro{\citep}
% \iffalse
%<*notes>
\head{Basic commands}
% \fi
The \thestyle\ package has two basic citation commands, |\citet| and
|\citep| for \emph{textual} and \emph{parenthetical} citations, respectively.
There also exist the starred versions |\citet*| and |\citep*| that print
the full author list, and not just the abbreviated one.
All of these may take one or two optional arguments to add some text before
and after the citation.
\begin{quote}
\begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
|\citet{jon90}| & Jones et al. (1990)\\
|\citet[chap.~2]{jon90}| & Jones et al. (1990, chap.~2)\\[0.5ex]
|\citep{jon90}| & (Jones et al., 1990)\\
|\citep[chap.~2]{jon90}| & (Jones et al., 1990, chap.~2)\\
|\citep[see][]{jon90}| & (see Jones et al., 1990)\\
|\citep[see][chap.~2]{jon90}| & (see Jones et al., 1990, chap.~2)\\[0.5ex]
|\citet*{jon90}| & Jones, Baker, and Williams (1990)\\
|\citep*{jon90}| & (Jones, Baker, and Williams, 1990)
\end{tabular}
\end{quote}
% \iffalse
%
% \fi
% The starred versions can only list the full authors if the \texttt{.bst}
% file supports this feature; otherwise, the abbreviated list is printed.
%
% In standard \LaTeX, the |\cite| command can only take a single optional
% text for a note after the citation; here, a single optional text is a
% post-note, while two are the pre- and post-notes. To have only a pre-note, it
% is necessary to provide an empty post-note text, as shown above.
%
% More complex mixtures of text and citations can be generated with the
% all-purpose |\citetext| command in Section~\ref{sec:excite}.
%
% \iffalse
%<*notes>
\head{Multiple citations}
% \fi
Multiple citations may be made 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}
|\citet{jon90,jam91}| & Jones et al. (1990); James et al. (1991)\\
|\citep{jon90,jam91}| & (Jones et al., 1990; James et al. 1991)\\
|\citep{jon90,jon91}| & (Jones et al., 1990, 1991)\\
|\citep{jon90a,jon90b}| & (Jones et al., 1990a,b)
\end{tabular}
\end{quote}
% \iffalse
\head{Numerical mode}
% \fi
These examples are for author--year citation mode. In numerical mode, the
results are different.
\begin{quote}
\begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
|\citet{jon90}| & Jones et al. [21]\\
|\citet[chap.~2]{jon90}| & Jones et al. [21, chap.~2]\\[0.5ex]
|\citep{jon90}| & [21]\\
|\citep[chap.~2]{jon90}| & [21, chap.~2]\\
|\citep[see][]{jon90}| & [see 21]\\
|\citep[see][chap.~2]{jon90}| & [see 21, chap.~2]\\[0.5ex]
|\citep{jon90a,jon90b}| & [21, 32]
\end{tabular}
\end{quote}
% \iffalse
%
% \fi
% The authors can only be listed if the \texttt{.bst} file supports
% author--year citations. The standard \texttt{.bst} files, such as
% \texttt{plain.bst} are numerical only and transfer no author--year
% information to \LaTeX. In this case, |\citet| prints ``\textbf{(author?)}
% [21].''
%
% \DescribeMacro{\cite}
% In the original versions of \thestyle, the traditional |\cite| command was
% used for both textual and parenthetical citations. The presence of an empty
% optional text in square brackets signalled parenthetical. This syntax has been
% retained for compatibility, but is no longer encouraged.
%
% This means that |\cite| (without notes) is the same as |\citet| in
% author--year mode, whereas in numerical mode, it is the same as |\citep|.
% The starred version, as well as the one or two optional notes, may also be
% used.
%
% It is possible to have multiple citations sorted into the same sequence as
% they appear in the list of references, regardless of their order as
% arguments to the |\cite| commands. The option \texttt{sort} is required for
% this feature. See Section~\ref{sec:sort}.
%
% Some publishers require that the first citation of any given reference be
% given with the full author list, but that all subsequent ones with the
% abbreviated list. Include the option \texttt{longnamesfirst} to enable this for
% \thestyle. See Section~\ref{sec:long}.
%
% \subsection{Extended Citation Commands}
% \label{sec:excite}
%
% \DescribeMacro{\citealt}
% \DescribeMacro{\citealp}
% \DescribeMacro{\citetext}
% \DescribeMacro{\citenum}
% \iffalse
%<*notes>
\head{Suppressed parentheses}
% \fi
As an alternative form of citation, |\citealt| is the same as |\citet| but
\emph{without parentheses}. Similarly, |\citealp| is |\citep| without
parentheses.
The |\citenum| command prints the citation number, without parentheses, even
in author--year mode, and without raising it in superscript mode. This is
intended to be able to refer to citation numbers without superscripting them.
% Multiple references, notes, and the starred variants
% also exist for these, except for |\citenum|.
%
\begin{quote}
\begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
|\citealt{jon90}| & Jones et al.\ 1990\\
|\citealt*{jon90}| & Jones, Baker, and Williams 1990\\
|\citealp{jon90}| & Jones et al., 1990\\
|\citealp*{jon90}| & Jones, Baker, and Williams, 1990\\
|\citealp{jon90,jam91}| & Jones et al., 1990; James et al., 1991\\
|\citealp[pg.~32]{jon90}| & Jones et al., 1990, pg.~32\\
|\citenum{jon90}| & 11\\
|\citetext{priv.\ comm.}| & (priv.\ comm.)
\end{tabular}
\end{quote}
The |\citetext| command
allows arbitrary text to be placed in the current citation parentheses.
This may be used in combination with |\citealp|.
% For example,
% \begin{verbatim}
% \citetext{see \citealp{jon90}, or even better \citealp{jam91}}
% \end{verbatim}
% to produce (see Jones et al., 1990, or even better James et al., 1991).
%
% \iffalse
%
% \fi
%
% \DescribeMacro{\citeauthor}
% \DescribeMacro{\citeyear}
% \DescribeMacro{\citeyearpar}
% \DescribeMacro{\citefullauthor}
% \iffalse
%<*notes>
\head{Partial citations}
% \fi
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 the
extra commands
\begin{quote}
\begin{tabular}{l@{\quad$\Rightarrow$\quad}l}
|\citeauthor{jon90}| & Jones et al.\\
|\citeauthor*{jon90}| & Jones, Baker, and Williams\\
|\citeyear{jon90}| & 1990\\
|\citeyearpar{jon90}| & (1990)
\end{tabular}
\end{quote}
% \iffalse
%
% \fi
% There also exists a command |\citefullauthor| which is equivalent to
% |\citeauthor*|.
%
% If the full author information is missing, then |\citeauthor*| is
% the same as |\citeauthor|, printing only the abbreviated list.
% This also applies to the starred versions of |\citet| and |\citep|.
%
% If the author or year information is missing (as is the case with the
% standard \LaTeX{} \texttt{.bst} files), these commands issue a warning.
%
% \medskip\noindent
% \textbf{Note:}
% these commands may also be used with numerical
% citations, provided an author--year \texttt{.bst} file is being employed.
%
% \medskip\noindent
% \textbf{Note:} all |\cite..| commands have the same
% syntax, allowing multiple citations and up to two notes (there are, however,
% no starred |\citeyear| or |\citenum| variants). It does not really make much sense to add
% notes to |\citeyear| and |\citeauthor|, especially with multiple citations;
% however, this can be done, there will be no error message, but the results
% are sometimes strange. For example, in numerical mode, the notes are fully
% ignored, while in author--year mode, only the post-note is accepted.
% Multiple citations in |\citet| are also not recommended (nor are they in my
% opinion meaningful), but if they are used with notes, the pre-note will
% appear before each year, and the post-note only after the last year. These
% are admittedly bugs, but the effort to remove them is not justified by the
% questionable usefulness of these features.
%
% In summary, notes are only intended for |\citep| but they may also be used
% with |\citet| in author--year mode, with single citations. In any other
% situation, the results are unpredictable.
%
% \DescribeMacro{\Citet}
% \DescribeMacro{\Citep}
% \DescribeMacro{\Citealt}
% \DescribeMacro{\Citealp}
% \DescribeMacro{\Citeauthor}
% \subsection{Forcing Upper Cased Name}
% \iffalse
%<*notes>
\head{Forcing upper cased names}
% \fi
If the first author's name contains a \textsl{von} part, such as ``della
Robbia'', then |\citet{dRob98}| produces ``della Robbia (1998)'', even at the
beginning of a sentence. One can force the first letter to be in upper case
with the command |\Citet| instead. Other upper case commands also exist.
\begin{quote}
\begin{tabular}{rl@{\quad$\Rightarrow$\quad}l}
when & |\citet{dRob98}| & della Robbia (1998) \\
then & |\Citet{dRob98}| & Della Robbia (1998) \\
& |\Citep{dRob98}| & (Della Robbia, 1998) \\
& |\Citealt{dRob98}| & Della Robbia 1998 \\
& |\Citealp{dRob98}| & Della Robbia, 1998 \\
& |\Citeauthor{dRob98}| & Della Robbia
\end{tabular}
\end{quote}
These commands also exist in starred versions for full author names.
% \medskip\noindent
% \textbf{Note:} the coding for the upper casing commands is tricky and likely
% buggy. It operates on the names that are stored in the |\bibitem| entry, and
% works even if old style font commands are used; however, \LaTeXe\ commands will
% cause it to crash. Thus\\
% \begin{tabular}[t]{ll}
% |\bibitem[{\it della Robbia}(1998)]{dRob98}| & is okay, but \\
% |\bibitem[\textit{della Robbia}(1998)]{dRob98}| & crashes.
% \end{tabular}
% ^^A I hope to improve this situation in future.
%
% \iffalse
%
% \fi
%
% \subsection{Citation Aliasing}
% \DescribeMacro{\defcitealias}
% \DescribeMacro{\citetalias}
% \DescribeMacro{\citepalias}
% \iffalse
%<*notes>
\head{Citation aliasing}
% \fi
Sometimes one wants to refer to a reference with a special designation,
rather than by the authors, i.e. as Paper~I, Paper~II. Such aliases can be
defined and used, textual and/or parenthetical with:
\begin{quote}
\begin{tabular}{lcl}
|\defcitealias{jon90}{Paper~I}|\\
|\citetalias{jon90}| & $\Rightarrow$ & Paper~I\\
|\citepalias{jon90}| & $\Rightarrow$ & (Paper~I)
\end{tabular}
\end{quote}
These citation commands function much like |\citet| and |\citep|: they may
take multiple keys in the argument, may contain notes, and are marked as
hyperlinks.
% \iffalse
%
% \fi
%
% A warning is issued if the alias is used before it is defined, or if an alias
% is redefined for a given citation. No warning is issued if an alias is
% defined for a citation key that does not exist; the warning comes when it is
% used!
%
% See Section~\ref{sec:yearless} for an alternative means of citing with
% a code name.
%
% \subsection{Authorless and Yearless References}\label{sec:yearless}
% What does one do about references that do not have authors? This has long
% bothered me but I do have a suggestion. Standard \btx\ styles make use of a
% \texttt{KEY} field in the entries to be used for alphabetizing when the
% authors or editors are missing. The author--year styles go even further and
% insert the \texttt{KEY} field in place of the authors. One can imagine giving
% a code designation for the work at this point. For example,
% \begin{quote}
% \begin{verbatim}
% @MANUAL{handbk98,
% title = {Assembling Computers},
% year = 1998,
% organization = {MacroHard Inc.},
% key = "MH-MAN"
% }
% \end{verbatim}
% \end{quote}
% With \texttt{plain}, the key text \texttt{MH-MAN} is used only to order the
% reference, but with \texttt{plainnat} and other author--year styles, it is
% used in place of the authors. One can then refer to it as
% |\citeauthor{handbk98}| to get MH-MAN or as |\citetext{\citeauthor{handbk98}}|
% for (MH-MAN), a parenthetical citation.
%
% This can be greatly simplified if
% the bibliography style leaves the date blank in the |\bibitem|
% entry, as
% \begin{quote}
% |\bibitem[MH-MAN()]{handbk98}|
% \end{quote}
% for then \thestyle\ suppresses the date, preceding punctuation, and the
% braces for |\citet|. This means that |\citet| and |\citep| behave
% automatically like the two examples above.
% The date still may appear in the text of the reference.
%
% The \thestyle\ bibliography styles have been modified accordingly to omit
% the date from the |\bibitem| entry when missing authors and/or editors
% are replaced by key text.
%
% Similarly, if the year is missing, it will be left blank in the |\bibitem|
% entry; thus citing such a work will only produce the authors' names.
%
% \medskip\noindent
% \textbf{Note:} there are many other possibilities with this feature. One can
% even produce citations like those of the \texttt{alpha} bibliography style,
% by placing the citation code in place of the authors in the |\bibitem| entry
% and leaving the year blank. A second code (or maybe even the authors
% themselves) could be placed where the full author list normally appears, to
% be printed with the starred version of the |\cite| commands. For example,
% \begin{quote}
% |\bibitem[MH-MAN()MacroHard Inc.]{handbk98}|
% \end{quote}
%
% \subsection{Extra Features in the \texttt{plainnat} Family}\label{sec:url}
%
% The special \texttt{.bst} files for \thestyle\ mentioned in
% Section~\ref{sec:plainnat} have a number of extra fields compared to the
% original files: \\
% \begin{tabular}{lp{10.5cm}}
% \texttt{ISBN} & for the ISBN number in books,\\
% \texttt{ISSN} & for the ISSN number in periodicals,\\
% \texttt{URL} & for the Internet address of online documents,\\
% \texttt{DOI} & the \emph{Digital Object Identifier} now being used by many
% journals as a more robust alternative to URL,\\
% \texttt{EID} & \emph{electronic ID}, a substitute for page numbers for online journals
% that also appear in print; also known as the \emph{sequence number}
% within the paper volume.
% \end{tabular}\\
%
% Both the DOI and URL tend to be very long, causing ugly line breaks or
% sticking out into the margin. This can be avoided by loading the \texttt{url}
% package by Donald Arseneau, which allows text to be broken at punctuation
% marks without a hyphen. This package is automatically detected by \thestyle{}
% and appropriate commands redefined. URLs are printed in typewriter font, DOI
% in roman. Without the \texttt{url} package, these numbers are never broken.
%
% As pointed out in Section~\ref{sec:yearless}, the \texttt{KEY} field is
% treated differently by \texttt{plainnat} than in \texttt{plain}. Whereas the
% latter uses this field only to alphabetize entries without authors,
% \texttt{plainnat} actually inserts it in place of the author, both in the
% reference text and in the citation label (|\bibitem| entries). Furthermore,
% the year is left empty in |\bibitem| so that |\citep| prints only the
% ``author'' text, which is now the \texttt{KEY}. This should be some code
% designation for the work.
%
% \subsection{Selecting Citation Punctuation}\label{sec:bibpunct}
%
% \DescribeMacro{\setcitestyle}
% The above examples have been printed with the default citation style.
% It is possible to change this, as well as to select numerical or
% author--year mode, by means of the |\setcitestyle| command, which takes as argument
% a comma-separated list of keywords. (This command is new to version~8.)
% \iffalse
%<*notes>
\head{Selecting citation style and punctuation}
Use the command |\setcitestyle| with a list of comma-separated
keywords (without spaces) as argument.
% \fi
\begin{quote}
Citation mode: |authoryear| or |numbers| or |super|\\
Braces: |round| or |square| or |open={|\emph{char}|},close={|\emph{char}|}|\\
Between citations: |semicolon| or |comma| or |citesep={|\emph{char}|}|\\
Between author and year: |aysep={|\emph{char}|}|\\
Between years with common author: |yysep={|\emph{char}|}|\\
Text before post-note: |notesep={|\emph{text}|}|
\end{quote}
Defaults are |authoryear|, |round|, |comma|, |aysep={;}|, |yysep={,}|,
|notesep={, }|
Example~1, |\setcitestyle{square,aysep={},yysep={;}}| changes the author--year
output of
\begin{quote}
|\citep{jon90,jon91,jam92}|
\end{quote}
into [Jones et al. 1990; 1991, James et al. 1992].
Example~2, |\setcitestyle{notesep={; },round,aysep={},yysep={;}}| changes the output of
\begin{quote}
|\citep[and references therein]{jon90}|
\end{quote}
into (Jones et al. 1990; and references therein).
% \medskip\noindent
% \textbf{Note}:
% \begin{itemize}
% \item parameters not specified remain unchanged;
% \item the order of the keywords is unimportant;
% \item the punctuation between author and year applies only to author--year
% citations, not numerical;
% \item the |yysep| punctuation comes between years when multiple citations
% have the same, non-repeated authors; a space is always inserted
% as well; if the years too are same, the citation is printed as `2007a,b',
% without a space; to include a space, add it with |yysep={,~}|;
% \item for numerical citations with common authors, e.g,
% |\citet{jon90,jon91}| produces `Jones et al.\ [21, 22]' with the
% punctuation between the numbers; a space is automatically included for
% numbers, but not for superscripts.
% \item a single character does not really need to be in |{ }|,
% other than a comma; |yysep=;| is acceptable;
% \end{itemize}
%
% \DescribeMacro{\bibpunct}
% The older command for setting the citation style is |\bibpunct| which
% takes one optional and 6 mandatory 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;
% \item the punctuation that comes between the author names and the year
% \item the punctuation that comes between years or numbers when common author
% lists are suppressed (default = ,);
% \end{enumerate}
%
% The optional argument is the character preceding a post-note, default is a
% comma plus space. In redefining this character, one must include a space if
% one is wanted.
%
% The above |\setcitestyle| examples can be achieved with
% \begin{quote}
% |\bibpunct{[}{]}{,}{a}{}{;}| and\\
% |\bibpunct[,~]{(}{)}{,}{a}{}{;}|.
% \end{quote}
%
% \iffalse
%
% \fi
%
% \subsection{Predefining a citation style}\label{sec:predef}
%
% \DescribeMacro{\bibstyle@xxx}
% \DescribeMacro{\citestyle}
%
% If a particular set of citation punctuations is commonly used, it is possible
% to store it in the local \thestyle\texttt{.cfg} and to recall it with
% |\citestyle{|\emph{name}|}|. The
% definition is done by creating a command |\bibstyle@|\emph{name}, which sets
% the desired citation style.
%
% For example, the American Geophysical Union (AGU) demands in its publications
% that citations be made with square brackets and separated by semi-colons.
% There is 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}
% which allows this set to be selected with the command
% \begin{quote}
% |\citestyle{agu}|
% \end{quote}
%
% There is an additional feature to such predefined styles: \thestyle\ attempts
% to execute |\citestyle| at the beginning of the document
% with the name of the bibliography style, as given by
% the |\bibliographystyle| command (and stored in the \texttt{.aux} file).
% This means that a citation style can be
% directly associated with a \texttt{.bst} file. Such implicit styles are
% immediately overwritten by any explicit style specifications, such as package
% options or |\setcitestyle|, |\bibpunct|, |\citestyle| commands.
%
% Predefined citation styles are contained within the \thestyle\ code for the
% following bibliography styles:
% \begin{description}
% \item[\texttt{plain}] etc. (the 4 base styles): square braces, numerical, commas
% \item[\texttt{plainnat}] etc.: square braces, author--year, commas
% \item[\texttt{agu}] (American Geophysical Union): square, author--year, semi-colon
% \item[\texttt{egu}] (European Geosciences Union): round, author--year, semi-colon
% \item[\texttt{agms, dcu, kluwer}] (Harvard set): round, author--year
% \item[\texttt{cospar}] (Committe on Space Research): slashes, numerical, comma
% \item[\texttt{nature}] (Journal \textsl{Nature}): superscripts
% \end{description}
% There are others but they are mainly for my personal convenience. The above
% represent most of the major variations and can be used as required. The
% automatic association with other bibliography styles can only be achieved by
% putting the definitions into the local \thestyle\texttt{.cfg}.
%
% Note that the predefinitions for |plain| and |plainnat| specify square
% braces, thus changing the normal \thestyle\ default of round parentheses.
%
% The style defining commands may contain more than just |\bibpunct|
% or |\setcitestyle|.
% Some numerical citation scheme require even more changes. For example,
% \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}{}{\textsuperscript{,}}%
% \renewcommand\bibnumfmt[1]{##1.}}
% \end{verbatim}
% \end{quote}
% The redefined |\bibnumfmt| command specifies how the reference numbers
% are to be formatted in the list of references itself.
%
% \subsection{Priority of Style Commands}\label{sec:priority}
% The citation style (punctuation and mode) can be selected by means of the
% |\setcitestyle|, |\bibpunct|, |\citestyle| commands or via
% |\bibliographystyle{|\textit{bst}|}| with a predefined |\bibstyle@|\textit{bst}.
% They can also be selected by package options
% (Section~\ref{sec:opts}). What happens if there are several conflicting
% selections?
%
% The lowest priority is assigned to the |\bibliographystyle|
% command, since this is implicit and not transparent to the user. The
% package options have the next priority. Finally, any selection by
% |\setcitestyle|,
% |\bibpunct| and/or |\citestyle| overrides those of the other methods.
%
% \subsection{Other Formatting Options}
%
% \iffalse
%<*notes>
\head{Other formatting options}
% \fi
%
% \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.
%
% \iffalse
Redefine |\bibsection| to the desired sectioning command for introducing
the list of references. This is normally |\section*| or |\chapter*|.
% \fi
%
% \DescribeMacro{\bibpreamble}
% A preamble appearing after the |\bibsection| heading may be inserted before
% the actual list of references by defining |\bibpreamble|. This will appear in
% the normal text font unless it contains font declarations. The
% |\bibfont| applies to the list of references, not to this preamble.
%
% \iffalse
Define |\bibpreamble| to be any text that is to be printed after the heading but
before the actual list of references.
% \fi
%
% \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 after any preamble. For example,
% \begin{quote}
% |\newcommand{\bibfont}{\small}|
% \end{quote}
% \iffalse
Define |\bibfont| to be a font declaration, e.g.\ |\small| to apply to
the list of references.
% \fi
%
% \DescribeMacro{\citenumfont}
% Numerical citations may be printed in a different font. Define |\citenumfont|
% to be a font declaration like |\itshape| or even a command taking arguments
% like |\textit|.
% \begin{quote}
% |\newcommand{\citenumfont}[1]{\textit{#1}}|
% \end{quote}
% The above is better than |\itshape| since it automatically adds italic
% correction.
% \iffalse
Define |\citenumfont| to be a font declaration or command like |\itshape|
or |\textit|.
% \fi
%
% \DescribeMacro{\bibnumfmt}
% The format of the numerical listing in the reference list may also be changed
% from the default [32] by redefining |\bibnumfmt|, for example
% \begin{quote}
% |\renewcommand{\bibnumfmt}[1]{\textbf{#1}:}|
% \end{quote}
% to achieve \textbf{32}: instead.
% \iffalse
Redefine |\bibnumfmt| as a command with an argument to format the numbers in
the list of references. The default definition is |[#1]|.
% \fi
%
% \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|.
%
% \iffalse
The indentation after the first line of each reference is given by
|\bibhang|; change this with the |\setlength| command.
% \fi
% \DescribeMacro{\bibsep}
% The vertical spacing between references in the list, whether author--year
% or numerical, is controlled by the length |\bibsep|. If this is set to
% 0~pt, there is no extra line spacing between references. The default
% spacing depends on the font size selected in |\documentclass|, and is
% almost a full blank line. Change this by redefining |\bibsep| with
% |\setlength| command.
%
% \iffalse
The vertical spacing between references is set by |\bibsep|; change this with
the |\setlength| command.
%
% \fi
%
% \subsection{Automatic Indexing of Citations}
%
% \DescribeMacro{\citeindextrue}
% \DescribeMacro{\citeindexfalse}
% \iffalse
%<*notes>
\head{Automatic indexing of citations}
% \fi
If one wishes to have the citations entered in the \texttt{.idx} indexing
file, it is only necessary to issue |\citeindextrue| at any point in the
document. All following |\cite| commands, of all variations, then insert
the corresponding entry to that file. With |\citeindexfalse|, these
entries will no longer be made.
% \iffalse
%
% \fi
% The |\bibitem| commands in the \texttt{thebibliography} environment will
% also make index entries. If this is not desired, then issue
% |\citeindexfalse| before |\bibliography| or |\begin{thebibliography}|.
%
% Of course, |\makeindex| must also be issued in the preamble to activate
% indexing, as usual. Otherwise, no indexing is done at all.
%
% Make sure that the document has been processed at least twice after the
% last \btx\ run before running the \texttt{makeindex} program.
%
% \DescribeMacro{\NAT@idxtxt}
% The form of the index entries is set by the internal |\NAT@idxtxt|, which
% can be redefined by hackers if wanted (in the \thestyle\texttt{.cfg} file
% please). By default, it prints the short author list plus date or number in the
% current parenthesis style and citation mode.
%
% The \thestyle\ package can also be used with the \texttt{index} package of
% David~M. Jones. The order in which the packages are loaded is not
% important.
%
% \DescribeMacro{\citeindextype}
% In that package, multiple index lists may be made by means of a |\newindex|
% command. For example, it may be desirable to put all the citation indexing
% into a separate list. First that list must be initiated with, e.g.,
% \begin{quote}
% |\newindex{cite}{ctx}{cnd}{List of Citations}|
% \end{quote}
% and then the automatic citation indexing associated with this list with the
% \thestyle\ command
% \begin{quote}
% |\renewcommand{\citeindextype}{cite}|
% \end{quote}
% See the documentation for \texttt{index.sty} for details.
%
% \subsection{Hyper\TeX\ Compatibility}
% The \thestyle\ package is compatible with the \texttt{hyperref}
% package of Sebastian Rahtz
% , for use with
% \LaTeX\ $\rightarrow$ HTML conversions, pdf\TeX, \texttt{pdfmark}.
% The compatibility is of a mutual nature: both packages contain
% coding that interact with that of the other.
%
% There is a special option to the \texttt{hyperref} package: \texttt{breaklinks}
% which allows the link text to be split over to the next
% line, avoiding many overfull line messages. By default, the link text is
% restricted to be on one line. For numerical citations, this may be desirable,
% but for author--year ones with long link texts, it is not.
%
% \subsection{Multiple Bibliographies in One Document}\label{sec:chapbib}
%
% \iffalse
%<*notes>
\head{Use with \texttt{chapterbib} package}
% \fi
The \thestyle\ package is compatible with the \texttt{chapterbib} package
% of Donald Arseneau and Niel Kempson,
which makes it possible to have several bibliographies in one document.
% The usual application is to have bibliographies in each chapter of a book,
% especially if they have been written by different authors.
%
% The \texttt{chapterbib} package works in a very natural way for the
% author; only the editor who puts all the chapters together into one book
% has to do some extra work.
The package makes use of the |\include| command, and each |\include|d file
has its own bibliography.
% For large books, it makes very good sense to take advantage of this feature
% in any case.
%
% To review the use of |\include|, recall that the main file
% \begin{verbatim}
% \documentclass{...}
% \includeonly{ch2}
% \begin{document}
% \include{ch1}
% \include{ch2}
% \include{ch3}
% \end{document}
% \end{verbatim}
% will process only the file \texttt{ch2.tex} as though the files
% \texttt{ch1.tex} and \texttt{ch3.tex} were also present. That is, all
% counters, especially the page and section numbers, as well as
% cross-referencing definitions, will function as if the whole document
% were processed. The trick is that each |\include|d file has it own
% \texttt{.aux} file containing these definitions, and they are all read
% in every time, even if the corresponding \texttt{.tex} file is not. The
% \texttt{.aux} files also contain the citation information for \btx,
% something that the \texttt{chapterbib} package exploits.
%
% If |\usepackage{chapterbib}| has been given, the keys in each |\cite|
% and |\bibitem| command are associated with the current |\include|d file
% and are distinguished from the identical key in a different file. Each of
% these files must contain its own |\bibliography| and |\bibliographystyle|
% commands. One processes \btx\ on each file separately before processing
% it under \LaTeX\ (at least twice).
%
% \subsubsection{Special Considerations for \thestyle\ and
% \texttt{chapterbib}}
The order in which the \texttt{chapterbib} and \thestyle\ packages are loaded
is unimportant.
The \texttt{chapterbib} package provides an option \texttt{sectionbib}
that puts the bibliography in a |\section*| instead of |\chapter*|,
something that makes sense if there is a bibliography in each chapter.
This option will not work when \thestyle\ is also loaded; instead, add
the option to \thestyle.
% (The \texttt{sectionbib} option can always be
% given, but it only has meaning for the \texttt{book} and \texttt{report}
% classes, or for classes derived from them.)
Every |\include|d file must contain its own
|\bibliography| command where the bibliography is to appear. The database
files listed as arguments to this command can be different in each file,
of course. However, what is not so obvious, is that each file must also
contain a |\bibliographystyle| command, with possibly differing arguments.
As of version~8.0, the citation style, including mode (author--year or
numerical) may also differ between chapters. The |\setcitestyle| command
% as well as |\bibpunct| and |\citestyle|
can be issued at any point in the document, in particular in different
chapters.
%(And this is the only time it would make sense to do so.)
%
% \iffalse
%
% \fi
%
% \subsection{Sorting and Compressing Numerical Citations}
% \label{sec:sort}
%
% Another package by Donald Arseneau, \texttt{cite.sty}, reimplements the
% entire (numerical) citation system such that one can control the
% punctuation and citation format, all of which is done by \thestyle\ as
% well. However, it also can sort and compress numerical citations,
% something that is required by some journals.
%
% What this means is that when multiple citations are given with a single
% |\cite| command, the normal order of the numbers is in the sequence
% given. This is usually a wild list of numbers, such as [4,2,8,3]. With
% the \texttt{cite} package, this list becomes [2--4,8].
%
% It is impossible to make the \texttt{cite} and \thestyle\ packages
% compatible, since both reimplement |\cite| from scratch. Instead, I have
% taken over some of the coding from \texttt{cite.sty}, modifying it for
% \thestyle{}. This coding is activated by including one of the options
% \texttt{sort} or \texttt{sort\&compress} in the |\usepackage| command.
%
% For author--year citations, the option \texttt{sort} orders the citations in
% a single |\citep| or |\citet| command into the sequence in which they appear
% in the list of references. This is normally alphabetical first, year second.
% This should avoid citations of the type: ``James et~al.\ (1994b,a)''. For
% author--year mode, the \texttt{sort\&compress} option is identical to
% \texttt{sort}.
%
% \iffalse
%<*notes>
\head{Sorting and compressing citations}
Do not use the \texttt{cite} package with \thestyle; rather use one of the
options \texttt{sort}, \texttt{compress}, or \texttt{sort\&compress}.
These also work with author--year citations, making multiple citations appear
in their order in the reference list.
%
% \fi
%
% \subsection{Long Author List on First Citation}\label{sec:long}
%
% A feature that has often been requested by otherwise happy users of
% \thestyle\ is one that is found in the \texttt{harvard} package as
% standard: with the first citation of any reference, the full author list is
% printed, and afterwards only the abbreviated list. One can control this
% with |\citet*| for the first citation, and |\citet| or |\citep| thereafter.
% However, the automatic feature is very desired.
%
% This can be activated with the option
% \texttt{longnamesfirst}.
%
% \iffalse
%<*notes>
\head{Long author list on first citation}
Use option \texttt{longnamesfirst} to have first citation automatically give
the full list of authors.
Suppress this for certain citations with |\shortcites{|\emph{key-list}|}|,
given before the first citation.
%
% \fi
%
% \DescribeMacro{\shortcites}
% Some references have so many authors that you want to suppress the
% automatic long list only for them. In this case, issue
% \begin{quote}
% |\shortcites|\marg{key-list}
% \end{quote}
% before the first citations, and those included in \emph{key-list} will have
% a short list on their first citation.
%
% Full author lists can still be forced at any time with the starred
% variants.
%
% \section{Numerical Citations with Author--Year Styles}\label{sec:6.0}
%
% It is possible to produce numerical citations with any author-year
% \texttt{.bst} file, with minimal change to the text. The commands |\citet|
% and |\citep| will produce sensible results in both modes, without any special
% editing. Obviously, the opposite is not possible; a \texttt{.bst} file
% intended for numerical citation can never produce author--year citations,
% simply because the information is not transferred to the auxiliary file.
%
% \subsection{Selecting Numerical Mode}
% By default, \thestyle{} is in author--year mode. This can be changed by
% \begin{enumerate}
% \item selecting a numerical bibliography style with predefined
% citation style, defined either in the package or in the local
% configuration file;
%
% \item giving options \texttt{numbers} or \texttt{super} to the
% |\usepackage| command;
%
% \item issuing |\setcitestyle{numbers}|;
%
% \item issuing |\citestyle| with the name of a predefined numerical
% bibliography style (like \texttt{plain} and use it with \texttt{plainnat}).
% \end{enumerate}
%
% The \thestyle{} package will automatically switch to numerical mode if
% any one of the |\bibitem| entries fails to conform to the possible
% author--year formats. There is no way to override this, since such an
% entry would cause trouble in the author--year mode.
%
% There are certain special `numerical' styles, like that of the standard
% \texttt{alpha.bst}, which include a non-numerical label in place of the
% number, in the form
% \begin{quote} |\bibitem[ABC95]{able95}| \end{quote}
% As far as \thestyle\ is concerned, this label does not conform to the
% author--year possibilities and is therefore considered to be numerical.
% The citation mode switches to numerical, and |\cite{able95}| prints
% [ABC95].
%
% See however, the end of Section~\ref{sec:yearless} for another possibility.
% The above result can be achieved with
% \begin{quote} |\bibitem[ABC95()]{able95}| \end{quote}
%
% \section{Local Configuration}
% 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 or her
% own |\bibstyle@|\textit{bst} definitions to couple citation punctuation
% with local bibliography styles or for use with |\citestyle|.
%
% \iffalse
%<*notes>
\head{Local configuration}
Any local recoding or definitions can be put in \thestyle\texttt{.cfg} which
is read in after the main package file.
%
% \fi
%
% \section{Package Options}\label{sec:opts}
% When a package is loaded with |\usepackage|, one can add options to select
% different features, as
% \begin{quote}
% |\usepackage[|\emph{options}|]{|\thestyle|}|
% \end{quote}
% \iffalse
%<*notes>
\head{Options that can be added to \texttt{\char`\\ usepackage}}
% \fi
% 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 semicolon] (default) to separate multiple citations with
semi-colons;
\item[\ttfamily colon] the same as \texttt{semicolon}, an earlier mistake in
terminology;
\item[\ttfamily comma] to use commas as separators;
\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 sort] orders multiple citations into the sequence in
which they appear in the list of references;
\item[\ttfamily sort\&compress] as \texttt{sort} but in addition multiple
numerical citations are compressed if possible (as 3--6, 15);
\item[\ttfamily compress] to compress without sorting, so compression only
occurs when the given citations would produce an ascending sequence of
numbers;
\item[\ttfamily longnamesfirst] makes the first citation of any reference
the equivalent of the starred variant (full author list) and subsequent
citations normal (abbreviated list);
\item[\ttfamily sectionbib] redefines |\thebibliography| to issue
|\section*| instead of |\chapter*|; valid only for classes with a
|\chapter| command; to be used with the \texttt{chapterbib} package;
\item[\ttfamily nonamebreak] keeps all the authors' names in a citation on
one line; causes overfull hboxes but helps with some \texttt{hyperref}
problems.
\end{description}
% The options \texttt{curly} and \texttt{angle} are not really serious; I only
% added them because that completes the normal list of bracket types. The only
% other citation possibilities I know have really encountered are solidus, e.g. /21/,
% or something like (Ref. 21). These must be set with |\setcitestyle{open={/},close={/}}|.
% \iffalse
%
% \fi
%
% The package options are overwritten by any explicit |\setcitestyle|, |\bibpunct|,
% or |\citestyle| commands. And both these commands and the package options
% turn off the automatic setting with |\bibliographystyle|, if effective.
%
% \section{Reference Sheet}
%
% A summary of the main points on using \thestyle\ can be obtained by
% \LaTeX{}ing the file \texttt{natnotes.tex}, which is extracted from the main
% source file \thestyle\texttt{.dtx} with the \texttt{docstrip} option
% \texttt{notes}. This is intended to act as a handy reference sheet.
%
% This file should be extracted automatically by the supplied installation file,
% \thestyle\texttt{.ins}.
%
%^^A The following is a summary that goes into the .sty file
%^^A It is not printed in the documentation, since the Reference Sheet exists
% \iffalse
%<*package>
% This package reimplements the LaTeX \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.
%
% With standard numerical .bst files, only numerical citations are
% possible. With an author-year .bst file, both numerical and
% author-year citations are possible.
%
% If author-year citations are selected, \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|all>
% \bibitem[Jones et al., 1990]{key}...
%
%<*newapa|chicago|all>
% \bibitem[\protect\citeauthoryear{Jones, Baker, and Williams}{Jones
% et al.}{1990}]{key}...
% \bibitem[\protect\citeauthoryear{Jones et al.}{1990}]{key}...
%
%<*astron|all>
% \bibitem[\protect\astroncite{Jones et al.}{1990}]{key}...
%
%<*authordate|all>
% \bibitem[\protect\citename{Jones et al., }1990]{key}...
%
%<*harvard|all>
% \harvarditem[Jones et al.]{Jones, Baker, and Williams}{1990}{key}...
%
%
% This is either to be made up manually, or to be generated by an
% appropriate .bst file with BibTeX.
% Author-year mode || Numerical mode
% Then, \citet{key} ==>> Jones et al. (1990) || Jones et al. [21]
% \citep{key} ==>> (Jones et al., 1990) || [21]
% Multiple citations as normal:
% \citep{key1,key2} ==>> (Jones et al., 1990; Smith, 1989) || [21,24]
% or (Jones et al., 1990, 1991) || [21,24]
% or (Jones et al., 1990a,b) || [21,24]
% \cite{key} is the equivalent of \citet{key} in author-year mode
% and of \citep{key} in numerical mode
% Full author lists may be forced with \citet* or \citep*, e.g.
% \citep*{key} ==>> (Jones, Baker, and Williams, 1990)
% Optional notes as:
% \citep[chap. 2]{key} ==>> (Jones et al., 1990, chap. 2)
% \citep[e.g.,][]{key} ==>> (e.g., Jones et al., 1990)
% \citep[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
% \citealp{key} ==>> Jones et al., 1990
% \citealp*{key} ==>> Jones, Baker, and Williams, 1990
% Additional citation possibilities (both author-year and numerical modes)
% \citeauthor{key} ==>> Jones et al.
% \citeauthor*{key} ==>> Jones, Baker, and Williams
% \citeyear{key} ==>> 1990
% \citeyearpar{key} ==>> (1990)
% \citetext{priv. comm.} ==>> (priv. comm.)
% \citenum{key} ==>> 11 [non-superscripted]
% Note: full author lists depends on whether the bib style supports them;
% if not, the abbreviated list is printed even when full requested.
%
% For names like della Robbia at the start of a sentence, use
% \Citet{dRob98} ==>> Della Robbia (1998)
% \Citep{dRob98} ==>> (Della Robbia, 1998)
% \Citeauthor{dRob98} ==>> Della Robbia
%
%
% Citation aliasing is achieved with
% \defcitealias{key}{text}
% \citetalias{key} ==>> text
% \citepalias{key} ==>> (text)
%
% Defining the citation mode and punctual (citation style)
% \setcitestyle{}
% Example: \setcitestyle{square,semicolon}
% Alternatively:
% Use \bibpunct with 6 mandatory 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 (or numbers) when common authors missing
% One optional argument is the character coming before post-notes. It
% appears in square braces before all other arguments. May be left off.
% 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 anywhere in the text
% by calling \citestyle{newbib}. This is only useful if the style specified
% differs from that in \bibliographystyle.
%
% With \citeindextrue and \citeindexfalse, one can control whether the
% \cite commands make an automatic entry of the citation in the .idx
% indexing file. For this, \makeindex must also be given in the preamble.
%
% Package 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
% \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 chicago] is the same as \texttt{newapa};
%
% \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}
%
% The remaining options are:
% \begin{description}
% \item[\ttfamily package] to produce a \texttt{.sty} package file with most
% comments removed;
%
% \item[\ttfamily notes] extracts a summary of usage to be used as a
% reference sheet; the resulting file is to be \LaTeX{}ed;
%
% \item[\ttfamily driver] to produce a driver \texttt{.drv} file that will
% print out the documentation when \LaTeX'd. This file can be modified
% to produce various alternatives (page size, fonts, manual only, or with
% annotated code). The \thestyle\texttt{.dtx} file is itself such a driver
% but it should never, ever be edited by a user.
%
% \end{description}
% The source file \texttt{\filename.dtx} is itself a driver file and can
% be processed directly by \LaTeX.
%
%
% \section{Other Author--Year Solutions}
% \begin{quote}\slshape
% This section is of historical interest only.
% \end{quote}
%
% Before \thestyle{} was published in 1993, there were several other attempts
% to provide author--year citations, some of which inspired \thestyle. A few of
% these are still maintained and used, and for that reason, \thestyle{} has
% attempted to include their |\bibitem| syntaxes, to be compatible with those
% \texttt{.bst} files.
%
% Most of these `packages' are really \LaTeX~2.09 style files, so do not have
% features available with the modern \LaTeXe.
%
% \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 formats |\bibitem| with just
% the abbreviated
% authors and year. Thus only parenthetical citations can be accommodated.
%
% The name \texttt{natsci} stands for \emph{natural sciences}, and it was this
% that led to the name \thestyle. (This is admittedly an ugly name, but it is
% now established and cannot be changed so easily.)
%
% \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. Its functionality is identical to that
% of the \texttt{natsci} files.
%
% The form of the \texttt{thebibliography} entries in this system is
% \begin{quote}
% |\bibitem[Jones et al., 1990]{jon90}...|
% \end{quote}
% 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, such as the
% \texttt{natsci} styles.
%
% 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 was 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}
%
% \noindent
% \textbf{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 substitute for |\bibitem| is used, as
% \begin{quote}
% |\harvarditem[Jones et al.]{Jones, Baker, and|\\
% | Williams}{1990}{jon90}...|
% \end{quote}
% The accompanying interface package 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 package file \texttt{astron.sty}
% 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 also found some packages 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}.
%
% \iffalse
%\end{document}
% \fi
%
% \StopEventually{\PrintIndex\PrintChanges}
%
% \section{The Coding}
% This section presents and explains the actual coding of the macros.
% It is nested between |%<*package>| and |%|, which
% are indicators to \texttt{docstrip} that this coding belongs to the package
% file.
%
% With \LaTeX\ release from \texttt{1995/12/01}, |\cite| is made robust,
% something that I have adopted as well.
%
% Another change in the above release is that
% |\G@refundefinedtrue|\footnote{In fact, it was only proposed to be
% removed, but because several packages, including this one, were
% adversely affected, the name was retained for the new coding.}
% and the |\if@openbib| flag have been removed.
% New, more effective, and compact, coding has replaced them. Rather than
% relying on the kernel coding, I make \thestyle\ more
% self-reliant.
%
% \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>
\@ifclassloaded{agu2001}{\PackageError{natbib}
{The agu2001 class already includes natbib coding,\MessageBreak
so you should not add it explicitly}
{Type for now, but then later remove\MessageBreak
the command \protect\usepackage{natbib} from the document}
\endinput}{}
\@ifclassloaded{aguplus}{\PackageError{natbib}
{The aguplus class already includes natbib coding,\MessageBreak
so you should not add it explicitly}
{Type 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 for now, but then later remove\MessageBreak
the command \protect\usepackage{natbib} from the document}
\endinput}{}
\@ifclassloaded{egs}{\PackageError{natbib}
{The egs class already includes natbib coding,\MessageBreak
so you should not add it explicitly}
{Type for now, but then later remove\MessageBreak
the command \protect\usepackage{natbib} from the document}
\endinput}{}
\@ifclassloaded{egu}{\PackageError{natbib}
{The egu class already includes natbib coding,\MessageBreak
so you should not add it explicitly}
{Type for now, but then later remove\MessageBreak
the command \protect\usepackage{natbib} from the document}
\endinput}{}
% \end{macrocode}
%
% \subsection{Selecting 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}
% Define citation punctuation for some author-year styles
% One may add and delete at this point
% Or put additions into local configuration file natbib.cfg
\newcommand\bibstyle@chicago{\bibpunct{(}{)}{;}{a}{,}{,}}
\newcommand\bibstyle@named{\bibpunct{[}{]}{;}{a}{,}{,}}
\newcommand\bibstyle@agu{\bibpunct{[}{]}{;}{a}{,}{,~}}%Amer. Geophys. Union
\newcommand\bibstyle@copernicus{\bibpunct{(}{)}{;}{a}{,}{,}}%Copernicus Publications
\let\bibstyle@egu=\bibstyle@copernicus
\let\bibstyle@egs=\bibstyle@copernicus
%<*all|harvard>
\newcommand\bibstyle@agsm{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
\newcommand\bibstyle@kluwer{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
\newcommand\bibstyle@dcu{\bibpunct{(}{)}{;}{a}{;}{,}\gdef\harvardand{and}}
%
% \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.
%
% Activate citation sorting for the journals.
% \changes{6.8b}{1998 July 2}{Turn off sorting for AGU and EGS}
% \begin{macrocode}
\newcommand\bibstyle@aa{\bibpunct{(}{)}{;}{a}{}{,}} %Astronomy & Astrophysics
\newcommand\bibstyle@pass{\bibpunct{(}{)}{;}{a}{,}{,}}%Planet. & Space Sci
\newcommand\bibstyle@anngeo{\bibpunct{(}{)}{;}{a}{,}{,}}%Annales Geophysicae
\newcommand\bibstyle@nlinproc{\bibpunct{(}{)}{;}{a}{,}{,}}%Nonlin.Proc.Geophys.
% \end{macrocode}
%
% \changes{6.5}{1997 Jan 30}{Fix \texttt{esa} style for new note system}
% \changes{7.0}{1999 May 7}{Fix \texttt{esa} style again}
% 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
\newcommand\bibstyle@cospar{\bibpunct{/}{/}{,}{n}{}{}%
\gdef\bibnumfmt##1{##1.}}
\newcommand\bibstyle@esa{\bibpunct{(Ref.~}{)}{,}{n}{}{}%
\gdef\bibnumfmt##1{##1.\hspace{1em}}}
\newcommand\bibstyle@nature{\bibpunct{}{}{,}{s}{}{\textsuperscript{,}}%
\gdef\bibnumfmt##1{##1.}}
% \end{macrocode}
%
% Finally, the standard \LaTeX{} (numerical) citation styles are included
% along with their \thestyle\ modifications (author--year).
% \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
% The author-year modifications of the standard styles
\newcommand\bibstyle@plainnat{\bibpunct{[}{]}{,}{a}{,}{,}}
\let\bibstyle@abbrvnat=\bibstyle@plainnat
\let\bibstyle@unsrtnat=\bibstyle@plainnat
% \end{macrocode}
% \end{macro}
%
% \subsection{Package 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
% \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}}
% \changes{6.0}{1995 Sep 6}{Add option \texttt{bibstyle}}
% \changes{6.0}{1995 Sep 6}{Execute \texttt{nobibstyle} with all options}
% \changes{6.1}{1995 Nov 27}{Add option \texttt{openbib}}
% \changes{6.4}{1996 Sep 1}{Add option \texttt{sectionbib}}
% \changes{6.4}{1996 Sep 13}{Add option \texttt{sort}}
% \changes{6.7}{1997 Jul 14}{Add option \texttt{longnamesfirst}}
% \changes{6.8c}{1998 Jul 14}{Add option \texttt{nonamebreak}}
% \changes{8.0}{2007 Feb 6}{Add option \texttt{semicolon}, same as \texttt{colon}}
% 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.
%
% The standard option \texttt{openbib} is also defined here so that its
% behaviour is entirely under my control. Relying on the standard classes
% can lead to trouble.
% \begin{macrocode}
\DeclareOption{numbers}{\NAT@numberstrue
\ExecuteOptions{square,comma,nobibstyle}}
\DeclareOption{super}{\NAT@supertrue\NAT@numberstrue
\renewcommand\NAT@open{}\renewcommand\NAT@close{}
\ExecuteOptions{nobibstyle}}
\DeclareOption{authoryear}{\NAT@numbersfalse
\ExecuteOptions{round,semicolon,bibstyle}}
\DeclareOption{round}{%
\renewcommand\NAT@open{(} \renewcommand\NAT@close{)}
\ExecuteOptions{nobibstyle}}
\DeclareOption{square}{%
\renewcommand\NAT@open{[} \renewcommand\NAT@close{]}
\ExecuteOptions{nobibstyle}}
\DeclareOption{angle}{%
\renewcommand\NAT@open{$<$} \renewcommand\NAT@close{$>$}
\ExecuteOptions{nobibstyle}}
\DeclareOption{curly}{%
\renewcommand\NAT@open{\{} \renewcommand\NAT@close{\}}
\ExecuteOptions{nobibstyle}}
\DeclareOption{comma}{\renewcommand\NAT@sep{,}
\ExecuteOptions{nobibstyle}}
\DeclareOption{semicolon}{\renewcommand\NAT@sep{;}
\ExecuteOptions{nobibstyle}}
\DeclareOption{colon}{\ExecuteOptions{semicolon}}
\DeclareOption{nobibstyle}{\let\bibstyle=\@gobble}
\DeclareOption{bibstyle}{\let\bibstyle=\@citestyle}
\newif\ifNAT@openbib \NAT@openbibfalse
\DeclareOption{openbib}{\NAT@openbibtrue}
\DeclareOption{sectionbib}{\def\NAT@sectionbib{on}}
\def\NAT@sort{0}
\def\NAT@cmprs{0}
\DeclareOption{sort}{\def\NAT@sort{1}}
\DeclareOption{compress}{\def\NAT@cmprs{1}}
\DeclareOption{sort&compress}{\def\NAT@sort{1}\def\NAT@cmprs{1}}
\@ifpackageloaded{cite}{\PackageWarningNoLine{natbib}
{The `cite' package should not be used\MessageBreak
with natbib. Use option `sort' instead}\ExecuteOptions{sort}}{}
\@ifpackageloaded{citeref}{\PackageError{natbib}
{The `citeref' package must be loaded after natbib}%
{Move \protect\usepackage{citeref} to after \string\usepackage{natbib}}}{}
\newif\ifNAT@longnames\NAT@longnamesfalse
\DeclareOption{longnamesfirst}{\NAT@longnamestrue}
\DeclareOption{nonamebreak}{\def\NAT@nmfmt#1{\mbox{\NAT@up#1}}}
\def\NAT@nmfmt#1{{\NAT@up#1}}
% \end{macrocode}
% Before version~6.0, the punctuation options had the lowest priority,
% being overridden by any |\bibstyle@|\textit{bst} command. It was necessary
% to add the option \texttt{nobibstyle} to make them effective. Now this
% option is automatically executed whenever a punctuation option is chosen.
% The reason is that \texttt{nobibstyle} is either superfluous (no
% predefined citation style is present) or always necessary to make the
% other options meaningful.
%
% It seems to be better practice to make any explicit choices to have
% higher priority over implicit ones.
%
% The option \texttt{bibstyle} reactivates the predefined commands, just in
% case this is needed, as it is for the option \texttt{authoryear}. This
% leaves the predefined styles functioning, since it does not really
% determine the citation style, but rather establishes a default which may
% be overwritten by a prestored one. For this reason, this option must be
% defined very early so that any explicit punctuation options overwrite the
% defaults. (Options are executed in the order defined.)
%
% \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}
\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}|.
%
% (|\NAT@set@cites| must also be executed at the start of the document;
% this is added later when the macro is defined.)
% \begin{macrocode}
\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}
% \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}
% \changes{6.0}{1995 Sep 6}{Sets \cs{bibstyle} to \cs{@gobble}}
% \changes{6.0}{1995 Sep 6}{Declare \cs{NAT@numbersfalse} before testing 4th
% argument}
% \changes{6.0}{1995 Sep 19}{Add optional argument for \cs{NAT@cmt}}
% \changes{7.0}{1999 May 7}{Add blank to default of first argument}
% 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.
%
% An optional argument has been added to determine the punctuation that
% precedes a trailing note. This makes the counting of mandatory arguments
% somewhat confused, since the fourth argument is now |#5|.
%
% \begin{macrocode}
\newcommand\bibpunct[7][, ]%
{\gdef\NAT@open{#2}\gdef\NAT@close{#3}\gdef
\NAT@sep{#4}\global\NAT@numbersfalse
\ifx #5n\global\NAT@numberstrue\global\NAT@superfalse
\else
\ifx #5s\global\NAT@numberstrue\global\NAT@supertrue
\fi\fi
\gdef\NAT@aysep{#6}\gdef\NAT@yrsep{#7}%
\gdef\NAT@cmt{#1}%
\NAT@@setcites
}
% \end{macrocode}
% The command turns off |\bibstyle| so that the predefined
% |\bibstyle@|\textit{bst} commands no longer work. Thus |\bibpunct| has
% priority over the predefined styles.
% \end{macro}
%
% \begin{macro}{\setcitestyle}
% \changes{8.0}{2007 Feb 2}{Add macro}
% A new command for setting the various parameters is added in version~8.0.
% This complements |\bibpunct| but will not replace it since it only sets
% selected parameters, while |\bibpunct| sets all at once, and is thus more
% appropriate for complete setting. This is better for changing just some
% parameters.
%
% The argument is a comma-separated list of keywords, many identical to the
% corresponding package options. However, others take an argument, as
% |yysep={;}| where the curly braces are unnecessary for a single character
% (except for a comma!) but they do not hurt. Spaces must not appear between
% entries, or they will be interpreted as part of the keyword.
%
% \begin{macrocode}
\newcommand\setcitestyle[1]{
\@for\@tempa:=#1\do
{\def\@tempb{round}\ifx\@tempa\@tempb
\renewcommand\NAT@open{(}\renewcommand\NAT@close{)}\fi
\def\@tempb{square}\ifx\@tempa\@tempb
\renewcommand\NAT@open{[}\renewcommand\NAT@close{]}\fi
\def\@tempb{angle}\ifx\@tempa\@tempb
\renewcommand\NAT@open{$<$}\renewcommand\NAT@close{$>$}\fi
\def\@tempb{curly}\ifx\@tempa\@tempb
\renewcommand\NAT@open{\{}\renewcommand\NAT@close{\}}\fi
\def\@tempb{semicolon}\ifx\@tempa\@tempb
\renewcommand\NAT@sep{;}\fi
\def\@tempb{colon}\ifx\@tempa\@tempb
\renewcommand\NAT@sep{;}\fi
\def\@tempb{comma}\ifx\@tempa\@tempb
\renewcommand\NAT@sep{,}\fi
\def\@tempb{authoryear}\ifx\@tempa\@tempb
\NAT@numbersfalse\fi
\def\@tempb{numbers}\ifx\@tempa\@tempb
\NAT@numberstrue\NAT@superfalse\fi
\def\@tempb{super}\ifx\@tempa\@tempb
\NAT@numberstrue\NAT@supertrue\fi
\expandafter\NAT@find@eq\@tempa=\relax\@nil
\if\@tempc\relax\else
\expandafter\NAT@rem@eq\@tempc
\def\@tempb{open}\ifx\@tempa\@tempb
\xdef\NAT@open{\@tempc}\fi
\def\@tempb{close}\ifx\@tempa\@tempb
\xdef\NAT@close{\@tempc}\fi
\def\@tempb{aysep}\ifx\@tempa\@tempb
\xdef\NAT@aysep{\@tempc}\fi
\def\@tempb{yysep}\ifx\@tempa\@tempb
\xdef\NAT@yrsep{\@tempc}\fi
\def\@tempb{notesep}\ifx\@tempa\@tempb
\xdef\NAT@cmt{\@tempc}\fi
\def\@tempb{citesep}\ifx\@tempa\@tempb
\xdef\NAT@sep{\@tempc}\fi
\fi
}%
\NAT@@setcites
}
\def\NAT@find@eq#1=#2\@nil{\def\@tempa{#1}\def\@tempc{#2}}
\def\NAT@rem@eq#1={\def\@tempc{#1}}
% \end{macrocode}
%
% After the parameters are set, it is still necessary to issue |\NAT@set@cites|
% to get things right for author--year or numerical mode. This is issued
% at the end of the preamble, and not in the preamble. But if |\setcitestyle| is
% given after the preamble, we need it right away. So issue instead |\NAT@@setcites|
% which in the preamble only deactivates |\bibstyle|, but later becomes
% |\NAT@set@cites|.
%
% The idea is that if |\setcitestyle| is used in the preamble, it is global and
% the values should be not changed by the bibliography style definitions. But if
% issued in the text, as part of \texttt{chapterbib} processing, then automatic
% style changes with different |.bst| files per chapter could be useful.
% \begin{macrocode}
\def\NAT@@setcites{\global\let\bibstyle\@gobble}
\AtBeginDocument{\let\NAT@@setcites\NAT@set@cites}
% \end{macrocode}
% \end{macro}
%
% \subsection{Setting the Defaults}
% The defaults (punctuation and scheme type) are set with the
% |\ExecuteOptions| command.
%
% \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}}
% \begin{macro}{\NAT@cmt}
% \changes{6.0}{1995 Sep 19}{Add macro}
% \changes{6.9}{1999 Feb 25}{Remove hardwired spaces after \cs{NAT@cmt},
% adding them to default definition instead}
% 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.
% A sixth one has been added: the character preceding post-notes,
% including any possible space.
% Define their default values.
% \begin{macrocode}
\newcommand\NAT@open{(} \newcommand\NAT@close{)}
\newcommand\NAT@sep{;}
% \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \changes{6.0}{1995 Sep 19}{Remove \cs{ExecuteOptions} since default
% style determined by definitions}
% The option \texttt{authoryear} was originally provided to serve as the
% default; hence its definition includes \texttt{bibstyle}. However, this
% is not necessary since all the appropriate parameters are set to these
% values anyway. (One could consider removing \texttt{bibstyle}.)
% \begin{macrocode}
%\ExecuteOptions{authoryear}
\ProcessOptions
\newcommand\NAT@aysep{,} \newcommand\NAT@yrsep{,}
\newcommand\NAT@cmt{, }
% \end{macrocode}
%
% \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}}
% \changes{6.6}{1997 May 26}{Use flag \cs{ifNAT@par} to suppress braces
% optionally}
% \changes{6.8}{1998 Feb 19}{Add \cs{endgroup} to terminate group}
% \changes{6.9a}{1999 Apr 20}{Change test for empty notes to asterix, not \cs{relax}}
% \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}}
% \changes{6.5}{1997 Jan 30}{Numericals always print notes if present, do not
% test for any flag first}
% \changes{6.6}{1997 May 27}{Can be textual or parenthetical}
% \changes{6.8}{1998 Feb 19}{Add \cs{endgroup} to terminate group}
% \changes{6.8}{1998 Feb 19}{Use \cs{NAT@@open} and \cs{NAT@@close} instead
% of \cs{NAT@open} and \cs{NAT@close}}
% \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}
% \changes{6.2}{1995 Feb 2}{Get superscript font size right; use
% \cs{textsuperscript}}
% \changes{6.6}{1997 Jun 4}{Modify for new \cs{NAT@citexnum}}
% \changes{6.8}{1998 Feb 19}{Add \cs{endgroup} to terminate group}
% \changes{7.0}{1999 May 7}{Add \cs{citenumfont} for numbers}
% \changes{7.0b}{2002 Feb 27}{Change \cs{hspace} to \cs{kern} to avoid line break}
% Define the internal |\@cite| commands that prints the assembled string of
% citation label texts, plus possible optional notes, before and after. The
% numerical version (now) the same, where previously (before 6.8) it used
% |\NAT@open| and |\NAT@close| so that braces were always present. (Keep the
% separate definitions anyway in case a difference should arise later.) In both
% cases, the notes are included (if present) only for parenthetical citations
% (|\ifNAT@swa| is \meta{true}) while for textual citations, they are printed
% by |\@citex|. The flag |\ifNAT@par| suppresses parentheses if \meta{false},
% which is used with |\citealt|, |\citealp|, |\citeyear|, and |\citeauthor|
% (both numerical and author--year modes).
%
% \changes{7.2}{2006 Jan 12}{Allow braces around superscripted citation}
% \changes{7.5}{2007 Feb 2}{Superscripted citation prints both notes}
% \changes{7.5}{2007 Feb 2}{Superscripted braces are elevated with \cs{citet} too}
% The superscript citation before version 7.5 prints only the following note;
% with 7.5, this is changed to print both, but as part of the revised treatment
% of notes with textual numerical citations.
%
% Use the construction |\if*#2*| to test for empty note argument. Previously
% used |\relax| in place of |*| but then it turned out that if the text began
% with a robust command (like |\S|) the |\protect| command implicit here is
% equal to |\relax| so the condition is \meta{true}. Now any notes beginning
% with an asterix will give trouble.
%
% \begin{macrocode}
\newcommand\NAT@cite%
[3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\ \fi
#1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
\newcommand\NAT@citenum%
[3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\ \fi
#1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
\newcommand\NAT@citesuper[3]{\ifNAT@swa
\if*#2*\else#2\ \fi
\unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close}%
\if*#3*\else\ #3\fi\else #1\fi\endgroup}
\providecommand\textsuperscript[1]{\mbox{$^{\mbox{\scriptsize#1}}$}}
% \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}
% \changes{6.1}{1995 Nov 22}{Use \cs{NAT@citeundefined}}
% \changes{6.6}{1997 May 17}{Add \cs{NAT@ctype} for author, year, or both}
% \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}}
% \changes{6.0}{1995 Sep 4}{Prints \cs{NAT@num} instead of \cs{b@citeb}}
% \changes{6.4}{1996 Sep 12}{Add \cs{NAT@space} for variable spacing between
% numericals and superscripts}
% \changes{6.4}{1996 Oct 2}{Add dummy macros for \texttt{hyperref.sty}}
% \changes{6.6}{1997 May 17}{Add \cs{NAT@ctype} for author, year, or number;
% can be textual or parethetical}
% \changes{6.6}{1997 Jun 3}{Re-write for sorting and compression}
% \changes{6.6}{1997 Jun 25}{Improve \texttt{hyperref} support}
% \changes{6.7}{1997 Jul 14}{Suppress repeated authors with numerical
% \cs{citet}}
% \changes{6.7}{1997 Jul 16}{Add \cs{ifNAT@longnames} test}
% The original definition of |\@citex| is used as basis for |\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@|\emph{key} (a number or
% author--year), and put together as the argument of |\@cite|.
%
% For a textual citation (|\ifNAT@swa| \meta{false}), the authors are printed
% and then the number in parentheses. For multiple citations (silly thing) each
% number is in separate parentheses preceded by authors.
% As of version 7.5, notes with textual (numerical) citations are outside the
% parentheses, so they are really part of the main text.
%
% 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 |\@firstofone| macro removes any leading blanks in
% |\@citeb|, making |\cite{key1, key2}| possible. If |\b@|\emph{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.
%
% As of version 6.0, the numerical label text is to be found in |\NAT@num|,
% whereas previously it was the entire label, |\b@|\emph{key}.
%
% 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.
%
% The number |\NAT@ctype| controls whether author (1), year (2), or number (0)
% is output by this macro. A value of 3 produces the cite alias.
%
% For compatibility with the \texttt{chapterbib} package of Donald Arseneau,
% add |\@extra@b@citeb| to the cite key; this contains the number of the
% included file in order to distinguish the same citation in separate files
% which then belong to different bibliography listings.
%
% The list of citation keys is in |#3|; this is sorted by |\NAT@sort@cites|
% and returned in |\NAT@cite@list|. If sorting is turned off, this list is
% the same as the input. If compression of numerical lists is active
% (|NAT@cmprs|=1) only the parenthetical output is affected.
%
% The command |\@cprwrite| is defined in the \texttt{citeref} package.
% \changes{7.2}{2006 Jan 12}{Add \texttt{citeref} support}
% \changes{8.1}{2007 Oct 30}{Add \cs{@empty} after \cs{@citeb}, as now in standard \LaTeX}
% \begin{macrocode}
\providecommand\@firstofone[1]{#1}
\newcommand\NAT@citexnum{}
\def\NAT@citexnum[#1][#2]#3{%
\NAT@sort@cites{#3}%
\let\@citea\@empty
\@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
\ifNAT@swa\else
\ifnum\NAT@ctype=0\if*#1*\else
#1\ \fi\fi\fi
\@for\@citeb:=\NAT@cite@list\do
{\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}%
\@ifundefined{@cprwrite}{}{\expandafter\@cprwrite\@citeb=}\fi
\@ifundefined{b@\@citeb\@extra@b@citeb}{%
{\reset@font\bfseries?}
\NAT@citeundefined\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}}%
{\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name\fi
% \end{macrocode}
% For compression of numerical citations, we need to save the last number;
% use |\NAT@last@num| for this purpose. Use |\NAT@last@nm| to save last
% names to check for repetitions.
%
% For parenthetical (\LaTeX\ standard) produce only the number (exception:
% year is allowed for |\citeyearpar|, but without sorting); any notes are
% added in the |\@cite| macro. For textual, print the authors and then the
% number in parentheses. This is done for each citation of a multiple set,
% unlike the parenthetical version where all citations appear in a single pair
% of parentheses.
%
% The hyperlink start and end are to bracket only the number; however, if
% only the authors or only the year are printed, then these are bracketed.
% With compression, only the first and last numbers in the range have a
% hyperlink (but the targets of the missing numbers lie between those two).
% \changes{7.2}{2006 Jan 12}{Separate compression and sorting flags so they
% can be used independently}
% \changes{7.2}{2006 Jan 12}{Add hyperlinks to compressed cites}
% \changes{7.4a}{2006 Sep 06}{Add \cs{noexpand} to \cs{hyper@natlinkend}}
% \changes{8.1}{2007 Oct 30}{Change \cs{edef} to \cs{protected@edef}}
% \begin{macrocode}
\ifNAT@swa
\ifnum\NAT@ctype>1\relax\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\ifnum\NAT@ctype=2\relax\NAT@test{\NAT@ctype}%
\else\NAT@alias
\fi\hyper@natlinkend\else
\ifnum\NAT@cmprs>0
\begingroup\catcode`\_=8
\ifcat _\ifnum\z@<0\NAT@num _\else A\fi
\global\let\NAT@nm=\NAT@num \else \gdef\NAT@nm{-2}\fi
\ifcat _\ifnum\z@<0\NAT@last@num _\else A\fi
\global\@tempcnta=\NAT@last@num \global\advance\@tempcnta by\@ne
\else \global\@tempcnta\m@ne\fi
\endgroup
\ifnum\NAT@nm=\@tempcnta
\ifx\NAT@last@yr\relax
\protected@edef\NAT@last@yr{\@citea \mbox{%
\noexpand\hyper@natlinkstart{\@citeb\@extra@b@citeb}{%
\noexpand\citenumfont{\NAT@num}}\noexpand\hyper@natlinkend}}%
\else
\protected@edef\NAT@last@yr{--\penalty\@m\mbox{%
\noexpand\hyper@natlinkstart{\@citeb\@extra@b@citeb}{%
\noexpand\citenumfont{\NAT@num}}\noexpand\hyper@natlinkend}}%
\fi
\else
\NAT@last@yr \@citea \mbox{\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
{\citenumfont{\NAT@num}}\hyper@natlinkend}%
\let\NAT@last@yr\relax
\fi
\else
\@citea \mbox{\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
{\citenumfont{\NAT@num}}\hyper@natlinkend}%
\fi
\fi
\def\@citea{\NAT@sep\penalty\@m\NAT@space}%
% \end{macrocode}
% \changes{7.5}{2007 Feb 2}{Textual numerical cites print notes outside brackets}
% For textual citations, test what the output is to be (number, year,
% author) and also test for comments.
% \begin{macrocode}
\else
\ifcase\NAT@ctype\relax
\ifx\NAT@last@nm\NAT@nm \NAT@yrsep\penalty\@m\NAT@space\else
\@citea \NAT@test{1}\ \NAT@mbox{\NAT@@open}%
\fi \NAT@mbox{%
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
{\citenumfont{\NAT@num}}\hyper@natlinkend}%
\def\@citea{\NAT@mbox{\NAT@@close\NAT@sep\penalty\@m\ }}%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@test{\NAT@ctype}\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@test{\NAT@ctype}\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\or\@citea
\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@alias\hyper@natlinkend
\def\@citea{\NAT@sep\penalty\@m\ }%
\fi
\fi
}}%
\ifnum\NAT@cmprs>0\relax\NAT@last@yr\fi
\ifNAT@swa\else\NAT@mbox{\NAT@@close}%
\ifnum\NAT@ctype=0\if*#2*\else
\NAT@cmt#2\fi
\fi\fi}{#1}{#2}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\NAT@test}
% \changes{6.6}{1997 May 29}{Add macro}
% \changes{7.4}{2006 Aug 18}{Fix bug by adding \cs{NAT@nmfmt}}
% For numerical mode, need to test if there really is a name or date; if a
% numerical \texttt{.bst} file is being used, there will not be any names or
% dates. This macro tests and writes |\NAT@nm| or |\NAT@date| according to
% its argument being 1 or 2.
% \begin{macrocode}
\newcommand\NAT@test[1]{\ifnum#1=1 \ifx\NAT@nmfmt{\NAT@nm}\NAT@noname
{\reset@font\bfseries(author?)}\PackageWarning{natbib}
{Author undefined for citation`\@citeb'
\MessageBreak
on page \thepage}\else \NAT@nm \fi
\else \if\relax\NAT@date\relax
{\reset@font\bfseries(year?)}\PackageWarning{natbib}
{Year undefined for citation`\@citeb'
\MessageBreak
on page \thepage}\else \NAT@date \fi \fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\citenumfont}
% \changes{7.0}{1999 May 7}{Add macro to format numerical citations}
% To set the numerical citations in a different font, define |\citenumfont|.
% \begin{macrocode}
\let\citenumfont=\relax
% \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}}
% \changes{6.0}{1995 Sep 21}{Move \cs{ifNAT@full} test from
% \cs{NAT@parse} to here}
% \changes{6.4}{1996 Oct 2}{Add dummy macros for \texttt{hyperref.sty}}
% \changes{6.6}{1997 Jun 3}{Add sorting of citations}
% \changes{6.7}{1997 Jul 16}{Add \cs{ifNAT@longnames} test}
% \changes{7.0}{1999 May 7}{Suppress years when empty}
% The author--year version of |\@citex| is now defined. It wants the authors
% and year for each decoded label text to be separated into |\NAT@nm| 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.
%
% The citation keys are in |#3|; these are sorted by |\NAT@sort@cites| and
% stored in |\NAT@cite@list|. If sorting is turned off, this list is the same
% as the original one.
%
% |\NAT@nm| will contain either |\NAT@name| or |\NAT@all@names| depending
% on the state of |\ifNAT@full|.
%
% With the option \texttt{longnamesfirst}, the flag |\ifNAT@longnames| is
% set; this makes the first citation of any reference use the long list of
% names. The flag |\bv@|\meta{key} is defined after the first citation so
% that short lists are used afterwards.
%
% When the year (|\NAT@date|) is empty, no year is printed, nor is the
% preceding punctuation there; for textual citations, the brackets are also
% suppressed. This is to allow to citations with a code designation without a
% year.
%
% The command |\@cprwrite| is defined in the \texttt{citeref} package.
% \changes{7.2}{2006 Jan 12}{Add \texttt{citeref} support}
% \changes{8.1}{2007 Oct 30}{Add \cs{@empty} after \cs{@citeb}, as now in standard \LaTeX}
% \begin{macrocode}
\newcommand\NAT@citex{}
\def\NAT@citex%
[#1][#2]#3{%
\NAT@sort@cites{#3}%
\let\@citea\@empty
\@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
\@for\@citeb:=\NAT@cite@list\do
{\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}%
\@ifundefined{@cprwrite}{}{\expandafter\@cprwrite\@citeb=}\fi
\@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
{\reset@font\bfseries ?}\NAT@citeundefined
\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}%
{\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name\fi
% \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}
% \changes{6.5}{1997 Jan 30}{Add optional notes for textual citations}
% 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.
%
% \changes{6.6}{1997 May 17}{Add \cs{NAT@ctype} for author, year, or both}
% This macro is to be used to define |\citep|, |\citet|, |\citeyear|, and
% |\citeauthor|, controlled by various flags. The |\NAT@ctype| is a number
% equal to 0 for author and year, 1 for author only, 2 for year only.
% \changes{6.9}{1999 Jan 22}{Add citation alias feature}
% A value of 3 is for the citation alias defined by |\defcitealias|.
%
% \changes{6.6}{1997 Jun 25}{Improve \texttt{hyperref} support}
% \changes{6.6}{1997 Jun 30}{Add missing \cs{NAT@close} to \cs{@citea}}
% \changes{6.7}{1997 Jul 14}{Put hyperlink brackets snuggly around
% \cs{NAT@exlab} and \cs{NAT@date}}
% \changes{6.8}{1998 Feb 19}{Remove superfluous \cs{hyper@natlinkstart}}
% \changes{6.8b}{1998 July 2}{Add \cs{hyper@natlinkbreak}}
% \changes{6.8c}{1998 July 14}{Remove opening brace and notes from link}
% \changes{6.8c}{1998 July 14}{Add \cs{NAT@nmfmt}}
% The hyperlinks are to bracket each reference completely, or at least that
% part that is present. The author names and year are made into separate links
% with the help of |\hyper@natlinkbreak|. Excluded from the link are
% punctuation and space between names and year, as well as notes and braces.
% Everything to be excluded is put into the first argument of |\hyper@natlinkbreak|.
% (This needs \texttt{hyperref.sty} version~6.32.)
%
% Another aid to keeping links on one page is the |\NAT@nmfmt| function for
% formatting names: normally this is nothing, but with the \texttt{nonamebreak}
% option, it becomes |\mbox|. This was a special request.
%
% \changes{7.1}{2003 June 6}{Add test for missing letter with multiple cites}
% Add a test for a missing extra letter in multiple citations. This can happen
% with the \texttt{chicago} style, for example. Pointed out by Frank Mittelbach.
% \begin{macrocode}
\ifNAT@swa\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\NAT@date\hyper@natlinkend
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\def\NAT@temp{{?}}%
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
{Multiple citation on page \thepage: same authors and
year\MessageBreak without distinguishing extra
letter,\MessageBreak appears as question mark}\fi
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@exlab
\hyper@natlinkend
\else\unskip\
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@date
\hyper@natlinkend
\fi
\else\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\NAT@aysep\ }{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend
\fi
\fi
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@alias\hyper@natlinkend
\fi \def\@citea{\NAT@sep\ }%
% \end{macrocode}
% Begin textual citation. Do same checks for repeated names and years.
% Optional notes are added here, not in |\NAT@cite|, which means for
% multiple citations, each one will receive the notes in the year part.
% (Pre-notes are questionable for this, but include them anyway.)
% \changes{6.6}{1997 July 5}{Fix closing brace bug}
% \begin{macrocode}
\else\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\hyper@natlinkend
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\def\NAT@temp{{?}}%
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
{Multiple citation on page \thepage: same authors and
year\MessageBreak without distinguishing extra
letter,\MessageBreak appears as question mark}\fi
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@exlab
\hyper@natlinkend
\else\unskip\
\hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@date
\hyper@natlinkend
\fi
\else\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}%
\hyper@natlinkbreak{\ \NAT@@open\if*#1*\else#1\ \fi}%
{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend\fi
\fi
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@nmfmt{\NAT@nm}\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@date\hyper@natlinkend
\or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
\NAT@alias\hyper@natlinkend
\fi \if\relax\NAT@date\relax\def\@citea{\NAT@sep\ }%
\else\def\@citea{\NAT@@close\NAT@sep\ }\fi
\fi
}}\ifNAT@swa\else\i