Debian Codegraph @

texmf-dist/bibtex/bst/base/acm.bst

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