1% BibTeX bibliography style `annotate' 2% based on alpha. 3 4ENTRY 5 { address 6 annotate 7 author 8 booktitle 9 chapter 10 edition 11 editor 12 howpublished 13 institution 14 journal 15 key 16 month 17 note 18 number 19 organization 20 pages 21 publisher 22 school 23 series 24 title 25 type 26 volume 27 year 28 } 29 {} 30 { label extra.label sort.label } 31 32INTEGERS { output.state before.all mid.sentence after.sentence after.block } 33 34FUNCTION {init.state.consts} 35{ #0 'before.all := 36 #1 'mid.sentence := 37 #2 'after.sentence := 38 #3 'after.block := 39} 40 41STRINGS { s t } 42 43FUNCTION {output.nonnull} 44{ 's := 45 output.state mid.sentence = 46 { ", " * write$ } 47 { output.state after.block = 48 { add.period$ write$ 49 newline$ 50 "\newblock " write$ 51 } 52 { output.state before.all = 53 'write$ 54 { add.period$ " " * write$ } 55 if$ 56 } 57 if$ 58 mid.sentence 'output.state := 59 } 60 if$ 61 s 62} 63 64FUNCTION {output} 65{ duplicate$ empty$ 66 'pop$ 67 'output.nonnull 68 if$ 69} 70 71FUNCTION {output.check} 72{ 't := 73 duplicate$ empty$ 74 { pop$ "empty " t * " in " * cite$ * warning$ } 75 'output.nonnull 76 if$ 77} 78 79FUNCTION {output.bibitem} 80{ newline$ 81 "\bibitem[" write$ 82 label write$ 83 "]{" write$ 84 cite$ write$ 85 "}" write$ 86 newline$ 87 "" 88 before.all 'output.state := 89} 90 91FUNCTION {fin.entry} 92{ add.period$ 93 write$ 94 newline$ 95} 96 97FUNCTION {new.block} 98{ output.state before.all = 99 'skip$ 100 { after.block 'output.state := } 101 if$ 102} 103 104FUNCTION {new.sentence} 105{ output.state after.block = 106 'skip$ 107 { output.state before.all = 108 'skip$ 109 { after.sentence 'output.state := } 110 if$ 111 } 112 if$ 113} 114 115FUNCTION {not} 116{ { #0 } 117 { #1 } 118 if$ 119} 120 121FUNCTION {and} 122{ 'skip$ 123 { pop$ #0 } 124 if$ 125} 126 127FUNCTION {or} 128{ { pop$ #1 } 129 'skip$ 130 if$ 131} 132 133FUNCTION {new.block.checka} 134{ empty$ 135 'skip$ 136 'new.block 137 if$ 138} 139 140FUNCTION {new.block.checkb} 141{ empty$ 142 swap$ empty$ 143 and 144 'skip$ 145 'new.block 146 if$ 147} 148 149FUNCTION {new.sentence.checka} 150{ empty$ 151 'skip$ 152 'new.sentence 153 if$ 154} 155 156FUNCTION {new.sentence.checkb} 157{ empty$ 158 swap$ empty$ 159 and 160 'skip$ 161 'new.sentence 162 if$ 163} 164 165FUNCTION {field.or.null} 166{ duplicate$ empty$ 167 { pop$ "" } 168 'skip$ 169 if$ 170} 171 172FUNCTION {emphasize} 173{ duplicate$ empty$ 174 { pop$ "" } 175 { "{\em " swap$ * "}" * } 176 if$ 177} 178 179INTEGERS { nameptr namesleft numnames } 180 181FUNCTION {format.names} 182{ 's := 183 #1 'nameptr := 184 s num.names$ 'numnames := 185 numnames 'namesleft := 186 { namesleft #0 > } 187 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := 188 nameptr #1 > 189 { namesleft #1 > 190 { ", " * t * } 191 { numnames #2 > 192 { "," * } 193 'skip$ 194 if$ 195 t "others" = 196 { " et~al." * } 197 { " and " * t * } 198 if$ 199 } 200 if$ 201 } 202 't 203 if$ 204 nameptr #1 + 'nameptr := 205 namesleft #1 - 'namesleft := 206 } 207 while$ 208} 209 210FUNCTION {format.authors} 211{ author empty$ 212 { "" } 213 { author format.names } 214 if$ 215} 216 217FUNCTION {format.annotate} 218{ annotate empty$ 219 { "" } 220 { " \begin{quotation}\noindent " 221 annotate 222 * " \end{quotation} " * 223 } 224 if$ 225} 226 227FUNCTION {format.editors} 228{ editor empty$ 229 { "" } 230 { editor format.names 231 editor num.names$ #1 > 232 { ", editors" * } 233 { ", editor" * } 234 if$ 235 } 236 if$ 237} 238 239FUNCTION {format.title} 240{ title empty$ 241 { "" } 242 { title "t" change.case$ } 243 if$ 244} 245 246FUNCTION {n.dashify} 247{ 't := 248 "" 249 { t empty$ not } 250 { t #1 #1 substring$ "-" = 251 { t #1 #2 substring$ "--" = not 252 { "--" * 253 t #2 global.max$ substring$ 't := 254 } 255 { { t #1 #1 substring$ "-" = } 256 { "-" * 257 t #2 global.max$ substring$ 't := 258 } 259 while$ 260 } 261 if$ 262 } 263 { t #1 #1 substring$ * 264 t #2 global.max$ substring$ 't := 265 } 266 if$ 267 } 268 while$ 269} 270 271FUNCTION {format.date} 272{ year empty$ 273 { month empty$ 274 { "" } 275 { "there's a month but no year in " cite$ * warning$ 276 month 277 } 278 if$ 279 } 280 { month empty$ 281 'year 282 { month " " * year * } 283 if$ 284 } 285 if$ 286} 287 288FUNCTION {format.btitle} 289{ title emphasize 290} 291 292FUNCTION {tie.or.space.connect} 293{ duplicate$ text.length$ #3 < 294 { "~" } 295 { " " } 296 if$ 297 swap$ * * 298} 299 300FUNCTION {either.or.check} 301{ empty$ 302 'pop$ 303 { "can't use both " swap$ * " fields in " * cite$ * warning$ } 304 if$ 305} 306 307FUNCTION {format.bvolume} 308{ volume empty$ 309 { "" } 310 { "volume" volume tie.or.space.connect 311 series empty$ 312 'skip$ 313 { " of " * series emphasize * } 314 if$ 315 "volume and number" number either.or.check 316 } 317 if$ 318} 319 320FUNCTION {format.number.series} 321{ volume empty$ 322 { number empty$ 323 { series field.or.null } 324 { output.state mid.sentence = 325 { "number" } 326 { "Number" } 327 if$ 328 number tie.or.space.connect 329 series empty$ 330 { "there's a number but no series in " cite$ * warning$ } 331 { " in " * series * } 332 if$ 333 } 334 if$ 335 } 336 { "" } 337 if$ 338} 339 340FUNCTION {format.edition} 341{ edition empty$ 342 { "" } 343 { output.state mid.sentence = 344 { edition "l" change.case$ " edition" * } 345 { edition "t" change.case$ " edition" * } 346 if$ 347 } 348 if$ 349} 350 351INTEGERS { multiresult } 352 353FUNCTION {multi.page.check} 354{ 't := 355 #0 'multiresult := 356 { multiresult not 357 t empty$ not 358 and 359 } 360 { t #1 #1 substring$ 361 duplicate$ "-" = 362 swap$ duplicate$ "," = 363 swap$ "+" = 364 or or 365 { #1 'multiresult := } 366 { t #2 global.max$ substring$ 't := } 367 if$ 368 } 369 while$ 370 multiresult 371} 372 373FUNCTION {format.pages} 374{ pages empty$ 375 { "" } 376 { pages multi.page.check 377 { "pages" pages n.dashify tie.or.space.connect } 378 { "page" pages tie.or.space.connect } 379 if$ 380 } 381 if$ 382} 383 384FUNCTION {format.vol.num.pages} 385{ volume field.or.null 386 number empty$ 387 'skip$ 388 { "(" number * ")" * * 389 volume empty$ 390 { "there's a number but no volume in " cite$ * warning$ } 391 'skip$ 392 if$ 393 } 394 if$ 395 pages empty$ 396 'skip$ 397 { duplicate$ empty$ 398 { pop$ format.pages } 399 { ":" * pages n.dashify * } 400 if$ 401 } 402 if$ 403} 404 405FUNCTION {format.chapter.pages} 406{ chapter empty$ 407 'format.pages 408 { type empty$ 409 { "chapter" } 410 { type "l" change.case$ } 411 if$ 412 chapter tie.or.space.connect 413 pages empty$ 414 'skip$ 415 { ", " * format.pages * } 416 if$ 417 } 418 if$ 419} 420 421FUNCTION {format.in.ed.booktitle} 422{ booktitle empty$ 423 { "" } 424 { editor empty$ 425 { "In " booktitle emphasize * } 426 { "In " format.editors * ", " * booktitle emphasize * } 427 if$ 428 } 429 if$ 430} 431 432FUNCTION {empty.misc.check} 433{ author empty$ title empty$ howpublished empty$ 434 month empty$ year empty$ note empty$ 435 and and and and and 436 key empty$ not and 437 { "all relevant fields are empty in " cite$ * warning$ } 438 'skip$ 439 if$ 440} 441 442FUNCTION {format.thesis.type} 443{ type empty$ 444 'skip$ 445 { pop$ 446 type "t" change.case$ 447 } 448 if$ 449} 450 451FUNCTION {format.tr.number} 452{ type empty$ 453 { "Technical Report" } 454 'type 455 if$ 456 number empty$ 457 { "t" change.case$ } 458 { number tie.or.space.connect } 459 if$ 460} 461 462FUNCTION {format.article.crossref} 463{ key empty$ 464 { journal empty$ 465 { "need key or journal for " cite$ * " to crossref " * crossref * 466 warning$ 467 "" 468 } 469 { "In {\em " journal * "\/}" * } 470 if$ 471 } 472 { "In " key * } 473 if$ 474 " \cite{" * crossref * "}" * 475} 476 477FUNCTION {format.crossref.editor} 478{ editor #1 "{vv~}{ll}" format.name$ 479 editor num.names$ duplicate$ 480 #2 > 481 { pop$ " et~al." * } 482 { #2 < 483 'skip$ 484 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" = 485 { " et~al." * } 486 { " and " * editor #2 "{vv~}{ll}" format.name$ * } 487 if$ 488 } 489 if$ 490 } 491 if$ 492} 493 494FUNCTION {format.book.crossref} 495{ volume empty$ 496 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$ 497 "In " 498 } 499 { "Volume" volume tie.or.space.connect 500 " of " * 501 } 502 if$ 503 editor empty$ 504 editor field.or.null author field.or.null = 505 or 506 { key empty$ 507 { series empty$ 508 { "need editor, key, or series for " cite$ * " to crossref " * 509 crossref * warning$ 510 "" * 511 } 512 { "{\em " * series * "\/}" * } 513 if$ 514 } 515 { key * } 516 if$ 517 } 518 { format.crossref.editor * } 519 if$ 520 " \cite{" * crossref * "}" * 521} 522 523FUNCTION {format.incoll.inproc.crossref} 524{ editor empty$ 525 editor field.or.null author field.or.null = 526 or 527 { key empty$ 528 { booktitle empty$ 529 { "need editor, key, or booktitle for " cite$ * " to crossref " * 530 crossref * warning$ 531 "" 532 } 533 { "In {\em " booktitle * "\/}" * } 534 if$ 535 } 536 { "In " key * } 537 if$ 538 } 539 { "In " format.crossref.editor * } 540 if$ 541 " \cite{" * crossref * "}" * 542} 543 544FUNCTION {article} 545{ output.bibitem 546 format.authors "author" output.check 547 new.block 548 format.title "title" output.check 549 new.block 550 crossref missing$ 551 { journal emphasize "journal" output.check 552 format.vol.num.pages output 553 format.date "year" output.check 554 } 555 { format.article.crossref output.nonnull 556 format.pages output 557 } 558 if$ 559 new.block 560 note output 561 fin.entry 562 format.annotate write$ 563 newline$ 564} 565 566FUNCTION {book} 567{ output.bibitem 568 author empty$ 569 { format.editors "author and editor" output.check } 570 { format.authors output.nonnull 571 crossref missing$ 572 { "author and editor" editor either.or.check } 573 'skip$ 574 if$ 575 } 576 if$ 577 new.block 578 format.btitle "title" output.check 579 crossref missing$ 580 { format.bvolume output 581 new.block 582 format.number.series output 583 new.sentence 584 publisher "publisher" output.check 585 address output 586 } 587 { new.block 588 format.book.crossref output.nonnull 589 } 590 if$ 591 format.edition output 592 format.date "year" output.check 593 new.block 594 note output 595 fin.entry 596 format.annotate write$ 597 newline$ 598 599} 600 601FUNCTION {booklet} 602{ output.bibitem 603 format.authors output 604 new.block 605 format.title "title" output.check 606 howpublished address new.block.checkb 607 howpublished output 608 address output 609 format.date output 610 new.block 611 note output 612 fin.entry 613 format.annotate write$ 614 newline$ 615 616} 617 618FUNCTION {inbook} 619{ output.bibitem 620 author empty$ 621 { format.editors "author and editor" output.check } 622 { format.authors output.nonnull 623 crossref missing$ 624 { "author and editor" editor either.or.check } 625 'skip$ 626 if$ 627 } 628 if$ 629 new.block 630 format.btitle "title" output.check 631 crossref missing$ 632 { format.bvolume output 633 format.chapter.pages "chapter and pages" output.check 634 new.block 635 format.number.series output 636 new.sentence 637 publisher "publisher" output.check 638 address output 639 } 640 { format.chapter.pages "chapter and pages" output.check 641 new.block 642 format.book.crossref output.nonnull 643 } 644 if$ 645 format.edition output 646 format.date "year" output.check 647 new.block 648 note output 649 fin.entry 650 format.annotate write$ 651} 652 653FUNCTION {incollection} 654{ output.bibitem 655 format.authors "author" output.check 656 new.block 657 format.title "title" output.check 658 new.block 659 crossref missing$ 660 { format.in.ed.booktitle "booktitle" output.check 661 format.bvolume output 662 format.number.series output 663 format.chapter.pages output 664 new.sentence 665 publisher "publisher" output.check 666 address output 667 format.edition output 668 format.date "year" output.check 669 } 670 { format.incoll.inproc.crossref output.nonnull 671 format.chapter.pages output 672 } 673 if$ 674 new.block 675 note output 676 fin.entry 677 format.annotate write$ 678} 679 680FUNCTION {inproceedings} 681{ output.bibitem 682 format.authors "author" output.check 683 new.block 684 format.title "title" output.check 685 new.block 686 crossref missing$ 687 { format.in.ed.booktitle "booktitle" output.check 688 format.bvolume output 689 format.number.series output 690 format.pages output 691 address empty$ 692 { organization publisher new.sentence.checkb 693 organization output 694 publisher output 695 format.date "year" output.check 696 } 697 { address output.nonnull 698 format.date "year" output.check 699 new.sentence 700 organization output 701 publisher output 702 } 703 if$ 704 } 705 { format.incoll.inproc.crossref output.nonnull 706 format.pages output 707 } 708 if$ 709 new.block 710 note output 711 fin.entry 712 format.annotate write$ 713} 714 715FUNCTION {conference} { inproceedings } 716 717FUNCTION {manual} 718{ output.bibitem 719 author empty$ 720 { organization empty$ 721 'skip$ 722 { organization output.nonnull 723 address output 724 } 725 if$ 726 } 727 { format.authors output.nonnull } 728 if$ 729 new.block 730 format.btitle "title" output.check 731 author empty$ 732 { organization empty$ 733 { address new.block.checka 734 address output 735 } 736 'skip$ 737 if$ 738 } 739 { organization address new.block.checkb 740 organization output 741 address output 742 } 743 if$ 744 format.edition output 745 format.date output 746 new.block 747 note output 748 fin.entry 749 750 format.annotate write$ 751} 752 753FUNCTION {mastersthesis} 754{ output.bibitem 755 format.authors "author" output.check 756 new.block 757 format.title "title" output.check 758 new.block 759 "Master's thesis" format.thesis.type output.nonnull 760 school "school" output.check 761 address output 762 format.date "year" output.check 763 new.block 764 note output 765 fin.entry 766 format.annotate write$ 767} 768 769FUNCTION {misc} 770{ output.bibitem 771 format.authors output 772 title howpublished new.block.checkb 773 format.title output 774 howpublished new.block.checka 775 howpublished output 776 format.date output 777 new.block 778 note output 779 fin.entry 780 format.annotate write$ 781 empty.misc.check 782} 783 784FUNCTION {phdthesis} 785{ output.bibitem 786 format.authors "author" output.check 787 new.block 788 format.btitle "title" output.check 789 new.block 790 "PhD thesis" format.thesis.type output.nonnull 791 school "school" output.check 792 address output 793 format.date "year" output.check 794 new.block 795 note output 796 fin.entry 797 format.annotate write$ 798} 799 800FUNCTION {proceedings} 801{ output.bibitem 802 editor empty$ 803 { organization output } 804 { format.editors output.nonnull } 805 if$ 806 new.block 807 format.btitle "title" output.check 808 format.bvolume output 809 format.number.series output 810 address empty$ 811 { editor empty$ 812 { publisher new.sentence.checka } 813 { organization publisher new.sentence.checkb 814 organization output 815 } 816 if$ 817 publisher output 818 format.date "year" output.check 819 } 820 { address output.nonnull 821 format.date "year" output.check 822 new.sentence 823 editor empty$ 824 'skip$ 825 { organization output } 826 if$ 827 publisher output 828 } 829 if$ 830 new.block 831 note output 832 fin.entry 833 format.annotate write$ 834} 835 836FUNCTION {techreport} 837{ output.bibitem 838 format.authors "author" output.check 839 new.block 840 format.title "title" output.check 841 new.block 842 format.tr.number output.nonnull 843 institution "institution" output.check 844 address output 845 format.date "year" output.check 846 new.block 847 note output 848 fin.entry 849 format.annotate write$ 850} 851 852FUNCTION {unpublished} 853{ output.bibitem 854 format.authors "author" output.check 855 new.block 856 format.title "title" output.check 857 new.block 858 note "note" output.check 859 format.date output 860 fin.entry 861 format.annotate write$ 862} 863 864FUNCTION {default.type} { misc } 865 866MACRO {jan} {"January"} 867 868MACRO {feb} {"February"} 869 870MACRO {mar} {"March"} 871 872MACRO {apr} {"April"} 873 874MACRO {may} {"May"} 875 876MACRO {jun} {"June"} 877 878MACRO {jul} {"July"} 879 880MACRO {aug} {"August"} 881 882MACRO {sep} {"September"} 883 884MACRO {oct} {"October"} 885 886MACRO {nov} {"November"} 887 888MACRO {dec} {"December"} 889 890MACRO {acmcs} {"ACM Computing Surveys"} 891 892MACRO {acta} {"Acta Informatica"} 893 894MACRO {cacm} {"Communications of the ACM"} 895 896MACRO {ibmjrd} {"IBM Journal of Research and Development"} 897 898MACRO {ibmsj} {"IBM Systems Journal"} 899 900MACRO {ieeese} {"IEEE Transactions on Software Engineering"} 901 902MACRO {ieeetc} {"IEEE Transactions on Computers"} 903 904MACRO {ieeetcad} 905 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} 906 907MACRO {ipl} {"Information Processing Letters"} 908 909MACRO {jacm} {"Journal of the ACM"} 910 911MACRO {jcss} {"Journal of Computer and System Sciences"} 912 913MACRO {scp} {"Science of Computer Programming"} 914 915MACRO {sicomp} {"SIAM Journal on Computing"} 916 917MACRO {tocs} {"ACM Transactions on Computer Systems"} 918 919MACRO {tods} {"ACM Transactions on Database Systems"} 920 921MACRO {tog} {"ACM Transactions on Graphics"} 922 923MACRO {toms} {"ACM Transactions on Mathematical Software"} 924 925MACRO {toois} {"ACM Transactions on Office Information Systems"} 926 927MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"} 928 929MACRO {tcs} {"Theoretical Computer Science"} 930 931READ 932 933FUNCTION {sortify} 934{ purify$ 935 "l" change.case$ 936} 937 938INTEGERS { len } 939 940FUNCTION {chop.word} 941{ 's := 942 'len := 943 s #1 len substring$ = 944 { s len #1 + global.max$ substring$ } 945 's 946 if$ 947} 948 949INTEGERS { et.al.char.used } 950 951FUNCTION {initialize.et.al.char.used} 952{ #0 'et.al.char.used := 953} 954 955EXECUTE {initialize.et.al.char.used} 956 957FUNCTION {format.lab.names} 958{ 's := 959 s num.names$ 'numnames := 960 numnames #1 > 961 { numnames #4 > 962 { #3 'namesleft := } 963 { numnames 'namesleft := } 964 if$ 965 #1 'nameptr := 966 "" 967 { namesleft #0 > } 968 { nameptr numnames = 969 { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" = 970 { "{\etalchar{+}}" * 971 #1 'et.al.char.used := 972 } 973 { s nameptr "{v{}}{l{}}" format.name$ * } 974 if$ 975 } 976 { s nameptr "{v{}}{l{}}" format.name$ * } 977 if$ 978 nameptr #1 + 'nameptr := 979 namesleft #1 - 'namesleft := 980 } 981 while$ 982 numnames #4 > 983 { "{\etalchar{+}}" * 984 #1 'et.al.char.used := 985 } 986 'skip$ 987 if$ 988 } 989 { s #1 "{v{}}{l{}}" format.name$ 990 duplicate$ text.length$ #2 < 991 { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ } 992 'skip$ 993 if$ 994 } 995 if$ 996} 997 998FUNCTION {author.key.label} 999{ author empty$ 1000 { key empty$ 1001 { cite$ #1 #3 substring$ } 1002 { key #3 text.prefix$ } 1003 if$ 1004 } 1005 { author format.lab.names } 1006 if$ 1007} 1008 1009FUNCTION {author.editor.key.label} 1010{ author empty$ 1011 { editor empty$ 1012 { key empty$ 1013 { cite$ #1 #3 substring$ } 1014 { key #3 text.prefix$ } 1015 if$ 1016 } 1017 { editor format.lab.names } 1018 if$ 1019 } 1020 { author format.lab.names } 1021 if$ 1022} 1023 1024FUNCTION {author.key.organization.label} 1025{ author empty$ 1026 { key empty$ 1027 { organization empty$ 1028 { cite$ #1 #3 substring$ } 1029 { "The " #4 organization chop.word #3 text.prefix$ } 1030 if$ 1031 } 1032 { key #3 text.prefix$ } 1033 if$ 1034 } 1035 { author format.lab.names } 1036 if$ 1037} 1038 1039FUNCTION {editor.key.organization.label} 1040{ editor empty$ 1041 { key empty$ 1042 { organization empty$ 1043 { cite$ #1 #3 substring$ } 1044 { "The " #4 organization chop.word #3 text.prefix$ } 1045 if$ 1046 } 1047 { key #3 text.prefix$ } 1048 if$ 1049 } 1050 { editor format.lab.names } 1051 if$ 1052} 1053 1054FUNCTION {calc.label} 1055{ type$ "book" = 1056 type$ "inbook" = 1057 or 1058 'author.editor.key.label 1059 { type$ "proceedings" = 1060 'editor.key.organization.label 1061 { type$ "manual" = 1062 'author.key.organization.label 1063 'author.key.label 1064 if$ 1065 } 1066 if$ 1067 } 1068 if$ 1069 duplicate$ 1070 year field.or.null purify$ #-1 #2 substring$ 1071 * 1072 'label := 1073 year field.or.null purify$ #-1 #4 substring$ 1074 * 1075 sortify 'sort.label := 1076} 1077 1078FUNCTION {sort.format.names} 1079{ 's := 1080 #1 'nameptr := 1081 "" 1082 s num.names$ 'numnames := 1083 numnames 'namesleft := 1084 { namesleft #0 > } 1085 { nameptr #1 > 1086 { " " * } 1087 'skip$ 1088 if$ 1089 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't := 1090 nameptr numnames = t "others" = and 1091 { "et al" * } 1092 { t sortify * } 1093 if$ 1094 nameptr #1 + 'nameptr := 1095 namesleft #1 - 'namesleft := 1096 } 1097 while$ 1098} 1099 1100FUNCTION {sort.format.title} 1101{ 't := 1102 "A " #2 1103 "An " #3 1104 "The " #4 t chop.word 1105 chop.word 1106 chop.word 1107 sortify 1108 #1 global.max$ substring$ 1109} 1110 1111FUNCTION {author.sort} 1112{ author empty$ 1113 { key empty$ 1114 { "to sort, need author or key in " cite$ * warning$ 1115 "" 1116 } 1117 { key sortify } 1118 if$ 1119 } 1120 { author sort.format.names } 1121 if$ 1122} 1123 1124FUNCTION {author.editor.sort} 1125{ author empty$ 1126 { editor empty$ 1127 { key empty$ 1128 { "to sort, need author, editor, or key in " cite$ * warning$ 1129 "" 1130 } 1131 { key sortify } 1132 if$ 1133 } 1134 { editor sort.format.names } 1135 if$ 1136 } 1137 { author sort.format.names } 1138 if$ 1139} 1140 1141FUNCTION {author.organization.sort} 1142{ author empty$ 1143 { organization empty$ 1144 { key empty$ 1145 { "to sort, need author, organization, or key in " cite$ * warning$ 1146 "" 1147 } 1148 { key sortify } 1149 if$ 1150 } 1151 { "The " #4 organization chop.word sortify } 1152 if$ 1153 } 1154 { author sort.format.names } 1155 if$ 1156} 1157 1158FUNCTION {editor.organization.sort} 1159{ editor empty$ 1160 { organization empty$ 1161 { key empty$ 1162 { "to sort, need editor, organization, or key in " cite$ * warning$ 1163 "" 1164 } 1165 { key sortify } 1166 if$ 1167 } 1168 { "The " #4 organization chop.word sortify } 1169 if$ 1170 } 1171 { editor sort.format.names } 1172 if$ 1173} 1174 1175FUNCTION {presort} 1176{ calc.label 1177 sort.label 1178 " " 1179 * 1180 type$ "book" = 1181 type$ "inbook" = 1182 or 1183 'author.editor.sort 1184 { type$ "proceedings" = 1185 'editor.organization.sort 1186 { type$ "manual" = 1187 'author.organization.sort 1188 'author.sort 1189 if$ 1190 } 1191 if$ 1192 } 1193 if$ 1194 * 1195 " " 1196 * 1197 year field.or.null sortify 1198 * 1199 " " 1200 * 1201 title field.or.null 1202 sort.format.title 1203 * 1204 #1 entry.max$ substring$ 1205 'sort.key$ := 1206} 1207 1208ITERATE {presort} 1209 1210SORT 1211 1212STRINGS { longest.label last.sort.label next.extra } 1213 1214INTEGERS { longest.label.width last.extra.num } 1215 1216FUNCTION {initialize.longest.label} 1217{ "" 'longest.label := 1218 #0 int.to.chr$ 'last.sort.label := 1219 "" 'next.extra := 1220 #0 'longest.label.width := 1221 #0 'last.extra.num := 1222} 1223 1224FUNCTION {forward.pass} 1225{ last.sort.label sort.label = 1226 { last.extra.num #1 + 'last.extra.num := 1227 last.extra.num int.to.chr$ 'extra.label := 1228 } 1229 { "a" chr.to.int$ 'last.extra.num := 1230 "" 'extra.label := 1231 sort.label 'last.sort.label := 1232 } 1233 if$ 1234} 1235 1236FUNCTION {reverse.pass} 1237{ next.extra "b" = 1238 { "a" 'extra.label := } 1239 'skip$ 1240 if$ 1241 label extra.label * 'label := 1242 label width$ longest.label.width > 1243 { label 'longest.label := 1244 label width$ 'longest.label.width := 1245 } 1246 'skip$ 1247 if$ 1248 extra.label 'next.extra := 1249} 1250 1251EXECUTE {initialize.longest.label} 1252 1253ITERATE {forward.pass} 1254 1255REVERSE {reverse.pass} 1256 1257FUNCTION {begin.bib} 1258{ et.al.char.used 1259 { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ } 1260 'skip$ 1261 if$ 1262 preamble$ empty$ 1263 'skip$ 1264 { preamble$ write$ newline$ } 1265 if$ 1266 "\begin{thebibliography}{" longest.label * "}" * write$ newline$ 1267} 1268 1269EXECUTE {begin.bib} 1270 1271EXECUTE {init.state.consts} 1272 1273ITERATE {call.type$} 1274 1275FUNCTION {end.bib} 1276{ newline$ 1277 "\end{thebibliography}" write$ newline$ 1278} 1279 1280EXECUTE {end.bib} 1281