| 1 |
% BibTex `jbact' bibliography style |
| 2 |
% version = 1.30 of jbact.bst 1992 June 29 |
| 3 |
% Fix format.vol.num.pages to use field.or.null to |
| 4 |
% correctly handle case of missing volume. |
| 5 |
% [Nelson H. F. Beebe <[email protected]>] |
| 6 |
% version = 1.29 of jbact.bst 1992 April 21 |
| 7 |
% from version = 1.21 of jmb.bst 1991 June 10 |
| 8 |
|
| 9 |
% TO BE DONE in inproceedings: |
| 10 |
% 1. editors are not boldface |
| 11 |
% 2. need comma after title, not period |
| 12 |
% 3. don't rearrange editor names |
| 13 |
% 4. no comma after editors |
| 14 |
% (The trouble is that there is only one name function...) |
| 15 |
|
| 16 |
% This program must be used in conjunction with jbact.sty |
| 17 |
|
| 18 |
% Thomas Schneider |
| 19 |
% National Cancer Institute |
| 20 |
% Laboratory of Mathematical Biology |
| 21 |
% Frederick, Maryland 21702-1013 |
| 22 |
% [email protected] |
| 23 |
% |
| 24 |
% This file is available by anonymous ftp from ncifcrf.gov in pub/delila. |
| 25 |
% |
| 26 |
% TITLES can be turned on and off! |
| 27 |
% Just nocite the reference TitlesOn in the paper (i.e. \nocite{TitlesOn}) |
| 28 |
% and have a bibliography article in your database with that cite key! |
| 29 |
% Without titles is Journal of Molecular Biology; |
| 30 |
% With titles is Journal of Theoretical Biology. |
| 31 |
% |
| 32 |
% WARNING: Since I use mostly article, book and inproceedings, these |
| 33 |
% are formatted pretty closely to the Journal of Theoretical Biology style |
| 34 |
% while other things are neglected. Also, I can't guarantee that the style |
| 35 |
% is exactly right. |
| 36 |
% |
| 37 |
% The following documentation is identical from the source of jmb.bst, |
| 38 |
% which was the apalike.bst taken from the Clarkson archive on 1989 June 19. |
| 39 |
% |
| 40 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 41 |
% BibTeX `apalike' bibliography style (24-Jan-88 version) |
| 42 |
% Adapted from the `alpha' style, version 0.99a; for BibTeX version 0.99a. |
| 43 |
% Copyright (C) 1988, all rights reserved. |
| 44 |
% Copying of this file is allowed, provided that if you make any changes at all |
| 45 |
% you name it something other than `apalike.bst'. |
| 46 |
% This restriction helps ensure that all copies are identical. |
| 47 |
% Differences between this style and `alpha' are generally heralded by a `%'. |
| 48 |
% The file btxbst.doc has the documentation for alpha.bst. |
| 49 |
% |
| 50 |
% This style should be used with the `apalike' LaTeX style (apalike.sty). |
| 51 |
% \cite's come out like "(Jones, 1986)" in the text but there are no labels |
| 52 |
% in the bibliography, and something like "(1986)" comes out immediately |
| 53 |
% after the author. Author (and editor) names appear as last name, comma, |
| 54 |
% initials. A `year' field is required for every entry, and so is either |
| 55 |
% an author (or in some cases, an editor) field or a key field. |
| 56 |
% |
| 57 |
% Editorial note: |
| 58 |
% Many journals require a style like `apalike', but I strongly, strongly, |
| 59 |
% strongly recommend that you not use it if you have a choice---use something |
| 60 |
% like `plain' instead. Mary-Claire van Leunen (A Handbook for Scholars, |
| 61 |
% Knopf, 1979) argues convincingly that a style like `plain' encourages better |
| 62 |
% writing than one like `apalike'. Furthermore the strongest arguments for |
| 63 |
% using an author-date style like `apalike'---that it's "the most practical" |
| 64 |
% (The Chicago Manual of Style, University of Chicago Press, thirteenth |
| 65 |
% edition, 1982, pages 400--401)---fall flat on their face with the new |
| 66 |
% computer-typesetting technology. For instance page 401 anachronistically |
| 67 |
% states "The chief disadvantage of [a style like `plain'] is that additions |
| 68 |
% or deletions cannot be made after the manuscript is typed without changing |
| 69 |
% numbers in both text references and list." LaTeX sidesteps the disadvantage. |
| 70 |
% |
| 71 |
% History: |
| 72 |
% 15-sep-86 (SK,OP) Original version, by Susan King and Oren Patashnik. |
| 73 |
% 10-nov-86 (OP) Truncated the sort.key$ string to the correct length |
| 74 |
% in bib.sort.order to eliminate error message. |
| 75 |
% 24-jan-88 (OP) Updated for BibTeX version 0.99a, from alpha.bst 0.99a; |
| 76 |
% apalike now sorts by author, then year, then title; |
| 77 |
% THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i. |
| 78 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 79 |
% |
| 80 |
% The program was further modified by Tom Schneider: |
| 81 |
% |
| 82 |
% 1989 June 19 (TDS) Renamed jmb.bst. Items that do not have years were |
| 83 |
% listed in the bibliography without identifiers. However, they |
| 84 |
% have identifiers in the text. The identifier was added. |
| 85 |
% Titles were removed :-(. |
| 86 |
|
| 87 |
% 1989 October 2 (TDS) Made labels in the paper use the & symbol rather |
| 88 |
% than `and', as required by JMB. |
| 89 |
% 1989 October 3 (TDS) Made et~al. be in italics. |
| 90 |
% Removed comma after journal name. (actually, all |
| 91 |
% mid sentence commas go!) |
| 92 |
% Made volume number be bold faced. |
| 93 |
% Converted colon (:) after volume number to a comma (,). |
| 94 |
% If a journal name does NOT end in a period, add |
| 95 |
% a comma after the name. |
| 96 |
% 1989 October 14 (TDS) Without a year the program used to sort on the |
| 97 |
% title. I made it sort on the cite$ if there is no year. |
| 98 |
% 1989 October 18 (TDS) If there is one reference without a year, put |
| 99 |
% an "a" at the end of its label, so that it comes out |
| 100 |
% as (Smith, a) in the text. in FUNCTION {forward.pass} |
| 101 |
% 1989 November 2 (TDS) Unpublished papers now give the title. |
| 102 |
% 1989 November 18 (TDS) TITLES can be turned on and off! |
| 103 |
% Just nocite the reference TitlesOn in the paper |
| 104 |
% and have a bibliography article in your database |
| 105 |
% with that cite key! |
| 106 |
% 1989 December 5 (TDS) I can't stand sorting to fall back on the |
| 107 |
% titles of the article - no control! So in function |
| 108 |
% bib.sort.order the default is now cite$. |
| 109 |
% 1990 November 14 (TDS) Changes to match JTB better: |
| 110 |
% Names in the bibliography are now connected |
| 111 |
% with "\&" instead of "and", since this fits JTB better. |
| 112 |
% "In" is now "In:". |
| 113 |
% "editors" and "editor" are now "eds" and "ed". |
| 114 |
% booktitle follows editors. editors in parenthesis. |
| 115 |
% pp. and p. instead of pages and page. |
| 116 |
% location followed by colon (:) and then publisher. |
| 117 |
|
| 118 |
% 1992 April 22 Changes to match J. Bact Proof |
| 119 |
% year is not in parens, ends with period. |
| 120 |
% the first name should be 'last name first', |
| 121 |
% but later ones should be the other way! |
| 122 |
% 'and' rather than & |
| 123 |
% journal name is not emphasized |
| 124 |
% author list is bold face, ends with period |
| 125 |
% comma after first author when there are two authors |
| 126 |
% changes to match J. Bact galley proof markings |
| 127 |
% expand journal titles where required by J. Bact! |
| 128 |
% no comma after title! |
| 129 |
|
| 130 |
ENTRY % declare variables that have a value for each entry on the list |
| 131 |
{ address |
| 132 |
author |
| 133 |
booktitle |
| 134 |
chapter |
| 135 |
edition |
| 136 |
editor |
| 137 |
howpublished |
| 138 |
institution |
| 139 |
journal |
| 140 |
key |
| 141 |
% month not used in apalike |
| 142 |
note |
| 143 |
number |
| 144 |
organization |
| 145 |
pages |
| 146 |
publisher |
| 147 |
school |
| 148 |
series |
| 149 |
title |
| 150 |
type |
| 151 |
volume |
| 152 |
year |
| 153 |
} |
| 154 |
{} |
| 155 |
{ label extra.label sort.label } |
| 156 |
|
| 157 |
INTEGERS { output.state before.all mid.sentence after.sentence after.block |
| 158 |
docomma givetitles } |
| 159 |
|
| 160 |
FUNCTION {init.state.consts} |
| 161 |
{ #0 'before.all := |
| 162 |
#1 'mid.sentence := |
| 163 |
#2 'after.sentence := |
| 164 |
#3 'after.block := |
| 165 |
|
| 166 |
#0 'docomma := % if it is 0 then don't do commas, otherwise do them. |
| 167 |
} |
| 168 |
|
| 169 |
FUNCTION {init.toggle.switches} |
| 170 |
{% set switches for controlling the output! |
| 171 |
#0 'givetitles := % if it is 0 then don't give titles, otherwise do them. |
| 172 |
} |
| 173 |
|
| 174 |
STRINGS { s t } |
| 175 |
|
| 176 |
FUNCTION {output.nonnull} |
| 177 |
{ 's := |
| 178 |
output.state mid.sentence = |
| 179 |
|
| 180 |
% % { ", " * write$ } % the comma here is responsible for every comma! |
| 181 |
% % % But JMB doesn't want commas, so away it goes! |
| 182 |
% { " " * write$ } % That does it! |
| 183 |
|
| 184 |
{ % doing a comma is controlled specifically in JMB using docomma |
| 185 |
docomma #0 = |
| 186 |
{ " " * write$ } |
| 187 |
{ ", " * write$ } |
| 188 |
if$ |
| 189 |
} |
| 190 |
{ output.state after.block = |
| 191 |
{ add.period$ write$ |
| 192 |
newline$ |
| 193 |
"\newblock " write$ |
| 194 |
} |
| 195 |
{ output.state before.all = |
| 196 |
'write$ |
| 197 |
{ add.period$ " " * write$ } |
| 198 |
if$ |
| 199 |
} |
| 200 |
if$ |
| 201 |
mid.sentence 'output.state := |
| 202 |
} |
| 203 |
if$ |
| 204 |
s |
| 205 |
} |
| 206 |
|
| 207 |
FUNCTION {output} |
| 208 |
{ duplicate$ empty$ |
| 209 |
'pop$ |
| 210 |
'output.nonnull |
| 211 |
if$ |
| 212 |
} |
| 213 |
|
| 214 |
FUNCTION {output.check} |
| 215 |
{ 't := |
| 216 |
duplicate$ empty$ |
| 217 |
{ t "title" = |
| 218 |
{ pop$ } % jmb ignores titles and does not object if missing |
| 219 |
{ pop$ "empty " t * " in " * cite$ * warning$ } |
| 220 |
if$ |
| 221 |
} |
| 222 |
'output.nonnull % block periods |
| 223 |
% { pop$ } % don't do anything |
| 224 |
if$ |
| 225 |
} |
| 226 |
|
| 227 |
% t "title" = |
| 228 |
% { "zowie" warning$ } |
| 229 |
% { duplicate$ empty$ |
| 230 |
% { pop$ "EmPtY " t * " in " * cite$ * warning$ } |
| 231 |
% 'output.nonnull |
| 232 |
% } |
| 233 |
% if$ |
| 234 |
% if$ |
| 235 |
%} |
| 236 |
|
| 237 |
% apalike needs this function because |
| 238 |
% the year has special punctuation; |
| 239 |
% apalike ignores the month |
| 240 |
FUNCTION {output.year.check} |
| 241 |
{ year empty$ |
| 242 |
{ |
| 243 |
"empty year in " cite$ ", using label: " extra.label * * * warning$ |
| 244 |
write$ |
| 245 |
% " (" extra.label * ")" * % TDS no parens in jbact |
| 246 |
" " extra.label * ". " * % period after year |
| 247 |
mid.sentence 'output.state := |
| 248 |
} |
| 249 |
{ write$ |
| 250 |
% " (" year * extra.label * ")" * |
| 251 |
" " year * extra.label * % period after year TDS |
| 252 |
mid.sentence 'output.state := |
| 253 |
} |
| 254 |
if$ |
| 255 |
} |
| 256 |
|
| 257 |
%FUNCTION {output.bibitem} |
| 258 |
%{ newline$ |
| 259 |
% "\bibitem[" write$ |
| 260 |
% label write$ |
| 261 |
% "]{" write$ |
| 262 |
% cite$ write$ |
| 263 |
% "}" write$ |
| 264 |
% newline$ |
| 265 |
% "" |
| 266 |
% before.all 'output.state := |
| 267 |
%} |
| 268 |
|
| 269 |
% do numbers instead: TDS (taken from unsrt.bst |
| 270 |
FUNCTION {output.bibitem} |
| 271 |
{ newline$ |
| 272 |
"\bibitem{" write$ |
| 273 |
cite$ write$ |
| 274 |
"}" write$ |
| 275 |
newline$ |
| 276 |
"" |
| 277 |
before.all 'output.state := |
| 278 |
} |
| 279 |
|
| 280 |
FUNCTION {fin.entry} |
| 281 |
{ add.period$ |
| 282 |
write$ |
| 283 |
newline$ |
| 284 |
} |
| 285 |
|
| 286 |
FUNCTION {new.block} |
| 287 |
{ output.state before.all = |
| 288 |
'skip$ |
| 289 |
{ after.block 'output.state := } |
| 290 |
if$ |
| 291 |
} |
| 292 |
|
| 293 |
FUNCTION {new.sentence} |
| 294 |
{ output.state after.block = |
| 295 |
'skip$ |
| 296 |
{ output.state before.all = |
| 297 |
'skip$ |
| 298 |
{ after.sentence 'output.state := } |
| 299 |
if$ |
| 300 |
} |
| 301 |
if$ |
| 302 |
} |
| 303 |
|
| 304 |
FUNCTION {not} |
| 305 |
{ { #0 } |
| 306 |
{ #1 } |
| 307 |
if$ |
| 308 |
} |
| 309 |
|
| 310 |
FUNCTION {and} |
| 311 |
{ 'skip$ |
| 312 |
{ pop$ #0 } |
| 313 |
if$ |
| 314 |
} |
| 315 |
|
| 316 |
FUNCTION {or} |
| 317 |
{ { pop$ #1 } |
| 318 |
'skip$ |
| 319 |
if$ |
| 320 |
} |
| 321 |
|
| 322 |
FUNCTION {new.block.checkb} |
| 323 |
{ empty$ |
| 324 |
swap$ empty$ |
| 325 |
and |
| 326 |
'skip$ |
| 327 |
'new.block |
| 328 |
if$ |
| 329 |
} |
| 330 |
|
| 331 |
FUNCTION {field.or.null} |
| 332 |
{ duplicate$ empty$ |
| 333 |
{ pop$ "" } |
| 334 |
'skip$ |
| 335 |
if$ |
| 336 |
} |
| 337 |
|
| 338 |
FUNCTION {emphasize} |
| 339 |
{ duplicate$ empty$ |
| 340 |
{ pop$ "" } |
| 341 |
{ "{\em " swap$ * "}" * } |
| 342 |
if$ |
| 343 |
} |
| 344 |
|
| 345 |
INTEGERS { nameptr namesleft numnames } |
| 346 |
|
| 347 |
FUNCTION {format.names} |
| 348 |
{ 's := |
| 349 |
|
| 350 |
%"TRY WITH" s * warning$ |
| 351 |
|
| 352 |
#1 'nameptr := |
| 353 |
s num.names$ 'numnames := |
| 354 |
|
| 355 |
%"TRY WITH" numnames * warning$ % this gives a warning |
| 356 |
% the problem is that num.names$ is 1, so the loop |
| 357 |
% doesn't work. Looks like names weren't counted somewhere! |
| 358 |
|
| 359 |
"{\bf " % start bold face |
| 360 |
|
| 361 |
numnames 'namesleft := |
| 362 |
{ namesleft #0 > } |
| 363 |
{ |
| 364 |
% the first name should be 'last name first', |
| 365 |
% but later ones should be the other way! |
| 366 |
nameptr #1 = |
| 367 |
{s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := } % last name first |
| 368 |
{s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } % first name first |
| 369 |
if$ |
| 370 |
|
| 371 |
% nameptr #1 = |
| 372 |
% {"then bbl" t * warning$} |
| 373 |
% {"ELSE bbl" t * warning$} |
| 374 |
% if$ |
| 375 |
|
| 376 |
nameptr #1 > |
| 377 |
{ namesleft #1 > |
| 378 |
{ ", " * t * } |
| 379 |
{ numnames #2 > |
| 380 |
{ "," * } |
| 381 |
'skip$ |
| 382 |
if$ |
| 383 |
|
| 384 |
% if there are EXACTY two names, put a comma after the first one! |
| 385 |
numnames #2 = |
| 386 |
{ "," * } % TDS |
| 387 |
'skip$ |
| 388 |
if$ |
| 389 |
|
| 390 |
t "others" = |
| 391 |
{ " {\em et~al.}" * } |
| 392 |
{ " and " * t * } % back to 'and' TDS |
| 393 |
% { " \& " * t * } |
| 394 |
if$ |
| 395 |
} |
| 396 |
if$ |
| 397 |
} |
| 398 |
't |
| 399 |
if$ |
| 400 |
nameptr #1 + 'nameptr := |
| 401 |
namesleft #1 - 'namesleft := |
| 402 |
} |
| 403 |
while$ |
| 404 |
|
| 405 |
% if there is more than one name, then DON'T put a period |
| 406 |
% at the end of the name list because it looks like Smith, J. K.. |
| 407 |
% otherwise put that period because the last name will end the list |
| 408 |
% as in Helsberg, M. and R.~Eichenlaub. |
| 409 |
numnames #1 > |
| 410 |
{"." *} |
| 411 |
'skip$ |
| 412 |
if$ |
| 413 |
|
| 414 |
"} " * * % end bold face end whole thing with period |
| 415 |
} |
| 416 |
|
| 417 |
FUNCTION {format.authors} |
| 418 |
{ author empty$ |
| 419 |
{ "" } |
| 420 |
% { author format.names } |
| 421 |
|
| 422 |
% { "{\bf " author ".} " * * format.names } % make bold face, end with . |
| 423 |
% doing the above causes trouble! |
| 424 |
% NOTE: we can't put bf here since it messes up the formatting of names! |
| 425 |
|
| 426 |
{ author format.names } % make bold face, end with . |
| 427 |
if$ |
| 428 |
} |
| 429 |
|
| 430 |
FUNCTION {format.key} % this function is just for apalike |
| 431 |
{ empty$ |
| 432 |
{ key field.or.null } |
| 433 |
{ "" } |
| 434 |
if$ |
| 435 |
} |
| 436 |
|
| 437 |
FUNCTION {format.editors} |
| 438 |
{ editor empty$ |
| 439 |
{ "" } |
| 440 |
{ editor format.names |
| 441 |
% editor num.names$ #1 > |
| 442 |
% { ", eds" * } % TDS |
| 443 |
% { ", ed" * } % TDS |
| 444 |
% if$ |
| 445 |
", (ed.)," * % TDS |
| 446 |
} |
| 447 |
if$ |
| 448 |
} |
| 449 |
|
| 450 |
FUNCTION {format.title} |
| 451 |
{ title empty$ |
| 452 |
{ "" } |
| 453 |
{ % decide whether to give the title or not |
| 454 |
givetitles #1 = |
| 455 |
{ title "t" change.case$ } % produce the title |
| 456 |
{ title pop$ "" } % don't produce the title |
| 457 |
if$ |
| 458 |
} |
| 459 |
if$ |
| 460 |
} |
| 461 |
|
| 462 |
FUNCTION {n.dashify} |
| 463 |
{ 't := |
| 464 |
"" |
| 465 |
{ t empty$ not } |
| 466 |
{ t #1 #1 substring$ "-" = |
| 467 |
{ t #1 #2 substring$ "--" = not |
| 468 |
{ "--" * |
| 469 |
t #2 global.max$ substring$ 't := |
| 470 |
} |
| 471 |
{ { t #1 #1 substring$ "-" = } |
| 472 |
{ "-" * |
| 473 |
t #2 global.max$ substring$ 't := |
| 474 |
} |
| 475 |
while$ |
| 476 |
} |
| 477 |
if$ |
| 478 |
} |
| 479 |
{ t #1 #1 substring$ * |
| 480 |
t #2 global.max$ substring$ 't := |
| 481 |
} |
| 482 |
if$ |
| 483 |
} |
| 484 |
while$ |
| 485 |
} |
| 486 |
|
| 487 |
FUNCTION {format.btitle} |
| 488 |
{ title emphasize |
| 489 |
} |
| 490 |
|
| 491 |
FUNCTION {tie.or.space.connect} |
| 492 |
{ duplicate$ text.length$ #3 < |
| 493 |
{ "~" } |
| 494 |
{ " " } |
| 495 |
if$ |
| 496 |
swap$ * * |
| 497 |
} |
| 498 |
|
| 499 |
FUNCTION {either.or.check} |
| 500 |
{ empty$ |
| 501 |
'pop$ |
| 502 |
{ "can't use both " swap$ * " fields in " * cite$ * warning$ } |
| 503 |
if$ |
| 504 |
} |
| 505 |
|
| 506 |
FUNCTION {format.bvolume} |
| 507 |
{ volume empty$ |
| 508 |
{ "" } |
| 509 |
{ "vol." volume tie.or.space.connect % TDS vol, not volume |
| 510 |
series empty$ |
| 511 |
'skip$ |
| 512 |
{ " of " * series emphasize * } |
| 513 |
if$ |
| 514 |
"volume and number" number either.or.check |
| 515 |
} |
| 516 |
if$ |
| 517 |
} |
| 518 |
|
| 519 |
FUNCTION {format.number.series} |
| 520 |
{ volume empty$ |
| 521 |
{ number empty$ |
| 522 |
{ series field.or.null } |
| 523 |
{ output.state mid.sentence = |
| 524 |
{ "number" } |
| 525 |
{ "Number" } |
| 526 |
if$ |
| 527 |
number tie.or.space.connect |
| 528 |
series empty$ |
| 529 |
{ "there's a number but no series in " cite$ * warning$ } |
| 530 |
{ " in " * series * } |
| 531 |
if$ |
| 532 |
} |
| 533 |
if$ |
| 534 |
} |
| 535 |
{ "" } |
| 536 |
if$ |
| 537 |
} |
| 538 |
|
| 539 |
FUNCTION {format.edition} |
| 540 |
{ edition empty$ |
| 541 |
{ "" } |
| 542 |
{ |
| 543 |
output.state mid.sentence = |
| 544 |
{ edition "l" change.case$ } |
| 545 |
{ edition "t" change.case$ } |
| 546 |
if$ |
| 547 |
% If the database has the word 'second' replace it with 2nd for J. Bact! |
| 548 |
"second" = |
| 549 |
{ "2nd"} |
| 550 |
{ |
| 551 |
if$ |
| 552 |
"third" = |
| 553 |
{ "3nd"} |
| 554 |
{ edition } |
| 555 |
} |
| 556 |
|
| 557 |
if$ |
| 558 |
|
| 559 |
" ed." * |
| 560 |
|
| 561 |
% output.state mid.sentence = |
| 562 |
% { edition "l" change.case$ " ed." * } |
| 563 |
% { edition "t" change.case$ " ed." * } |
| 564 |
% if$ |
| 565 |
} |
| 566 |
if$ |
| 567 |
} |
| 568 |
|
| 569 |
INTEGERS { multiresult } |
| 570 |
|
| 571 |
FUNCTION {multi.page.check} |
| 572 |
{ 't := |
| 573 |
#0 'multiresult := |
| 574 |
{ multiresult not |
| 575 |
t empty$ not |
| 576 |
and |
| 577 |
} |
| 578 |
{ t #1 #1 substring$ |
| 579 |
duplicate$ "-" = |
| 580 |
swap$ duplicate$ "," = |
| 581 |
swap$ "+" = |
| 582 |
or or |
| 583 |
{ #1 'multiresult := } |
| 584 |
{ t #2 global.max$ substring$ 't := } |
| 585 |
if$ |
| 586 |
} |
| 587 |
while$ |
| 588 |
multiresult |
| 589 |
} |
| 590 |
|
| 591 |
FUNCTION {format.pages} |
| 592 |
{ pages empty$ |
| 593 |
{ "" } |
| 594 |
{ pages multi.page.check |
| 595 |
% { "pp." pages n.dashify tie.or.space.connect } % TDS |
| 596 |
% for some crazy reason, J.Bact wants p instead of pp |
| 597 |
{ "p." pages n.dashify tie.or.space.connect } % TDS |
| 598 |
{ "p." pages tie.or.space.connect } % TDS |
| 599 |
if$ |
| 600 |
} |
| 601 |
if$ |
| 602 |
} |
| 603 |
|
| 604 |
FUNCTION {format.vol.num.pages} |
| 605 |
{ "{\bf " volume field.or.null * "}" * % make volume bold face |
| 606 |
number empty$ |
| 607 |
'skip$ |
| 608 |
{ " (" number * ")" * * |
| 609 |
volume empty$ |
| 610 |
{ "there's a number but no volume in " cite$ * warning$ } |
| 611 |
'skip$ |
| 612 |
if$ |
| 613 |
} |
| 614 |
if$ |
| 615 |
pages empty$ |
| 616 |
'skip$ |
| 617 |
{ duplicate$ empty$ |
| 618 |
{ pop$ format.pages } |
| 619 |
{ ":" * pages n.dashify * } |
| 620 |
if$ |
| 621 |
} |
| 622 |
if$ |
| 623 |
} |
| 624 |
|
| 625 |
FUNCTION {format.chapter.pages} |
| 626 |
{ chapter empty$ |
| 627 |
'format.pages |
| 628 |
{ type empty$ |
| 629 |
{ "chapter" } |
| 630 |
{ type "l" change.case$ } |
| 631 |
if$ |
| 632 |
chapter tie.or.space.connect |
| 633 |
pages empty$ |
| 634 |
'skip$ |
| 635 |
{ ", " * format.pages * } |
| 636 |
if$ |
| 637 |
} |
| 638 |
if$ |
| 639 |
} |
| 640 |
|
| 641 |
FUNCTION {format.in.ed.booktitle} |
| 642 |
{ booktitle empty$ |
| 643 |
{ "" } |
| 644 |
{ editor empty$ |
| 645 |
{ "In: " emphasize booktitle * } % TDS |
| 646 |
{ "In: " emphasize format.editors " " * * |
| 647 |
booktitle * ", " * |
| 648 |
} % TDS |
| 649 |
if$ |
| 650 |
} |
| 651 |
if$ |
| 652 |
} |
| 653 |
|
| 654 |
FUNCTION {format.thesis.type} |
| 655 |
{ type empty$ |
| 656 |
'skip$ |
| 657 |
{ pop$ |
| 658 |
type "t" change.case$ |
| 659 |
} |
| 660 |
if$ |
| 661 |
} |
| 662 |
|
| 663 |
FUNCTION {format.tr.number} |
| 664 |
{ type empty$ |
| 665 |
{ "Technical Report" } |
| 666 |
'type |
| 667 |
if$ |
| 668 |
number empty$ |
| 669 |
{ "t" change.case$ } |
| 670 |
{ number tie.or.space.connect } |
| 671 |
if$ |
| 672 |
} |
| 673 |
|
| 674 |
FUNCTION {format.article.crossref} |
| 675 |
{ "In:" % this is for apalike % TDS |
| 676 |
" \cite{" * crossref * "}" * |
| 677 |
} |
| 678 |
|
| 679 |
FUNCTION {format.book.crossref} |
| 680 |
{ volume empty$ |
| 681 |
{ "empty volume in " cite$ * "'s crossref of " * crossref * warning$ |
| 682 |
"In: " % TDS |
| 683 |
} |
| 684 |
{ "Volume" volume tie.or.space.connect |
| 685 |
" of " * |
| 686 |
} |
| 687 |
if$ |
| 688 |
"\cite{" * crossref * "}" * % this is for apalike |
| 689 |
} |
| 690 |
|
| 691 |
FUNCTION {format.incoll.inproc.crossref} |
| 692 |
{ "In:" % this is for apalike % TDS |
| 693 |
" \cite{" * crossref * "}" * |
| 694 |
} |
| 695 |
|
| 696 |
FUNCTION {article} |
| 697 |
{ |
| 698 |
cite$ "TitlesOn" = |
| 699 |
'skip$ % Don't write out an article of this kind, it's a toggle switch! |
| 700 |
{ |
| 701 |
output.bibitem |
| 702 |
format.authors "author" output.check |
| 703 |
author format.key output % special for |
| 704 |
output.year.check % apalike |
| 705 |
new.block |
| 706 |
% zzzz |
| 707 |
format.title "title" output.check |
| 708 |
new.block |
| 709 |
crossref missing$ |
| 710 |
{ % figure out the last character of the journal name. |
| 711 |
% "<<" journal #-1 #1 substring$ ">>" * * % for testing |
| 712 |
% "<" journal ">" * * % this works ok % for testing |
| 713 |
|
| 714 |
% from here on the string t will carry the journal title |
| 715 |
journal 't := |
| 716 |
|
| 717 |
% expand journal titles where required by J. Bact! TDS |
| 718 |
t "Nucl. Acids Res." = |
| 719 |
{ "Nucleic Acids Res." 't := } |
| 720 |
'skip$ |
| 721 |
if$ |
| 722 |
|
| 723 |
t "J. Bact." = |
| 724 |
{ "J. Bacteriol." 't := } |
| 725 |
'skip$ |
| 726 |
if$ |
| 727 |
|
| 728 |
t "Bell System Tech. J." = |
| 729 |
{ "Bell Syst. Tech. J." 't := } |
| 730 |
'skip$ |
| 731 |
if$ |
| 732 |
|
| 733 |
t "Molec. Microb." = |
| 734 |
{ "Molec. Microbiol." 't := } |
| 735 |
'skip$ |
| 736 |
if$ |
| 737 |
|
| 738 |
% deal with periods at the ends of titles |
| 739 |
t #-1 #1 substring$ "." = |
| 740 |
{ t } % journal ended in period so don't do anything |
| 741 |
{ t " " *} % NO COMMAS AFTER THE JOURNAL NAME IN J. BACT! |
| 742 |
% { t ", " *} % journal ended without period, so add comma |
| 743 |
if$ |
| 744 |
|
| 745 |
%journal #-1 #1 substring$ "." = |
| 746 |
%{ journal } % journal ended in period so don't do anything |
| 747 |
%{ journal ", " *} % journal ended without period, so add comma |
| 748 |
%if$ |
| 749 |
|
| 750 |
% emphasize "journal" output.check % TDS |
| 751 |
"journal" output.check % not emphasized any more |
| 752 |
|
| 753 |
% journal * emphasize "journal" output.check % the original method |
| 754 |
|
| 755 |
format.vol.num.pages output |
| 756 |
} |
| 757 |
{ format.article.crossref output.nonnull |
| 758 |
format.pages output |
| 759 |
} |
| 760 |
if$ |
| 761 |
new.block |
| 762 |
note output |
| 763 |
fin.entry |
| 764 |
} |
| 765 |
if$ |
| 766 |
} |
| 767 |
|
| 768 |
FUNCTION {book} |
| 769 |
{ output.bibitem |
| 770 |
author empty$ |
| 771 |
{ format.editors "author and editor" output.check |
| 772 |
editor format.key output |
| 773 |
} |
| 774 |
{ format.authors output.nonnull |
| 775 |
crossref missing$ |
| 776 |
{ "author and editor" editor either.or.check } |
| 777 |
'skip$ |
| 778 |
if$ |
| 779 |
} |
| 780 |
if$ |
| 781 |
output.year.check % special for apalike |
| 782 |
new.block |
| 783 |
format.btitle "title" output.check |
| 784 |
#1 'docomma := % TURN COMMAS ON FOR JMB |
| 785 |
crossref missing$ |
| 786 |
{ |
| 787 |
format.bvolume output |
| 788 |
new.block |
| 789 |
format.number.series output |
| 790 |
format.edition output |
| 791 |
new.sentence |
| 792 |
#0 'docomma := % no comma after address |
| 793 |
% publisher "publisher" % TDS |
| 794 |
% address output output.check % TDS |
| 795 |
#1 'docomma := % comma back on |
| 796 |
publisher "publisher" output.check |
| 797 |
address output |
| 798 |
} |
| 799 |
{ new.block |
| 800 |
format.book.crossref output.nonnull |
| 801 |
} |
| 802 |
if$ |
| 803 |
% format.edition output |
| 804 |
new.block |
| 805 |
note output |
| 806 |
fin.entry |
| 807 |
#0 'docomma := % TURN COMMAS OFF |
| 808 |
} |
| 809 |
|
| 810 |
FUNCTION {booklet} |
| 811 |
{ output.bibitem |
| 812 |
format.authors output |
| 813 |
author format.key output % special for |
| 814 |
output.year.check % apalike |
| 815 |
new.block |
| 816 |
format.title "title" output.check |
| 817 |
new.block |
| 818 |
howpublished output |
| 819 |
address output |
| 820 |
new.block |
| 821 |
note output |
| 822 |
fin.entry |
| 823 |
} |
| 824 |
|
| 825 |
FUNCTION {inbook} |
| 826 |
{ output.bibitem |
| 827 |
author empty$ |
| 828 |
{ format.editors "author and editor" output.check |
| 829 |
editor format.key output |
| 830 |
} |
| 831 |
{ format.authors output.nonnull |
| 832 |
crossref missing$ |
| 833 |
{ "author and editor" editor either.or.check } |
| 834 |
'skip$ |
| 835 |
if$ |
| 836 |
} |
| 837 |
if$ |
| 838 |
output.year.check % special for apalike |
| 839 |
new.block |
| 840 |
format.btitle "title" output.check |
| 841 |
crossref missing$ |
| 842 |
{ format.bvolume output |
| 843 |
format.chapter.pages "chapter and pages" output.check |
| 844 |
new.block |
| 845 |
format.number.series output |
| 846 |
new.sentence |
| 847 |
#0 'docomma := % no comma after address |
| 848 |
address ":" * output % TDS |
| 849 |
publisher "publisher" output.check % TDS |
| 850 |
#1 'docomma := % comma back on |
| 851 |
% publisher "publisher" output.check |
| 852 |
% address output |
| 853 |
} |
| 854 |
{ format.chapter.pages "chapter and pages" output.check |
| 855 |
new.block |
| 856 |
format.book.crossref output.nonnull |
| 857 |
} |
| 858 |
if$ |
| 859 |
format.edition output |
| 860 |
new.block |
| 861 |
note output |
| 862 |
fin.entry |
| 863 |
} |
| 864 |
|
| 865 |
FUNCTION {incollection} |
| 866 |
{ output.bibitem |
| 867 |
format.authors "author" output.check |
| 868 |
author format.key output % special for |
| 869 |
output.year.check % apalike |
| 870 |
new.block |
| 871 |
format.title "title" output.check |
| 872 |
new.block |
| 873 |
crossref missing$ |
| 874 |
{ format.in.ed.booktitle "booktitle" output.check |
| 875 |
format.bvolume output |
| 876 |
format.number.series output |
| 877 |
format.chapter.pages output |
| 878 |
new.sentence |
| 879 |
publisher "publisher" output.check |
| 880 |
address output |
| 881 |
format.edition output |
| 882 |
} |
| 883 |
{ format.incoll.inproc.crossref output.nonnull |
| 884 |
format.chapter.pages output |
| 885 |
} |
| 886 |
if$ |
| 887 |
new.block |
| 888 |
note output |
| 889 |
fin.entry |
| 890 |
} |
| 891 |
|
| 892 |
FUNCTION {inproceedings} |
| 893 |
{ output.bibitem |
| 894 |
format.authors "author" output.check |
| 895 |
author format.key output % special for |
| 896 |
output.year.check % apalike |
| 897 |
new.block |
| 898 |
% NOTE: they want a comma after the title, but that would mess |
| 899 |
% up the period after other titles. |
| 900 |
format.title "title" output.check |
| 901 |
new.block |
| 902 |
crossref missing$ |
| 903 |
{ |
| 904 |
% #1 'docomma := % TURN COMMAS ON FOR JMB, BUT NOT FOR JTB: inconsistent |
| 905 |
|
| 906 |
format.pages |
| 907 |
pages empty$ |
| 908 |
{ output } |
| 909 |
{ "." * output } % TDS toss in period |
| 910 |
if$ |
| 911 |
|
| 912 |
format.in.ed.booktitle "booktitle" output.check |
| 913 |
format.bvolume "." * output |
| 914 |
format.number.series output |
| 915 |
|
| 916 |
% address output % TDS address is below for JTB |
| 917 |
% new.sentence % TDS remove period |
| 918 |
organization output |
| 919 |
#0 'docomma := % NO COMMA AFTER ADDRESS |
| 920 |
publisher "," * output % TDS |
| 921 |
% publisher "publisher" output % TDS |
| 922 |
address output % TDS |
| 923 |
#1 'docomma := % comma back on |
| 924 |
|
| 925 |
% publisher output % are simpler |
| 926 |
#0 'docomma := % TURN COMMAS OFF |
| 927 |
} |
| 928 |
{ format.incoll.inproc.crossref output.nonnull |
| 929 |
format.pages output |
| 930 |
} |
| 931 |
if$ |
| 932 |
new.block |
| 933 |
note output |
| 934 |
fin.entry |
| 935 |
} |
| 936 |
|
| 937 |
FUNCTION {conference} { inproceedings } |
| 938 |
|
| 939 |
FUNCTION {manual} |
| 940 |
{ output.bibitem |
| 941 |
format.authors output |
| 942 |
author format.key output % special for |
| 943 |
output.year.check % apalike |
| 944 |
new.block |
| 945 |
format.btitle "title" output.check |
| 946 |
organization address new.block.checkb |
| 947 |
organization output |
| 948 |
address output |
| 949 |
format.edition output |
| 950 |
new.block |
| 951 |
note output |
| 952 |
fin.entry |
| 953 |
} |
| 954 |
|
| 955 |
FUNCTION {mastersthesis} |
| 956 |
{ output.bibitem |
| 957 |
format.authors "author" output.check |
| 958 |
author format.key output % special for |
| 959 |
output.year.check % apalike |
| 960 |
new.block |
| 961 |
format.title "title" output.check |
| 962 |
new.block |
| 963 |
"Master's thesis" format.thesis.type output.nonnull |
| 964 |
school "school" output.check |
| 965 |
address output |
| 966 |
new.block |
| 967 |
note output |
| 968 |
fin.entry |
| 969 |
} |
| 970 |
|
| 971 |
FUNCTION {misc} |
| 972 |
{ output.bibitem |
| 973 |
format.authors output |
| 974 |
author format.key output % special for |
| 975 |
output.year.check % apalike |
| 976 |
new.block |
| 977 |
format.title output |
| 978 |
new.block |
| 979 |
howpublished output |
| 980 |
new.block |
| 981 |
note output |
| 982 |
fin.entry |
| 983 |
} |
| 984 |
|
| 985 |
FUNCTION {phdthesis} |
| 986 |
{ output.bibitem |
| 987 |
format.authors "author" output.check |
| 988 |
author format.key output % special for |
| 989 |
output.year.check % apalike |
| 990 |
new.block |
| 991 |
format.btitle "title" output.check |
| 992 |
new.block |
| 993 |
"PhD thesis" format.thesis.type output.nonnull |
| 994 |
school "school" output.check |
| 995 |
address output |
| 996 |
new.block |
| 997 |
note output |
| 998 |
fin.entry |
| 999 |
} |
| 1000 |
|
| 1001 |
FUNCTION {proceedings} |
| 1002 |
{ output.bibitem |
| 1003 |
format.editors output |
| 1004 |
editor format.key output % special for |
| 1005 |
output.year.check % apalike |
| 1006 |
new.block |
| 1007 |
format.btitle "title" output.check |
| 1008 |
format.bvolume output |
| 1009 |
format.number.series output |
| 1010 |
address output % for apalike |
| 1011 |
new.sentence % we always output |
| 1012 |
organization output % a nonempty organization |
| 1013 |
publisher output % here |
| 1014 |
new.block |
| 1015 |
note output |
| 1016 |
fin.entry |
| 1017 |
} |
| 1018 |
|
| 1019 |
FUNCTION {techreport} |
| 1020 |
{ output.bibitem |
| 1021 |
format.authors "author" output.check |
| 1022 |
author format.key output % special for |
| 1023 |
output.year.check % apalike |
| 1024 |
new.block |
| 1025 |
format.title "title" output.check |
| 1026 |
new.block |
| 1027 |
format.tr.number output.nonnull |
| 1028 |
institution "institution" output.check |
| 1029 |
address output |
| 1030 |
new.block |
| 1031 |
note output |
| 1032 |
fin.entry |
| 1033 |
} |
| 1034 |
|
| 1035 |
FUNCTION {unpublished} |
| 1036 |
{ output.bibitem |
| 1037 |
format.authors "author" output.check |
| 1038 |
author format.key output % special for |
| 1039 |
output.year.check % apalike |
| 1040 |
new.block |
| 1041 |
|
| 1042 |
% Since format.title is out of commission, the original method won't work: |
| 1043 |
% format.title "title" output.check |
| 1044 |
% so do the equivalent of the format.title procedure: (TDS) |
| 1045 |
title empty$ |
| 1046 |
{ "" } |
| 1047 |
{ title "t" change.case$ } % produce the title |
| 1048 |
if$ |
| 1049 |
"title" output.check |
| 1050 |
|
| 1051 |
new.block |
| 1052 |
note "note" output.check |
| 1053 |
fin.entry |
| 1054 |
} |
| 1055 |
|
| 1056 |
FUNCTION {default.type} { misc } |
| 1057 |
|
| 1058 |
MACRO {jan} {"January"} |
| 1059 |
|
| 1060 |
MACRO {feb} {"February"} |
| 1061 |
|
| 1062 |
MACRO {mar} {"March"} |
| 1063 |
|
| 1064 |
MACRO {apr} {"April"} |
| 1065 |
|
| 1066 |
MACRO {may} {"May"} |
| 1067 |
|
| 1068 |
MACRO {jun} {"June"} |
| 1069 |
|
| 1070 |
MACRO {jul} {"July"} |
| 1071 |
|
| 1072 |
MACRO {aug} {"August"} |
| 1073 |
|
| 1074 |
MACRO {sep} {"September"} |
| 1075 |
|
| 1076 |
MACRO {oct} {"October"} |
| 1077 |
|
| 1078 |
MACRO {nov} {"November"} |
| 1079 |
|
| 1080 |
MACRO {dec} {"December"} |
| 1081 |
|
| 1082 |
MACRO {acmcs} {"ACM Computing Surveys"} |
| 1083 |
|
| 1084 |
MACRO {acta} {"Acta Informatica"} |
| 1085 |
|
| 1086 |
MACRO {cacm} {"Communications of the ACM"} |
| 1087 |
|
| 1088 |
MACRO {ibmjrd} {"IBM Journal of Research and Development"} |
| 1089 |
|
| 1090 |
MACRO {ibmsj} {"IBM Systems Journal"} |
| 1091 |
|
| 1092 |
MACRO {ieeese} {"IEEE Transactions on Software Engineering"} |
| 1093 |
|
| 1094 |
MACRO {ieeetc} {"IEEE Transactions on Computers"} |
| 1095 |
|
| 1096 |
MACRO {ieeetcad} |
| 1097 |
{"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} |
| 1098 |
|
| 1099 |
MACRO {ipl} {"Information Processing Letters"} |
| 1100 |
|
| 1101 |
MACRO {jacm} {"Journal of the ACM"} |
| 1102 |
|
| 1103 |
MACRO {jcss} {"Journal of Computer and System Sciences"} |
| 1104 |
|
| 1105 |
MACRO {scp} {"Science of Computer Programming"} |
| 1106 |
|
| 1107 |
MACRO {sicomp} {"SIAM Journal on Computing"} |
| 1108 |
|
| 1109 |
MACRO {tocs} {"ACM Transactions on Computer Systems"} |
| 1110 |
|
| 1111 |
MACRO {tods} {"ACM Transactions on Database Systems"} |
| 1112 |
|
| 1113 |
MACRO {tog} {"ACM Transactions on Graphics"} |
| 1114 |
|
| 1115 |
MACRO {toms} {"ACM Transactions on Mathematical Software"} |
| 1116 |
|
| 1117 |
MACRO {toois} {"ACM Transactions on Office Information Systems"} |
| 1118 |
|
| 1119 |
MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} |
| 1120 |
|
| 1121 |
MACRO {tcs} {"Theoretical Computer Science"} |
| 1122 |
|
| 1123 |
READ |
| 1124 |
|
| 1125 |
% *********************************************************** |
| 1126 |
|
| 1127 |
FUNCTION {check.for.titlecommand} |
| 1128 |
% go through each entry and see if one of them has the key |
| 1129 |
% 'TitlesOn'. If this is found, then do titles! |
| 1130 |
% 1989 November 18 TDS |
| 1131 |
{ |
| 1132 |
% "|" label "|" * * write$ newline$ % |Arrhenius {\em et~al.}, 1986| |
| 1133 |
% "|" cite$ "|" * * write$ newline$ % |Arrhenius1986| |
| 1134 |
% so cite$ is the thing I want to detect... |
| 1135 |
|
| 1136 |
cite$ "TitlesOn" = |
| 1137 |
{ % got it! |
| 1138 |
% "FOUND TitlesOn" write$ newline$ |
| 1139 |
"Titles Will Be Printed" warning$ |
| 1140 |
#1 'givetitles := % give titles! |
| 1141 |
} |
| 1142 |
'skip$ |
| 1143 |
if$ |
| 1144 |
} |
| 1145 |
EXECUTE {init.toggle.switches} |
| 1146 |
ITERATE {check.for.titlecommand} |
| 1147 |
% *********************************************************** |
| 1148 |
|
| 1149 |
FUNCTION {sortify} |
| 1150 |
{ purify$ |
| 1151 |
"l" change.case$ |
| 1152 |
} |
| 1153 |
|
| 1154 |
INTEGERS { len } |
| 1155 |
|
| 1156 |
FUNCTION {chop.word} |
| 1157 |
{ 's := |
| 1158 |
'len := |
| 1159 |
s #1 len substring$ = |
| 1160 |
{ s len #1 + global.max$ substring$ } |
| 1161 |
's |
| 1162 |
if$ |
| 1163 |
} |
| 1164 |
|
| 1165 |
% There are three apalike cases: one person (Jones), |
| 1166 |
% two (Jones and de~Bruijn), and more (Jones et~al.). |
| 1167 |
% This function is much like format.crossref.editors. |
| 1168 |
% |
| 1169 |
FUNCTION {format.lab.names} |
| 1170 |
{ 's := |
| 1171 |
s #1 "{vv~}{ll}" format.name$ |
| 1172 |
s num.names$ duplicate$ |
| 1173 |
#2 > |
| 1174 |
{ pop$ " {\em et~al.}" * } |
| 1175 |
{ #2 < |
| 1176 |
'skip$ |
| 1177 |
{ s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = |
| 1178 |
{ " {\em et~al.}" * } |
| 1179 |
{ " and " * s #2 "{vv~}{ll}" format.name$ * } % TDS |
| 1180 |
% well, back to 'and'! |
| 1181 |
% { " \& " * s #2 "{vv~}{ll}" format.name$ * } |
| 1182 |
% note new use of & rather than `and'. TDS |
| 1183 |
if$ |
| 1184 |
} |
| 1185 |
if$ |
| 1186 |
} |
| 1187 |
if$ |
| 1188 |
} |
| 1189 |
|
| 1190 |
FUNCTION {author.key.label} |
| 1191 |
{ author empty$ |
| 1192 |
{ key empty$ |
| 1193 |
{ cite$ #1 #3 substring$ } |
| 1194 |
'key % apalike uses the whole key |
| 1195 |
if$ |
| 1196 |
} |
| 1197 |
{ author format.lab.names } |
| 1198 |
if$ |
| 1199 |
} |
| 1200 |
|
| 1201 |
FUNCTION {author.editor.key.label} |
| 1202 |
{ author empty$ |
| 1203 |
{ editor empty$ |
| 1204 |
{ key empty$ |
| 1205 |
{ cite$ #1 #3 substring$ } |
| 1206 |
'key % apalike uses the whole key |
| 1207 |
if$ |
| 1208 |
} |
| 1209 |
{ editor format.lab.names } |
| 1210 |
if$ |
| 1211 |
} |
| 1212 |
{ author format.lab.names } |
| 1213 |
if$ |
| 1214 |
} |
| 1215 |
|
| 1216 |
FUNCTION {editor.key.label} |
| 1217 |
{ editor empty$ |
| 1218 |
{ key empty$ |
| 1219 |
{ cite$ #1 #3 substring$ } |
| 1220 |
'key % apalike uses the whole key, no organization |
| 1221 |
if$ |
| 1222 |
} |
| 1223 |
{ editor format.lab.names } |
| 1224 |
if$ |
| 1225 |
} |
| 1226 |
|
| 1227 |
FUNCTION {calc.label} |
| 1228 |
{ type$ "book" = |
| 1229 |
type$ "inbook" = |
| 1230 |
or |
| 1231 |
'author.editor.key.label |
| 1232 |
{ type$ "proceedings" = |
| 1233 |
'editor.key.label % apalike ignores organization |
| 1234 |
'author.key.label % for labeling and sorting |
| 1235 |
if$ |
| 1236 |
} |
| 1237 |
if$ |
| 1238 |
", " % these three lines are |
| 1239 |
* % for apalike, which |
| 1240 |
year field.or.null purify$ #-1 #4 substring$ % uses all four digits |
| 1241 |
* |
| 1242 |
'label := |
| 1243 |
} |
| 1244 |
|
| 1245 |
FUNCTION {sort.format.names} |
| 1246 |
{ 's := |
| 1247 |
#1 'nameptr := |
| 1248 |
"" |
| 1249 |
s num.names$ 'numnames := |
| 1250 |
numnames 'namesleft := |
| 1251 |
{ namesleft #0 > } |
| 1252 |
{ nameptr #1 > |
| 1253 |
{ " " * } |
| 1254 |
'skip$ |
| 1255 |
if$ % apalike uses initials |
| 1256 |
s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := % <= here |
| 1257 |
nameptr numnames = t "others" = and |
| 1258 |
{ "{\em et al}" * } |
| 1259 |
{ t sortify * } |
| 1260 |
if$ |
| 1261 |
nameptr #1 + 'nameptr := |
| 1262 |
namesleft #1 - 'namesleft := |
| 1263 |
} |
| 1264 |
while$ |
| 1265 |
} |
| 1266 |
|
| 1267 |
FUNCTION {sort.format.title} |
| 1268 |
{ 't := |
| 1269 |
"A " #2 |
| 1270 |
"An " #3 |
| 1271 |
"The " #4 t chop.word |
| 1272 |
chop.word |
| 1273 |
chop.word |
| 1274 |
sortify |
| 1275 |
#1 global.max$ substring$ |
| 1276 |
} |
| 1277 |
|
| 1278 |
FUNCTION {author.sort} |
| 1279 |
{ author empty$ |
| 1280 |
{ key empty$ |
| 1281 |
{ "to sort, need author or key in " cite$ * warning$ |
| 1282 |
"" |
| 1283 |
} |
| 1284 |
{ key sortify } |
| 1285 |
if$ |
| 1286 |
} |
| 1287 |
{ author sort.format.names } |
| 1288 |
if$ |
| 1289 |
} |
| 1290 |
|
| 1291 |
FUNCTION {author.editor.sort} |
| 1292 |
{ author empty$ |
| 1293 |
{ editor empty$ |
| 1294 |
{ key empty$ |
| 1295 |
{ "to sort, need author, editor, or key in " cite$ * warning$ |
| 1296 |
"" |
| 1297 |
} |
| 1298 |
{ key sortify } |
| 1299 |
if$ |
| 1300 |
} |
| 1301 |
{ editor sort.format.names } |
| 1302 |
if$ |
| 1303 |
} |
| 1304 |
{ author sort.format.names } |
| 1305 |
if$ |
| 1306 |
} |
| 1307 |
|
| 1308 |
FUNCTION {editor.sort} |
| 1309 |
{ editor empty$ |
| 1310 |
{ key empty$ |
| 1311 |
{ "to sort, need editor or key in " cite$ * warning$ |
| 1312 |
"" |
| 1313 |
} |
| 1314 |
{ key sortify } |
| 1315 |
if$ |
| 1316 |
} |
| 1317 |
{ editor sort.format.names } |
| 1318 |
if$ |
| 1319 |
} |
| 1320 |
|
| 1321 |
% apalike uses two sorting passes; the first one sets the |
| 1322 |
% labels so that the `a's, `b's, etc. can be computed; |
| 1323 |
% the second pass puts the references in "correct" order. |
| 1324 |
% The presort function is for the first pass. It computes |
| 1325 |
% label, sort.label, and title, and then concatenates. |
| 1326 |
FUNCTION {presort} |
| 1327 |
{ calc.label |
| 1328 |
label sortify |
| 1329 |
" " |
| 1330 |
* |
| 1331 |
type$ "book" = |
| 1332 |
type$ "inbook" = |
| 1333 |
or |
| 1334 |
'author.editor.sort |
| 1335 |
{ type$ "proceedings" = |
| 1336 |
'editor.sort |
| 1337 |
'author.sort |
| 1338 |
if$ |
| 1339 |
} |
| 1340 |
if$ |
| 1341 |
#1 entry.max$ substring$ % for |
| 1342 |
'sort.label := % apalike |
| 1343 |
sort.label % style |
| 1344 |
* |
| 1345 |
" " |
| 1346 |
* |
| 1347 |
title field.or.null |
| 1348 |
sort.format.title |
| 1349 |
* |
| 1350 |
#1 entry.max$ substring$ |
| 1351 |
'sort.key$ := |
| 1352 |
} |
| 1353 |
|
| 1354 |
ITERATE {presort} |
| 1355 |
|
| 1356 |
SORT % by label, sort.label, title---for final label calculation |
| 1357 |
|
| 1358 |
STRINGS { last.label next.extra } % apalike labels are only for the text; |
| 1359 |
|
| 1360 |
INTEGERS { last.extra.num } % there are none in the bibliography |
| 1361 |
|
| 1362 |
FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label' |
| 1363 |
{ #0 int.to.chr$ 'last.label := |
| 1364 |
"" 'next.extra := |
| 1365 |
#0 'last.extra.num := |
| 1366 |
} |
| 1367 |
|
| 1368 |
FUNCTION {forward.pass} |
| 1369 |
% pass through the references forward |
| 1370 |
{ |
| 1371 |
%"\\ label=" label "//" * * write$ newline$ % display the label |
| 1372 |
%"\\last.label=" last.label "//" * * write$ newline$ % display the label |
| 1373 |
|
| 1374 |
last.label label = % if the label repeats the previous label... |
| 1375 |
{ % then increment the extra number |
| 1376 |
last.extra.num #1 + 'last.extra.num := |
| 1377 |
% and convert it to a label |
| 1378 |
last.extra.num int.to.chr$ 'extra.label := |
| 1379 |
} |
| 1380 |
{ % else set things up for the next entry |
| 1381 |
"a" chr.to.int$ 'last.extra.num := |
| 1382 |
|
| 1383 |
% However, if the year was missing, tack on an extra "a". TDS |
| 1384 |
year empty$ |
| 1385 |
{"a" 'extra.label :=} |
| 1386 |
{"" 'extra.label :=} |
| 1387 |
if$ |
| 1388 |
|
| 1389 |
% "" 'extra.label := % the original method was not to do anything TDS |
| 1390 |
|
| 1391 |
label 'last.label := % capture this label for next time |
| 1392 |
} |
| 1393 |
if$ |
| 1394 |
%"\\extra.label = " extra.label "//" * * write$ newline$ % display the label |
| 1395 |
} |
| 1396 |
|
| 1397 |
FUNCTION {reverse.pass} |
| 1398 |
% pass through the references backwards |
| 1399 |
% add extra characters to the end of the label string |
| 1400 |
{ |
| 1401 |
%"{{" label "}}" * * write$ newline$ % display the label |
| 1402 |
next.extra "b" = |
| 1403 |
% original logic: |
| 1404 |
{ "a" 'extra.label := } |
| 1405 |
'skip$ |
| 1406 |
if$ |
| 1407 |
|
| 1408 |
% next.extra "b" = { "next.extra was = b" write$ newline$} 'skip$ if$ |
| 1409 |
|
| 1410 |
% new as of 1989 Oct 18 |
| 1411 |
% { "a" 'extra.label := } |
| 1412 |
% { % Put on an "a" at the end of the label if the year is missing. TDS |
| 1413 |
% year empty$ |
| 1414 |
% { "a" 'extra.label := } |
| 1415 |
% %{ label "a" * 'label := } |
| 1416 |
% 'skip$ % otherwise leave it alone (orignial method) |
| 1417 |
% if$ } |
| 1418 |
% if$ |
| 1419 |
|
| 1420 |
label extra.label * 'label := |
| 1421 |
extra.label 'next.extra := |
| 1422 |
%"{{" label "}}" * * write$ newline$ % display the label |
| 1423 |
} |
| 1424 |
|
| 1425 |
FUNCTION {bib.sort.order} |
| 1426 |
% Generate the sort.key$ variables for sorting. |
| 1427 |
% The sorting is first on the sort.label (ie, author's name), followed |
| 1428 |
% by the year then the title. If there is no year, the cite$ is used. |
| 1429 |
{ |
| 1430 |
sort.label % this is based on the author name |
| 1431 |
" " * % tack on some space |
| 1432 |
% original apa command was to use the year or an empty string: |
| 1433 |
% year field.or.null sortify |
| 1434 |
% |
| 1435 |
% Replace that with the use of the cite$, when there is no year: |
| 1436 |
year duplicate$ empty$ |
| 1437 |
{pop$ cite$} |
| 1438 |
'skip$ |
| 1439 |
if$ |
| 1440 |
|
| 1441 |
* " " * % tack on some space |
| 1442 |
|
| 1443 |
% I CAN'T STAND SORTING ON TITLE!!! TDS 1989 Dec 5 |
| 1444 |
% title field.or.null |
| 1445 |
% sort.format.title |
| 1446 |
% * % attach them together |
| 1447 |
cite$ |
| 1448 |
* % use cite$ instead!! |
| 1449 |
|
| 1450 |
% note: if there is no year, then the cite$ will override the sorting |
| 1451 |
% on the title. Oh well. Title sorting is sorta (ha ha) awful. |
| 1452 |
|
| 1453 |
#1 entry.max$ substring$ |
| 1454 |
'sort.key$ := |
| 1455 |
|
| 1456 |
% The following line helps debug the program. It shows what the sort.key$ is. |
| 1457 |
% "%" sort.key$ * write$ newline$ |
| 1458 |
} |
| 1459 |
|
| 1460 |
% Here is the place that the actual executions of the labeling and sorting |
| 1461 |
% functions are done. |
| 1462 |
|
| 1463 |
|
| 1464 |
EXECUTE {initialize.extra.label.stuff} % initialize variables |
| 1465 |
ITERATE {bib.sort.order} % set up the sorting keys |
| 1466 |
SORT % by sort.label, year, title---giving final bibliography order |
| 1467 |
% Having sorted NOW we apply the extra letters at the end! |
| 1468 |
ITERATE {forward.pass} |
| 1469 |
REVERSE {reverse.pass} |
| 1470 |
|
| 1471 |
FUNCTION {begin.bib} |
| 1472 |
{ preamble$ empty$ % no \etalchar in apalike |
| 1473 |
'skip$ |
| 1474 |
{ preamble$ write$ newline$ } |
| 1475 |
if$ |
| 1476 |
"\begin{thebibliography}{}" write$ newline$ % no labels in apalike |
| 1477 |
} |
| 1478 |
|
| 1479 |
EXECUTE {begin.bib} |
| 1480 |
|
| 1481 |
EXECUTE {init.state.consts} |
| 1482 |
|
| 1483 |
ITERATE {call.type$} |
| 1484 |
|
| 1485 |
FUNCTION {end.bib} |
| 1486 |
{ newline$ |
| 1487 |
"\end{thebibliography}" write$ newline$ |
| 1488 |
} |
| 1489 |
|
| 1490 |
EXECUTE {end.bib} |