]> AND Private Git Repository - LiCO.git/blob - PeCO-EO/natbib.sty
Logo AND Algorithmique Numérique Distribuée

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