source: doc/papers/AMA/AMA-stix/ama/NJDnatbib.sty @ ded6c2a6

ast-experimental
Last change on this file since ded6c2a6 was 6e1e2d0, checked in by caparsons <caparson@…>, 19 months ago

resolved merge conflicts

  • Property mode set to 100644
File size: 44.7 KB
RevLine 
[6e1e2d0]1%%
2%% This is file `NJDnatbib.sty',
3%% generated with the docstrip utility.
4%%
5%% The original source files were:
6%%
7%% natbib.dtx  (with options: `package,all')
8%% =============================================
9%% IMPORTANT NOTICE:
10%%
11%% This program can be redistributed and/or modified under the terms
12%% of the LaTeX Project Public License Distributed from CTAN
13%% archives in directory macros/latex/base/lppl.txt; either
14%% version 1 of the License, or any later version.
15%%
16%% This is a generated file.
17%% It may not be distributed without the original source file natbib.dtx.
18%%
19%% Full documentation can be obtained by LaTeXing that original file.
20%% Only a few abbreviated comments remain here to describe the usage.
21%% =============================================
22%% Copyright 1993-2010 Patrick W Daly
23%% Max-Planck-Institut f\"ur Sonnensystemforschung
24%% Max-Planck-Str. 2
25%% D-37191 Katlenburg-Lindau
26%% Germany
27%% E-mail: daly@mps.mpg.de
28\NeedsTeXFormat{LaTeX2e}[1995/06/01]
29\ProvidesPackage{NJDnatbib}
30        [2010/09/13 8.31b (PWD, AO)]
31
32 % This package reimplements the LaTeX \cite command to be used for various
33 % citation styles, both author-year and numerical. It accepts BibTeX
34 % output intended for many other packages, and therefore acts as a
35 % general, all-purpose citation-style interface.
36 %
37 % With standard numerical .bst files, only numerical citations are
38 % possible. With an author-year .bst file, both numerical and
39 % author-year citations are possible.
40 %
41 % If author-year citations are selected, \bibitem must have one of the
42 %   following forms:
43 %   \bibitem[Jones et al.(1990)]{key}...
44 %   \bibitem[Jones et al.(1990)Jones, Baker, and Williams]{key}...
45 %   \bibitem[Jones et al., 1990]{key}...
46 %   \bibitem[\protect\citeauthoryear{Jones, Baker, and Williams}{Jones
47 %       et al.}{1990}]{key}...
48 %   \bibitem[\protect\citeauthoryear{Jones et al.}{1990}]{key}...
49 %   \bibitem[\protect\astroncite{Jones et al.}{1990}]{key}...
50 %   \bibitem[\protect\citename{Jones et al., }1990]{key}...
51 %   \harvarditem[Jones et al.]{Jones, Baker, and Williams}{1990}{key}...
52 %
53 % This is either to be made up manually, or to be generated by an
54 % appropriate .bst file with BibTeX.
55 %                            Author-year mode     ||   Numerical mode
56 % Then, \citet{key}  ==>>  Jones et al. (1990)    ||   Jones et al. [21]
57 %       \citep{key}  ==>> (Jones et al., 1990)    ||   [21]
58 % Multiple citations as normal:
59 % \citep{key1,key2}  ==>> (Jones et al., 1990; Smith, 1989) || [21,24]
60 %                           or  (Jones et al., 1990, 1991)  || [21,24]
61 %                           or  (Jones et al., 1990a,b)     || [21,24]
62 % \cite{key} is the equivalent of \citet{key} in author-year mode
63 %                         and  of \citep{key} in numerical mode
64 % Full author lists may be forced with \citet* or \citep*, e.g.
65 %       \citep*{key}      ==>> (Jones, Baker, and Williams, 1990)
66 % Optional notes as:
67 %   \citep[chap. 2]{key}    ==>> (Jones et al., 1990, chap. 2)
68 %   \citep[e.g.,][]{key}    ==>> (e.g., Jones et al., 1990)
69 %   \citep[see][pg. 34]{key}==>> (see Jones et al., 1990, pg. 34)
70 %  (Note: in standard LaTeX, only one note is allowed, after the ref.
71 %   Here, one note is like the standard, two make pre- and post-notes.)
72 %   \citealt{key}          ==>> Jones et al. 1990
73 %   \citealt*{key}         ==>> Jones, Baker, and Williams 1990
74 %   \citealp{key}          ==>> Jones et al., 1990
75 %   \citealp*{key}         ==>> Jones, Baker, and Williams, 1990
76 % Additional citation possibilities (both author-year and numerical modes)
77 %   \citeauthor{key}       ==>> Jones et al.
78 %   \citeauthor*{key}      ==>> Jones, Baker, and Williams
79 %   \citeyear{key}         ==>> 1990
80 %   \citeyearpar{key}      ==>> (1990)
81 %   \citetext{priv. comm.} ==>> (priv. comm.)
82 %   \citenum{key}          ==>> 11 [non-superscripted]
83 % Note: full author lists depends on whether the bib style supports them;
84 %       if not, the abbreviated list is printed even when full requested.
85 %
86 % For names like della Robbia at the start of a sentence, use
87 %   \Citet{dRob98}         ==>> Della Robbia (1998)
88 %   \Citep{dRob98}         ==>> (Della Robbia, 1998)
89 %   \Citeauthor{dRob98}    ==>> Della Robbia
90 %
91 %
92 % Citation aliasing is achieved with
93 %   \defcitealias{key}{text}
94 %   \citetalias{key}  ==>> text
95 %   \citepalias{key}  ==>> (text)
96 %
97 % Defining the citation mode and punctual (citation style)
98 %   \setcitestyle{<comma-separated list of keywords, same
99 %     as the package options>}
100 % Example: \setcitestyle{square,semicolon}
101 % Alternatively:
102 % Use \bibpunct with 6 mandatory arguments:
103 %    1. opening bracket for citation
104 %    2. closing bracket
105 %    3. citation separator (for multiple citations in one \cite)
106 %    4. the letter n for numerical styles, s for superscripts
107 %        else anything for author-year
108 %    5. punctuation between authors and date
109 %    6. punctuation between years (or numbers) when common authors missing
110 % One optional argument is the character coming before post-notes. It
111 %   appears in square braces before all other arguments. May be left off.
112 % Example (and default) \bibpunct[, ]{(}{)}{;}{a}{,}{,}
113 %
114 % To make this automatic for a given bib style, named newbib, say, make
115 % a local configuration file, natbib.cfg, with the definition
116 %   \newcommand{\bibstyle@newbib}{\bibpunct...}
117 % Then the \bibliographystyle{newbib} will cause \bibstyle@newbib to
118 % be called on THE NEXT LATEX RUN (via the aux file).
119 %
120 % Such preprogrammed definitions may be invoked anywhere in the text
121 %  by calling \citestyle{newbib}. This is only useful if the style specified
122 %  differs from that in \bibliographystyle.
123 %
124 % With \citeindextrue and \citeindexfalse, one can control whether the
125 % \cite commands make an automatic entry of the citation in the .idx
126 % indexing file. For this, \makeindex must also be given in the preamble.
127 %
128 % Package Options: (for selecting punctuation)
129 %   round  -  round parentheses are used (default)
130 %   square -  square brackets are used   [option]
131 %   curly  -  curly braces are used      {option}
132 %   angle  -  angle brackets are used    <option>
133 %   semicolon  -  multiple citations separated by semi-colon (default)
134 %   colon  - same as semicolon, an earlier confusion
135 %   comma  -  separated by comma
136 %   authoryear - selects author-year citations (default)
137 %   numbers-  selects numerical citations
138 %   super  -  numerical citations as superscripts
139 %   sort   -  sorts multiple citations according to order in ref. list
140 %   sort&compress   -  like sort, but also compresses numerical citations
141 %   compress - compresses without sorting
142 %   longnamesfirst  -  makes first citation full author list
143 %   sectionbib - puts bibliography in a \section* instead of \chapter*
144 %   merge - allows the citation key to have a * prefix,
145 %           signifying to merge its reference with that of the previous citation.
146 %   elide - if references are merged, repeated portions of later ones may be removed.
147 %   mcite - recognizes and ignores the * prefix for merging.
148 % Punctuation so selected dominates over any predefined ones.
149 % Package options are called as, e.g.
150 %        \usepackage[square,comma]{natbib}
151 % LaTeX the source file natbib.dtx to obtain more details
152 % or the file natnotes.tex for a brief reference sheet.
153 %-----------------------------------------------------------
154\providecommand\@ifxundefined[1]{%
155 \ifx#1\@undefined\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
156}%
157\providecommand\@ifnum[1]{%
158 \ifnum#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
159}%
160\providecommand\@ifx[1]{%
161 \ifx#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
162}%
163\providecommand\appdef[2]{%
164 \toks@\expandafter{#1}\@temptokena{#2}%
165 \edef#1{\the\toks@\the\@temptokena}%
166}%
167\@ifclassloaded{agu2001}{\PackageError{natbib}
168  {The agu2001 class already includes natbib coding,\MessageBreak
169   so you should not add it explicitly}
170  {Type <Return> for now, but then later remove\MessageBreak
171   the command \protect\usepackage{natbib} from the document}
172  \endinput}{}
173\@ifclassloaded{agutex}{\PackageError{natbib}
174  {The AGUTeX class already includes natbib coding,\MessageBreak
175   so you should not add it explicitly}
176  {Type <Return> for now, but then later remove\MessageBreak
177   the command \protect\usepackage{natbib} from the document}
178  \endinput}{}
179\@ifclassloaded{aguplus}{\PackageError{natbib}
180  {The aguplus class already includes natbib coding,\MessageBreak
181   so you should not add it explicitly}
182  {Type <Return> for now, but then later remove\MessageBreak
183   the command \protect\usepackage{natbib} from the document}
184  \endinput}{}
185\@ifclassloaded{nlinproc}{\PackageError{natbib}
186  {The nlinproc class already includes natbib coding,\MessageBreak
187   so you should not add it explicitly}
188  {Type <Return> for now, but then later remove\MessageBreak
189   the command \protect\usepackage{natbib} from the document}
190  \endinput}{}
191\@ifclassloaded{egs}{\PackageError{natbib}
192  {The egs class already includes natbib coding,\MessageBreak
193   so you should not add it explicitly}
194  {Type <Return> for now, but then later remove\MessageBreak
195   the command \protect\usepackage{natbib} from the document}
196  \endinput}{}
197\@ifclassloaded{egu}{\PackageError{natbib}
198  {The egu class already includes natbib coding,\MessageBreak
199   so you should not add it explicitly}
200  {Type <Return> for now, but then later remove\MessageBreak
201   the command \protect\usepackage{natbib} from the document}
202  \endinput}{}
203 % Define citation punctuation for some author-year styles
204 % One may add and delete at this point
205 % Or put additions into local configuration file natbib.cfg
206\newcommand\bibstyle@chicago{\bibpunct{(}{)}{;}{a}{,}{,}}
207\newcommand\bibstyle@named{\bibpunct{[}{]}{;}{a}{,}{,}}
208\newcommand\bibstyle@agu{\bibpunct{[}{]}{;}{a}{,}{,~}}%Amer. Geophys. Union
209\newcommand\bibstyle@copernicus{\bibpunct{(}{)}{;}{a}{,}{,}}%Copernicus Publications
210\let\bibstyle@egu=\bibstyle@copernicus
211\let\bibstyle@egs=\bibstyle@copernicus
212\newcommand\bibstyle@agsm{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
213\newcommand\bibstyle@kluwer{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
214\newcommand\bibstyle@dcu{\bibpunct{(}{)}{;}{a}{;}{,}\gdef\harvardand{and}}
215\newcommand\bibstyle@aa{\bibpunct{(}{)}{;}{a}{}{,}} %Astronomy & Astrophysics
216\newcommand\bibstyle@pass{\bibpunct{(}{)}{;}{a}{,}{,}}%Planet. & Space Sci
217\newcommand\bibstyle@anngeo{\bibpunct{(}{)}{;}{a}{,}{,}}%Annales Geophysicae
218\newcommand\bibstyle@nlinproc{\bibpunct{(}{)}{;}{a}{,}{,}}%Nonlin.Proc.Geophys.
219 % Define citation punctuation for some numerical styles
220\newcommand\bibstyle@cospar{\bibpunct{/}{/}{,}{n}{}{}%
221     \gdef\bibnumfmt##1{##1.}}
222\newcommand\bibstyle@esa{\bibpunct{(Ref.~}{)}{,}{n}{}{}%
223     \gdef\bibnumfmt##1{##1.\hspace{1em}}}
224\newcommand\bibstyle@nature{\bibpunct{}{}{,}{s}{}{\textsuperscript{,}}%
225     \gdef\bibnumfmt##1{##1.}}
226 % The standard LaTeX styles
227\newcommand\bibstyle@plain{\bibpunct{[}{]}{,}{n}{}{,}}
228\let\bibstyle@alpha=\bibstyle@plain
229\let\bibstyle@abbrv=\bibstyle@plain
230\let\bibstyle@unsrt=\bibstyle@plain
231 % The author-year modifications of the standard styles
232\newcommand\bibstyle@plainnat{\bibpunct{[}{]}{,}{a}{,}{,}}
233\let\bibstyle@abbrvnat=\bibstyle@plainnat
234\let\bibstyle@unsrtnat=\bibstyle@plainnat
235\newif\ifNAT@numbers \NAT@numbersfalse
236\newif\ifNAT@super \NAT@superfalse
237\let\NAT@merge\z@
238\DeclareOption{numbers}{\NAT@numberstrue
239   \ExecuteOptions{square,comma,nobibstyle}}
240\DeclareOption{super}{\NAT@supertrue\NAT@numberstrue
241   \renewcommand\NAT@open{}\renewcommand\NAT@close{}
242   \ExecuteOptions{nobibstyle}}
243\DeclareOption{authoryear}{\NAT@numbersfalse
244   \ExecuteOptions{round,semicolon,bibstyle}}
245\DeclareOption{round}{%
246      \renewcommand\NAT@open{(} \renewcommand\NAT@close{)}
247   \ExecuteOptions{nobibstyle}}
248\DeclareOption{square}{%
249      \renewcommand\NAT@open{[} \renewcommand\NAT@close{]}
250   \ExecuteOptions{nobibstyle}}
251\DeclareOption{angle}{%
252      \renewcommand\NAT@open{$<$} \renewcommand\NAT@close{$>$}
253   \ExecuteOptions{nobibstyle}}
254\DeclareOption{curly}{%
255      \renewcommand\NAT@open{\{} \renewcommand\NAT@close{\}}
256   \ExecuteOptions{nobibstyle}}
257\DeclareOption{comma}{\renewcommand\NAT@sep{,}
258   \ExecuteOptions{nobibstyle}}
259\DeclareOption{semicolon}{\renewcommand\NAT@sep{;}
260   \ExecuteOptions{nobibstyle}}
261\DeclareOption{colon}{\ExecuteOptions{semicolon}}
262\DeclareOption{nobibstyle}{\let\bibstyle=\@gobble}
263\DeclareOption{bibstyle}{\let\bibstyle=\@citestyle}
264\newif\ifNAT@openbib \NAT@openbibfalse
265\DeclareOption{openbib}{\NAT@openbibtrue}
266\DeclareOption{sectionbib}{\def\NAT@sectionbib{on}}
267\def\NAT@sort{\z@}
268\def\NAT@cmprs{\z@}
269\DeclareOption{sort}{\def\NAT@sort{\@ne}}
270\DeclareOption{compress}{\def\NAT@cmprs{\@ne}}
271\DeclareOption{sort&compress}{\def\NAT@sort{\@ne}\def\NAT@cmprs{\@ne}}
272\DeclareOption{mcite}{\let\NAT@merge\@ne}
273\DeclareOption{merge}{\@ifnum{\NAT@merge<\tw@}{\let\NAT@merge\tw@}{}}
274\DeclareOption{elide}{\@ifnum{\NAT@merge<\thr@@}{\let\NAT@merge\thr@@}{}}
275\@ifpackageloaded{cite}{\PackageWarningNoLine{natbib}
276  {The `cite' package should not be used\MessageBreak
277   with natbib. Use option `sort' instead}\ExecuteOptions{sort}}{}
278\@ifpackageloaded{mcite}{\PackageWarningNoLine{natbib}
279  {The `mcite' package should not be used\MessageBreak
280   with natbib. Use option `merge' instead}\ExecuteOptions{merge}}{}
281\@ifpackageloaded{citeref}{\PackageError{natbib}
282  {The `citeref' package must be loaded after natbib}%
283  {Move \protect\usepackage{citeref} to after \string\usepackage{natbib}}}{}
284\newif\ifNAT@longnames\NAT@longnamesfalse
285\DeclareOption{longnamesfirst}{\NAT@longnamestrue}
286\DeclareOption{nonamebreak}{\def\NAT@nmfmt#1{\mbox{\NAT@up#1}}}
287\def\NAT@nmfmt#1{{\NAT@up#1}}
288\renewcommand\bibstyle[1]{\csname bibstyle@#1\endcsname}
289\AtBeginDocument{\global\let\bibstyle=\@gobble}
290\let\@citestyle\bibstyle
291\newcommand\citestyle[1]{\@citestyle{#1}\let\bibstyle\@gobble}
292\newcommand\bibpunct[7][, ]%
293  {\gdef\NAT@open{#2}\gdef\NAT@close{#3}\gdef
294   \NAT@sep{#4}\global\NAT@numbersfalse
295     \ifx #5n\global\NAT@numberstrue\global\NAT@superfalse
296   \else
297     \ifx #5s\global\NAT@numberstrue\global\NAT@supertrue
298   \fi\fi
299   \gdef\NAT@aysep{#6}\gdef\NAT@yrsep{#7}%
300   \gdef\NAT@cmt{#1}%
301   \NAT@@setcites
302  }
303\newcommand\setcitestyle[1]{
304 \@for\@tempa:=#1\do
305 {\def\@tempb{round}\ifx\@tempa\@tempb
306    \renewcommand\NAT@open{(}\renewcommand\NAT@close{)}\fi
307  \def\@tempb{square}\ifx\@tempa\@tempb
308    \renewcommand\NAT@open{[}\renewcommand\NAT@close{]}\fi
309  \def\@tempb{angle}\ifx\@tempa\@tempb
310    \renewcommand\NAT@open{$<$}\renewcommand\NAT@close{$>$}\fi
311  \def\@tempb{curly}\ifx\@tempa\@tempb
312    \renewcommand\NAT@open{\{}\renewcommand\NAT@close{\}}\fi
313  \def\@tempb{semicolon}\ifx\@tempa\@tempb
314    \renewcommand\NAT@sep{;}\fi
315  \def\@tempb{colon}\ifx\@tempa\@tempb
316    \renewcommand\NAT@sep{;}\fi
317  \def\@tempb{comma}\ifx\@tempa\@tempb
318    \renewcommand\NAT@sep{,}\fi
319  \def\@tempb{authoryear}\ifx\@tempa\@tempb
320    \NAT@numbersfalse\fi
321  \def\@tempb{numbers}\ifx\@tempa\@tempb
322    \NAT@numberstrue\NAT@superfalse\fi
323  \def\@tempb{super}\ifx\@tempa\@tempb
324    \NAT@numberstrue\NAT@supertrue\fi
325  \expandafter\NAT@find@eq\@tempa=\relax\@nil
326  \if\@tempc\relax\else
327    \expandafter\NAT@rem@eq\@tempc
328    \def\@tempb{open}\ifx\@tempa\@tempb
329     \xdef\NAT@open{\@tempc}\fi
330    \def\@tempb{close}\ifx\@tempa\@tempb
331     \xdef\NAT@close{\@tempc}\fi
332    \def\@tempb{aysep}\ifx\@tempa\@tempb
333     \xdef\NAT@aysep{\@tempc}\fi
334    \def\@tempb{yysep}\ifx\@tempa\@tempb
335     \xdef\NAT@yrsep{\@tempc}\fi
336    \def\@tempb{notesep}\ifx\@tempa\@tempb
337     \xdef\NAT@cmt{\@tempc}\fi
338    \def\@tempb{citesep}\ifx\@tempa\@tempb
339     \xdef\NAT@sep{\@tempc}\fi
340  \fi
341 }%
342 \NAT@@setcites
343}
344 \def\NAT@find@eq#1=#2\@nil{\def\@tempa{#1}\def\@tempc{#2}}
345 \def\NAT@rem@eq#1={\def\@tempc{#1}}
346 \def\NAT@@setcites{\global\let\bibstyle\@gobble}
347\AtBeginDocument{\let\NAT@@setcites\NAT@set@cites}
348\newcommand\NAT@open{(} \newcommand\NAT@close{)}
349\newcommand\NAT@sep{;}
350\ProcessOptions
351\newcommand\NAT@aysep{,} \newcommand\NAT@yrsep{,}
352\newcommand\NAT@cmt{, }
353\newcommand\NAT@cite%
354    [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi
355        #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
356\newcommand\NAT@citenum%
357    [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi
358        #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}
359%\newcommand\NAT@citesuper[3]{\ifNAT@swa
360%\if*#2*\else#2\NAT@spacechar\fi
361%\unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close}%
362%   \if*#3*\else\NAT@spacechar#3\fi\else #1\fi\endgroup}
363%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364\newcommand\NAT@citesuper[3]{\ifNAT@swa
365\if*#2*\else#2\NAT@spacechar\fi
366\unskip\kern\p@\textsuperscript{\NAT@@open#1\if*#3*\else,\NAT@spacechar#3\fi\NAT@@close}%
367   \else #1\fi\endgroup}
368%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369\providecommand\textsuperscript[1]{\mbox{$^{\mbox{\scriptsize#1}}$}}
370\begingroup \catcode`\_=8
371\gdef\NAT@ifcat@num#1{%
372 \ifcat_\ifnum\z@<0#1_\else A\fi
373  \expandafter\@firstoftwo
374 \else
375  \expandafter\@secondoftwo
376 \fi
377}%
378\endgroup
379\providecommand\@firstofone[1]{#1}
380\newcommand\NAT@citexnum{}
381\def\NAT@citexnum[#1][#2]#3{%
382  \NAT@reset@parser
383  \NAT@sort@cites{#3}%
384  \NAT@reset@citea
385  \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
386    \@for\@citeb:=\NAT@cite@list\do
387    {\@safe@activestrue
388     \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
389     \@safe@activesfalse
390     \@ifundefined{b@\@citeb\@extra@b@citeb}{%
391       {\reset@font\bfseries?}
392        \NAT@citeundefined\PackageWarning{natbib}%
393       {Citation `\@citeb' on page \thepage \space undefined}}%
394     {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
395      \NAT@parse{\@citeb}%
396      \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
397        \let\NAT@name=\NAT@all@names
398        \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
399      \fi
400      \ifNAT@full\let\NAT@nm\NAT@all@names\else
401        \let\NAT@nm\NAT@name\fi
402      \ifNAT@swa
403       \@ifnum{\NAT@ctype>\@ne}{%
404        \@citea
405        \NAT@hyper@{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}%
406       }{%
407        \@ifnum{\NAT@cmprs>\z@}{%
408         \NAT@ifcat@num\NAT@num
409          {\let\NAT@nm=\NAT@num}%
410          {\def\NAT@nm{-2}}%
411         \NAT@ifcat@num\NAT@last@num
412          {\@tempcnta=\NAT@last@num\relax}%
413          {\@tempcnta\m@ne}%
414         \@ifnum{\NAT@nm=\@tempcnta}{%
415          \@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}%
416         }{%
417           \advance\@tempcnta by\@ne
418           \@ifnum{\NAT@nm=\@tempcnta}{%
419             \ifx\NAT@last@yr\relax
420               \def@NAT@last@yr{\@citea}%
421             \else
422               \def@NAT@last@yr{--\NAT@penalty}%
423             \fi
424           }{%
425             \NAT@last@yr@mbox
426           }%
427         }%
428        }{%
429         \@tempswatrue
430         \@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}%
431         \if@tempswa\NAT@citea@mbox\fi
432        }%
433       }%
434       \NAT@def@citea
435      \else
436        \ifcase\NAT@ctype
437          \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else
438            \@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}%
439          \fi
440          \if*#1*\else#1\NAT@spacechar\fi
441          \NAT@mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}%
442          \NAT@def@citea@box
443        \or
444          \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%
445        \or
446          \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%
447        \or
448          \NAT@hyper@citea@space\NAT@alias
449        \fi
450      \fi
451     }%
452    }%
453      \@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}%
454      \ifNAT@swa\else
455        \@ifnum{\NAT@ctype=\z@}{%
456          \if*#2*\else\NAT@cmt#2\fi
457        }{}%
458        \NAT@mbox{\NAT@@close}%
459      \fi
460  }{#1}{#2}%
461}%
462\def\NAT@citea@mbox{%
463 \@citea\mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}%
464}%
465\def\NAT@hyper@#1{%
466 \hyper@natlinkstart{\@citeb\@extra@b@citeb}#1\hyper@natlinkend
467}%
468\def\NAT@hyper@citea#1{%
469 \@citea
470 \NAT@hyper@{#1}%
471 \NAT@def@citea
472}%
473\def\NAT@hyper@citea@space#1{%
474 \@citea
475 \NAT@hyper@{#1}%
476 \NAT@def@citea@space
477}%
478\def\def@NAT@last@yr#1{%
479 \protected@edef\NAT@last@yr{%
480  #1%
481  \noexpand\mbox{%
482   \noexpand\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
483   {\noexpand\citenumfont{\NAT@num}}%
484   \noexpand\hyper@natlinkend
485  }%
486 }%
487}%
488\def\NAT@last@yr@mbox{%
489 \NAT@last@yr\let\NAT@last@yr\relax
490 \NAT@citea@mbox
491}%
492\newcommand\NAT@test[1]{%
493 \@ifnum{#1=\@ne}{%
494  \ifx\NAT@nm\NAT@noname
495   \begingroup\reset@font\bfseries(author?)\endgroup
496   \PackageWarning{natbib}{%
497    Author undefined for citation`\@citeb' \MessageBreak on page \thepage%
498   }%
499  \else \NAT@nm
500  \fi
501 }{%
502  \if\relax\NAT@date\relax
503   \begingroup\reset@font\bfseries(year?)\endgroup
504   \PackageWarning{natbib}{%
505    Year undefined for citation`\@citeb' \MessageBreak on page \thepage%
506   }%
507  \else \NAT@date
508  \fi
509 }%
510}%
511\let\citenumfont=\@empty
512\newcommand\NAT@citex{}
513\def\NAT@citex%
514  [#1][#2]#3{%
515  \NAT@reset@parser
516  \NAT@sort@cites{#3}%
517  \NAT@reset@citea
518  \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
519    \@for\@citeb:=\NAT@cite@list\do
520    {\@safe@activestrue
521     \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
522     \@safe@activesfalse
523     \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
524       {\reset@font\bfseries ?}\NAT@citeundefined
525                 \PackageWarning{natbib}%
526       {Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}%
527     {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
528      \NAT@parse{\@citeb}%
529      \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
530        \let\NAT@name=\NAT@all@names
531        \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
532      \fi
533     \ifNAT@full\let\NAT@nm\NAT@all@names\else
534       \let\NAT@nm\NAT@name\fi
535     \ifNAT@swa\ifcase\NAT@ctype
536       \if\relax\NAT@date\relax
537         \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}%
538       \else
539         \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
540            \ifx\NAT@last@yr\NAT@year
541              \def\NAT@temp{{?}}%
542              \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
543               {Multiple citation on page \thepage: same authors and
544               year\MessageBreak without distinguishing extra
545               letter,\MessageBreak appears as question mark}\fi
546              \NAT@hyper@{\NAT@exlab}%
547            \else\unskip\NAT@spacechar
548              \NAT@hyper@{\NAT@date}%
549            \fi
550         \else
551           \@citea\NAT@hyper@{%
552             \NAT@nmfmt{\NAT@nm}%
553             \hyper@natlinkbreak{%
554               \NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb
555             }%
556             \NAT@date
557           }%
558         \fi
559       \fi
560     \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
561     \or\@citea\NAT@hyper@{\NAT@date}%
562     \or\@citea\NAT@hyper@{\NAT@alias}%
563     \fi \NAT@def@citea
564     \else
565       \ifcase\NAT@ctype
566        \if\relax\NAT@date\relax
567          \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
568        \else
569         \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
570            \ifx\NAT@last@yr\NAT@year
571              \def\NAT@temp{{?}}%
572              \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
573               {Multiple citation on page \thepage: same authors and
574               year\MessageBreak without distinguishing extra
575               letter,\MessageBreak appears as question mark}\fi
576              \NAT@hyper@{\NAT@exlab}%
577            \else
578              \unskip\NAT@spacechar
579              \NAT@hyper@{\NAT@date}%
580            \fi
581         \else
582           \@citea\NAT@hyper@{%
583             \NAT@nmfmt{\NAT@nm}%
584             \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%
585               {\@citeb\@extra@b@citeb}%
586             \NAT@date
587           }%
588         \fi
589        \fi
590       \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
591       \or\@citea\NAT@hyper@{\NAT@date}%
592       \or\@citea\NAT@hyper@{\NAT@alias}%
593       \fi
594       \if\relax\NAT@date\relax
595         \NAT@def@citea
596       \else
597         \NAT@def@citea@close
598       \fi
599     \fi
600     }}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
601     \if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}}
602\def\NAT@spacechar{\ }%
603\def\NAT@separator{\NAT@sep\NAT@penalty}%
604\def\NAT@reset@citea{\c@NAT@ctr\@ne\let\@citea\@empty}%
605\def\NAT@def@citea{\def\@citea{\NAT@separator\NAT@space}}%
606\def\NAT@def@citea@space{\def\@citea{\NAT@separator\NAT@spacechar}}%
607\def\NAT@def@citea@close{\def\@citea{\NAT@@close\NAT@separator\NAT@space}}%
608\def\NAT@def@citea@box{\def\@citea{\NAT@mbox{\NAT@@close}\NAT@separator\NAT@spacechar}}%
609\newif\ifNAT@par \NAT@partrue
610\newcommand\NAT@@open{\ifNAT@par\NAT@open\fi}
611\newcommand\NAT@@close{\ifNAT@par\NAT@close\fi}
612\newcommand\NAT@alias{\@ifundefined{al@\@citeb\@extra@b@citeb}{%
613  {\reset@font\bfseries(alias?)}\PackageWarning{natbib}
614  {Alias undefined for citation `\@citeb'
615  \MessageBreak on page \thepage}}{\@nameuse{al@\@citeb\@extra@b@citeb}}}
616\let\NAT@up\relax
617\newcommand\NAT@Up[1]{{\let\protect\@unexpandable@protect\let~\relax
618  \expandafter\NAT@deftemp#1}\expandafter\NAT@UP\NAT@temp}
619\newcommand\NAT@deftemp[1]{\xdef\NAT@temp{#1}}
620\newcommand\NAT@UP[1]{\let\@tempa\NAT@UP\ifcat a#1\MakeUppercase{#1}%
621  \let\@tempa\relax\else#1\fi\@tempa}
622\newcommand\shortcites[1]{%
623  \@bsphack\@for\@citeb:=#1\do
624  {\@safe@activestrue
625   \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
626   \@safe@activesfalse
627   \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}\@esphack}
628\newcommand\NAT@biblabel[1]{\hfill}
629\newcommand\NAT@biblabelnum[1]{\bibnumfmt{#1}}
630\let\bibnumfmt\@empty
631\providecommand\@biblabel[1]{[#1]}
632\AtBeginDocument{\ifx\bibnumfmt\@empty\let\bibnumfmt\@biblabel\fi}
633\newcommand\NAT@bibsetnum[1]{\settowidth\labelwidth{\@biblabel{#1}}%
634   \setlength{\leftmargin}{\labelwidth}\addtolength{\leftmargin}{\labelsep}%
635   \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}%
636   \ifNAT@openbib
637     \addtolength{\leftmargin}{\bibindent}%
638     \setlength{\itemindent}{-\bibindent}%
639     \setlength{\listparindent}{\itemindent}%
640     \setlength{\parsep}{0pt}%
641   \fi
642}
643\newlength{\bibhang}
644\setlength{\bibhang}{1em}
645\newlength{\bibsep}
646 {\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
647
648\newcommand\NAT@bibsetup%
649   [1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\leftmargin}%
650       \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}}
651\newcommand\NAT@set@cites{%
652  \ifNAT@numbers
653    \ifNAT@super \let\@cite\NAT@citesuper
654       \def\NAT@mbox##1{\unskip\nobreak\textsuperscript{##1}}%
655       \let\citeyearpar=\citeyear
656       \let\NAT@space\relax
657       \def\NAT@super@kern{\kern\p@}%
658    \else
659       \let\NAT@mbox=\mbox
660       \let\@cite\NAT@citenum
661       \let\NAT@space\NAT@spacechar
662       \let\NAT@super@kern\relax
663    \fi
664    \let\@citex\NAT@citexnum
665    \let\@biblabel\NAT@biblabelnum
666    \let\@bibsetup\NAT@bibsetnum
667    \renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@num\NAT@close}%
668    \def\natexlab##1{}%
669    \def\NAT@penalty{\penalty\@m}%
670  \else
671    \let\@cite\NAT@cite
672    \let\@citex\NAT@citex
673    \let\@biblabel\NAT@biblabel
674    \let\@bibsetup\NAT@bibsetup
675    \let\NAT@space\NAT@spacechar
676    \let\NAT@penalty\@empty
677    \renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@date\NAT@close}%
678    \def\natexlab##1{##1}%
679  \fi}
680\AtBeginDocument{\NAT@set@cites}
681\AtBeginDocument{\ifx\SK@def\@undefined\else
682\ifx\SK@cite\@empty\else
683  \SK@def\@citex[#1][#2]#3{\SK@\SK@@ref{#3}\SK@@citex[#1][#2]{#3}}\fi
684\ifx\SK@citeauthor\@undefined\def\HAR@checkdef{}\else
685  \let\citeauthor\SK@citeauthor
686  \let\citefullauthor\SK@citefullauthor
687  \let\citeyear\SK@citeyear\fi
688\fi}
689\newif\ifNAT@full\NAT@fullfalse
690\newif\ifNAT@swa
691\DeclareRobustCommand\citet
692   {\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@partrue
693     \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
694\newcommand\NAT@citetp{\@ifnextchar[{\NAT@@citetp}{\NAT@@citetp[]}}
695\newcommand\NAT@@citetp{}
696\def\NAT@@citetp[#1]{\@ifnextchar[{\@citex[#1]}{\@citex[][#1]}}
697\DeclareRobustCommand\citep
698   {\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@partrue
699         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
700\DeclareRobustCommand\cite
701    {\begingroup\let\NAT@ctype\z@\NAT@partrue\NAT@swatrue
702      \@ifstar{\NAT@fulltrue\NAT@cites}{\NAT@fullfalse\NAT@cites}}
703\newcommand\NAT@cites{\@ifnextchar [{\NAT@@citetp}{%
704     \ifNAT@numbers\else
705     \NAT@swafalse
706     \fi
707    \NAT@@citetp[]}}
708\DeclareRobustCommand\citealt
709   {\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@parfalse
710         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
711\DeclareRobustCommand\citealp
712   {\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse
713         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
714\DeclareRobustCommand\citenum
715   {\begingroup
716     \NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse\let\textsuperscript\NAT@spacechar
717     \NAT@citexnum[][]}
718\DeclareRobustCommand\citeauthor
719   {\begingroup\NAT@swafalse\let\NAT@ctype\@ne\NAT@parfalse
720    \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
721\DeclareRobustCommand\Citet
722   {\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@partrue
723     \let\NAT@up\NAT@Up
724     \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
725\DeclareRobustCommand\Citep
726   {\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@partrue
727     \let\NAT@up\NAT@Up
728         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
729\DeclareRobustCommand\Citealt
730   {\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@parfalse
731     \let\NAT@up\NAT@Up
732         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
733\DeclareRobustCommand\Citealp
734   {\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse
735     \let\NAT@up\NAT@Up
736         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
737\DeclareRobustCommand\Citeauthor
738   {\begingroup\NAT@swafalse\let\NAT@ctype\@ne\NAT@parfalse
739     \let\NAT@up\NAT@Up
740    \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
741\DeclareRobustCommand\citeyear
742   {\begingroup\NAT@swafalse\let\NAT@ctype\tw@\NAT@parfalse\NAT@citetp}
743\DeclareRobustCommand\citeyearpar
744   {\begingroup\NAT@swatrue\let\NAT@ctype\tw@\NAT@partrue\NAT@citetp}
745\newcommand\citetext[1]{\NAT@open#1\NAT@close}
746\DeclareRobustCommand\citefullauthor
747   {\citeauthor*}
748\newcommand\defcitealias[2]{%
749   \@ifundefined{al@#1\@extra@b@citeb}{}
750   {\PackageWarning{natbib}{Overwriting existing alias for citation #1}}
751   \@namedef{al@#1\@extra@b@citeb}{#2}}
752\DeclareRobustCommand\citetalias{\begingroup
753   \NAT@swafalse\let\NAT@ctype\thr@@\NAT@parfalse\NAT@citetp}
754\DeclareRobustCommand\citepalias{\begingroup
755   \NAT@swatrue\let\NAT@ctype\thr@@\NAT@partrue\NAT@citetp}
756\renewcommand\nocite[1]{\@bsphack
757  \@for\@citeb:=#1\do{%
758    \@safe@activestrue
759    \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
760    \@safe@activesfalse
761    \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
762    \if*\@citeb\else
763    \@ifundefined{b@\@citeb\@extra@b@citeb}{%
764       \NAT@citeundefined \PackageWarning{natbib}%
765       {Citation `\@citeb' undefined}}{}\fi}%
766  \@esphack}
767\newcommand\NAT@parse[1]{%
768  \begingroup
769   \let\protect=\@unexpandable@protect
770   \let~\relax
771   \let\active@prefix=\@gobble
772   \edef\NAT@temp{\csname b@#1\@extra@b@citeb\endcsname}%
773   \aftergroup\NAT@split
774   \expandafter
775  \endgroup
776  \NAT@temp{}{}{}{}{}@@%
777  \expandafter\NAT@parse@date\NAT@date??????@@%
778  \ifciteindex\NAT@index\fi
779}%
780\def\NAT@split#1#2#3#4#5@@{%
781  \gdef\NAT@num{#1}\gdef\NAT@name{#3}\gdef\NAT@date{#2}%
782  \gdef\NAT@all@names{#4}%
783  \ifx\NAT@num\@empty\gdef\NAT@num{0}\fi
784  \ifx\NAT@noname\NAT@all@names \gdef\NAT@all@names{#3}\fi
785}%
786\def\NAT@reset@parser{%
787  \global\let\NAT@num\@empty
788  \global\let\NAT@name\@empty
789  \global\let\NAT@date\@empty
790  \global\let\NAT@all@names\@empty
791}%
792\newcommand\NAT@parse@date{}
793\def\NAT@parse@date#1#2#3#4#5#6@@{%
794  \ifnum\the\catcode`#1=11\def\NAT@year{}\def\NAT@exlab{#1}\else
795  \ifnum\the\catcode`#2=11\def\NAT@year{#1}\def\NAT@exlab{#2}\else
796  \ifnum\the\catcode`#3=11\def\NAT@year{#1#2}\def\NAT@exlab{#3}\else
797  \ifnum\the\catcode`#4=11\def\NAT@year{#1#2#3}\def\NAT@exlab{#4}\else
798    \def\NAT@year{#1#2#3#4}\def\NAT@exlab{{#5}}\fi\fi\fi\fi}
799\newcommand\NAT@index{}
800\let\NAT@makeindex=\makeindex
801\renewcommand\makeindex{\NAT@makeindex
802  \renewcommand\NAT@index{\@bsphack\begingroup
803     \def~{\string~}\@wrindex{\NAT@idxtxt}}}
804\newcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@date\NAT@close}
805\@ifxundefined\@indexfile{}{\let\NAT@makeindex\relax\makeindex}
806\newif\ifciteindex \citeindexfalse
807\newcommand\citeindextype{default}
808\newcommand\NAT@index@alt{{\let\protect=\noexpand\let~\relax
809  \xdef\NAT@temp{\NAT@idxtxt}}\expandafter\NAT@exp\NAT@temp\@nil}
810\newcommand\NAT@exp{}
811\def\NAT@exp#1\@nil{\index[\citeindextype]{#1}}
812
813\AtBeginDocument{%
814\@ifpackageloaded{index}{\let\NAT@index=\NAT@index@alt}{}}
815\newcommand\NAT@ifcmd{\futurelet\NAT@temp\NAT@ifxcmd}
816\newcommand\NAT@ifxcmd{\ifx\NAT@temp\relax\else\expandafter\NAT@bare\fi}
817\def\NAT@bare#1(#2)#3(@)#4\@nil#5{%
818  \if @#2
819    \expandafter\NAT@apalk#1, , \@nil{#5}%
820  \else
821  \NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{#3}{#5}%
822\fi
823}
824\newcommand\NAT@wrout[5]{%
825\if@filesw
826      {\let\protect\noexpand\let~\relax
827       \immediate
828       \write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi
829\ignorespaces}
830\def\NAT@noname{{}}
831\renewcommand\bibitem{\@ifnextchar[{\@lbibitem}{\@lbibitem[]}}%
832\let\NAT@bibitem@first@sw\@secondoftwo
833\def\@lbibitem[#1]#2{%
834  \if\relax\@extra@b@citeb\relax\else
835    \@ifundefined{br@#2\@extra@b@citeb}{}{%
836     \@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}%
837    }%
838  \fi
839  \@ifundefined{b@#2\@extra@b@citeb}{%
840   \def\NAT@num{}%
841  }{%
842   \NAT@parse{#2}%
843  }%
844  \def\NAT@tmp{#1}%
845  \expandafter\let\expandafter\bibitemOpen\csname NAT@b@open@#2\endcsname
846  \expandafter\let\expandafter\bibitemShut\csname NAT@b@shut@#2\endcsname
847  \@ifnum{\NAT@merge>\@ne}{%
848   \NAT@bibitem@first@sw{%
849    \@firstoftwo
850   }{%
851    \@ifundefined{NAT@b*@#2}{%
852     \@firstoftwo
853    }{%
854     \expandafter\def\expandafter\NAT@num\expandafter{\the\c@NAT@ctr}%
855     \@secondoftwo
856    }%
857   }%
858  }{%
859   \@firstoftwo
860  }%
861  {%
862   \global\advance\c@NAT@ctr\@ne
863   \@ifx{\NAT@tmp\@empty}{\@firstoftwo}{%
864    \@secondoftwo
865   }%
866   {%
867    \expandafter\def\expandafter\NAT@num\expandafter{\the\c@NAT@ctr}%
868    \global\NAT@stdbsttrue
869   }{}%
870   \bibitem@fin
871   \item[\hfil\NAT@anchor{#2}{\NAT@num}]%
872   \global\let\NAT@bibitem@first@sw\@secondoftwo
873   \NAT@bibitem@init
874  }%
875  {%
876   \NAT@anchor{#2}{}%
877   \NAT@bibitem@cont
878   \bibitem@fin
879  }%
880  \@ifx{\NAT@tmp\@empty}{%
881    \NAT@wrout{\the\c@NAT@ctr}{}{}{}{#2}%
882  }{%
883    \expandafter\NAT@ifcmd\NAT@tmp(@)(@)\@nil{#2}%
884  }%
885}%
886\def\bibitem@fin{%
887 \@ifxundefined\@bibstop{}{\csname bibitem@\@bibstop\endcsname}%
888}%
889\def\NAT@bibitem@init{%
890 \let\@bibstop\@undefined
891}%
892\def\NAT@bibitem@cont{%
893 \let\bibitem@Stop\bibitemContinue
894 \let\bibitem@NoStop\bibitemContinue
895}%
896\def\BibitemOpen{%
897 \bibitemOpen
898}%
899\def\BibitemShut#1{%
900 \def\@bibstop{#1}%
901 \let\bibitem@Stop\bibitemStop
902 \let\bibitem@NoStop\bibitemNoStop
903 \@ifx{\bibitemShut\relax}{\let\@bibitemShut\@empty}{%
904  \expandafter\def\expandafter\@bibitemShut\expandafter{\bibitemShut}%
905 }%
906}%
907\def\@bibitemShut{}%
908\def\bibitemStop{\@bibitemShut}%
909\def\bibitemNoStop{%
910 \@ifx{\@empty\@bibitemShut}{.\spacefactor\@mmm\space}{\@bibitemShut}%
911}%
912\def\bibitemContinue{%
913 \@ifx{\@empty\@bibitemShut}{;\spacefactor\@mmm\space}{\@bibitemShut}%
914}%
915\mathchardef\@mmm=3000 %
916\let\bibitemOpen\relax
917\let\bibitemShut\relax
918\@ifnum{\NAT@merge>\@ne}{%
919\providecommand{\bibAnnote}[3]{%
920  \BibitemShut{#1}%
921  \def\@tempa{#3}\@ifx{\@tempa\@empty}{}{%
922   \begin{quotation}\noindent
923    \textsc{Key:}\ #2\\\textsc{Annotation:}\ \@tempa
924   \end{quotation}%
925  }%
926  \ignorespaces
927}%
928\providecommand{\bibAnnoteFile}[2]{%
929  \IfFileExists{#2}{%
930    \bibAnnote{#1}{#2}{\input{#2}}%
931  }{%
932    \bibAnnote{#1}{#2}{}%
933  }%
934}%
935}{}%
936\def\bibfield{\@ifnum{\NAT@merge>\tw@}{\@bibfield}{\@secondoftwo}}%
937\def\@bibfield#1#2{%
938 \begingroup
939  \let\Doi\@gobble
940  \let\bibinfo\relax
941  \let\restore@protect\@empty
942  \protected@edef\@tempa{#2}%
943  \aftergroup\def\aftergroup\@tempa
944 \expandafter\endgroup\expandafter{\@tempa}%
945 \expandafter\@ifx\expandafter{\csname @bib#1\endcsname\@tempa}{%
946  \expandafter\let\expandafter\@tempa\csname @bib@X#1\endcsname
947 }{%
948  \expandafter\let\csname @bib#1\endcsname\@tempa
949  \expandafter\let\expandafter\@tempa\csname @bib@Y#1\endcsname
950 }%
951 \@ifx{\@tempa\relax}{\let\@tempa\@firstofone}{}%
952 \@tempa{#2}%
953}%
954\def\bibinfo#1{%
955 \expandafter\let\expandafter\@tempa\csname bibinfo@X@#1\endcsname
956 \@ifx{\@tempa\relax}{\@firstofone}{\@tempa}%
957}%
958\def\@bib@Xauthor#1{\let\@bib@Xjournal\@gobble}%
959\def\@bib@Xjournal#1{\begingroup\let\bibinfo@X@journal\@bib@Z@journal#1\endgroup}%
960\def\@bibibid@#1{\textit{ibid}.}%
961\appdef\NAT@bibitem@init{%
962 \let\@bibauthor  \@empty
963 \let\@bibjournal \@empty
964 \let\@bib@Z@journal\@bibibid@
965}%
966\ifx\SK@lbibitem\@undefined\else
967   \let\SK@lbibitem\@lbibitem
968   \def\@lbibitem[#1]#2{%
969     \SK@lbibitem[#1]{#2}\SK@\SK@@label{#2}\ignorespaces}\fi
970\newif\ifNAT@stdbst \NAT@stdbstfalse
971
972\AtEndDocument{%
973  \ifNAT@stdbst\if@filesw
974   \immediate\write\@auxout{%
975    \string\providecommand\string\NAT@force@numbers{}%
976    \string\NAT@force@numbers
977   }%
978  \fi\fi
979 }
980\newcommand\NAT@force@numbers{%
981  \ifNAT@numbers\else
982  \PackageError{natbib}{Bibliography not compatible with author-year
983  citations.\MessageBreak
984  Press <return> to continue in numerical citation style}
985  {Check the bibliography entries for non-compliant syntax,\MessageBreak
986   or select author-year BibTeX style, e.g. plainnat}%
987  \global\NAT@numberstrue\fi}
988
989\providecommand\bibcite{}
990\renewcommand\bibcite[2]{%
991 \@ifundefined{b@#1\@extra@binfo}{\relax}{%
992   \NAT@citemultiple
993   \PackageWarningNoLine{natbib}{Citation `#1' multiply defined}%
994 }%
995 \global\@namedef{b@#1\@extra@binfo}{#2}%
996}%
997\AtEndDocument{\NAT@swatrue\let\bibcite\NAT@testdef}
998\newcommand\NAT@testdef[2]{%
999  \def\NAT@temp{#2}%
1000  \expandafter \ifx \csname b@#1\@extra@binfo\endcsname\NAT@temp
1001  \else
1002    \ifNAT@swa \NAT@swafalse
1003      \PackageWarningNoLine{natbib}{%
1004        Citation(s) may have changed.\MessageBreak
1005        Rerun to get citations correct%
1006      }%
1007    \fi
1008  \fi
1009}%
1010\newcommand\NAT@apalk{}
1011\def\NAT@apalk#1, #2, #3\@nil#4{%
1012  \if\relax#2\relax
1013    \global\NAT@stdbsttrue
1014    \NAT@wrout{#1}{}{}{}{#4}%
1015  \else
1016    \NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#4}%
1017  \fi
1018}%
1019\newcommand\citeauthoryear{}
1020\def\citeauthoryear#1#2#3(@)(@)\@nil#4{%
1021  \if\relax#3\relax
1022    \NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#4}%
1023  \else
1024    \NAT@wrout{\the\c@NAT@ctr}{#3}{#2}{#1}{#4}%
1025  \fi
1026}%
1027\newcommand\citestarts{\NAT@open}%
1028\newcommand\citeends{\NAT@close}%
1029\newcommand\betweenauthors{and}%
1030\newcommand\astroncite{}
1031\def\astroncite#1#2(@)(@)\@nil#3{%
1032 \NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#3}%
1033}%
1034\newcommand\citename{}
1035\def\citename#1#2(@)(@)\@nil#3{\expandafter\NAT@apalk#1#2, \@nil{#3}}
1036\newcommand\harvarditem[4][]{%
1037 \if\relax#1\relax
1038   \bibitem[#2(#3)]{#4}%
1039 \else
1040   \bibitem[#1(#3)#2]{#4}%
1041 \fi
1042}%
1043\newcommand\harvardleft{\NAT@open}
1044\newcommand\harvardright{\NAT@close}
1045\newcommand\harvardyearleft{\NAT@open}
1046\newcommand\harvardyearright{\NAT@close}
1047\AtBeginDocument{\providecommand{\harvardand}{and}}
1048\newcommand\harvardurl[1]{\textbf{URL:} \textit{#1}}
1049\providecommand\bibsection{}
1050\@ifundefined{chapter}{%
1051  \renewcommand\bibsection{%
1052   \section*{\refname\@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}%
1053  }%
1054}{%
1055  \@ifxundefined\NAT@sectionbib{%
1056    \renewcommand\bibsection{%
1057      \chapter*{\bibname\@mkboth{\MakeUppercase{\bibname}}{\MakeUppercase{\bibname}}}%
1058    }%
1059  }{%
1060    \renewcommand\bibsection{%
1061      \section*{\bibname\ifx\@mkboth\@gobbletwo\else\markright{\MakeUppercase{\bibname}}\fi}%
1062    }%
1063  }%
1064}%
1065\@ifclassloaded{amsart}{\renewcommand\bibsection{\section*{\refname}}}{}%
1066\@ifclassloaded{amsbook}{\renewcommand\bibsection{\chapter*{\bibname}}}{}%
1067\@ifxundefined\bib@heading{}{\let\bibsection\bib@heading}%
1068\newcounter{NAT@ctr}
1069\renewenvironment{thebibliography}[1]{%
1070 \bibsection
1071 \parindent\z@
1072 \bibpreamble
1073 \bibfont
1074 \list{\@biblabel{\the\c@NAT@ctr}}{\@bibsetup{#1}\global\c@NAT@ctr\z@}%
1075 \ifNAT@openbib
1076   \renewcommand\newblock{\par}%
1077 \else
1078   \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%
1079 \fi
1080 \sloppy\clubpenalty4000\widowpenalty4000
1081 \sfcode`\.\@m
1082 \let\NAT@bibitem@first@sw\@firstoftwo
1083    \let\citeN\cite \let\shortcite\cite
1084    \let\citeasnoun\cite
1085}{%
1086 \bibitem@fin
1087 \bibpostamble
1088 \def\@noitemerr{%
1089  \PackageWarning{natbib}{Empty `thebibliography' environment}%
1090 }%
1091 \endlist
1092 \bibcleanup
1093}%
1094\let\bibfont\@empty
1095\let\bibpreamble\@empty
1096\let\bibpostamble\@empty
1097\def\bibcleanup{\vskip-\lastskip}%
1098\providecommand\reset@font{\relax}
1099\providecommand\bibname{Bibliography}
1100\providecommand\refname{References}
1101\newcommand\NAT@citeundefined{\gdef \NAT@undefined {%
1102    \PackageWarningNoLine{natbib}{There were undefined citations}}}
1103\let \NAT@undefined \relax
1104\newcommand\NAT@citemultiple{\gdef \NAT@multiple {%
1105    \PackageWarningNoLine{natbib}{There were multiply defined citations}}}
1106\let \NAT@multiple \relax
1107\AtEndDocument{\NAT@undefined\NAT@multiple}
1108\providecommand\@mkboth[2]{}
1109\providecommand\MakeUppercase{\uppercase}
1110\providecommand{\@extra@b@citeb}{}
1111\gdef\@extra@binfo{}
1112\def\NAT@anchor#1#2{%
1113 \hyper@natanchorstart{#1\@extra@b@citeb}%
1114  \def\@tempa{#2}\@ifx{\@tempa\@empty}{}{\@biblabel{#2}}%
1115 \hyper@natanchorend
1116}%
1117\providecommand\hyper@natanchorstart[1]{}%
1118\providecommand\hyper@natanchorend{}%
1119\providecommand\hyper@natlinkstart[1]{}%
1120\providecommand\hyper@natlinkend{}%
1121\providecommand\hyper@natlinkbreak[2]{#1}%
1122\AtBeginDocument{%
1123  \@ifpackageloaded{babel}{%
1124     \let\org@@citex\@citex}{}}
1125\providecommand\@safe@activestrue{}%
1126\providecommand\@safe@activesfalse{}%
1127
1128\newcommand\NAT@sort@cites[1]{%
1129  \let\NAT@cite@list\@empty
1130  \@for\@citeb:=#1\do{\expandafter\NAT@star@cite\@citeb\@@}%
1131  \if@filesw
1132    \expandafter\immediate\expandafter\write\expandafter\@auxout
1133      \expandafter{\expandafter\string\expandafter\citation\expandafter{\NAT@cite@list}}%
1134  \fi
1135  \@ifnum{\NAT@sort>\z@}{%
1136    \expandafter\NAT@sort@cites@\expandafter{\NAT@cite@list}%
1137  }{}%
1138}%
1139\def\NAT@star@cite{%
1140  \let\NAT@star@sw\@secondoftwo
1141  \@ifnum{\NAT@merge>\z@}{%
1142   \@ifnextchar*{%
1143    \let\NAT@star@sw\@firstoftwo
1144    \NAT@star@cite@star
1145   }{%
1146    \NAT@star@cite@nostar
1147   }%
1148  }{%
1149   \NAT@star@cite@noextension
1150  }%
1151}%
1152\def\NAT@star@cite@star*{%
1153 \NAT@star@cite@nostar
1154}%
1155\def\NAT@star@cite@nostar{%
1156 \let\nat@keyopt@open\@empty
1157 \let\nat@keyopt@shut\@empty
1158 \@ifnextchar[{\NAT@star@cite@pre}{\NAT@star@cite@pre[]}%
1159}%
1160\def\NAT@star@cite@pre[#1]{%
1161 \def\nat@keyopt@open{#1}%
1162 \@ifnextchar[{\NAT@star@cite@post}{\NAT@star@cite@post[]}%
1163}%
1164\def\NAT@star@cite@post[#1]#2\@@{%
1165 \def\nat@keyopt@shut{#1}%
1166 \NAT@star@sw{\expandafter\global\expandafter\let\csname NAT@b*@#2\endcsname\@empty}{}%
1167 \NAT@cite@list@append{#2}%
1168}%
1169\def\NAT@star@cite@noextension#1\@@{%
1170  \let\nat@keyopt@open\@empty
1171  \let\nat@keyopt@shut\@empty
1172  \NAT@cite@list@append{#1}%
1173}%
1174\def\NAT@cite@list@append#1{%
1175  \edef\@citeb{\@firstofone#1\@empty}%
1176  \if@filesw\@ifxundefined\@cprwrite{}{\expandafter\@cprwrite\@citeb=}\fi
1177  \if\relax\nat@keyopt@open\relax\else
1178   \global\expandafter\let\csname NAT@b@open@\@citeb\endcsname\nat@keyopt@open
1179  \fi
1180  \if\relax\nat@keyopt@shut\relax\else
1181   \global\expandafter\let\csname NAT@b@shut@\@citeb\endcsname\nat@keyopt@shut
1182  \fi
1183  \toks@\expandafter{\NAT@cite@list}%
1184  \ifx\NAT@cite@list\@empty
1185    \@temptokena\expandafter{\@citeb}%
1186  \else
1187    \@temptokena\expandafter{\expandafter,\@citeb}%
1188  \fi
1189  \edef\NAT@cite@list{\the\toks@\the\@temptokena}%
1190}%
1191\newcommand\NAT@sort@cites@[1]{%
1192  \count@\z@
1193  \@tempcntb\m@ne
1194  \let\@celt\delimiter
1195  \def\NAT@num@list{}%
1196  \let\NAT@cite@list\@empty
1197  \let\NAT@nonsort@list\@empty
1198  \@for \@citeb:=#1\do{\NAT@make@cite@list}%
1199  \ifx\NAT@nonsort@list\@empty\else
1200   \protected@edef\NAT@cite@list{\NAT@cite@list\NAT@nonsort@list}%
1201  \fi
1202  \ifx\NAT@cite@list\@empty\else
1203   \protected@edef\NAT@cite@list{\expandafter\NAT@xcom\NAT@cite@list @@}%
1204  \fi
1205}%
1206\def\NAT@make@cite@list{%
1207  \advance\count@\@ne
1208  \@safe@activestrue
1209  \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
1210  \@safe@activesfalse
1211  \@ifundefined{b@\@citeb\@extra@b@citeb}%
1212   {\def\NAT@num{A}}%
1213   {\NAT@parse{\@citeb}}%
1214  \NAT@ifcat@num\NAT@num
1215   {\@tempcnta\NAT@num \relax
1216    \@ifnum{\@tempcnta<\@tempcntb}{%
1217      \let\NAT@@cite@list=\NAT@cite@list
1218      \let\NAT@cite@list\@empty
1219      \begingroup\let\@celt=\NAT@celt\NAT@num@list\endgroup
1220      \protected@edef\NAT@num@list{%
1221       \expandafter\NAT@num@celt \NAT@num@list \@gobble @%
1222      }%
1223    }{%
1224      \protected@edef\NAT@num@list{\NAT@num@list \@celt{\NAT@num}}%
1225      \protected@edef\NAT@cite@list{\NAT@cite@list\@citeb,}%
1226      \@tempcntb\@tempcnta
1227    }%
1228   }%
1229   {\protected@edef\NAT@nonsort@list{\NAT@nonsort@list\@citeb,}}%
1230}%
1231\def\NAT@celt#1{%
1232  \@ifnum{#1>\@tempcnta}{%
1233    \xdef\NAT@cite@list{\NAT@cite@list\@citeb,\NAT@@cite@list}%
1234    \let\@celt\@gobble
1235  }{%
1236    \expandafter\def@NAT@cite@lists\NAT@@cite@list\@@
1237  }%
1238}%
1239\def\NAT@num@celt#1#2{%
1240 \ifx#1\@celt
1241  \@ifnum{#2>\@tempcnta}{%
1242    \@celt{\number\@tempcnta}%
1243    \@celt{#2}%
1244  }{%
1245    \@celt{#2}%
1246    \expandafter\NAT@num@celt
1247  }%
1248 \fi
1249}%
1250\def\def@NAT@cite@lists#1,#2\@@{%
1251  \xdef\NAT@cite@list{\NAT@cite@list#1,}%
1252  \xdef\NAT@@cite@list{#2}%
1253}%
1254\def\NAT@nextc#1,#2@@{#1,}
1255\def\NAT@restc#1,#2{#2}
1256\def\NAT@xcom#1,@@{#1}
1257\InputIfFileExists{natbib.cfg}
1258       {\typeout{Local config file natbib.cfg used}}{}
1259%%
1260%% <<<<< End of generated file <<<<<<
1261%%
1262%% End of file `natbib.sty'.
Note: See TracBrowser for help on using the repository browser.