| 1 |
% apalike-ejor v1.2.0 |
| 2 |
% Copyright (C) 2021 Adam Rumpf |
| 3 |
% |
| 4 |
% BibTeX `apalike-ejor' bibliography style, forked from the `apalike' style, |
| 5 |
% version 0.99a, by Oren Patashnik. The original copyright and documentation |
| 6 |
% are included below. |
| 7 |
% |
| 8 |
% This is a lightly modified APA-like bibliography style made in accordance |
| 9 |
% with the European Journal of Operational Research reference style guidelines |
| 10 |
% <https://www.elsevier.com/journals/european-journal-of-operational-research/ |
| 11 |
% 0377-2217/guide-for-authors> |
| 12 |
% |
| 13 |
% Specific deviations from the original apalike settings include the following: |
| 14 |
% - Changed `and' to `\&' in lists of multiple authors. |
| 15 |
% - Changed `:' to `, ' between volume number and page numbers. |
| 16 |
% - Added a hyperlinked URL field (requires hyperref). |
| 17 |
% - Added a hyperlinked DOI field (requires hyperref). If both the DOI and |
| 18 |
% URL fields are present, the DOI is preferred. |
| 19 |
% - Removed address information from publisher names. |
| 20 |
% - Removed editor information, publisher information, and the words "In" and |
| 21 |
% "pages" from conference proceedings. |
| 22 |
% - Removed thesis label and address from theses. |
| 23 |
% - Book edition numbers are in parentheses following the title, and |
| 24 |
% abbreviated "edition" to "ed.". |
| 25 |
% - Added an optional chapter number for books. |
| 26 |
% - Added a new dataset field for misc references. If it contains any value |
| 27 |
% besides "0" or "false", the string "[dataset]" is prepended to the |
| 28 |
% reference. |
| 29 |
% - Moved the note field to the end of references (except for unpublished). |
| 30 |
% |
| 31 |
% ============================================================================= |
| 32 |
% |
| 33 |
% BibTeX `apalike' bibliography style (version 0.99a, 8-Dec-10), adapted from |
| 34 |
% the `alpha' style, version 0.99a; for BibTeX version 0.99a. |
| 35 |
% |
| 36 |
% Copyright (C) 1988, 2010 Oren Patashnik. |
| 37 |
% Unlimited copying and redistribution of this file are permitted as long as |
| 38 |
% it is unmodified. Modifications (and redistribution of modified versions) |
| 39 |
% are also permitted, but only if the resulting file is renamed. |
| 40 |
% |
| 41 |
% Differences between this style and `alpha' are generally heralded by a `%'. |
| 42 |
% The file btxbst.doc has the documentation for alpha.bst. |
| 43 |
% |
| 44 |
% This style should be used with the `apalike' LaTeX style (apalike.sty). |
| 45 |
% \cite's come out like "(Jones, 1986)" in the text but there are no labels |
| 46 |
% in the bibliography, and something like "(1986)" comes out immediately |
| 47 |
% after the author. Author (and editor) names appear as last name, comma, |
| 48 |
% initials. A `year' field is required for every entry, and so is either |
| 49 |
% an author (or in some cases, an editor) field or a key field. |
| 50 |
% |
| 51 |
% Editorial note: |
| 52 |
% Many journals require a style like `apalike', but I strongly, strongly, |
| 53 |
% strongly recommend that you not use it if you have a choice---use something |
| 54 |
% like `plain' instead. Mary-Claire van Leunen (A Handbook for Scholars, |
| 55 |
% Knopf, 1979) argues convincingly that a style like `plain' encourages better |
| 56 |
% writing than one like `apalike'. Furthermore the strongest arguments for |
| 57 |
% using an author-date style like `apalike'---that it's "the most practical" |
| 58 |
% (The Chicago Manual of Style, University of Chicago Press, thirteenth |
| 59 |
% edition, 1982, pages 400--401)---fall flat on their face with the new |
| 60 |
% computer-typesetting technology. For instance page 401 anachronistically |
| 61 |
% states "The chief disadvantage of [a style like `plain'] is that additions |
| 62 |
% or deletions cannot be made after the manuscript is typed without changing |
| 63 |
% numbers in both text references and list." LaTeX sidesteps the disadvantage. |
| 64 |
% |
| 65 |
% History: |
| 66 |
% 15-sep-86 (OP) Original version by Oren Patashnik, ideas from Susan King. |
| 67 |
% 10-nov-86 (OP) Truncated the sort.key$ string to the correct length |
| 68 |
% in bib.sort.order to eliminate error message. |
| 69 |
% 24-jan-88 (OP) Updated for BibTeX version 0.99a, from alpha.bst 0.99a; |
| 70 |
% apalike now sorts by author, then year, then title; |
| 71 |
% THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i. |
| 72 |
% 8-dec-10 (OP) Still version 0.99a, as the code itself was unchanged; |
| 73 |
% this release clarified the license. |
| 74 |
% 18-jun-21 (AR) Modifications made by Adam Rumpf to comply with the EJOR |
| 75 |
% bibliography style guide. |
| 76 |
% 21-jun-21 (AR) Modified misc formatting and added dataset field support. |
| 77 |
|
| 78 |
ENTRY |
| 79 |
{ address |
| 80 |
author |
| 81 |
booktitle |
| 82 |
chapter |
| 83 |
dataset % unique field added for apalike-ejor |
| 84 |
doi % added for apalike-ejor |
| 85 |
edition |
| 86 |
editor |
| 87 |
howpublished |
| 88 |
institution |
| 89 |
journal |
| 90 |
key |
| 91 |
% month not used in apalike |
| 92 |
note |
| 93 |
number |
| 94 |
organization |
| 95 |
pages |
| 96 |
publisher |
| 97 |
school |
| 98 |
series |
| 99 |
title |
| 100 |
type |
| 101 |
url % added for apalike-ejor |
| 102 |
volume |
| 103 |
year |
| 104 |
} |
| 105 |
{} |
| 106 |
{ label extra.label sort.label } |
| 107 |
|
| 108 |
INTEGERS { output.state before.all mid.sentence after.sentence after.block } |
| 109 |
|
| 110 |
FUNCTION {init.state.consts} |
| 111 |
{ #0 'before.all := |
| 112 |
#1 'mid.sentence := |
| 113 |
#2 'after.sentence := |
| 114 |
#3 'after.block := |
| 115 |
} |
| 116 |
|
| 117 |
STRINGS { s t } |
| 118 |
|
| 119 |
FUNCTION {output.nonnull} |
| 120 |
{ 's := |
| 121 |
output.state mid.sentence = |
| 122 |
{ ", " * write$ } |
| 123 |
{ output.state after.block = |
| 124 |
{ add.period$ write$ |
| 125 |
newline$ |
| 126 |
"\newblock " write$ |
| 127 |
} |
| 128 |
{ output.state before.all = |
| 129 |
'write$ |
| 130 |
{ add.period$ " " * write$ } |
| 131 |
if$ |
| 132 |
} |
| 133 |
if$ |
| 134 |
mid.sentence 'output.state := |
| 135 |
} |
| 136 |
if$ |
| 137 |
s |
| 138 |
} |
| 139 |
|
| 140 |
FUNCTION {output} |
| 141 |
{ duplicate$ empty$ |
| 142 |
'pop$ |
| 143 |
'output.nonnull |
| 144 |
if$ |
| 145 |
} |
| 146 |
|
| 147 |
FUNCTION {output.check} |
| 148 |
{ 't := |
| 149 |
duplicate$ empty$ |
| 150 |
{ pop$ "empty " t * " in " * cite$ * warning$ } |
| 151 |
'output.nonnull |
| 152 |
if$ |
| 153 |
} |
| 154 |
|
| 155 |
% apalike needs this function because |
| 156 |
% the year has special punctuation; |
| 157 |
% apalike ignores the month |
| 158 |
FUNCTION {output.year.check} |
| 159 |
{ year empty$ |
| 160 |
{ "empty year in " cite$ * warning$ } |
| 161 |
{ write$ |
| 162 |
" (" year * extra.label * ")" * |
| 163 |
mid.sentence 'output.state := |
| 164 |
} |
| 165 |
if$ |
| 166 |
} |
| 167 |
|
| 168 |
FUNCTION {output.bibitem} |
| 169 |
{ newline$ |
| 170 |
"\bibitem[" write$ |
| 171 |
label write$ |
| 172 |
"]{" write$ |
| 173 |
cite$ write$ |
| 174 |
"}" write$ |
| 175 |
newline$ |
| 176 |
"" |
| 177 |
before.all 'output.state := |
| 178 |
} |
| 179 |
|
| 180 |
FUNCTION {fin.entry} |
| 181 |
{ add.period$ |
| 182 |
write$ |
| 183 |
newline$ |
| 184 |
} |
| 185 |
|
| 186 |
FUNCTION {fin.npentry} % no-period final entry for apalike-ejor |
| 187 |
{ write$ |
| 188 |
newline$ |
| 189 |
} |
| 190 |
|
| 191 |
FUNCTION {new.block} |
| 192 |
{ output.state before.all = |
| 193 |
'skip$ |
| 194 |
{ after.block 'output.state := } |
| 195 |
if$ |
| 196 |
} |
| 197 |
|
| 198 |
FUNCTION {new.sentence} |
| 199 |
{ output.state after.block = |
| 200 |
'skip$ |
| 201 |
{ output.state before.all = |
| 202 |
'skip$ |
| 203 |
{ after.sentence 'output.state := } |
| 204 |
if$ |
| 205 |
} |
| 206 |
if$ |
| 207 |
} |
| 208 |
|
| 209 |
FUNCTION {not} |
| 210 |
{ { #0 } |
| 211 |
{ #1 } |
| 212 |
if$ |
| 213 |
} |
| 214 |
|
| 215 |
FUNCTION {and} |
| 216 |
{ 'skip$ |
| 217 |
{ pop$ #0 } |
| 218 |
if$ |
| 219 |
} |
| 220 |
|
| 221 |
FUNCTION {or} |
| 222 |
{ { pop$ #1 } |
| 223 |
'skip$ |
| 224 |
if$ |
| 225 |
} |
| 226 |
|
| 227 |
FUNCTION {format.doi} % doi field for apalike-ejor |
| 228 |
{ doi empty$ |
| 229 |
{ "" } |
| 230 |
{ "\url{https://doi.org/" doi * "}" * } |
| 231 |
if$ |
| 232 |
} |
| 233 |
|
| 234 |
|
| 235 |
FUNCTION {format.url} % url field for apalike-ejor |
| 236 |
{ url empty$ |
| 237 |
{ "" } |
| 238 |
{ "\url{" url * "}" * } |
| 239 |
if$ |
| 240 |
} |
| 241 |
|
| 242 |
FUNCTION {format.urlending} % formats ending for doi and/or url fields |
| 243 |
{ |
| 244 |
doi missing$ |
| 245 |
{ |
| 246 |
url missing$ |
| 247 |
{ note output |
| 248 |
fin.entry |
| 249 |
} |
| 250 |
{ new.block % use url if no doi |
| 251 |
format.url output |
| 252 |
note missing$ |
| 253 |
{ fin.npentry } |
| 254 |
{ new.block |
| 255 |
note output |
| 256 |
fin.npentry |
| 257 |
} |
| 258 |
if$ |
| 259 |
} |
| 260 |
if$ |
| 261 |
} |
| 262 |
{ new.block % use doi if present |
| 263 |
format.doi output |
| 264 |
note missing$ |
| 265 |
{ fin.npentry } |
| 266 |
{ new.block |
| 267 |
note output |
| 268 |
fin.npentry |
| 269 |
} |
| 270 |
if$ |
| 271 |
} |
| 272 |
if$ |
| 273 |
} |
| 274 |
|
| 275 |
FUNCTION {new.block.checkb} |
| 276 |
{ empty$ |
| 277 |
swap$ empty$ |
| 278 |
and |
| 279 |
'skip$ |
| 280 |
'new.block |
| 281 |
if$ |
| 282 |
} |
| 283 |
|
| 284 |
FUNCTION {field.or.null} |
| 285 |
{ duplicate$ empty$ |
| 286 |
{ pop$ "" } |
| 287 |
'skip$ |
| 288 |
if$ |
| 289 |
} |
| 290 |
|
| 291 |
FUNCTION {emphasize} |
| 292 |
{ duplicate$ empty$ |
| 293 |
{ pop$ "" } |
| 294 |
{ "{\em " swap$ * "}" * } |
| 295 |
if$ |
| 296 |
} |
| 297 |
|
| 298 |
INTEGERS { nameptr namesleft numnames } |
| 299 |
|
| 300 |
FUNCTION {format.names} |
| 301 |
{ 's := |
| 302 |
#1 'nameptr := |
| 303 |
s num.names$ 'numnames := |
| 304 |
numnames 'namesleft := |
| 305 |
{ namesleft #0 > } |
| 306 |
{ s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := % last name first |
| 307 |
nameptr #1 > |
| 308 |
{ namesleft #1 > |
| 309 |
{ ", " * t * } |
| 310 |
{ numnames #2 > |
| 311 |
{ "," * } |
| 312 |
'skip$ |
| 313 |
if$ |
| 314 |
t "others" = |
| 315 |
{ " et~al." * } |
| 316 |
{ " \& " * t * } % ampersand for apalike-ejor |
| 317 |
if$ |
| 318 |
} |
| 319 |
if$ |
| 320 |
} |
| 321 |
't |
| 322 |
if$ |
| 323 |
nameptr #1 + 'nameptr := |
| 324 |
namesleft #1 - 'namesleft := |
| 325 |
} |
| 326 |
while$ |
| 327 |
} |
| 328 |
|
| 329 |
FUNCTION {format.authors} |
| 330 |
{ author empty$ |
| 331 |
{ "" } |
| 332 |
{ author format.names } |
| 333 |
if$ |
| 334 |
} |
| 335 |
|
| 336 |
FUNCTION {format.key} % this function is just for apalike |
| 337 |
{ empty$ |
| 338 |
{ key field.or.null } |
| 339 |
{ "" } |
| 340 |
if$ |
| 341 |
} |
| 342 |
|
| 343 |
FUNCTION {format.editors} |
| 344 |
{ editor empty$ |
| 345 |
{ "" } |
| 346 |
{ editor format.names |
| 347 |
editor num.names$ #1 > |
| 348 |
{ ", editors" * } |
| 349 |
{ ", editor" * } |
| 350 |
if$ |
| 351 |
} |
| 352 |
if$ |
| 353 |
} |
| 354 |
|
| 355 |
FUNCTION {format.title} |
| 356 |
{ title empty$ |
| 357 |
{ "" } |
| 358 |
{ title "t" change.case$ } |
| 359 |
if$ |
| 360 |
} |
| 361 |
|
| 362 |
FUNCTION {n.dashify} |
| 363 |
{ 't := |
| 364 |
"" |
| 365 |
{ t empty$ not } |
| 366 |
{ t #1 #1 substring$ "-" = |
| 367 |
{ t #1 #2 substring$ "--" = not |
| 368 |
{ "--" * |
| 369 |
t #2 global.max$ substring$ 't := |
| 370 |
} |
| 371 |
{ { t #1 #1 substring$ "-" = } |
| 372 |
{ "-" * |
| 373 |
t #2 global.max$ substring$ 't := |
| 374 |
} |
| 375 |
while$ |
| 376 |
} |
| 377 |
if$ |
| 378 |
} |
| 379 |
{ t #1 #1 substring$ * |
| 380 |
t #2 global.max$ substring$ 't := |
| 381 |
} |
| 382 |
if$ |
| 383 |
} |
| 384 |
while$ |
| 385 |
} |
| 386 |
|
| 387 |
FUNCTION {format.btitle} |
| 388 |
{ title emphasize |
| 389 |
} |
| 390 |
|
| 391 |
FUNCTION {tie.or.space.connect} |
| 392 |
{ duplicate$ text.length$ #3 < |
| 393 |
{ "~" } |
| 394 |
{ " " } |
| 395 |
if$ |
| 396 |
swap$ * * |
| 397 |
} |
| 398 |
|
| 399 |
FUNCTION {either.or.check} |
| 400 |
{ empty$ |
| 401 |
'pop$ |
| 402 |
{ "can't use both " swap$ * " fields in " * cite$ * warning$ } |
| 403 |
if$ |
| 404 |
} |
| 405 |
|
| 406 |
FUNCTION {format.bvolume} |
| 407 |
{ volume empty$ |
| 408 |
{ "" } |
| 409 |
{ "volume" volume tie.or.space.connect |
| 410 |
series empty$ |
| 411 |
'skip$ |
| 412 |
{ " of " * series emphasize * } |
| 413 |
if$ |
| 414 |
"volume \& number" number either.or.check % ampersand for apalike-ejor |
| 415 |
} |
| 416 |
if$ |
| 417 |
} |
| 418 |
|
| 419 |
FUNCTION {format.number.series} |
| 420 |
{ volume empty$ |
| 421 |
{ number empty$ |
| 422 |
{ series field.or.null } |
| 423 |
{ output.state mid.sentence = |
| 424 |
{ "number" } |
| 425 |
{ "Number" } |
| 426 |
if$ |
| 427 |
number tie.or.space.connect |
| 428 |
series empty$ |
| 429 |
{ "there's a number but no series in " cite$ * warning$ } |
| 430 |
{ " in " * series * } |
| 431 |
if$ |
| 432 |
} |
| 433 |
if$ |
| 434 |
} |
| 435 |
{ "" } |
| 436 |
if$ |
| 437 |
} |
| 438 |
|
| 439 |
FUNCTION {format.edition} |
| 440 |
{ edition empty$ |
| 441 |
{ "" } |
| 442 |
{ output.state mid.sentence = |
| 443 |
{ "(" edition * "l" change.case$ " ed.)" * } % changed for apalike-ejor |
| 444 |
{ "(" edition * "t" change.case$ " ed.)" * } |
| 445 |
if$ |
| 446 |
} |
| 447 |
if$ |
| 448 |
} |
| 449 |
|
| 450 |
INTEGERS { multiresult } |
| 451 |
|
| 452 |
FUNCTION {multi.page.check} |
| 453 |
{ 't := |
| 454 |
#0 'multiresult := |
| 455 |
{ multiresult not |
| 456 |
t empty$ not |
| 457 |
and |
| 458 |
} |
| 459 |
{ t #1 #1 substring$ |
| 460 |
duplicate$ "-" = |
| 461 |
swap$ duplicate$ "," = |
| 462 |
swap$ "+" = |
| 463 |
or or |
| 464 |
{ #1 'multiresult := } |
| 465 |
{ t #2 global.max$ substring$ 't := } |
| 466 |
if$ |
| 467 |
} |
| 468 |
while$ |
| 469 |
multiresult |
| 470 |
} |
| 471 |
|
| 472 |
FUNCTION {format.pages} |
| 473 |
{ pages empty$ |
| 474 |
{ "" } |
| 475 |
{ pages multi.page.check |
| 476 |
{ pages n.dashify } %removed "page" and "pages" for apalike-ejor |
| 477 |
{ pages } |
| 478 |
if$ |
| 479 |
} |
| 480 |
if$ |
| 481 |
} |
| 482 |
|
| 483 |
FUNCTION {format.vol.num.pages} |
| 484 |
{ volume field.or.null |
| 485 |
number empty$ |
| 486 |
'skip$ |
| 487 |
{ "(" number * ")" * * |
| 488 |
volume empty$ |
| 489 |
{ "there's a number but no volume in " cite$ * warning$ } |
| 490 |
'skip$ |
| 491 |
if$ |
| 492 |
} |
| 493 |
if$ |
| 494 |
pages empty$ |
| 495 |
'skip$ |
| 496 |
{ duplicate$ empty$ |
| 497 |
{ pop$ format.pages } |
| 498 |
{ ", " * pages n.dashify * } % replaced : with , for apalike-ejor |
| 499 |
if$ |
| 500 |
} |
| 501 |
if$ |
| 502 |
} |
| 503 |
|
| 504 |
FUNCTION {format.chapter.pages} |
| 505 |
{ chapter empty$ |
| 506 |
'format.pages |
| 507 |
{ type empty$ |
| 508 |
{ "(Chapter" } % capitalizing for apalike-ejor |
| 509 |
{ type "l" change.case$ } |
| 510 |
if$ |
| 511 |
chapter tie.or.space.connect |
| 512 |
pages empty$ |
| 513 |
{ ")" * } |
| 514 |
{ ", " * format.pages * ")" * } |
| 515 |
if$ |
| 516 |
} |
| 517 |
if$ |
| 518 |
} |
| 519 |
|
| 520 |
FUNCTION {format.in.ed.booktitle} % removed editor names for apalike-ejor |
| 521 |
{ %booktitle empty$ |
| 522 |
% { "" } |
| 523 |
% { editor empty$ |
| 524 |
% { "In " booktitle emphasize * } |
| 525 |
% { "In " format.editors * ", " * booktitle emphasize * } |
| 526 |
% if$ |
| 527 |
% } |
| 528 |
% if$ |
| 529 |
booktitle emphasize |
| 530 |
} |
| 531 |
|
| 532 |
FUNCTION {format.thesis.type} |
| 533 |
{ type empty$ |
| 534 |
'skip$ |
| 535 |
{ pop$ |
| 536 |
type "t" change.case$ |
| 537 |
} |
| 538 |
if$ |
| 539 |
} |
| 540 |
|
| 541 |
FUNCTION {format.tr.number} |
| 542 |
{ type empty$ |
| 543 |
{ "Technical Report" } |
| 544 |
'type |
| 545 |
if$ |
| 546 |
number empty$ |
| 547 |
{ "t" change.case$ } |
| 548 |
{ number tie.or.space.connect } |
| 549 |
if$ |
| 550 |
} |
| 551 |
|
| 552 |
FUNCTION {format.article.crossref} |
| 553 |
{ "In" % this is for apalike |
| 554 |
" \cite{" * crossref * "}" * |
| 555 |
} |
| 556 |
|
| 557 |
FUNCTION {format.book.crossref} |
| 558 |
{ volume empty$ |
| 559 |
{ "empty volume in " cite$ * "'s crossref of " * crossref * warning$ |
| 560 |
"In " |
| 561 |
} |
| 562 |
{ "Volume" volume tie.or.space.connect |
| 563 |
" of " * |
| 564 |
} |
| 565 |
if$ |
| 566 |
"\cite{" * crossref * "}" * % this is for apalike |
| 567 |
} |
| 568 |
|
| 569 |
FUNCTION {format.incoll.inproc.crossref} |
| 570 |
{ "In" % this is for apalike |
| 571 |
" \cite{" * crossref * "}" * |
| 572 |
} |
| 573 |
|
| 574 |
FUNCTION {format.dataset} % unique "dataset" field for apalike |
| 575 |
{ dataset empty$ % prints "[dataset]" for any value besides "0" or "false" |
| 576 |
{ "" } |
| 577 |
{ dataset "0" = dataset "l" change.case$ "false" = or |
| 578 |
{ "" } |
| 579 |
{ "[dataset]" } |
| 580 |
if$ |
| 581 |
} |
| 582 |
if$ |
| 583 |
} |
| 584 |
|
| 585 |
FUNCTION {article} |
| 586 |
{ output.bibitem |
| 587 |
format.authors "author" output.check |
| 588 |
author format.key output % special for |
| 589 |
output.year.check % apalike |
| 590 |
new.block |
| 591 |
format.title "title" output.check |
| 592 |
new.block |
| 593 |
crossref missing$ |
| 594 |
{ journal emphasize "journal" output.check |
| 595 |
format.vol.num.pages output |
| 596 |
} |
| 597 |
{ format.article.crossref output.nonnull |
| 598 |
format.pages output |
| 599 |
} |
| 600 |
if$ |
| 601 |
new.block |
| 602 |
% note output % note handled in urlending |
| 603 |
format.urlending % auto-formatted doi/url ending |
| 604 |
} |
| 605 |
|
| 606 |
FUNCTION {book} |
| 607 |
{ output.bibitem |
| 608 |
author empty$ |
| 609 |
{ format.editors "author \& editor" output.check % & for apalike-ejor |
| 610 |
editor format.key output |
| 611 |
} |
| 612 |
{ format.authors output.nonnull |
| 613 |
crossref missing$ |
| 614 |
{ "author \& editor" editor either.or.check } % & for apalike-ejor |
| 615 |
'skip$ |
| 616 |
if$ |
| 617 |
} |
| 618 |
if$ |
| 619 |
output.year.check % special for apalike |
| 620 |
new.block |
| 621 |
edition missing$ % moved and reformatted ed. for apalike-ejor |
| 622 |
{ format.btitle output |
| 623 |
} |
| 624 |
{ format.btitle " " * format.edition * output |
| 625 |
} |
| 626 |
if$ |
| 627 |
crossref missing$ |
| 628 |
{ format.bvolume output |
| 629 |
new.block |
| 630 |
format.number.series output |
| 631 |
new.sentence |
| 632 |
chapter missing$ % adding chapter number for apalike-ejor |
| 633 |
{ publisher output |
| 634 |
} |
| 635 |
{ publisher " " * format.chapter.pages * output |
| 636 |
} |
| 637 |
if$ |
| 638 |
% address output removing publisher address for apalike-ejor |
| 639 |
} |
| 640 |
{ new.block |
| 641 |
format.book.crossref output.nonnull |
| 642 |
} |
| 643 |
if$ |
| 644 |
new.block |
| 645 |
% note output % note handled in urlending |
| 646 |
format.urlending % auto-formatted doi/url ending |
| 647 |
} |
| 648 |
|
| 649 |
FUNCTION {booklet} |
| 650 |
{ output.bibitem |
| 651 |
format.authors output |
| 652 |
author format.key output % special for |
| 653 |
output.year.check % apalike |
| 654 |
new.block |
| 655 |
format.title "title" output.check |
| 656 |
new.block |
| 657 |
howpublished output |
| 658 |
address output |
| 659 |
new.block |
| 660 |
% note output % note handled in urlending |
| 661 |
format.urlending % auto-formatted doi/url ending |
| 662 |
} |
| 663 |
|
| 664 |
FUNCTION {inbook} |
| 665 |
{ output.bibitem |
| 666 |
author empty$ |
| 667 |
{ format.editors "author \& editor" output.check % & for apalike-ejor |
| 668 |
editor format.key output |
| 669 |
} |
| 670 |
{ format.authors output.nonnull |
| 671 |
crossref missing$ |
| 672 |
{ "author \& editor" editor either.or.check } % & for apalike-ejor |
| 673 |
'skip$ |
| 674 |
if$ |
| 675 |
} |
| 676 |
if$ |
| 677 |
output.year.check % special for apalike |
| 678 |
new.block |
| 679 |
format.btitle "title" output.check |
| 680 |
crossref missing$ |
| 681 |
{ format.bvolume output |
| 682 |
format.chapter.pages "chapter \& pages" output.check % & for apalike-ejor |
| 683 |
new.block |
| 684 |
format.number.series output |
| 685 |
new.sentence |
| 686 |
publisher "publisher" output.check |
| 687 |
% address output removing publisher address for apalike-ejor |
| 688 |
} |
| 689 |
{ format.chapter.pages "chapter \& pages" output.check % & for apalike-ejor |
| 690 |
new.block |
| 691 |
format.book.crossref output.nonnull |
| 692 |
} |
| 693 |
if$ |
| 694 |
format.edition output |
| 695 |
new.block |
| 696 |
% note output % note handled in urlending |
| 697 |
format.urlending % auto-formatted doi/url ending |
| 698 |
} |
| 699 |
|
| 700 |
FUNCTION {incollection} |
| 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 |
format.title "title" output.check |
| 707 |
new.block |
| 708 |
crossref missing$ |
| 709 |
{ format.in.ed.booktitle "booktitle" output.check |
| 710 |
format.bvolume output |
| 711 |
format.number.series output |
| 712 |
format.chapter.pages output |
| 713 |
new.sentence |
| 714 |
publisher "publisher" output.check |
| 715 |
% address output removing publisher address for apalike-ejor |
| 716 |
format.edition output |
| 717 |
} |
| 718 |
{ format.incoll.inproc.crossref output.nonnull |
| 719 |
format.chapter.pages output |
| 720 |
} |
| 721 |
if$ |
| 722 |
new.block |
| 723 |
% note output % note handled in urlending |
| 724 |
format.urlending % auto-formatted doi/url ending |
| 725 |
} |
| 726 |
|
| 727 |
FUNCTION {inproceedings} |
| 728 |
{ output.bibitem |
| 729 |
format.authors "author" output.check |
| 730 |
author format.key output % special for |
| 731 |
output.year.check % apalike |
| 732 |
new.block |
| 733 |
format.title "title" output.check |
| 734 |
new.block |
| 735 |
crossref missing$ |
| 736 |
{ format.in.ed.booktitle "booktitle" output.check |
| 737 |
format.bvolume output |
| 738 |
format.number.series output |
| 739 |
format.pages output |
| 740 |
% address output % for apalike % removed for apalike-ejor |
| 741 |
% new.sentence % there's no year |
| 742 |
% organization output % here so things |
| 743 |
% publisher output % are simpler |
| 744 |
} |
| 745 |
{ format.incoll.inproc.crossref output.nonnull |
| 746 |
format.pages output |
| 747 |
} |
| 748 |
if$ |
| 749 |
new.block |
| 750 |
% note output % note handled in urlending |
| 751 |
format.urlending % auto-formatted doi/url ending |
| 752 |
} |
| 753 |
|
| 754 |
FUNCTION {conference} { inproceedings } |
| 755 |
|
| 756 |
FUNCTION {manual} |
| 757 |
{ output.bibitem |
| 758 |
format.authors output |
| 759 |
author format.key output % special for |
| 760 |
output.year.check % apalike |
| 761 |
new.block |
| 762 |
format.btitle "title" output.check |
| 763 |
organization address new.block.checkb |
| 764 |
organization output |
| 765 |
address output |
| 766 |
format.edition output |
| 767 |
new.block |
| 768 |
% note output % note handled in urlending |
| 769 |
format.urlending % auto-formatted doi/url ending |
| 770 |
} |
| 771 |
|
| 772 |
FUNCTION {mastersthesis} |
| 773 |
{ output.bibitem |
| 774 |
format.authors "author" output.check |
| 775 |
author format.key output % special for |
| 776 |
output.year.check % apalike |
| 777 |
new.block |
| 778 |
format.title "title" output.check |
| 779 |
new.block |
| 780 |
% "Master's thesis" format.thesis.type output.nonnull remove for apalike-ejor |
| 781 |
school "school" output.check |
| 782 |
% address output % removing address for apalike-ejor |
| 783 |
new.block |
| 784 |
% note output % note handled in urlending |
| 785 |
format.urlending % auto-formatted doi/url ending |
| 786 |
} |
| 787 |
|
| 788 |
FUNCTION {misc} |
| 789 |
{ output.bibitem |
| 790 |
format.dataset "" = % unique "dataset" field for apalike-ejor |
| 791 |
{ skip$ } |
| 792 |
{ format.dataset " " * write$ } |
| 793 |
if$ |
| 794 |
format.authors output |
| 795 |
author format.key output % special for |
| 796 |
output.year.check % apalike |
| 797 |
new.block |
| 798 |
format.title emphasize output |
| 799 |
new.block |
| 800 |
howpublished output |
| 801 |
new.block |
| 802 |
% note output % note handled in urlending |
| 803 |
format.urlending % auto-formatted doi/url ending |
| 804 |
} |
| 805 |
|
| 806 |
FUNCTION {phdthesis} |
| 807 |
{ output.bibitem |
| 808 |
format.authors "author" output.check |
| 809 |
author format.key output % special for |
| 810 |
output.year.check % apalike |
| 811 |
new.block |
| 812 |
format.btitle "title" output.check |
| 813 |
new.block |
| 814 |
% "PhD thesis" format.thesis.type output.nonnull remove for apalike-ejor |
| 815 |
school "school" output.check |
| 816 |
% address output % removing address for apalike-ejor |
| 817 |
new.block |
| 818 |
% note output % note handled in urlending |
| 819 |
format.urlending % auto-formatted doi/url ending |
| 820 |
} |
| 821 |
|
| 822 |
FUNCTION {proceedings} |
| 823 |
{ output.bibitem |
| 824 |
% format.editors output removing editors for apalike-ejor |
| 825 |
% editor format.key output % special for |
| 826 |
output.year.check % apalike |
| 827 |
new.block |
| 828 |
format.btitle "title" output.check |
| 829 |
format.bvolume output |
| 830 |
format.number.series output |
| 831 |
% address output % for apalike % removed for apalike-ejor |
| 832 |
new.sentence % we always output |
| 833 |
organization output % a nonempty organization |
| 834 |
publisher output % here |
| 835 |
new.block |
| 836 |
% note output % note handled in urlending |
| 837 |
format.urlending % auto-formatted doi/url ending |
| 838 |
} |
| 839 |
|
| 840 |
FUNCTION {techreport} |
| 841 |
{ output.bibitem |
| 842 |
format.authors "author" output.check |
| 843 |
author format.key output % special for |
| 844 |
output.year.check % apalike |
| 845 |
new.block |
| 846 |
format.title "title" output.check |
| 847 |
new.block |
| 848 |
format.tr.number output.nonnull |
| 849 |
institution "institution" output.check |
| 850 |
address output |
| 851 |
new.block |
| 852 |
% note output % note handled in urlending |
| 853 |
format.urlending % auto-formatted doi/url ending |
| 854 |
} |
| 855 |
|
| 856 |
FUNCTION {unpublished} |
| 857 |
{ output.bibitem |
| 858 |
format.authors "author" output.check |
| 859 |
author format.key output % special for |
| 860 |
output.year.check % apalike |
| 861 |
new.block |
| 862 |
format.title "title" output.check |
| 863 |
new.block |
| 864 |
note "note" output.check |
| 865 |
format.urlending % auto-formatted doi/url ending |
| 866 |
} |
| 867 |
|
| 868 |
FUNCTION {default.type} { misc } |
| 869 |
|
| 870 |
MACRO {jan} {"January"} |
| 871 |
|
| 872 |
MACRO {feb} {"February"} |
| 873 |
|
| 874 |
MACRO {mar} {"March"} |
| 875 |
|
| 876 |
MACRO {apr} {"April"} |
| 877 |
|
| 878 |
MACRO {may} {"May"} |
| 879 |
|
| 880 |
MACRO {jun} {"June"} |
| 881 |
|
| 882 |
MACRO {jul} {"July"} |
| 883 |
|
| 884 |
MACRO {aug} {"August"} |
| 885 |
|
| 886 |
MACRO {sep} {"September"} |
| 887 |
|
| 888 |
MACRO {oct} {"October"} |
| 889 |
|
| 890 |
MACRO {nov} {"November"} |
| 891 |
|
| 892 |
MACRO {dec} {"December"} |
| 893 |
|
| 894 |
MACRO {acmcs} {"ACM Computing Surveys"} |
| 895 |
|
| 896 |
MACRO {acta} {"Acta Informatica"} |
| 897 |
|
| 898 |
MACRO {cacm} {"Communications of the ACM"} |
| 899 |
|
| 900 |
MACRO {ibmjrd} {"IBM Journal of Research and Development"} |
| 901 |
|
| 902 |
MACRO {ibmsj} {"IBM Systems Journal"} |
| 903 |
|
| 904 |
MACRO {ieeese} {"IEEE Transactions on Software Engineering"} |
| 905 |
|
| 906 |
MACRO {ieeetc} {"IEEE Transactions on Computers"} |
| 907 |
|
| 908 |
MACRO {ieeetcad} |
| 909 |
{"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} |
| 910 |
|
| 911 |
MACRO {ipl} {"Information Processing Letters"} |
| 912 |
|
| 913 |
MACRO {jacm} {"Journal of the ACM"} |
| 914 |
|
| 915 |
MACRO {jcss} {"Journal of Computer and System Sciences"} |
| 916 |
|
| 917 |
MACRO {scp} {"Science of Computer Programming"} |
| 918 |
|
| 919 |
MACRO {sicomp} {"SIAM Journal on Computing"} |
| 920 |
|
| 921 |
MACRO {tocs} {"ACM Transactions on Computer Systems"} |
| 922 |
|
| 923 |
MACRO {tods} {"ACM Transactions on Database Systems"} |
| 924 |
|
| 925 |
MACRO {tog} {"ACM Transactions on Graphics"} |
| 926 |
|
| 927 |
MACRO {toms} {"ACM Transactions on Mathematical Software"} |
| 928 |
|
| 929 |
MACRO {toois} {"ACM Transactions on Office Information Systems"} |
| 930 |
|
| 931 |
MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} |
| 932 |
|
| 933 |
MACRO {tcs} {"Theoretical Computer Science"} |
| 934 |
|
| 935 |
READ |
| 936 |
|
| 937 |
FUNCTION {sortify} |
| 938 |
{ purify$ |
| 939 |
"l" change.case$ |
| 940 |
} |
| 941 |
|
| 942 |
INTEGERS { len } |
| 943 |
|
| 944 |
FUNCTION {chop.word} |
| 945 |
{ 's := |
| 946 |
'len := |
| 947 |
s #1 len substring$ = |
| 948 |
{ s len #1 + global.max$ substring$ } |
| 949 |
's |
| 950 |
if$ |
| 951 |
} |
| 952 |
|
| 953 |
% There are three apalike cases: one person (Jones), |
| 954 |
% two (Jones and de~Bruijn), and more (Jones et~al.). |
| 955 |
% This function is much like format.crossref.editors. |
| 956 |
% |
| 957 |
FUNCTION {format.lab.names} |
| 958 |
{ 's := |
| 959 |
s #1 "{vv~}{ll}" format.name$ |
| 960 |
s num.names$ duplicate$ |
| 961 |
#2 > |
| 962 |
{ pop$ " et~al." * } |
| 963 |
{ #2 < |
| 964 |
'skip$ |
| 965 |
{ s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = |
| 966 |
{ " et~al." * } |
| 967 |
{ " \& " * s #2 "{vv~}{ll}" format.name$ * } % & for apalike-ejor |
| 968 |
if$ |
| 969 |
} |
| 970 |
if$ |
| 971 |
} |
| 972 |
if$ |
| 973 |
} |
| 974 |
|
| 975 |
FUNCTION {author.key.label} |
| 976 |
{ author empty$ |
| 977 |
{ key empty$ |
| 978 |
{ cite$ #1 #3 substring$ } |
| 979 |
'key % apalike uses the whole key |
| 980 |
if$ |
| 981 |
} |
| 982 |
{ author format.lab.names } |
| 983 |
if$ |
| 984 |
} |
| 985 |
|
| 986 |
FUNCTION {author.editor.key.label} |
| 987 |
{ author empty$ |
| 988 |
{ editor empty$ |
| 989 |
{ key empty$ |
| 990 |
{ cite$ #1 #3 substring$ } |
| 991 |
'key % apalike uses the whole key |
| 992 |
if$ |
| 993 |
} |
| 994 |
{ editor format.lab.names } |
| 995 |
if$ |
| 996 |
} |
| 997 |
{ author format.lab.names } |
| 998 |
if$ |
| 999 |
} |
| 1000 |
|
| 1001 |
FUNCTION {editor.key.label} |
| 1002 |
{ editor empty$ |
| 1003 |
{ key empty$ |
| 1004 |
{ cite$ #1 #3 substring$ } |
| 1005 |
'key % apalike uses the whole key, no organization |
| 1006 |
if$ |
| 1007 |
} |
| 1008 |
{ editor format.lab.names } |
| 1009 |
if$ |
| 1010 |
} |
| 1011 |
|
| 1012 |
FUNCTION {calc.label} |
| 1013 |
{ type$ "book" = |
| 1014 |
type$ "inbook" = |
| 1015 |
or |
| 1016 |
'author.editor.key.label |
| 1017 |
{ type$ "proceedings" = |
| 1018 |
'editor.key.label % apalike ignores organization |
| 1019 |
'author.key.label % for labeling and sorting |
| 1020 |
if$ |
| 1021 |
} |
| 1022 |
if$ |
| 1023 |
", " % these three lines are |
| 1024 |
* % for apalike, which |
| 1025 |
year field.or.null purify$ #-1 #4 substring$ % uses all four digits |
| 1026 |
* |
| 1027 |
'label := |
| 1028 |
} |
| 1029 |
|
| 1030 |
FUNCTION {sort.format.names} |
| 1031 |
{ 's := |
| 1032 |
#1 'nameptr := |
| 1033 |
"" |
| 1034 |
s num.names$ 'numnames := |
| 1035 |
numnames 'namesleft := |
| 1036 |
{ namesleft #0 > } |
| 1037 |
{ nameptr #1 > |
| 1038 |
{ " " * } |
| 1039 |
'skip$ |
| 1040 |
if$ % apalike uses initials |
| 1041 |
s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := % <= here |
| 1042 |
nameptr numnames = t "others" = and |
| 1043 |
{ "et al" * } |
| 1044 |
{ t sortify * } |
| 1045 |
if$ |
| 1046 |
nameptr #1 + 'nameptr := |
| 1047 |
namesleft #1 - 'namesleft := |
| 1048 |
} |
| 1049 |
while$ |
| 1050 |
} |
| 1051 |
|
| 1052 |
FUNCTION {sort.format.title} |
| 1053 |
{ 't := |
| 1054 |
"A " #2 |
| 1055 |
"An " #3 |
| 1056 |
"The " #4 t chop.word |
| 1057 |
chop.word |
| 1058 |
chop.word |
| 1059 |
sortify |
| 1060 |
#1 global.max$ substring$ |
| 1061 |
} |
| 1062 |
|
| 1063 |
FUNCTION {author.sort} |
| 1064 |
{ author empty$ |
| 1065 |
{ key empty$ |
| 1066 |
{ "to sort, need author or key in " cite$ * warning$ |
| 1067 |
"" |
| 1068 |
} |
| 1069 |
{ key sortify } |
| 1070 |
if$ |
| 1071 |
} |
| 1072 |
{ author sort.format.names } |
| 1073 |
if$ |
| 1074 |
} |
| 1075 |
|
| 1076 |
FUNCTION {author.editor.sort} |
| 1077 |
{ author empty$ |
| 1078 |
{ editor empty$ |
| 1079 |
{ key empty$ |
| 1080 |
{ "to sort, need author, editor, or key in " cite$ * warning$ |
| 1081 |
"" |
| 1082 |
} |
| 1083 |
{ key sortify } |
| 1084 |
if$ |
| 1085 |
} |
| 1086 |
{ editor sort.format.names } |
| 1087 |
if$ |
| 1088 |
} |
| 1089 |
{ author sort.format.names } |
| 1090 |
if$ |
| 1091 |
} |
| 1092 |
|
| 1093 |
FUNCTION {editor.sort} |
| 1094 |
{ editor empty$ |
| 1095 |
{ key empty$ |
| 1096 |
{ "to sort, need editor or key in " cite$ * warning$ |
| 1097 |
"" |
| 1098 |
} |
| 1099 |
{ key sortify } |
| 1100 |
if$ |
| 1101 |
} |
| 1102 |
{ editor sort.format.names } |
| 1103 |
if$ |
| 1104 |
} |
| 1105 |
|
| 1106 |
% apalike uses two sorting passes; the first one sets the |
| 1107 |
% labels so that the `a's, `b's, etc. can be computed; |
| 1108 |
% the second pass puts the references in "correct" order. |
| 1109 |
% The presort function is for the first pass. It computes |
| 1110 |
% label, sort.label, and title, and then concatenates. |
| 1111 |
FUNCTION {presort} |
| 1112 |
{ calc.label |
| 1113 |
label sortify |
| 1114 |
" " |
| 1115 |
* |
| 1116 |
type$ "book" = |
| 1117 |
type$ "inbook" = |
| 1118 |
or |
| 1119 |
'author.editor.sort |
| 1120 |
{ type$ "proceedings" = |
| 1121 |
'editor.sort |
| 1122 |
'author.sort |
| 1123 |
if$ |
| 1124 |
} |
| 1125 |
if$ |
| 1126 |
#1 entry.max$ substring$ % for |
| 1127 |
'sort.label := % apalike |
| 1128 |
sort.label % style |
| 1129 |
* |
| 1130 |
" " |
| 1131 |
* |
| 1132 |
title field.or.null |
| 1133 |
sort.format.title |
| 1134 |
* |
| 1135 |
#1 entry.max$ substring$ |
| 1136 |
'sort.key$ := |
| 1137 |
} |
| 1138 |
|
| 1139 |
ITERATE {presort} |
| 1140 |
|
| 1141 |
SORT % by label, sort.label, title---for final label calculation |
| 1142 |
|
| 1143 |
STRINGS { last.label next.extra } % apalike labels are only for the text; |
| 1144 |
|
| 1145 |
INTEGERS { last.extra.num } % there are none in the bibliography |
| 1146 |
|
| 1147 |
FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label' |
| 1148 |
{ #0 int.to.chr$ 'last.label := |
| 1149 |
"" 'next.extra := |
| 1150 |
#0 'last.extra.num := |
| 1151 |
} |
| 1152 |
|
| 1153 |
FUNCTION {forward.pass} |
| 1154 |
{ last.label label = |
| 1155 |
{ last.extra.num #1 + 'last.extra.num := |
| 1156 |
last.extra.num int.to.chr$ 'extra.label := |
| 1157 |
} |
| 1158 |
{ "a" chr.to.int$ 'last.extra.num := |
| 1159 |
"" 'extra.label := |
| 1160 |
label 'last.label := |
| 1161 |
} |
| 1162 |
if$ |
| 1163 |
} |
| 1164 |
|
| 1165 |
FUNCTION {reverse.pass} |
| 1166 |
{ next.extra "b" = |
| 1167 |
{ "a" 'extra.label := } |
| 1168 |
'skip$ |
| 1169 |
if$ |
| 1170 |
label extra.label * 'label := |
| 1171 |
extra.label 'next.extra := |
| 1172 |
} |
| 1173 |
|
| 1174 |
EXECUTE {initialize.extra.label.stuff} |
| 1175 |
|
| 1176 |
ITERATE {forward.pass} |
| 1177 |
|
| 1178 |
REVERSE {reverse.pass} |
| 1179 |
|
| 1180 |
% Now that the label is right we sort for real, |
| 1181 |
% on sort.label then year then title. This is |
| 1182 |
% for the second sorting pass. |
| 1183 |
FUNCTION {bib.sort.order} |
| 1184 |
{ sort.label |
| 1185 |
" " |
| 1186 |
* |
| 1187 |
year field.or.null sortify |
| 1188 |
* |
| 1189 |
" " |
| 1190 |
* |
| 1191 |
title field.or.null |
| 1192 |
sort.format.title |
| 1193 |
* |
| 1194 |
#1 entry.max$ substring$ |
| 1195 |
'sort.key$ := |
| 1196 |
} |
| 1197 |
|
| 1198 |
ITERATE {bib.sort.order} |
| 1199 |
|
| 1200 |
SORT % by sort.label, year, title---giving final bibliography order |
| 1201 |
|
| 1202 |
FUNCTION {begin.bib} |
| 1203 |
{ preamble$ empty$ % no \etalchar in apalike |
| 1204 |
'skip$ |
| 1205 |
{ preamble$ write$ newline$ } |
| 1206 |
if$ |
| 1207 |
"\begin{thebibliography}{}" write$ newline$ % no labels in apalike |
| 1208 |
} |
| 1209 |
|
| 1210 |
EXECUTE {begin.bib} |
| 1211 |
|
| 1212 |
EXECUTE {init.state.consts} |
| 1213 |
|
| 1214 |
ITERATE {call.type$} |
| 1215 |
|
| 1216 |
FUNCTION {end.bib} |
| 1217 |
{ newline$ |
| 1218 |
"\end{thebibliography}" write$ newline$ |
| 1219 |
} |
| 1220 |
|
| 1221 |
EXECUTE {end.bib} |