Debian Codegraph @

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

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