Debian Codegraph @

texmf-dist/bibtex/bst/sort-by-letters/siam-letters.bst

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