Debian Codegraph @

texmf-dist/bibtex/bst/asaetr/asaetr.bst

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