WAC8: acl.bst

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