natbib.sty 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  1. %%
  2. %% This is file `natbib.sty',
  3. %% generated with the docstrip utility.
  4. %%
  5. %% The original source files were:
  6. %%
  7. %% natbib.dtx (with options: `package,all')
  8. %%
  9. %% Full documentation can be obtained by LaTeXing the source file:
  10. %% natbib.dtx.
  11. %%
  12. %% Only a few abbreviated comments remain here to describe the usage.
  13. %%
  14. \NeedsTeXFormat{LaTeX2e}[1994/06/01]
  15. \ProvidesPackage{natbib}
  16. [1998/02/19 6.8 (PWD)]
  17. %%-------------------------------------------------------------------
  18. %% NOTICE:
  19. %% This file may be used for non-profit purposes.
  20. %% It may not be distributed in exchange for money,
  21. %% other than distribution costs.
  22. %%
  23. %% The author provides it `as is' and does not guarantee it in any way.
  24. %%
  25. %% Natbib coding copyright (C) 1994--1998 Patrick W. Daly
  26. %% Max-Planck-Institut f\"ur Aeronomie
  27. %% Max-Planck-Str. 2
  28. %% D-37191 Katlenburg-Lindau
  29. %% Germany
  30. %%
  31. %% E-mail: [email protected]
  32. %%-----------------------------------------------------------
  33. % This package reimplements the LaTeX \cite command to be used for various
  34. % citation styles, both author-year and numerical. It accepts BibTeX
  35. % output intended for many other packages, and therefore acts as a
  36. % general, all-purpose citation-style interface.
  37. %
  38. % With standard numerical .bst files, only numerical citations are
  39. % possible. With an author-year .bst file, both numerical and
  40. % author-year citations are possible.
  41. %
  42. % If author-year citations are selected, \bibitem must have one of the
  43. % following forms:
  44. % \bibitem[Jones et al.(1990)]{key}...
  45. % \bibitem[Jones et al.(1990)Jones, Baker, and Williams]{key}...
  46. % \bibitem[Jones et al., 1990]{key}...
  47. % \bibitem[\protect\citeauthoryear{Jones, Baker, and Williams}{Jones
  48. % et al.}{1990}]{key}...
  49. % \bibitem[\protect\citeauthoryear{Jones et al.}{1990}]{key}...
  50. % \bibitem[\protect\astroncite{Jones et al.}{1990}]{key}...
  51. % \bibitem[\protect\citename{Jones et al., }1990]{key}...
  52. % \harvarditem[Jones et al.]{Jones, Baker, and Williams}{1990}{key}...
  53. %
  54. % This is either to be made up manually, or to be generated by an
  55. % appropriate .bst file with BibTeX.
  56. % Author-year mode || Numerical mode
  57. % Then, \citet{key} ==>> Jones et al. (1990) || Jones et al. [21]
  58. % \citep{key} ==>> (Jones et al., 1990) || [21]
  59. % Multiple citations as normal:
  60. % \citep{key1,key2} ==>> (Jones et al., 1990; Smith, 1989) || [21,24]
  61. % or (Jones et al., 1990, 1991) || [21,24]
  62. % or (Jones et al., 1990a,b) || [21,24]
  63. % \cite{key} is the equivalent of \citet{key} in author-year mode
  64. % and of \citep{key} in numerical mode
  65. % Full author lists may be forced with \citet* or \citep*, e.g.
  66. % \citep*{key} ==>> (Jones, Baker, and Williams, 1990)
  67. % Optional notes as:
  68. % \citep[chap. 2]{key} ==>> (Jones et al., 1990, chap. 2)
  69. % \citep[e.g.,][]{key} ==>> (e.g., Jones et al., 1990)
  70. % \citep[see][pg. 34]{key}==>> (see Jones et al., 1990, pg. 34)
  71. % (Note: in standard LaTeX, only one note is allowed, after the ref.
  72. % Here, one note is like the standard, two make pre- and post-notes.)
  73. % \citealt{key} ==>> Jones et al. 1990
  74. % \citealt*{key} ==>> Jones, Baker, and Williams 1990
  75. % \citealp{key} ==>> Jones et al., 1990
  76. % \citealp*{key} ==>> Jones, Baker, and Williams, 1990
  77. % Additional citation possibilities (both author-year and numerical modes)
  78. % \citeauthor{key} ==>> Jones et al.
  79. % \citeauthor*{key} ==>> Jones, Baker, and Williams
  80. % \citeyear{key} ==>> 1990
  81. % \citeyearpar{key} ==>> (1990)
  82. % \citetext{priv. comm.} ==>> (priv. comm.)
  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. % Defining the citation style of a given bib style:
  87. % Use \bibpunct (in the preamble only) with 6 mandatory arguments:
  88. % 1. opening bracket for citation
  89. % 2. closing bracket
  90. % 3. citation separator (for multiple citations in one \cite)
  91. % 4. the letter n for numerical styles, s for superscripts
  92. % else anything for author-year
  93. % 5. punctuation between authors and date
  94. % 6. punctuation between years (or numbers) when common authors missing
  95. % One optional argument is the character coming before post-notes. It
  96. % appears in square braces before all other arguments. May be left off.
  97. % Example (and default) \bibpunct[,]{(}{)}{;}{a}{,}{,}
  98. %
  99. % To make this automatic for a given bib style, named newbib, say, make
  100. % a local configuration file, natbib.cfg, with the definition
  101. % \newcommand{\bibstyle@newbib}{\bibpunct...}
  102. % Then the \bibliographystyle{newbib} will cause \bibstyle@newbib to
  103. % be called on THE NEXT LATEX RUN (via the aux file).
  104. %
  105. % Such preprogrammed definitions may be invoked in the text (preamble only)
  106. % by calling \citestyle{newbib}. This is only useful if the style specified
  107. % differs from that in \bibliographystyle.
  108. %
  109. % With \citeindextrue and \citeindexfalse, one can control whether the
  110. % \cite commands make an automatic entry of the citation in the .idx
  111. % indexing file. For this, \makeindex must also be given in the preamble.
  112. %
  113. % LaTeX2e Options: (for selecting punctuation)
  114. % round - round parentheses are used (default)
  115. % square - square brackets are used [option]
  116. % curly - curly braces are used {option}
  117. % angle - angle brackets are used <option>
  118. % colon - multiple citations separated by colon (default)
  119. % comma - separated by comma
  120. % authoryear - selects author-year citations (default)
  121. % numbers- selects numerical citations
  122. % super - numerical citations as superscripts
  123. % sort - sorts multiple citations according to order in ref. list
  124. % sort&compress - like sort, but also compresses numerical citations
  125. % longnamesfirst - makes first citation full author list
  126. % sectionbib - puts bibliography in a \section* instead of \chapter*
  127. % Punctuation so selected dominates over any predefined ones.
  128. % LaTeX2e options are called as, e.g.
  129. % \usepackage[square,comma]{natbib}
  130. % LaTeX the source file natbib.dtx to obtain more details
  131. % or the file natnotes.tex for a brief reference sheet.
  132. %-----------------------------------------------------------
  133. \@ifclassloaded{aguplus}{\PackageError{natbib}
  134. {The aguplus class already includes natbib coding,\MessageBreak
  135. so you should not add it explicitly}
  136. {Type <Return> for now, but then later remove\MessageBreak
  137. the command \protect\usepackage{natbib} from the document}
  138. \endinput}{}
  139. \@ifclassloaded{nlinproc}{\PackageError{natbib}
  140. {The nlinproc class already includes natbib coding,\MessageBreak
  141. so you should not add it explicitly}
  142. {Type <Return> for now, but then later remove\MessageBreak
  143. the command \protect\usepackage{natbib} from the document}
  144. \endinput}{}
  145. \@ifclassloaded{egs}{\PackageError{natbib}
  146. {The egs class already includes natbib coding,\MessageBreak
  147. so you should not add it explicitly}
  148. {Type <Return> for now, but then later remove\MessageBreak
  149. the command \protect\usepackage{natbib} from the document}
  150. \endinput}{}
  151. % Define citation punctuation for some author-year styles
  152. % One may add and delete at this point
  153. % Or put additions into local configuration file natbib.cfg
  154. \newcommand\bibstyle@chicago{\bibpunct{(}{)}{;}{a}{,}{,}}
  155. \newcommand\bibstyle@named{\bibpunct{[}{]}{;}{a}{,}{,}}
  156. \newcommand\bibstyle@agu{\bibpunct{[}{]}{;}{a}{,}{,~}}%Amer. Geophys. Union
  157. \newcommand\bibstyle@egs{\bibpunct{(}{)}{;}{a}{,}{,}}%Eur. Geophys. Soc.
  158. \newcommand\bibstyle@agsm{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
  159. \newcommand\bibstyle@kluwer{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
  160. \newcommand\bibstyle@dcu{\bibpunct{(}{)}{;}{a}{;}{,}\gdef\harvardand{and}}
  161. \newcommand\bibstyle@aa{\bibpunct{(}{)}{;}{a}{}{,}} %Astronomy & Astrophysics
  162. \newcommand\bibstyle@pass{\bibpunct{(}{)}{;}{a}{,}{,}}%Planet. & Space Sci
  163. \newcommand\bibstyle@anngeo{\bibpunct{(}{)}{;}{a}{,}{,}}%Annales Geophysicae
  164. \newcommand\bibstyle@nlinproc{\bibpunct{(}{)}{;}{a}{,}{,}}%Nonlin.Proc.Geophys.
  165. % Define citation punctuation for some numerical styles
  166. \newcommand\bibstyle@cospar{\bibpunct{/}{/}{,}{n}{}{}%
  167. \gdef\NAT@biblabelnum##1{##1.}}
  168. \newcommand\bibstyle@esa{\bibpunct{(}{)}{,}{n}{}{}%
  169. \gdef\NAT@biblabelnum##1{##1.\hspace{1em}}%
  170. \gdef\NAT@citenum##1##2##3{\NAT@@open \if\relax##2\relax\else
  171. ##2\ \fi Ref.~##1\if\relax##3\relax\else\NAT@cmt\
  172. ##3\fi\NAT@@close\endgroup}}
  173. \newcommand\bibstyle@nature{\bibpunct{}{}{,}{s}{}{\textsuperscript{,}}%
  174. \gdef\NAT@biblabelnum##1{##1.}}
  175. % The standard LaTeX styles
  176. \newcommand\bibstyle@plain{\bibpunct{[}{]}{,}{n}{}{,}}
  177. \let\bibstyle@alpha=\bibstyle@plain
  178. \let\bibstyle@abbrv=\bibstyle@plain
  179. \let\bibstyle@unsrt=\bibstyle@plain
  180. % The author-year modifications of the standard styles
  181. \newcommand\bibstyle@plainnat{\bibpunct{[}{]}{,}{a}{,}{,}}
  182. \let\bibstyle@abbrvnat=\bibstyle@plainnat
  183. \let\bibstyle@unsrtnat=\bibstyle@plainnat
  184. \newif\ifNAT@numbers \NAT@numbersfalse
  185. \newif\ifNAT@super \NAT@superfalse
  186. \DeclareOption{numbers}{\NAT@numberstrue
  187. \ExecuteOptions{square,comma,nobibstyle}}
  188. \DeclareOption{super}{\NAT@supertrue\NAT@numberstrue
  189. \ExecuteOptions{nobibstyle}}
  190. \DeclareOption{authoryear}{\NAT@numbersfalse
  191. \ExecuteOptions{round,colon,bibstyle}}
  192. \DeclareOption{round}{%
  193. \renewcommand\NAT@open{(} \renewcommand\NAT@close{)}
  194. \ExecuteOptions{nobibstyle}}
  195. \DeclareOption{square}{%
  196. \renewcommand\NAT@open{[} \renewcommand\NAT@close{]}
  197. \ExecuteOptions{nobibstyle}}
  198. \DeclareOption{angle}{%
  199. \renewcommand\NAT@open{$<$} \renewcommand\NAT@close{$>$}
  200. \ExecuteOptions{nobibstyle}}
  201. \DeclareOption{curly}{%
  202. \renewcommand\NAT@open{\{} \renewcommand\NAT@close{\}}
  203. \ExecuteOptions{nobibstyle}}
  204. \DeclareOption{comma}{\renewcommand\NAT@sep{,}
  205. \ExecuteOptions{nobibstyle}}
  206. \DeclareOption{colon}{\renewcommand\NAT@sep{;}
  207. \ExecuteOptions{nobibstyle}}
  208. \DeclareOption{nobibstyle}{\let\bibstyle=\@gobble}
  209. \DeclareOption{bibstyle}{\let\bibstyle=\@citestyle}
  210. \newif\ifNAT@openbib \NAT@openbibfalse
  211. \DeclareOption{openbib}{\NAT@openbibtrue}
  212. \DeclareOption{sectionbib}{\def\NAT@sectionbib{on}}
  213. \def\NAT@sort{0}
  214. \DeclareOption{sort}{\def\NAT@sort{1}}
  215. \DeclareOption{sort&compress}{\def\NAT@sort{2}}
  216. \@ifpackageloaded{cite}{\PackageWarningNoLine{natbib}
  217. {The `cite' package should not be used\MessageBreak
  218. with natbib. Use option `sort' instead}\ExecuteOptions{sort}}{}
  219. \newif\ifNAT@longnames\NAT@longnamesfalse
  220. \DeclareOption{longnamesfirst}{\NAT@longnamestrue}
  221. \renewcommand\bibstyle[1]{\@ifundefined{bibstyle@#1}{\relax}
  222. {\csname bibstyle@#1\endcsname}}
  223. \AtBeginDocument{\global\let\bibstyle=\@gobble}
  224. \let\@citestyle\bibstyle
  225. \newcommand\citestyle[1]{\@citestyle{#1}\let\bibstyle\@gobble}
  226. \@onlypreamble{\citestyle}\@onlypreamble{\@citestyle}
  227. \newcommand\bibpunct[7][,]%
  228. {\gdef\NAT@open{#2}\gdef\NAT@close{#3}\gdef
  229. \NAT@sep{#4}\global\NAT@numbersfalse\ifx #5n\global\NAT@numberstrue
  230. \else
  231. \ifx #5s\global\NAT@numberstrue\global\NAT@supertrue
  232. \fi\fi
  233. \gdef\NAT@aysep{#6}\gdef\NAT@yrsep{#7}%
  234. \gdef\NAT@cmt{#1}%
  235. \global\let\bibstyle\@gobble
  236. }
  237. \@onlypreamble{\bibpunct}
  238. \newcommand\NAT@open{(} \newcommand\NAT@close{)}
  239. \newcommand\NAT@sep{;}
  240. \ProcessOptions
  241. \newcommand\NAT@aysep{,} \newcommand\NAT@yrsep{,}
  242. \newcommand\NAT@cmt{,}
  243. \newcommand\NAT@cite%
  244. [3]{\ifNAT@swa\NAT@@open\if\relax#2\relax\else#2\ \fi
  245. #1\if\relax#3\relax\else\NAT@cmt\ #3\fi\NAT@@close\else#1\fi\endgroup}
  246. \newcommand\NAT@citenum%
  247. [3]{\ifNAT@swa\NAT@@open\if\relax#2\relax\else#2\ \fi
  248. #1\if\relax#3\relax\else\NAT@cmt\ #3\fi\NAT@@close\else#1\fi\endgroup}
  249. \newcommand\NAT@citesuper[3]{\ifNAT@swa
  250. \unskip\hspace{1\p@}\textsuperscript{#1}%
  251. \if\relax#3\relax\else\ (#3)\fi\else #1\fi\endgroup}
  252. \providecommand
  253. \textsuperscript[1]{\mbox{$^{\mbox{\scriptsize#1}}$}}
  254. \providecommand\@firstofone[1]{#1}
  255. \newcommand\NAT@citexnum{}
  256. \def\NAT@citexnum[#1][#2]#3{%
  257. \NAT@sort@cites{#3}%
  258. \let\@citea\@empty
  259. \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
  260. \@for\@citeb:=\NAT@cite@list\do
  261. {\edef\@citeb{\expandafter\@firstofone\@citeb}%
  262. \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
  263. \@ifundefined{b@\@citeb\@extra@b@citeb}{%
  264. {\reset@font\bfseries?}
  265. \NAT@citeundefined\PackageWarning{natbib}%
  266. {Citation `\@citeb' on page \thepage \space undefined}}%
  267. {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
  268. \NAT@parse{\@citeb}%
  269. \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
  270. \let\NAT@name=\NAT@all@names
  271. \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
  272. \fi
  273. \ifNAT@full\let\NAT@nm\NAT@all@names\else
  274. \let\NAT@nm\NAT@name\fi
  275. \ifNAT@swa
  276. \ifnum\NAT@ctype=2\relax\@citea
  277. \hyper@natlinkstart{\@citeb}\NAT@test{2}\hyper@natlinkend\else
  278. \ifnum\NAT@sort>1
  279. \begingroup\catcode`\_=8
  280. \ifcat _\ifnum\z@<0\NAT@num _\else A\fi
  281. \global\let\NAT@nm=\NAT@num \else \gdef\NAT@nm{-2}\fi
  282. \ifcat _\ifnum\z@<0\NAT@last@num _\else A\fi
  283. \global\@tempcnta=\NAT@last@num \global\advance\@tempcnta by\@ne
  284. \else \global\@tempcnta\m@ne\fi
  285. \endgroup
  286. \ifnum\NAT@nm=\@tempcnta
  287. \ifx\NAT@last@yr\relax
  288. \edef\NAT@last@yr{\@citea \mbox{\NAT@num}}%
  289. \else
  290. \edef\NAT@last@yr{--\penalty\@m\mbox{\NAT@num}}%
  291. \fi
  292. \else
  293. \NAT@last@yr \@citea \mbox{\NAT@num}%
  294. \let\NAT@last@yr\relax
  295. \fi
  296. \else
  297. \@citea \mbox{\hyper@natlinkstart{\@citeb}\NAT@num
  298. \hyper@natlinkend}%
  299. \fi
  300. \fi
  301. \def\@citea{\NAT@sep\penalty\@m\NAT@space}%
  302. \else
  303. \ifcase\NAT@ctype\relax
  304. \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\penalty\@m\NAT@space\else
  305. \@citea \NAT@test{1}\ \NAT@@open
  306. \if\relax#1\relax\else#1\ \fi\fi \NAT@mbox{%
  307. \hyper@natlinkstart{\@citeb}\NAT@num\hyper@natlinkend}%
  308. \def\@citea{\NAT@@close\NAT@sep\penalty\@m\ }%
  309. \or\@citea
  310. \hyper@natlinkstart{\@citeb}\NAT@test{1}\hyper@natlinkend
  311. \def\@citea{\NAT@sep\penalty\@m\ }%
  312. \or\@citea
  313. \hyper@natlinkstart{\@citeb}\NAT@test{2}\hyper@natlinkend
  314. \def\@citea{\NAT@sep\penalty\@m\ }%
  315. \fi
  316. \fi
  317. }}%
  318. \ifnum\NAT@sort>1\NAT@last@yr\fi
  319. \ifNAT@swa\else\ifnum\NAT@ctype=0\if\relax#2\relax\else
  320. \NAT@cmt\ #2\fi \NAT@@close\fi\fi}{#1}{#2}}
  321. \newcommand\NAT@test[1]{\ifnum#1=1 \ifx\NAT@nm\NAT@noname
  322. {\reset@font\bfseries(author?)}\PackageWarning{natbib}
  323. {Author undefined for citation`\@citeb'
  324. \MessageBreak
  325. on page \thepage}\else \NAT@nm \fi
  326. \else \if\relax\NAT@date\relax
  327. {\reset@font\bfseries(year?)}\PackageWarning{natbib}
  328. {Year undefined for citation`\@citeb'
  329. \MessageBreak
  330. on page \thepage}\else \NAT@date \fi \fi}
  331. \newcommand\NAT@citex{}
  332. \def\NAT@citex%
  333. [#1][#2]#3{%
  334. \NAT@sort@cites{#3}%
  335. \let\@citea\@empty
  336. \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
  337. \@for\@citeb:=\NAT@cite@list\do
  338. {\edef\@citeb{\expandafter\@firstofone\@citeb}%
  339. \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
  340. \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
  341. {\reset@font\bfseries ?}\NAT@citeundefined
  342. \PackageWarning{natbib}%
  343. {Citation `\@citeb' on page \thepage \space undefined}}%
  344. {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
  345. \NAT@parse{\@citeb}%
  346. \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
  347. \let\NAT@name=\NAT@all@names
  348. \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
  349. \fi
  350. \ifNAT@full\let\NAT@nm\NAT@all@names\else
  351. \let\NAT@nm\NAT@name\fi
  352. \ifNAT@swa\ifcase\NAT@ctype
  353. \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
  354. \ifx\NAT@last@yr\NAT@year
  355. \hyper@natlinkstart{\@citeb}\NAT@exlab\hyper@natlinkend
  356. \else\unskip\
  357. \hyper@natlinkstart{\@citeb}\NAT@date\hyper@natlinkend
  358. \fi
  359. \else\@citea\hyper@natlinkstart{\@citeb}{\NAT@nm}\NAT@aysep
  360. \ \NAT@date\hyper@natlinkend \fi
  361. \or\@citea\hyper@natlinkstart{\@citeb}%
  362. {\NAT@nm}\hyper@natlinkend
  363. \or\@citea\hyper@natlinkstart{\@citeb}%
  364. \NAT@date\hyper@natlinkend\fi \def\@citea{\NAT@sep\ }%
  365. \else\ifcase\NAT@ctype
  366. \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
  367. \ifx\NAT@last@yr\NAT@year
  368. \hyper@natlinkstart{\@citeb}\NAT@exlab\hyper@natlinkend
  369. \else\unskip\
  370. \hyper@natlinkstart{\@citeb}\NAT@date\hyper@natlinkend
  371. \fi
  372. \else\@citea\hyper@natlinkstart{\@citeb}%
  373. {\NAT@nm}\ \NAT@@open\if\relax#1\relax\else#1\ \fi
  374. \NAT@date\hyper@natlinkend\fi
  375. \or\@citea\hyper@natlinkstart{\@citeb}%
  376. {\NAT@nm}\hyper@natlinkend
  377. \or\@citea\hyper@natlinkstart{\@citeb}%
  378. \NAT@date\hyper@natlinkend\fi \def\@citea{\NAT@@close\NAT@sep\ }%
  379. \fi
  380. }}\ifNAT@swa\else\if\relax#2\relax\else\NAT@cmt\ #2\fi
  381. \NAT@@close\fi}{#1}{#2}}
  382. \newif\ifNAT@par \NAT@partrue
  383. \newcommand\NAT@@open{\ifNAT@par\NAT@open\fi}
  384. \newcommand\NAT@@close{\ifNAT@par\NAT@close\fi}
  385. \newcommand\shortcites[1]{%
  386. \@bsphack\@for\@citeb:=#1\do
  387. {\edef\@citeb{\expandafter\@firstofone\@citeb}%
  388. \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}\@esphack}
  389. \newcommand\NAT@biblabel[1]{\hfill}
  390. \newcommand\NAT@biblabelnum[1]{[#1]}
  391. \def\@tempa#1{[#1]}
  392. \ifx\@tempa\@biblabel\let\@biblabel\@empty\fi
  393. \newcommand\NAT@bibsetnum[1]{\settowidth\labelwidth{\@biblabel{#1}}%
  394. \setlength{\leftmargin}{\labelwidth}\addtolength{\leftmargin}{\labelsep}%
  395. \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}%
  396. \ifNAT@openbib
  397. \addtolength{\leftmargin}{\bibindent}%
  398. \setlength{\itemindent}{-\bibindent}%
  399. \setlength{\listparindent}{\itemindent}%
  400. \setlength{\parsep}{0pt}%
  401. \fi
  402. }
  403. \newlength{\bibhang}
  404. \setlength{\bibhang}{1em}
  405. \newlength{\bibsep}
  406. {\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}
  407. \newcommand\NAT@bibsetup%
  408. [1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\leftmargin}%
  409. \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}}
  410. \newcommand\NAT@set@cites{\ifNAT@numbers
  411. \ifNAT@super \let\@cite\NAT@citesuper
  412. \def\NAT@mbox##1{\unskip\nobreak\hspace{1\p@}\textsuperscript{##1}}%
  413. \let\citeyearpar=\citeyear
  414. \let\NAT@space\relax\else
  415. \let\NAT@mbox=\mbox
  416. \let\@cite\NAT@citenum \def\NAT@space{ }\fi
  417. \let\@citex\NAT@citexnum
  418. \ifx\@biblabel\@empty\let\@biblabel\NAT@biblabelnum\fi
  419. \let\@bibsetup\NAT@bibsetnum
  420. \def\natexlab##1{}%
  421. \else
  422. \let\@cite\NAT@cite
  423. \let\@citex\NAT@citex
  424. \ifx\@biblabel\@empty\let\@biblabel\NAT@biblabel\fi
  425. \let\@bibsetup\NAT@bibsetup
  426. \def\natexlab##1{##1}%
  427. \fi}
  428. \AtBeginDocument{\NAT@set@cites}
  429. \AtBeginDocument{\ifx\SK@def\@undefined\else
  430. \ifx\SK@cite\@empty\else
  431. \SK@def\@citex[#1][#2]#3{\SK@\SK@@ref{#3}\SK@@citex[#1][#2]{#3}}\fi
  432. \ifx\SK@citeauthor\@undefined\def\HAR@checkdef{}\else
  433. \let\citeauthor\SK@citeauthor
  434. \let\citefullauthor\SK@citefullauthor
  435. \let\citeyear\SK@citeyear\fi
  436. \fi}
  437. \AtBeginDocument{\@ifpackageloaded{hyperref}{%
  438. \ifnum\NAT@sort=2\def\NAT@sort{1}\fi}{}}
  439. \newif\ifNAT@full\NAT@fullfalse
  440. \newif\ifNAT@swa
  441. \DeclareRobustCommand\citet
  442. {\begingroup\NAT@swafalse\def\NAT@ctype{0}\NAT@partrue
  443. \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
  444. \newcommand\NAT@citetp{\@ifnextchar[{\NAT@@citetp}{\NAT@@citetp[]}}
  445. \newcommand\NAT@@citetp{}
  446. \def\NAT@@citetp[#1]{\@ifnextchar[{\@citex[#1]}{\@citex[][#1]}}
  447. \DeclareRobustCommand\citep
  448. {\begingroup\NAT@swatrue\def\NAT@ctype{0}\NAT@partrue
  449. \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
  450. \DeclareRobustCommand\cite
  451. {\begingroup\def\NAT@ctype{0}\NAT@partrue\NAT@swatrue
  452. \@ifstar{\NAT@fulltrue\NAT@cites}{\NAT@fullfalse\NAT@cites}}
  453. \newcommand\NAT@cites{\@ifnextchar [{\NAT@@citetp}{%
  454. \ifNAT@numbers\else
  455. \NAT@swafalse
  456. \fi
  457. \NAT@@citetp[]}}
  458. \DeclareRobustCommand\citealt
  459. {\begingroup\NAT@swafalse\def\NAT@ctype{0}\NAT@parfalse
  460. \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
  461. \DeclareRobustCommand\citealp
  462. {\begingroup\NAT@swatrue\def\NAT@ctype{0}\NAT@parfalse
  463. \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
  464. \DeclareRobustCommand\citeauthor
  465. {\begingroup\NAT@swafalse\def\NAT@ctype{1}\NAT@parfalse
  466. \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}
  467. \DeclareRobustCommand\citeyear
  468. {\begingroup\NAT@swafalse\def\NAT@ctype{2}\NAT@parfalse\NAT@citetp}
  469. \DeclareRobustCommand\citeyearpar
  470. {\begingroup\NAT@swatrue\def\NAT@ctype{2}\NAT@partrue\NAT@citetp}
  471. \newcommand\citetext[1]{\NAT@open#1\NAT@close}
  472. \DeclareRobustCommand\citefullauthor
  473. {\citeauthor*}
  474. \renewcommand\nocite[1]{\@bsphack
  475. \@for\@citeb:=#1\do{%
  476. \edef\@citeb{\expandafter\@firstofone\@citeb}%
  477. \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
  478. \if*\@citeb\else
  479. \@ifundefined{b@\@citeb\@extra@b@citeb}{%
  480. \NAT@citeundefined \PackageWarning{natbib}%
  481. {Citation `\@citeb' undefined}}{}\fi}%
  482. \@esphack}
  483. \newcommand\NAT@parse[1]{{%
  484. \let\protect=\@unexpandable@protect\let~\relax
  485. \let\active@prefix=\@gobble
  486. \xdef\NAT@temp{\csname b@#1\@extra@b@citeb\endcsname}}%
  487. \expandafter\NAT@split\NAT@temp
  488. \expandafter\NAT@parse@date\NAT@date??????@@%
  489. \ifciteindex\NAT@index\fi
  490. }
  491. \newcommand\NAT@split[4]{%
  492. \gdef\NAT@num{#1}\gdef\NAT@name{#3}\gdef\NAT@date{#2}%
  493. \gdef\NAT@all@names{#4}%
  494. \ifx\NAT@noname\NAT@all@names \gdef\NAT@all@names{#3}\fi}
  495. \newcommand\NAT@parse@date{}
  496. \def\NAT@parse@date#1#2#3#4#5#6@@{%
  497. \ifnum\the\catcode`#1=11\def\NAT@year{}\def\NAT@exlab{#1}\else
  498. \ifnum\the\catcode`#2=11\def\NAT@year{#1}\def\NAT@exlab{#2}\else
  499. \ifnum\the\catcode`#3=11\def\NAT@year{#1#2}\def\NAT@exlab{#3}\else
  500. \ifnum\the\catcode`#4=11\def\NAT@year{#1#2#3}\def\NAT@exlab{#4}\else
  501. \def\NAT@year{#1#2#3#4}\def\NAT@exlab{{#5}}\fi\fi\fi\fi}
  502. \newcommand\NAT@index{}
  503. \let\NAT@makeindex=\makeindex
  504. \renewcommand\makeindex{\NAT@makeindex
  505. \renewcommand\NAT@index{\@bsphack\begingroup
  506. \def~{\string~}\@wrindex{\NAT@idxtxt}}}
  507. \newcommand\NAT@idxtxt{\NAT@name\ \NAT@open\NAT@date\NAT@close}
  508. \newif\ifciteindex \citeindexfalse
  509. \newcommand\citeindextype{default}
  510. \newcommand\NAT@index@alt{{\let\protect=\noexpand\let~\relax
  511. \xdef\NAT@temp{\NAT@idxtxt}}\expandafter\NAT@exp\NAT@temp\@nil}
  512. \newcommand\NAT@exp{}
  513. \def\NAT@exp#1\@nil{\index[\citeindextype]{#1}}
  514. \AtBeginDocument{%
  515. \@ifpackageloaded{index}{\let\NAT@index=\NAT@index@alt}{}}
  516. \newcommand\NAT@ifcmd{\futurelet\NAT@temp\NAT@ifxcmd}
  517. \newcommand\NAT@ifxcmd{\ifx\NAT@temp\relax\else\expandafter\NAT@bare\fi}
  518. \def\NAT@bare#1(#2)#3()#4\@nil#5{%
  519. \if\relax#2\relax
  520. \expandafter\NAT@apalk#1, , \@nil{#5}\else
  521. \stepcounter{NAT@ctr}%
  522. \NAT@wrout{\arabic {NAT@ctr}}{#2}{#1}{#3}{#5}
  523. \fi
  524. }
  525. \newcommand\NAT@wrout[5]{%
  526. \if@filesw
  527. {\let\protect\noexpand\let~\relax
  528. \immediate
  529. \write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi
  530. \ignorespaces}
  531. \def\NAT@noname{{}}
  532. \renewcommand\bibitem{%
  533. \@ifnextchar[{\@lbibitem}{%
  534. \global\NAT@stdbsttrue
  535. \stepcounter{NAT@ctr}\@lbibitem[\arabic{NAT@ctr}]}}
  536. \def\@lbibitem[#1]#2{%
  537. \@ifundefined{b@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}%
  538. \item[\hfil\hyper@natanchorstart{#2}\@biblabel{\NAT@num}%
  539. \hyper@natanchorend]%
  540. \NAT@ifcmd#1()()\@nil{#2}}
  541. \ifx\SK@lbibitem\@undefined\else
  542. \let\SK@lbibitem\@lbibitem
  543. \def\@lbibitem[#1]#2{%
  544. \SK@lbibitem[#1]{#2}\SK@\SK@@label{#2}\ignorespaces}\fi
  545. \newif\ifNAT@stdbst \NAT@stdbstfalse
  546. \AtEndDocument
  547. {\ifNAT@stdbst\if@filesw\immediate\write\@auxout{\string
  548. \global\string\NAT@numberstrue}\fi\fi
  549. }
  550. \providecommand\bibcite{}
  551. \renewcommand\bibcite[2]{\@ifundefined{b@#1\@extra@binfo}\relax
  552. {\NAT@citemultiple
  553. \PackageWarningNoLine{natbib}{Citation `#1' multiply defined}}%
  554. \global\@namedef{b@#1\@extra@binfo}{#2}}
  555. \AtEndDocument{\NAT@swatrue\renewcommand\bibcite[2]%
  556. {\NAT@testdef{#1}{#2}}}
  557. \newcommand\NAT@testdef[2]{%
  558. \def\NAT@temp{#2}\expandafter \ifx \csname b@#1\@extra@binfo\endcsname
  559. \NAT@temp \else \ifNAT@swa \NAT@swafalse
  560. \PackageWarningNoLine{natbib}{Citation(s) may have
  561. changed.\MessageBreak
  562. Rerun to get citations correct}\fi\fi}
  563. \newcommand\NAT@apalk{}
  564. \def\NAT@apalk#1, #2, #3\@nil#4{\if\relax#2\relax
  565. \global\NAT@stdbsttrue
  566. \NAT@wrout{#1}{}{}{}{#4}\else
  567. \stepcounter{NAT@ctr}%
  568. \NAT@wrout{\arabic {NAT@ctr}}{#2}{#1}{}{#4}\fi}
  569. \newcommand\citeauthoryear{}
  570. \def\citeauthoryear#1#2#3()()\@nil#4{\stepcounter{NAT@ctr}\if\relax#3\relax
  571. \NAT@wrout{\arabic {NAT@ctr}}{#2}{#1}{}{#4}\else
  572. \NAT@wrout{\arabic {NAT@ctr}}{#3}{#2}{#1}{#4}\fi}
  573. \newcommand\citestarts{\NAT@open}
  574. \newcommand\citeends{\NAT@close}
  575. \newcommand\betweenauthors{and}
  576. \newcommand\astroncite{}
  577. \def\astroncite#1#2()()\@nil#3{\stepcounter{NAT@ctr}\NAT@wrout{\arabic
  578. {NAT@ctr}}{#2}{#1}{}{#3}}
  579. \newcommand\citename{}
  580. \def\citename#1#2()()\@nil#3{\expandafter\NAT@apalk#1#2, \@nil{#3}}
  581. \newcommand\harvarditem[4][]%
  582. {\if\relax#1\relax\bibitem[#2(#3)]{#4}\else
  583. \bibitem[#1(#3)#2]{#4}\fi }
  584. \newcommand\harvardleft{\NAT@open}
  585. \newcommand\harvardright{\NAT@close}
  586. \newcommand\harvardyearleft{\NAT@open}
  587. \newcommand\harvardyearright{\NAT@close}
  588. \AtBeginDocument{\providecommand{\harvardand}{and}}
  589. \newcommand\harvardurl[1]{\textbf{URL:} \textit{#1}}
  590. \providecommand\bibsection{}
  591. \@ifundefined{chapter}%
  592. {\renewcommand\bibsection{\section*{\refname
  593. \@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}}}
  594. {\@ifundefined{NAT@sectionbib}%
  595. {\renewcommand\bibsection{\chapter*{\bibname
  596. \@mkboth{\MakeUppercase{\bibname}}{\MakeUppercase{\bibname}}}}}
  597. {\renewcommand\bibsection{\section*{\bibname
  598. \ifx\@mkboth\@gobbletwo\else\markright{\MakeUppercase{\bibname}}\fi}}}}
  599. \@ifclassloaded{amsart}%
  600. {\renewcommand\bibsection{\section*{\refname}}{}}{}
  601. \@ifclassloaded{amsbook}%
  602. {\renewcommand\bibsection{\section*{\bibname}}{}}{}
  603. \@ifundefined{bib@heading}{}{\let\bibsection\bib@heading}
  604. \newcounter{NAT@ctr}
  605. \renewenvironment{thebibliography}[1]{%
  606. \bibfont\bibsection\parindent \z@\list
  607. {\@biblabel{\arabic{NAT@ctr}}}{\@bibsetup{#1}%
  608. \setcounter{NAT@ctr}{0}}%
  609. \ifNAT@openbib
  610. \renewcommand\newblock{\par}
  611. \else
  612. \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%
  613. \fi
  614. \sloppy\clubpenalty4000\widowpenalty4000
  615. \sfcode`\.=1000\relax
  616. \let\citeN\cite \let\shortcite\cite
  617. \let\citeasnoun\cite
  618. }{\def\@noitemerr{%
  619. \PackageWarning{natbib}
  620. {Empty `thebibliography' environment}}%
  621. \endlist\vskip-\lastskip}
  622. \let\bibfont=\relax
  623. \providecommand\reset@font{\relax}
  624. \providecommand\bibname{Bibliography}
  625. \providecommand\refname{References}
  626. \newcommand\NAT@citeundefined{\gdef \NAT@undefined {%
  627. \PackageWarningNoLine{natbib}{There were undefined citations}}}
  628. \let \NAT@undefined \relax
  629. \newcommand\NAT@citemultiple{\gdef \NAT@multiple {%
  630. \PackageWarningNoLine{natbib}{There were multiply defined citations}}}
  631. \let \NAT@multiple \relax
  632. \AtEndDocument{\NAT@undefined\NAT@multiple}
  633. \providecommand\@mkboth[2]{}
  634. \providecommand\MakeUppercase{\uppercase}
  635. \providecommand{\@extra@b@citeb}{}
  636. \gdef\@extra@binfo{}
  637. \providecommand\hyper@natanchorstart[1]{}
  638. \providecommand\hyper@natanchorend{}
  639. \providecommand\hyper@natlinkstart[1]{}
  640. \providecommand\hyper@natlinkend{}
  641. \@ifpackageloaded{babel}{\PackageWarningNoLine{natbib}{%
  642. If you use both babel and natbib\MessageBreak
  643. then load babel AFTER natbib}}{}
  644. \AtBeginDocument{\@ifpackageloaded{babel}{%
  645. \bbl@redefine\@citex[#1][#2]#3{%
  646. \@safe@activestrue\org@@citex[#1][#2]{#3}\@safe@activesfalse}%
  647. }{}}
  648. \ifnum\NAT@sort>0
  649. \newcommand\NAT@sort@cites[1]{%
  650. \@tempcntb\m@ne
  651. \let\@celt\delimiter
  652. \def\NAT@num@list{}%
  653. \def\NAT@cite@list{}%
  654. \def\NAT@nonsort@list{}%
  655. \@for \@citeb:=#1\do{\NAT@make@cite@list}%
  656. \edef\NAT@cite@list{\NAT@cite@list\NAT@nonsort@list}%
  657. \edef\NAT@cite@list{\expandafter\NAT@xcom\NAT@cite@list @@}}
  658. \begingroup \catcode`\_=8
  659. \gdef\NAT@make@cite@list{%
  660. \edef\@citeb{\expandafter\@firstofone\@citeb}%
  661. \@ifundefined{b@\@citeb\@extra@b@citeb}{\def\NAT@num{A}}%
  662. {\NAT@parse{\@citeb}}%
  663. \ifcat _\ifnum\z@<0\NAT@num _\else A\fi
  664. \@tempcnta\NAT@num \relax
  665. \ifnum \@tempcnta>\@tempcntb
  666. \edef\NAT@num@list{\NAT@num@list \@celt{\NAT@num}}%
  667. \edef\NAT@cite@list{\NAT@cite@list\@citeb,}%
  668. \@tempcntb\@tempcnta
  669. \else
  670. \let\NAT@@cite@list=\NAT@cite@list \def\NAT@cite@list{}%
  671. \edef\NAT@num@list{\expandafter\NAT@num@celt \NAT@num@list \@gobble @}%
  672. {\let\@celt=\NAT@celt\NAT@num@list}%
  673. \fi
  674. \else
  675. \edef\NAT@nonsort@list{\NAT@nonsort@list\@citeb,}%
  676. \fi}
  677. \endgroup
  678. \def\NAT@celt#1{\ifnum #1<\@tempcnta
  679. \xdef\NAT@cite@list{\NAT@cite@list\expandafter\NAT@nextc\NAT@@cite@list @@}%
  680. \xdef\NAT@@cite@list{\expandafter\NAT@restc\NAT@@cite@list}%
  681. \else
  682. \xdef\NAT@cite@list{\NAT@cite@list\@citeb,\NAT@@cite@list}\let\@celt\@gobble%
  683. \fi}
  684. \def\NAT@num@celt#1#2{\ifx \@celt #1%
  685. \ifnum #2<\@tempcnta
  686. \@celt{#2}%
  687. \expandafter\expandafter\expandafter\NAT@num@celt
  688. \else
  689. \@celt{\number\@tempcnta}\@celt{#2}%
  690. \fi\fi}
  691. \def\NAT@nextc#1,#2@@{#1,}
  692. \def\NAT@restc#1,#2{#2}
  693. \def\NAT@xcom#1,@@{#1}
  694. \else
  695. \newcommand\NAT@sort@cites[1]{\edef\NAT@cite@list{#1}}\fi
  696. \InputIfFileExists{natbib.cfg}
  697. {\typeout{Local config file natbib.cfg used}}{}
  698. %%
  699. %% <<<<< End of decommented file <<<<<<
  700. %%
  701. %% End of file `natbib.sty'.