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