this repo has no description

msclike-url.bst

+1483 -1
+1479
msclike-url.bst
··· 1 + %%% Modification of BibTeX style file msclike.bst 2 + %%% ... by urlbst, version 0.8 (marked with "% urlbst") 3 + %%% See <http://purl.org/nxg/dist/urlbst> 4 + %%% Modifications Copyright 2002-03, 2005-12, 2014, 2019, Norman Gray, 5 + %%% and distributed under the terms of the LPPL; see README for discussion. 6 + %%% 7 + %%% Added webpage entry type, and url and lastchecked fields. 8 + %%% Added eprint support. 9 + %%% Added DOI support. 10 + %%% Added PUBMED support. 11 + %%% Original headers follow... 12 + 13 + % BibTeX `apalike' bibliography style (version 0.99a, 8-Dec-10), adapted from 14 + % the `alpha' style, version 0.99a; for BibTeX version 0.99a. 15 + % 16 + % Copyright (C) 1988, 2010 Oren Patashnik. 17 + % Unlimited copying and redistribution of this file are permitted as long as 18 + % it is unmodified. Modifications (and redistribution of modified versions) 19 + % are also permitted, but only if the resulting file is renamed. 20 + % 21 + % Differences between this style and `alpha' are generally heralded by a `%'. 22 + % The file btxbst.doc has the documentation for alpha.bst. 23 + % 24 + % This style should be used with the `apalike' LaTeX style (apalike.sty). 25 + % \cite's come out like "(Jones, 1986)" in the text but there are no labels 26 + % in the bibliography, and something like "(1986)" comes out immediately 27 + % after the author. Author (and editor) names appear as last name, comma, 28 + % initials. A `year' field is required for every entry, and so is either 29 + % an author (or in some cases, an editor) field or a key field. 30 + % 31 + % Editorial note: 32 + % Many journals require a style like `apalike', but I strongly, strongly, 33 + % strongly recommend that you not use it if you have a choice---use something 34 + % like `plain' instead. Mary-Claire van Leunen (A Handbook for Scholars, 35 + % Knopf, 1979) argues convincingly that a style like `plain' encourages better 36 + % writing than one like `apalike'. Furthermore the strongest arguments for 37 + % using an author-date style like `apalike'---that it's "the most practical" 38 + % (The Chicago Manual of Style, University of Chicago Press, thirteenth 39 + % edition, 1982, pages 400--401)---fall flat on their face with the new 40 + % computer-typesetting technology. For instance page 401 anachronistically 41 + % states "The chief disadvantage of [a style like `plain'] is that additions 42 + % or deletions cannot be made after the manuscript is typed without changing 43 + % numbers in both text references and list." LaTeX sidesteps the disadvantage. 44 + % 45 + % History: 46 + % 15-sep-86 (OP) Original version by Oren Patashnik, ideas from Susan King. 47 + % 10-nov-86 (OP) Truncated the sort.key$ string to the correct length 48 + % in bib.sort.order to eliminate error message. 49 + % 24-jan-88 (OP) Updated for BibTeX version 0.99a, from alpha.bst 0.99a; 50 + % apalike now sorts by author, then year, then title; 51 + % THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i. 52 + % 8-dec-10 (OP) Still version 0.99a, as the code itself was unchanged; 53 + % this release clarified the license. 54 + 55 + ENTRY 56 + { address 57 + author 58 + booktitle 59 + chapter 60 + edition 61 + editor 62 + howpublished 63 + institution 64 + journal 65 + key 66 + % month not used in apalike 67 + note 68 + number 69 + organization 70 + pages 71 + publisher 72 + school 73 + series 74 + title 75 + type 76 + volume 77 + year 78 + eprint % urlbst 79 + doi % urlbst 80 + pubmed % urlbst 81 + url % urlbst 82 + lastchecked % urlbst 83 + } 84 + {} 85 + { label extra.label sort.label } 86 + 87 + INTEGERS { output.state before.all mid.sentence after.sentence after.block } 88 + 89 + % urlbst... 90 + % urlbst constants and state variables 91 + STRINGS { urlintro 92 + eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl 93 + citedstring onlinestring linktextstring 94 + openinlinelink closeinlinelink } 95 + INTEGERS { hrefform inlinelinks makeinlinelink 96 + addeprints adddoiresolver addpubmedresolver } 97 + FUNCTION {init.urlbst.variables} 98 + { 99 + % The following constants may be adjusted by hand, if desired 100 + 101 + % The first set allow you to enable or disable certain functionality. 102 + #1 'addeprints := % 0=no eprints; 1=include eprints 103 + #1 'adddoiresolver := % 0=no DOI resolver; 1=include it 104 + #1 'addpubmedresolver := % 0=no PUBMED resolver; 1=include it 105 + #0 'hrefform := % 0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs 106 + #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles 107 + 108 + % String constants, which you _might_ want to tweak. 109 + "URL: " 'urlintro := % prefix before URL; typically "Available from:" or "URL": 110 + "online" 'onlinestring := % indication that resource is online; typically "online" 111 + "cited " 'citedstring := % indicator of citation date; typically "cited " 112 + "[link]" 'linktextstring := % dummy link text; typically "[link]" 113 + "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref 114 + "arXiv:" 'eprintprefix := % text prefix printed before eprint ref; typically "arXiv:" 115 + "https://doi.org/" 'doiurl := % prefix to make URL from DOI 116 + "doi:" 'doiprefix := % text prefix printed before DOI ref; typically "doi:" 117 + "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED 118 + "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref; typically "PMID:" 119 + 120 + % The following are internal state variables, not configuration constants, 121 + % so they shouldn't be fiddled with. 122 + #0 'makeinlinelink := % state variable managed by possibly.setup.inlinelink 123 + "" 'openinlinelink := % ditto 124 + "" 'closeinlinelink := % ditto 125 + } 126 + INTEGERS { 127 + bracket.state 128 + outside.brackets 129 + open.brackets 130 + within.brackets 131 + close.brackets 132 + } 133 + % ...urlbst to here 134 + FUNCTION {init.state.consts} 135 + { #0 'outside.brackets := % urlbst... 136 + #1 'open.brackets := 137 + #2 'within.brackets := 138 + #3 'close.brackets := % ...urlbst to here 139 + 140 + #0 'before.all := 141 + #1 'mid.sentence := 142 + #2 'after.sentence := 143 + #3 'after.block := 144 + } 145 + 146 + STRINGS { s t } 147 + 148 + % urlbst 149 + FUNCTION {output.nonnull.original} 150 + { 's := 151 + output.state mid.sentence = 152 + { ", " * write$ } 153 + { output.state after.block = 154 + { add.period$ write$ 155 + newline$ 156 + "\newblock " write$ 157 + } 158 + { output.state before.all = 159 + 'write$ 160 + { add.period$ " " * write$ } 161 + if$ 162 + } 163 + if$ 164 + mid.sentence 'output.state := 165 + } 166 + if$ 167 + s 168 + } 169 + 170 + % urlbst... 171 + % The following three functions are for handling inlinelink. They wrap 172 + % a block of text which is potentially output with write$ by multiple 173 + % other functions, so we don't know the content a priori. 174 + % They communicate between each other using the variables makeinlinelink 175 + % (which is true if a link should be made), and closeinlinelink (which holds 176 + % the string which should close any current link. They can be called 177 + % at any time, but start.inlinelink will be a no-op unless something has 178 + % previously set makeinlinelink true, and the two ...end.inlinelink functions 179 + % will only do their stuff if start.inlinelink has previously set 180 + % closeinlinelink to be non-empty. 181 + % (thanks to 'ijvm' for suggested code here) 182 + FUNCTION {uand} 183 + { 'skip$ { pop$ #0 } if$ } % 'and' (which isn't defined at this point in the file) 184 + FUNCTION {possibly.setup.inlinelink} 185 + { makeinlinelink hrefform #0 > uand 186 + { doi empty$ adddoiresolver uand 187 + { pubmed empty$ addpubmedresolver uand 188 + { eprint empty$ addeprints uand 189 + { url empty$ 190 + { "" } 191 + { url } 192 + if$ } 193 + { eprinturl eprint * } 194 + if$ } 195 + { pubmedurl pubmed * } 196 + if$ } 197 + { doiurl doi * } 198 + if$ 199 + % an appropriately-formatted URL is now on the stack 200 + hrefform #1 = % hypertex 201 + { "\special {html:<a href=" quote$ * swap$ * quote$ * "> }{" * 'openinlinelink := 202 + "\special {html:</a>}" 'closeinlinelink := } 203 + { "\href {" swap$ * "} {" * 'openinlinelink := % hrefform=#2 -- hyperref 204 + % the space between "} {" matters: a URL of just the right length can cause "\% newline em" 205 + "}" 'closeinlinelink := } 206 + if$ 207 + #0 'makeinlinelink := 208 + } 209 + 'skip$ 210 + if$ % makeinlinelink 211 + } 212 + FUNCTION {add.inlinelink} 213 + { openinlinelink empty$ 214 + 'skip$ 215 + { openinlinelink swap$ * closeinlinelink * 216 + "" 'openinlinelink := 217 + } 218 + if$ 219 + } 220 + FUNCTION {output.nonnull} 221 + { % Save the thing we've been asked to output 222 + 's := 223 + % If the bracket-state is close.brackets, then add a close-bracket to 224 + % what is currently at the top of the stack, and set bracket.state 225 + % to outside.brackets 226 + bracket.state close.brackets = 227 + { "]" * 228 + outside.brackets 'bracket.state := 229 + } 230 + 'skip$ 231 + if$ 232 + bracket.state outside.brackets = 233 + { % We're outside all brackets -- this is the normal situation. 234 + % Write out what's currently at the top of the stack, using the 235 + % original output.nonnull function. 236 + s 237 + add.inlinelink 238 + output.nonnull.original % invoke the original output.nonnull 239 + } 240 + { % Still in brackets. Add open-bracket or (continuation) comma, add the 241 + % new text (in s) to the top of the stack, and move to the close-brackets 242 + % state, ready for next time (unless inbrackets resets it). If we come 243 + % into this branch, then output.state is carefully undisturbed. 244 + bracket.state open.brackets = 245 + { " [" * } 246 + { ", " * } % bracket.state will be within.brackets 247 + if$ 248 + s * 249 + close.brackets 'bracket.state := 250 + } 251 + if$ 252 + } 253 + 254 + % Call this function just before adding something which should be presented in 255 + % brackets. bracket.state is handled specially within output.nonnull. 256 + FUNCTION {inbrackets} 257 + { bracket.state close.brackets = 258 + { within.brackets 'bracket.state := } % reset the state: not open nor closed 259 + { open.brackets 'bracket.state := } 260 + if$ 261 + } 262 + 263 + FUNCTION {format.lastchecked} 264 + { lastchecked empty$ 265 + { "" } 266 + { inbrackets citedstring lastchecked * } 267 + if$ 268 + } 269 + % ...urlbst to here 270 + 271 + FUNCTION {output} 272 + { duplicate$ empty$ 273 + 'pop$ 274 + 'output.nonnull 275 + if$ 276 + } 277 + 278 + FUNCTION {output.check} 279 + { 't := 280 + duplicate$ empty$ 281 + { pop$ "empty " t * " in " * cite$ * warning$ } 282 + 'output.nonnull 283 + if$ 284 + } 285 + 286 + % apalike needs this function because 287 + % the year has special punctuation; 288 + % apalike ignores the month 289 + FUNCTION {output.year.check} 290 + { year empty$ 291 + { "empty year in " cite$ * warning$ } 292 + { write$ 293 + " " year * extra.label * 294 + mid.sentence 'output.state := 295 + } 296 + if$ 297 + } 298 + 299 + FUNCTION {output.bibitem.original} % urlbst (renamed from output.bibitem, so it can be wrapped below) 300 + { newline$ 301 + "\bibitem[" write$ 302 + label write$ 303 + "]{" write$ 304 + cite$ write$ 305 + "}" write$ 306 + newline$ 307 + "" 308 + before.all 'output.state := 309 + } 310 + 311 + FUNCTION {fin.entry.original} % urlbst (renamed from fin.entry, so it can be wrapped below) 312 + { add.period$ 313 + write$ 314 + newline$ 315 + } 316 + 317 + FUNCTION {new.block} 318 + { output.state before.all = 319 + 'skip$ 320 + { after.block 'output.state := } 321 + if$ 322 + } 323 + 324 + FUNCTION {new.sentence} 325 + { output.state after.block = 326 + 'skip$ 327 + { output.state before.all = 328 + 'skip$ 329 + { after.sentence 'output.state := } 330 + if$ 331 + } 332 + if$ 333 + } 334 + 335 + FUNCTION {not} 336 + { { #0 } 337 + { #1 } 338 + if$ 339 + } 340 + 341 + FUNCTION {and} 342 + { 'skip$ 343 + { pop$ #0 } 344 + if$ 345 + } 346 + 347 + FUNCTION {or} 348 + { { pop$ #1 } 349 + 'skip$ 350 + if$ 351 + } 352 + 353 + FUNCTION {new.block.checkb} 354 + { empty$ 355 + swap$ empty$ 356 + and 357 + 'skip$ 358 + 'new.block 359 + if$ 360 + } 361 + 362 + FUNCTION {field.or.null} 363 + { duplicate$ empty$ 364 + { pop$ "" } 365 + 'skip$ 366 + if$ 367 + } 368 + 369 + FUNCTION {emphasize} 370 + { duplicate$ empty$ 371 + { pop$ "" } 372 + { "{\em " swap$ * "}" * } 373 + if$ 374 + } 375 + 376 + INTEGERS { nameptr namesleft numnames } 377 + 378 + FUNCTION {format.names} 379 + { 's := 380 + #1 'nameptr := 381 + s num.names$ 'numnames := 382 + numnames 'namesleft := 383 + { namesleft #0 > } 384 + { "{\bf " s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ * "}" * 't := % last name first 385 + nameptr #1 > 386 + { namesleft #1 > 387 + { ", " * t * } 388 + { numnames #2 > 389 + { "," * } 390 + 'skip$ 391 + if$ 392 + t "others" = 393 + { " \textbf{et~al.}" * } 394 + { " \textbf{and} " * t * } 395 + if$ 396 + } 397 + if$ 398 + } 399 + 't 400 + if$ 401 + nameptr #1 + 'nameptr := 402 + namesleft #1 - 'namesleft := 403 + } 404 + while$ 405 + } 406 + 407 + FUNCTION {format.authors} 408 + { author empty$ 409 + { "" } 410 + { author format.names } 411 + if$ 412 + } 413 + 414 + FUNCTION {format.key} % this function is just for apalike 415 + { empty$ 416 + { key field.or.null } 417 + { "" } 418 + if$ 419 + } 420 + 421 + FUNCTION {format.editors} 422 + { editor empty$ 423 + { "" } 424 + { editor format.names 425 + editor num.names$ #1 > 426 + { ", editors" * } 427 + { ", editor" * } 428 + if$ 429 + } 430 + if$ 431 + } 432 + 433 + FUNCTION {format.title} 434 + { title empty$ 435 + { "" } 436 + { title "t" change.case$ } 437 + if$ 438 + } 439 + 440 + FUNCTION {n.dashify} 441 + { 't := 442 + "" 443 + { t empty$ not } 444 + { t #1 #1 substring$ "-" = 445 + { t #1 #2 substring$ "--" = not 446 + { "--" * 447 + t #2 global.max$ substring$ 't := 448 + } 449 + { { t #1 #1 substring$ "-" = } 450 + { "-" * 451 + t #2 global.max$ substring$ 't := 452 + } 453 + while$ 454 + } 455 + if$ 456 + } 457 + { t #1 #1 substring$ * 458 + t #2 global.max$ substring$ 't := 459 + } 460 + if$ 461 + } 462 + while$ 463 + } 464 + 465 + FUNCTION {format.btitle} 466 + { title emphasize 467 + } 468 + 469 + FUNCTION {tie.or.space.connect} 470 + { duplicate$ text.length$ #3 < 471 + { "~" } 472 + { " " } 473 + if$ 474 + swap$ * * 475 + } 476 + 477 + FUNCTION {either.or.check} 478 + { empty$ 479 + 'pop$ 480 + { "can't use both " swap$ * " fields in " * cite$ * warning$ } 481 + if$ 482 + } 483 + 484 + FUNCTION {format.bvolume} 485 + { volume empty$ 486 + { "" } 487 + { "volume" volume tie.or.space.connect 488 + series empty$ 489 + 'skip$ 490 + { " of " * series emphasize * } 491 + if$ 492 + "volume and number" number either.or.check 493 + } 494 + if$ 495 + } 496 + 497 + FUNCTION {format.number.series} 498 + { volume empty$ 499 + { number empty$ 500 + { series field.or.null } 501 + { output.state mid.sentence = 502 + { "number" } 503 + { "Number" } 504 + if$ 505 + number tie.or.space.connect 506 + series empty$ 507 + { "there's a number but no series in " cite$ * warning$ } 508 + { " in " * series * } 509 + if$ 510 + } 511 + if$ 512 + } 513 + { "" } 514 + if$ 515 + } 516 + 517 + FUNCTION {format.edition} 518 + { edition empty$ 519 + { "" } 520 + { output.state mid.sentence = 521 + { edition "l" change.case$ " edition" * } 522 + { edition "t" change.case$ " edition" * } 523 + if$ 524 + } 525 + if$ 526 + } 527 + 528 + INTEGERS { multiresult } 529 + 530 + FUNCTION {multi.page.check} 531 + { 't := 532 + #0 'multiresult := 533 + { multiresult not 534 + t empty$ not 535 + and 536 + } 537 + { t #1 #1 substring$ 538 + duplicate$ "-" = 539 + swap$ duplicate$ "," = 540 + swap$ "+" = 541 + or or 542 + { #1 'multiresult := } 543 + { t #2 global.max$ substring$ 't := } 544 + if$ 545 + } 546 + while$ 547 + multiresult 548 + } 549 + 550 + FUNCTION {format.pages} 551 + { pages empty$ 552 + { "" } 553 + { pages multi.page.check 554 + { "pp." pages n.dashify tie.or.space.connect } 555 + { "" pages tie.or.space.connect } 556 + if$ 557 + } 558 + if$ 559 + } 560 + 561 + FUNCTION {format.vol.num.pages} 562 + { volume field.or.null 563 + number empty$ 564 + 'skip$ 565 + { "(" number * ")" * * 566 + volume empty$ 567 + { "there's a number but no volume in " cite$ * warning$ } 568 + 'skip$ 569 + if$ 570 + } 571 + if$ 572 + pages empty$ 573 + 'skip$ 574 + { duplicate$ empty$ 575 + { pop$ format.pages } 576 + { ":" * pages n.dashify * } 577 + if$ 578 + } 579 + if$ 580 + } 581 + 582 + FUNCTION {format.chapter.pages} 583 + { chapter empty$ 584 + 'format.pages 585 + { type empty$ 586 + { "chapter" } 587 + { type "l" change.case$ } 588 + if$ 589 + chapter tie.or.space.connect 590 + pages empty$ 591 + 'skip$ 592 + { ", " * format.pages * } 593 + if$ 594 + } 595 + if$ 596 + } 597 + 598 + FUNCTION {format.in.ed.booktitle} 599 + { booktitle empty$ 600 + { "" } 601 + { editor empty$ 602 + { "In " booktitle emphasize * } 603 + { "In " format.editors * ", " * booktitle emphasize * } 604 + if$ 605 + } 606 + if$ 607 + } 608 + 609 + FUNCTION {format.thesis.type} 610 + { type empty$ 611 + 'skip$ 612 + { pop$ 613 + type "t" change.case$ 614 + } 615 + if$ 616 + } 617 + 618 + FUNCTION {format.tr.number} 619 + { type empty$ 620 + { "Technical Report" } 621 + 'type 622 + if$ 623 + number empty$ 624 + { "t" change.case$ } 625 + { number tie.or.space.connect } 626 + if$ 627 + } 628 + 629 + FUNCTION {format.article.crossref} 630 + { "In" % this is for apalike 631 + " \cite{" * crossref * "}" * 632 + } 633 + 634 + FUNCTION {format.book.crossref} 635 + { volume empty$ 636 + { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ 637 + "In " 638 + } 639 + { "Volume" volume tie.or.space.connect 640 + " of " * 641 + } 642 + if$ 643 + "\cite{" * crossref * "}" * % this is for apalike 644 + } 645 + 646 + FUNCTION {format.incoll.inproc.crossref} 647 + { "In" % this is for apalike 648 + " \cite{" * crossref * "}" * 649 + } 650 + 651 + FUNCTION {format.date} 652 + { year empty$ 653 + 'skip$ 654 + { %write$ 655 + "(" year * ")" * 656 + } 657 + if$ 658 + } 659 + % urlbst... 660 + % Functions for making hypertext links. 661 + % In all cases, the stack has (link-text href-url) 662 + % 663 + % make 'null' specials 664 + FUNCTION {make.href.null} 665 + { 666 + pop$ 667 + } 668 + % make hypertex specials 669 + FUNCTION {make.href.hypertex} 670 + { 671 + "\special {html:<a href=" quote$ * 672 + swap$ * quote$ * "> }" * swap$ * 673 + "\special {html:</a>}" * 674 + } 675 + % make hyperref specials 676 + FUNCTION {make.href.hyperref} 677 + { 678 + "\href {" swap$ * "} {\path{" * swap$ * "}}" * 679 + } 680 + FUNCTION {make.href} 681 + { hrefform #2 = 682 + 'make.href.hyperref % hrefform = 2 683 + { hrefform #1 = 684 + 'make.href.hypertex % hrefform = 1 685 + 'make.href.null % hrefform = 0 (or anything else) 686 + if$ 687 + } 688 + if$ 689 + } 690 + 691 + % If inlinelinks is true, then format.url should be a no-op, since it's 692 + % (a) redundant, and (b) could end up as a link-within-a-link. 693 + FUNCTION {format.url} 694 + { inlinelinks #1 = url empty$ or 695 + { "" } 696 + { hrefform #1 = 697 + { % special case -- add HyperTeX specials 698 + urlintro "\url{" url * "}" * url make.href.hypertex * } 699 + { urlintro "\url{" * url * "}" * } 700 + if$ 701 + } 702 + if$ 703 + } 704 + FUNCTION {format.eprint} 705 + { eprint empty$ 706 + { "" } 707 + { eprintprefix eprint * eprinturl eprint * make.href } 708 + if$ 709 + } 710 + 711 + FUNCTION {format.doi} 712 + { doi empty$ 713 + { "" } 714 + { doiprefix doi * doiurl doi * make.href } 715 + if$ 716 + } 717 + 718 + FUNCTION {format.pubmed} 719 + { pubmed empty$ 720 + { "" } 721 + { pubmedprefix pubmed * pubmedurl pubmed * make.href } 722 + if$ 723 + } 724 + 725 + % Output a URL. We can't use the more normal idiom (something like 726 + % `format.url output'), because the `inbrackets' within 727 + % format.lastchecked applies to everything between calls to `output', 728 + % so that `format.url format.lastchecked * output' ends up with both 729 + % the URL and the lastchecked in brackets. 730 + FUNCTION {output.url} 731 + { url empty$ 732 + 'skip$ 733 + { new.block 734 + format.url output 735 + format.lastchecked output 736 + } 737 + if$ 738 + } 739 + 740 + FUNCTION {output.web.refs} 741 + { 742 + new.block 743 + inlinelinks 744 + 'skip$ % links were inline -- don't repeat them 745 + { % If the generated DOI will be the same as the URL, 746 + % then don't print the URL (thanks to Joseph Wright for this code, 747 + % at http://tex.stackexchange.com/questions/5660) 748 + adddoiresolver 749 + doiurl doi empty$ { "X" } { doi } if$ * % DOI URL to be generated 750 + url empty$ { "Y" } { url } if$ % the URL, or "Y" if empty 751 + = % are the strings equal? 752 + and 753 + 'skip$ 754 + { output.url } 755 + if$ 756 + addeprints eprint empty$ not and 757 + { format.eprint output.nonnull } 758 + 'skip$ 759 + if$ 760 + adddoiresolver doi empty$ not and 761 + { format.doi output.nonnull } 762 + 'skip$ 763 + if$ 764 + addpubmedresolver pubmed empty$ not and 765 + { format.pubmed output.nonnull } 766 + 'skip$ 767 + if$ 768 + } 769 + if$ 770 + } 771 + 772 + % Wrapper for output.bibitem.original. 773 + % If the URL field is not empty, set makeinlinelink to be true, 774 + % so that an inline link will be started at the next opportunity 775 + FUNCTION {output.bibitem} 776 + { outside.brackets 'bracket.state := 777 + output.bibitem.original 778 + inlinelinks url empty$ not doi empty$ not or pubmed empty$ not or eprint empty$ not or and 779 + { #1 'makeinlinelink := } 780 + { #0 'makeinlinelink := } 781 + if$ 782 + } 783 + 784 + % Wrapper for fin.entry.original 785 + FUNCTION {fin.entry} 786 + { output.web.refs % urlbst 787 + makeinlinelink % ooops, it appears we didn't have a title for inlinelink 788 + { possibly.setup.inlinelink % add some artificial link text here, as a fallback 789 + linktextstring output.nonnull } 790 + 'skip$ 791 + if$ 792 + bracket.state close.brackets = % urlbst 793 + { "]" * } 794 + 'skip$ 795 + if$ 796 + fin.entry.original 797 + } 798 + 799 + % Webpage entry type. 800 + % Title and url fields required; 801 + % author, note, year, month, and lastchecked fields optional 802 + % See references 803 + % ISO 690-2 http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm 804 + % http://www.classroom.net/classroom/CitingNetResources.html 805 + % http://neal.ctstateu.edu/history/cite.html 806 + % http://www.cas.usf.edu/english/walker/mla.html 807 + % for citation formats for web pages. 808 + FUNCTION {webpage} 809 + { output.bibitem 810 + author empty$ 811 + { editor empty$ 812 + 'skip$ % author and editor both optional 813 + { format.editors output.nonnull } 814 + if$ 815 + } 816 + { editor empty$ 817 + { format.authors output.nonnull } 818 + { "can't use both author and editor fields in " cite$ * warning$ } 819 + if$ 820 + } 821 + if$ 822 + new.block 823 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ 824 + format.title "title" output.check 825 + inbrackets onlinestring output 826 + new.block 827 + year empty$ 828 + 'skip$ 829 + { format.date "year" output.check } 830 + if$ 831 + % We don't need to output the URL details ('lastchecked' and 'url'), 832 + % because fin.entry does that for us, using output.web.refs. The only 833 + % reason we would want to put them here is if we were to decide that 834 + % they should go in front of the rather miscellaneous information in 'note'. 835 + new.block 836 + note output 837 + fin.entry 838 + } 839 + % ...urlbst to here 840 + 841 + 842 + FUNCTION {article} 843 + { output.bibitem 844 + format.authors "author" output.check 845 + author format.key output % special for 846 + output.year.check % apalike 847 + new.block 848 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 849 + format.title "title" output.check 850 + new.block 851 + crossref missing$ 852 + { journal emphasize "journal" output.check 853 + possibly.setup.inlinelink format.vol.num.pages output% urlbst 854 + } 855 + { format.article.crossref output.nonnull 856 + format.pages output 857 + } 858 + if$ 859 + new.block 860 + note output 861 + fin.entry 862 + } 863 + 864 + FUNCTION {book} 865 + { output.bibitem 866 + author empty$ 867 + { format.editors "author and editor" output.check 868 + editor format.key output 869 + } 870 + { format.authors output.nonnull 871 + crossref missing$ 872 + { "author and editor" editor either.or.check } 873 + 'skip$ 874 + if$ 875 + } 876 + if$ 877 + output.year.check % special for apalike 878 + new.block 879 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 880 + format.btitle "title" output.check 881 + crossref missing$ 882 + { format.bvolume output 883 + new.block 884 + format.number.series output 885 + new.sentence 886 + publisher "publisher" output.check 887 + address output 888 + } 889 + { new.block 890 + format.book.crossref output.nonnull 891 + } 892 + if$ 893 + format.edition output 894 + new.block 895 + note output 896 + fin.entry 897 + } 898 + 899 + FUNCTION {booklet} 900 + { output.bibitem 901 + format.authors output 902 + author format.key output % special for 903 + output.year.check % apalike 904 + new.block 905 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 906 + format.title "title" output.check 907 + new.block 908 + howpublished output 909 + address output 910 + new.block 911 + note output 912 + fin.entry 913 + } 914 + 915 + FUNCTION {inbook} 916 + { output.bibitem 917 + author empty$ 918 + { format.editors "author and editor" output.check 919 + editor format.key output 920 + } 921 + { format.authors output.nonnull 922 + crossref missing$ 923 + { "author and editor" editor either.or.check } 924 + 'skip$ 925 + if$ 926 + } 927 + if$ 928 + output.year.check % special for apalike 929 + new.block 930 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 931 + format.btitle "title" output.check 932 + crossref missing$ 933 + { format.bvolume output 934 + format.chapter.pages "chapter and pages" output.check 935 + new.block 936 + format.number.series output 937 + new.sentence 938 + publisher "publisher" output.check 939 + address output 940 + } 941 + { format.chapter.pages "chapter and pages" output.check 942 + new.block 943 + format.book.crossref output.nonnull 944 + } 945 + if$ 946 + format.edition output 947 + new.block 948 + note output 949 + fin.entry 950 + } 951 + 952 + FUNCTION {incollection} 953 + { output.bibitem 954 + format.authors "author" output.check 955 + author format.key output % special for 956 + output.year.check % apalike 957 + new.block 958 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 959 + format.title "title" output.check 960 + new.block 961 + crossref missing$ 962 + { format.in.ed.booktitle "booktitle" output.check 963 + format.bvolume output 964 + format.number.series output 965 + format.chapter.pages output 966 + new.sentence 967 + publisher "publisher" output.check 968 + address output 969 + format.edition output 970 + } 971 + { format.incoll.inproc.crossref output.nonnull 972 + format.chapter.pages output 973 + } 974 + if$ 975 + new.block 976 + note output 977 + fin.entry 978 + } 979 + 980 + FUNCTION {inproceedings} 981 + { output.bibitem 982 + format.authors "author" output.check 983 + author format.key output % special for 984 + output.year.check % apalike 985 + new.block 986 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 987 + format.title "title" output.check 988 + new.block 989 + crossref missing$ 990 + { format.in.ed.booktitle "booktitle" output.check 991 + format.bvolume output 992 + format.number.series output 993 + format.pages output 994 + address output % for apalike 995 + new.sentence % there's no year 996 + organization output % here so things 997 + publisher output % are simpler 998 + } 999 + { format.incoll.inproc.crossref output.nonnull 1000 + format.pages output 1001 + } 1002 + if$ 1003 + new.block 1004 + note output 1005 + fin.entry 1006 + } 1007 + 1008 + FUNCTION {conference} { inproceedings } 1009 + 1010 + FUNCTION {manual} 1011 + { output.bibitem 1012 + format.authors output 1013 + author format.key output % special for 1014 + output.year.check % apalike 1015 + new.block 1016 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 1017 + format.btitle "title" output.check 1018 + organization address new.block.checkb 1019 + organization output 1020 + address output 1021 + format.edition output 1022 + new.block 1023 + note output 1024 + fin.entry 1025 + } 1026 + 1027 + FUNCTION {mastersthesis} 1028 + { output.bibitem 1029 + format.authors "author" output.check 1030 + author format.key output % special for 1031 + output.year.check % apalike 1032 + new.block 1033 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 1034 + format.title "title" output.check 1035 + new.block 1036 + "Master's thesis" format.thesis.type output.nonnull 1037 + school "school" output.check 1038 + address output 1039 + new.block 1040 + note output 1041 + fin.entry 1042 + } 1043 + 1044 + FUNCTION {misc} 1045 + { output.bibitem 1046 + format.authors output 1047 + author format.key output % special for 1048 + output.year.check % apalike 1049 + new.block 1050 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 1051 + format.title output 1052 + new.block 1053 + howpublished output 1054 + new.block 1055 + note output 1056 + fin.entry 1057 + } 1058 + 1059 + FUNCTION {phdthesis} 1060 + { output.bibitem 1061 + format.authors "author" output.check 1062 + author format.key output % special for 1063 + output.year.check % apalike 1064 + new.block 1065 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 1066 + format.btitle "title" output.check 1067 + new.block 1068 + "PhD thesis" format.thesis.type output.nonnull 1069 + school "school" output.check 1070 + address output 1071 + new.block 1072 + note output 1073 + fin.entry 1074 + } 1075 + 1076 + FUNCTION {proceedings} 1077 + { output.bibitem 1078 + format.editors output 1079 + editor format.key output % special for 1080 + output.year.check % apalike 1081 + new.block 1082 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 1083 + format.btitle "title" output.check 1084 + format.bvolume output 1085 + format.number.series output 1086 + address output % for apalike 1087 + new.sentence % we always output 1088 + organization output % a nonempty organization 1089 + publisher output % here 1090 + new.block 1091 + note output 1092 + fin.entry 1093 + } 1094 + 1095 + FUNCTION {techreport} 1096 + { output.bibitem 1097 + format.authors "author" output.check 1098 + author format.key output % special for 1099 + output.year.check % apalike 1100 + new.block 1101 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 1102 + format.title "title" output.check 1103 + new.block 1104 + format.tr.number output.nonnull 1105 + institution "institution" output.check 1106 + address output 1107 + new.block 1108 + note output 1109 + fin.entry 1110 + } 1111 + 1112 + FUNCTION {unpublished} 1113 + { output.bibitem 1114 + format.authors "author" output.check 1115 + author format.key output % special for 1116 + output.year.check % apalike 1117 + new.block 1118 + title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst 1119 + format.title "title" output.check 1120 + new.block 1121 + note "note" output.check 1122 + fin.entry 1123 + } 1124 + 1125 + FUNCTION {default.type} { misc } 1126 + 1127 + MACRO {jan} {"January"} 1128 + 1129 + MACRO {feb} {"February"} 1130 + 1131 + MACRO {mar} {"March"} 1132 + 1133 + MACRO {apr} {"April"} 1134 + 1135 + MACRO {may} {"May"} 1136 + 1137 + MACRO {jun} {"June"} 1138 + 1139 + MACRO {jul} {"July"} 1140 + 1141 + MACRO {aug} {"August"} 1142 + 1143 + MACRO {sep} {"September"} 1144 + 1145 + MACRO {oct} {"October"} 1146 + 1147 + MACRO {nov} {"November"} 1148 + 1149 + MACRO {dec} {"December"} 1150 + 1151 + MACRO {acmcs} {"ACM Computing Surveys"} 1152 + 1153 + MACRO {acta} {"Acta Informatica"} 1154 + 1155 + MACRO {cacm} {"Communications of the ACM"} 1156 + 1157 + MACRO {ibmjrd} {"IBM Journal of Research and Development"} 1158 + 1159 + MACRO {ibmsj} {"IBM Systems Journal"} 1160 + 1161 + MACRO {ieeese} {"IEEE Transactions on Software Engineering"} 1162 + 1163 + MACRO {ieeetc} {"IEEE Transactions on Computers"} 1164 + 1165 + MACRO {ieeetcad} 1166 + {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} 1167 + 1168 + MACRO {ipl} {"Information Processing Letters"} 1169 + 1170 + MACRO {jacm} {"Journal of the ACM"} 1171 + 1172 + MACRO {jcss} {"Journal of Computer and System Sciences"} 1173 + 1174 + MACRO {scp} {"Science of Computer Programming"} 1175 + 1176 + MACRO {sicomp} {"SIAM Journal on Computing"} 1177 + 1178 + MACRO {tocs} {"ACM Transactions on Computer Systems"} 1179 + 1180 + MACRO {tods} {"ACM Transactions on Database Systems"} 1181 + 1182 + MACRO {tog} {"ACM Transactions on Graphics"} 1183 + 1184 + MACRO {toms} {"ACM Transactions on Mathematical Software"} 1185 + 1186 + MACRO {toois} {"ACM Transactions on Office Information Systems"} 1187 + 1188 + MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} 1189 + 1190 + MACRO {tcs} {"Theoretical Computer Science"} 1191 + 1192 + READ 1193 + 1194 + FUNCTION {sortify} 1195 + { purify$ 1196 + "l" change.case$ 1197 + } 1198 + 1199 + INTEGERS { len } 1200 + 1201 + FUNCTION {chop.word} 1202 + { 's := 1203 + 'len := 1204 + s #1 len substring$ = 1205 + { s len #1 + global.max$ substring$ } 1206 + 's 1207 + if$ 1208 + } 1209 + 1210 + % There are three apalike cases: one person (Jones), 1211 + % two (Jones and de~Bruijn), and more (Jones et~al.). 1212 + % This function is much like format.crossref.editors. 1213 + % 1214 + FUNCTION {format.lab.names} 1215 + { 's := 1216 + s #1 "{vv~}{ll}" format.name$ 1217 + s num.names$ duplicate$ 1218 + #2 > 1219 + { pop$ " et~al." * } 1220 + { #2 < 1221 + 'skip$ 1222 + { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = 1223 + { " et~al." * } 1224 + { " and " * s #2 "{vv~}{ll}" format.name$ * } 1225 + if$ 1226 + } 1227 + if$ 1228 + } 1229 + if$ 1230 + } 1231 + 1232 + FUNCTION {author.key.label} 1233 + { author empty$ 1234 + { key empty$ 1235 + { cite$ #1 #3 substring$ } 1236 + 'key % apalike uses the whole key 1237 + if$ 1238 + } 1239 + { author format.lab.names } 1240 + if$ 1241 + } 1242 + 1243 + FUNCTION {author.editor.key.label} 1244 + { author empty$ 1245 + { editor empty$ 1246 + { key empty$ 1247 + { cite$ #1 #3 substring$ } 1248 + 'key % apalike uses the whole key 1249 + if$ 1250 + } 1251 + { editor format.lab.names } 1252 + if$ 1253 + } 1254 + { author format.lab.names } 1255 + if$ 1256 + } 1257 + 1258 + FUNCTION {editor.key.label} 1259 + { editor empty$ 1260 + { key empty$ 1261 + { cite$ #1 #3 substring$ } 1262 + 'key % apalike uses the whole key, no organization 1263 + if$ 1264 + } 1265 + { editor format.lab.names } 1266 + if$ 1267 + } 1268 + 1269 + FUNCTION {calc.label} 1270 + { type$ "book" = 1271 + type$ "inbook" = 1272 + or 1273 + 'author.editor.key.label 1274 + { type$ "proceedings" = 1275 + 'editor.key.label % apalike ignores organization 1276 + 'author.key.label % for labeling and sorting 1277 + if$ 1278 + } 1279 + if$ 1280 + ", " % these three lines are 1281 + * % for apalike, which 1282 + year field.or.null purify$ #-1 #4 substring$ % uses all four digits 1283 + * 1284 + 'label := 1285 + } 1286 + 1287 + FUNCTION {sort.format.names} 1288 + { 's := 1289 + #1 'nameptr := 1290 + "" 1291 + s num.names$ 'numnames := 1292 + numnames 'namesleft := 1293 + { namesleft #0 > } 1294 + { nameptr #1 > 1295 + { " " * } 1296 + 'skip$ 1297 + if$ % apalike uses initials 1298 + s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := % <= here 1299 + nameptr numnames = t "others" = and 1300 + { "et al" * } 1301 + { t sortify * } 1302 + if$ 1303 + nameptr #1 + 'nameptr := 1304 + namesleft #1 - 'namesleft := 1305 + } 1306 + while$ 1307 + } 1308 + 1309 + FUNCTION {sort.format.title} 1310 + { 't := 1311 + "A " #2 1312 + "An " #3 1313 + "The " #4 t chop.word 1314 + chop.word 1315 + chop.word 1316 + sortify 1317 + #1 global.max$ substring$ 1318 + } 1319 + 1320 + FUNCTION {author.sort} 1321 + { author empty$ 1322 + { key empty$ 1323 + { "to sort, need author or key in " cite$ * warning$ 1324 + "" 1325 + } 1326 + { key sortify } 1327 + if$ 1328 + } 1329 + { author sort.format.names } 1330 + if$ 1331 + } 1332 + 1333 + FUNCTION {author.editor.sort} 1334 + { author empty$ 1335 + { editor empty$ 1336 + { key empty$ 1337 + { "to sort, need author, editor, or key in " cite$ * warning$ 1338 + "" 1339 + } 1340 + { key sortify } 1341 + if$ 1342 + } 1343 + { editor sort.format.names } 1344 + if$ 1345 + } 1346 + { author sort.format.names } 1347 + if$ 1348 + } 1349 + 1350 + FUNCTION {editor.sort} 1351 + { editor empty$ 1352 + { key empty$ 1353 + { "to sort, need editor or key in " cite$ * warning$ 1354 + "" 1355 + } 1356 + { key sortify } 1357 + if$ 1358 + } 1359 + { editor sort.format.names } 1360 + if$ 1361 + } 1362 + 1363 + % apalike uses two sorting passes; the first one sets the 1364 + % labels so that the `a's, `b's, etc. can be computed; 1365 + % the second pass puts the references in "correct" order. 1366 + % The presort function is for the first pass. It computes 1367 + % label, sort.label, and title, and then concatenates. 1368 + FUNCTION {presort} 1369 + { calc.label 1370 + label sortify 1371 + " " 1372 + * 1373 + type$ "book" = 1374 + type$ "inbook" = 1375 + or 1376 + 'author.editor.sort 1377 + { type$ "proceedings" = 1378 + 'editor.sort 1379 + 'author.sort 1380 + if$ 1381 + } 1382 + if$ 1383 + #1 entry.max$ substring$ % for 1384 + 'sort.label := % apalike 1385 + sort.label % style 1386 + * 1387 + " " 1388 + * 1389 + title field.or.null 1390 + sort.format.title 1391 + * 1392 + #1 entry.max$ substring$ 1393 + 'sort.key$ := 1394 + } 1395 + 1396 + ITERATE {presort} 1397 + 1398 + SORT % by label, sort.label, title---for final label calculation 1399 + 1400 + STRINGS { last.label next.extra } % apalike labels are only for the text; 1401 + 1402 + INTEGERS { last.extra.num } % there are none in the bibliography 1403 + 1404 + FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label' 1405 + { #0 int.to.chr$ 'last.label := 1406 + "" 'next.extra := 1407 + #0 'last.extra.num := 1408 + } 1409 + 1410 + FUNCTION {forward.pass} 1411 + { last.label label = 1412 + { last.extra.num #1 + 'last.extra.num := 1413 + last.extra.num int.to.chr$ 'extra.label := 1414 + } 1415 + { "a" chr.to.int$ 'last.extra.num := 1416 + "" 'extra.label := 1417 + label 'last.label := 1418 + } 1419 + if$ 1420 + } 1421 + 1422 + FUNCTION {reverse.pass} 1423 + { next.extra "b" = 1424 + { "a" 'extra.label := } 1425 + 'skip$ 1426 + if$ 1427 + label extra.label * 'label := 1428 + extra.label 'next.extra := 1429 + } 1430 + 1431 + EXECUTE {initialize.extra.label.stuff} 1432 + 1433 + ITERATE {forward.pass} 1434 + 1435 + REVERSE {reverse.pass} 1436 + 1437 + % Now that the label is right we sort for real, 1438 + % on sort.label then year then title. This is 1439 + % for the second sorting pass. 1440 + FUNCTION {bib.sort.order} 1441 + { sort.label 1442 + " " 1443 + * 1444 + year field.or.null sortify 1445 + * 1446 + " " 1447 + * 1448 + title field.or.null 1449 + sort.format.title 1450 + * 1451 + #1 entry.max$ substring$ 1452 + 'sort.key$ := 1453 + } 1454 + 1455 + ITERATE {bib.sort.order} 1456 + 1457 + SORT % by sort.label, year, title---giving final bibliography order 1458 + 1459 + FUNCTION {begin.bib} 1460 + { preamble$ empty$ % no \etalchar in apalike 1461 + 'skip$ 1462 + { preamble$ write$ newline$ } 1463 + if$ 1464 + "\begin{thebibliography}{}" write$ newline$ % no labels in apalike 1465 + } 1466 + 1467 + EXECUTE {begin.bib} 1468 + 1469 + EXECUTE {init.urlbst.variables} % urlbst 1470 + EXECUTE {init.state.consts} 1471 + 1472 + ITERATE {call.type$} 1473 + 1474 + FUNCTION {end.bib} 1475 + { newline$ 1476 + "\end{thebibliography}" write$ newline$ 1477 + } 1478 + 1479 + EXECUTE {end.bib}
+4 -1
mscs.tex
··· 65 65 \maketitle 66 66 \input{nodes/body} 67 67 68 - \bibliographystyle{msclike} 68 + \section*{Competing interests} 69 + The author declares none 70 + 71 + \bibliographystyle{msclike-url} 69 72 \bibliography{references/refs-bibtex} 70 73 71 74 \end{document}