"Fossies" - the Fresh Open Source Software Archive 
Member "hevea-2.35/natbib-common.hva" (16 Jan 2021, 11807 Bytes) of package /linux/www/hevea-2.35.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 \RequirePackage{keyval}
2 %% Options
3 \DeclareOption{numbers}
4 {\NAT@numbers\NAT@square\NAT@comma\NAT@nobibstyle}
5 \DeclareOption{super}
6 {\NAT@super\def\NAT@open{}\def\NAT@close{}\NAT@nobibstyle}
7 \DeclareOption{authoryear}
8 {\NAT@authoryear\NAT@round\NAT@semicolon\NAT@bibstyle}
9 \DeclareOption{round}{\NAT@round\NAT@nobibstyle}
10 \DeclareOption{square}{\NAT@square\NAT@nobibstyle}
11 \DeclareOption{angle}{\NAT@angle\NAT@nobibstyle}
12 \DeclareOption{curly}{\NAT@curly\NAT@nobibstyle}
13 \DeclareOption{comma}{\NAT@comma\NAT@nobibstyle}
14 \DeclareOption{semicolon}{\NAT@semicolon\NAT@nobibstyle}
15 \DeclareOption{colon}{\NAT@semicolon\NAT@nobibstyle}
16 \DeclareOption{nobibstyle}{\NAT@nobibstyle}
17 \DeclareOption{bibstyle}{\NAT@bibstyle}
18 \DeclareOption{openbib}{}%undocumented, what does it do ?
19 \DeclareOption{sectionbib}{}%useless, chapterbib does the job
20 %%%Not implemented, ignore silently
21 \DeclareOption{sort}{}
22 \DeclareOption{compress}{}
23 \DeclareOption{sort&compress}{}
24 %%
25 \@primitives{natbib}
26 \newcommand{\NAT@warn}[1]{\hva@warn{natbib in hevea: #1}}
27 \newif\ifNAT@super
28 \newcommand{\NAT@bibstyle}{\let\bibstyle\@citestyle}
29 \newcommand{\NAT@nobibstyle}{\let\bibstyle\@gobble}
30 % Automatic bibstyle (excerpt from natbib.sty)
31 % Define citation punctuation for some author-year styles
32 % One may add and delete at this point
33 % Or put additions into local configuration file natbib.cfg
34 \newcommand\bibstyle@chicago{\bibpunct{(}{)}{;}{a}{,}{,}}
35 \newcommand\bibstyle@named{\bibpunct{[}{]}{;}{a}{,}{,}}
36 \newcommand\bibstyle@agu{\bibpunct{[}{]}{;}{a}{,}{,~}}%Amer. Geophys. Union
37 \newcommand\bibstyle@copernicus{\bibpunct{(}{)}{;}{a}{,}{,}}%Copernicus Publications
38 \let\bibstyle@egu=\bibstyle@copernicus
39 \let\bibstyle@egs=\bibstyle@copernicus
40 \newcommand\bibstyle@agsm{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
41 \newcommand\bibstyle@kluwer{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}
42 \newcommand\bibstyle@dcu{\bibpunct{(}{)}{;}{a}{;}{,}\gdef\harvardand{and}}
43 \newcommand\bibstyle@aa{\bibpunct{(}{)}{;}{a}{}{,}} %Astronomy & Astrophysics
44 \newcommand\bibstyle@pass{\bibpunct{(}{)}{;}{a}{,}{,}}%Planet. & Space Sci
45 \newcommand\bibstyle@anngeo{\bibpunct{(}{)}{;}{a}{,}{,}}%Annales Geophysicae
46 \newcommand\bibstyle@nlinproc{\bibpunct{(}{)}{;}{a}{,}{,}}%Nonlin.Proc.Geophys.
47 % Define citation punctuation for some numerical styles
48 \newcommand\bibstyle@cospar{\bibpunct{/}{/}{,}{n}{}{}%
49 \gdef\bibnumfmt##1{##1.}}
50 \newcommand\bibstyle@esa{\bibpunct{(Ref.~}{)}{,}{n}{}{}%
51 \gdef\bibnumfmt##1{##1.\hspace{1em}}}
52 \newcommand\bibstyle@nature{\bibpunct{}{}{,}{s}{}{\textsuperscript{,}}%
53 \gdef\bibnumfmt##1{##1.}}
54 % The standard LaTeX styles
55 \newcommand\bibstyle@plain{\bibpunct{[}{]}{,}{n}{}{,}}
56 \let\bibstyle@alpha=\bibstyle@plain
57 \let\bibstyle@abbrv=\bibstyle@plain
58 \let\bibstyle@unsrt=\bibstyle@plain
59 % The author-year modifications of the standard styles
60 \newcommand\bibstyle@plainnat{\bibpunct{[}{]}{,}{a}{,}{,}}
61 \let\bibstyle@abbrvnat=\bibstyle@plainnat
62 \let\bibstyle@unsrtnat=\bibstyle@plainnat
63 %%%Bibstyle definition
64 \renewcommand\bibstyle[1]{\@ifundefined{bibstyle@#1}{\relax}
65 {\csname bibstyle@#1\endcsname}}
66 \AtBeginDocument{\global\let\bibstyle=\@gobble}
67 \let\@citestyle\bibstyle
68 \newcommand\citestyle[1]{\@citestyle{#1}\let\bibstyle\@gobble}
69 %%%%%%%%%%%% Citation formating, two macros per style
70 % #1 -> num, #2 author (short or long), #3 year.
71 \newcommand{\NAT@extra}[1]
72 {\def\@tmp{#1}\ifx\@tmp\@empty\relax\else\NAT@post{} #1\fi}
73 \newcommand{\NAT@authoryear@p}[5]{#2\@aysep@cite{} #3\NAT@extra{#4}}
74 \newcommand{\NAT@authoryear@t}[5]{#2 \NAT@open{}#3\NAT@extra{#4}\NAT@close}
75 \newcommand{\NAT@numbers@p}[5]{#1\NAT@extra{#4}}
76 \newcommand{\NAT@numbers@t}[5]{#2 \NAT@open{}#1\NAT@close\NAT@extra{#4}}
77 \newcommand{\NAT@super@p}[5]{#1\NAT@extra{#4}}
78 \newcommand{\NAT@super@t}[5]
79 {#2\ensuremath{^{\mbox{\NAT@yopen{}#1\NAT@yclose}}}\NAT@extra{#4}}
80 %%\citenum,\citeauthor..
81 \newcommand{\NAT@authoryear@n}[5]{#1}
82 \newcommand{\NAT@numbers@n}[5]{#1}
83 \newcommand{\NAT@super@n}[5]{#1}
84 \newcommand{\NAT@authoryear@a}[5]{#2}
85 \newcommand{\NAT@numbers@a}[5]{#2}
86 \newcommand{\NAT@super@a}[5]{#2}
87 \newcommand{\NAT@authoryear@y}[5]{#3}
88 \newcommand{\NAT@numbers@y}[5]{#3}
89 \newcommand{\NAT@super@y}[5]{#3}
90 %%\citealias
91 \newcommand{\NAT@authoryear@b}[5]{\NAT@getalias{#5}\NAT@extra{#4}}
92 \newcommand{\NAT@numbers@b}[5]{\NAT@getalias{#5}\NAT@extra{#4}}
93 \newcommand{\NAT@super@b}[5]{\NAT@getalias{#5}\NAT@extra{#4}}
94 %%Citation formatting hook
95 \newcommand{\@NAT@format@cite}{\csname NAT@\NAT@style{}@\NAT@pt\endcsname}
96 \newcommand{\NAT@format@cite}[3]
97 {\@callsubst\NAT@args#1%
98 \@NAT@format@cite
99 {\NAT@num}
100 {\NAT@choose@author{\NAT@auth}{\NAT@long}}
101 {\NAT@year}{#2}{#3}}
102 \newcommand{\NAT@args}[4]
103 {\def\NAT@num{#1}\def\NAT@year{#2}\def\NAT@auth{#3}%
104 \ifthenelse{\equal{#4}{}}{\let\NAT@long\NAT@auth}{\def\NAT@long{#4}}}
105 %%%
106 \newcommand{\bibnumfmt}[1]{[#1]}
107 \newcommand{\NAT@format@item}[4]
108 {\ifx#3\@empty#2\else
109 \NAT@item@hook{\NAT@authoryear@t{#2}{#3}{#4}{}}{\bibnumfmt{#2}}\fi}
110 \def\NAT@check#1(#2)#3(@){#2#3}%
111 \def\NAT@bibitem#1(#2)#3(@)#4(@)#5(@){%
112 \NAT@write{{#4}}{#5}{#1}{#2}{#3}%
113 \item[#4]}
114 \newif\ifNAT@forced\NAT@forcedfalse
115 \newcommand{\NAT@force@numbers}
116 {\ifNAT@forced\else\NAT@forcedtrue\@auxdowrite{\string\NAT@numbers{}
117 }\fi}
118 \renewcommand{\bibitem}[2][!*!]
119 {\stepcounter{heveabib}\ifthenelse{\equal{#1}{!*!}}
120 {\@callsubst{\NAT@bibitem}{()(@)#2(@)\theheveabib(@)}}
121 {\ifthenelse
122 {\equal{\@callsubst{\NAT@check}{#1()(@)}}{}}
123 {\NAT@force@numbers\@callsubst{\NAT@bibitem}{()(@)#2(@)#1(@)}}
124 {\@callsubst{\NAT@bibitem}{#1(@)#2(@)\theheveabib(@)}}}}
125 %%%% Default config used for tags in the bibliography itself
126 \newcommand{\NAT@fst}[2]{#1}
127 \newcommand{\NAT@snd}[2]{#2}
128 \let\NAT@choose@author\NAT@fst
129 \let\NAT@item@hook\NAT@fst
130 %% Those can be configured
131 \def\NAT@open{(}
132 \def\NAT@close{)}
133 \def\NAT@sep{,}
134 \def\NAT@post{,}
135 \def\NAT@aysep{,}
136 %shorcuts
137 \newcommand{\NAT@square}{\def\NAT@open{[}\def\NAT@close{]}}
138 \newcommand{\NAT@round}{\def\NAT@open{(}\def\NAT@close{)}}
139 \newcommand{\NAT@curly}{\def\NAT@open{\{}\def\NAT@close{\}}}
140 \newcommand{\NAT@angle}{\def\NAT@open{<}\def\NAT@close{>}}
141 \newcommand{\NAT@comma}{\def\NAT@sep{,}}
142 \newcommand{\NAT@semicolon}{\def\NAT@sep{;}}
143 %%%
144 \let\@aysep@cite\relax
145 \let\NAT@yopen\NAT@open
146 \let\NAT@yclose\NAT@close
147 \let\NAT@finalhook\relax
148 \newcommand{\NAT@neutral}
149 {\let\NAT@open@super\relax
150 \let\NAT@close@super\relax\let\@cite@pre\NAT@addsp
151 \NAT@superfalse}
152 \newcommand{\NAT@addsp}[1]{#1~}
153 \newcommand{\NAT@id}[1]{#1}
154 \NAT@neutral
155 \let\NAT@finalhook\relax
156 %%%% Hack \cite in fact has two optional arguments
157 %%%% and may hooks that are parametrize below
158 \let\hva@cite\cite
159 \newcommand{\NAT@IN}[5]
160 {\ifNAT@super
161 \def\@open@cite@one{}%
162 \def\@open@cite@two{\NAT@open@super{}#1}%
163 \else
164 \def\@open@cite@one{#1}%
165 \let\@open@cite@two\relax
166 \fi
167 \def\@close@cite{\NAT@OUT{#2}}%
168 \let\@sep@cite\NAT@sep%
169 \let\@post@cite\NAT@post%
170 \let\@aysep@cite#3\let\NAT@yopen#4\let\NAT@yclose#5}
171 \newcommand{\NAT@OUT}[1]{#1\NAT@close@super\endgroup{}\NAT@finalhook}
172 \newcommand{\citep}
173 {\begingroup\def\NAT@pt{p}%
174 \NAT@IN{\NAT@open}{\NAT@close}{\NAT@aysep}{\relax}{\relax}\hva@cite}
175 \newcommand{\citep*}
176 {\begingroup%
177 \let\NAT@choose@author\NAT@snd%
178 \let\NAT@finalhook\endgroup%
179 \citep}
180 \newcommand{\citealp}
181 {\begingroup\def\NAT@pt{p}%
182 \NAT@IN{\relax}{\relax}{\NAT@aysep}{\relax}{\relax}\hva@cite}
183 \newcommand{\citealp*}
184 {\begingroup%
185 \let\NAT@choose@author\NAT@snd%
186 \let\NAT@finalhook\endgroup%
187 \citealp}
188 \newcommand{\citet}
189 {\begingroup\def\NAT@pt{t}\NAT@neutral\def\@sep@cite@space{ }%
190 \NAT@IN{\relax}{\relax}{\relax}{\NAT@open}{\NAT@close}%
191 \hva@cite}
192 \newcommand{\citet*}
193 {\begingroup%
194 \let\NAT@choose@author\NAT@snd%
195 \let\NAT@finalhook\endgroup%
196 \citet}
197 \newcommand{\citealt}
198 {\begingroup\def\NAT@pt{t}\NAT@neutral\def\@sep@cite@space{ }%
199 \NAT@IN{\relax}{\relax}{\relax}{\relax}{\relax}%
200 \hva@cite}
201 \newcommand{\citealt*}
202 {\begingroup%
203 \let\NAT@choose@author\NAT@snd%
204 \let\NAT@finalhook\endgroup%
205 \citealt}
206 \newcommand{\citenum}
207 {\begingroup\def\NAT@pt{n}\NAT@neutral\def\@sep@cite@space{}%
208 \NAT@IN{\relax}{\relax}{\relax}{\relax}{\relax}%
209 \hva@cite}
210 \newcommand{\citeauthor}
211 {\begingroup\def\NAT@pt{a}\NAT@neutral\def\@sep@cite@space{ }%
212 \NAT@IN{\relax}{\relax}{\relax}{\relax}{\relax}%
213 \hva@cite}
214 \newcommand{\citeauthor*}
215 {\begingroup%
216 \let\NAT@choose@author\NAT@snd%
217 \let\NAT@finalhook\endgroup%
218 \citeauthor}
219 \let\citefullauthor\citeauthor*
220 \newcommand{\citeyear}
221 {\begingroup\def\NAT@pt{y}\NAT@neutral\def\@sep@cite@space{ }%
222 \NAT@IN{\relax}{\relax}{\relax}{\relax}{\relax}%
223 \hva@cite}
224 \newcommand{\citeyearpar}
225 {\begingroup\def\NAT@pt{y}\NAT@neutral\def\@sep@cite@space{ }%
226 \NAT@IN{\NAT@open}{\NAT@close}{\relax}{\relax}{\relax}%
227 \hva@cite}
228 \newcommand{\citetext}[1]{\NAT@open{}#1\NAT@close}
229 \renewcommand{\cite}{\NAT@ifay{\citet}{\citep}}
230 %% Aliases, the explicit \bibtaghook is for chapterbib compatibility
231 \newcommand{\defcitealias}[2]
232 {\def\csname NAT@alias@\bibtaghook{#1}\endcsname{#2}}
233 \newcommand{\NAT@getalias}[1]
234 {\@ifundefined{NAT@alias@#1}
235 {\NAT@warn{undefined alias '#1'}}
236 {\csname NAT@alias@#1\endcsname}}
237 \newcommand{\citetalias}
238 {\begingroup%
239 \def\NAT@pt{b}\NAT@neutral\def\@sep@cite@space{ }%
240 \NAT@IN{\relax}{\relax}{\relax}{\relax}{\relax}%
241 \hva@cite}
242 \newcommand{\citepalias}
243 {\begingroup%
244 \def\NAT@pt{b}\NAT@neutral\def\@sep@cite@space{ }%
245 \NAT@IN{\NAT@open}{\NAT@close}{\relax}{\relax}{\relax}%
246 \hva@cite}
247 %%%%%%%%%%%%
248 %% Index %%
249 %%%%%%%%%%%%
250 \newif\ifciteindex\citeindexfalse
251 \newcommand{\citeindextype}{default}
252 \newcommand{\NAT@idxtxt}
253 {\NAT@auth\NAT@aysep{} \NAT@open{}\NAT@year\NAT@close}
254 \newcommand{\NATfmtindex}[1]
255 {\NAT@bibread{#1}\NAT@format@item{#1}{\NAT@num}{\NAT@auth}{\NAT@year}}
256 \newcommand{\NAT@idxkey}[1]
257 {\NAT@bibread{#1}%
258 \ifx\NAT@num\@empty#1\else\@pad{0}{3}{\NAT@num}CITE\fi}
259 \newcommand{\NAT@index}[1]
260 {\@@@indexwrite[\citeindextype]{\NAT@idxkey{#1}}{\NATfmtindex{#1}}{\@indexlabel}}
261 %%%%%%%%%%%%
262 %% Modes %%
263 %%%%%%%%%%%%
264 %%%Author / year, default style in some sense
265 \newcommand{\NAT@authoryear}
266 {\def\NAT@style{authoryear}\NAT@superfalse%
267 \let\NAT@ifay\NAT@fst%
268 \def\@sep@cite@space{ }\let\NAT@item@hook\NAT@fst\NAT@neutral}
269 %%%Numbers
270 \newcommand{\NAT@numbers}
271 {\def\NAT@style{numbers}\NAT@superfalse\let\NAT@ifay\NAT@snd%
272 \let\@sep@cite@space\@empty\let\NAT@item@hook\NAT@snd\NAT@neutral}
273 %%%Super is harder
274 \newif\ifNAT@closed
275 \newcommand{\@NAT@os}{\@style{SUP}}
276 \newcommand{\@NAT@cs}{}
277 \newcommand{\NAT@super}{
278 \def\NAT@style{super}\NAT@supertrue\let\NAT@ifay\NAT@snd%
279 \let\NAT@item@hook\NAT@snd%
280 \let\@sep@cite@space\@empty%
281 \let\NAT@open@super\@NAT@os\let\NAT@close@super\@NAT@cs\let\@cite@pre\NAT@id}
282 %% \bibpunct command, arg #8 ignored
283 \newcommand{\bibpunct}[7][, ]
284 {\def\NAT@post{#1}%
285 \def\NAT@open{#2}\def\NAT@close{#3}\def\NAT@sep{#4}%
286 \ifthenelse{\equal{#5}{n}}{\NAT@numbers}
287 {\ifthenelse{\equal{#5}{s}}{\NAT@super}
288 {\NAT@authoryear}}
289 \def\NAT@aysep{#6}%
290 \let\bibstyle\@gobble}
291 %% Keyval interface
292 \newcommand{\setcitestyle}[1]{\@setkeys{NAT}{#1}\let\bibstyle\@gobble}
293 %simple keys
294 \define@key{NAT}{numbers}[]{\NAT@numbers}
295 \define@key{NAT}{authoryear}[]{\NAT@authoryear}
296 \define@key{NAT}{super}[]{\NAT@super}
297 \define@key{NAT}{round}[]{\NAT@round}
298 \define@key{NAT}{square}[]{\NAT@square}
299 \define@key{NAT}{curly}[]{\NAT@curly}
300 \define@key{NAT}{angle}[]{\NAT@angle}
301 \define@key{NAT}{comma}[]{\NAT@comma}
302 \define@key{NAT}{semicolon}[]{\NAT@semicolon}
303 \define@key{NAT}{colon}[]{\NAT@semicolon}
304 %keys with argument
305 \define@key{NAT}{open}{\def\NAT@open{#1}}
306 \define@key{NAT}{close}{\def\NAT@close{#1}}
307 %%% Need that because natbib styles put strange things in .bbl files
308 \providecommand{\penalty}[1]{}
309 %%%
310 \NAT@authoryear%default
311 \ProcessOptions*%