process the rest of Pieter's comments
[phd-thesis.git] / myabbrvnat.bst
1 %% File: `abbrvnat.bst'
2 %% A modification of `abbrv.bst' for use with natbib package
3 %%
4 %% Copyright 1993-2007 Patrick W Daly
5 %% Max-Planck-Institut f\"ur Sonnensystemforschung
6 %% Max-Planck-Str. 2
7 %% D-37191 Katlenburg-Lindau
8 %% Germany
9 %% E-mail: daly@mps.mpg.de
10 %%
11 %% This program can be redistributed and/or modified under the terms
12 %% of the LaTeX Project Public License Distributed from CTAN
13 %% archives in directory macros/latex/base/lppl.txt; either
14 %% version 1 of the License, or any later version.
15 %%
16 % Version and source file information:
17 % \ProvidesFile{natbst.mbs}[2007/11/26 1.93 (PWD)]
18 %
19 % BibTeX `plainnat' family
20 % version 0.99b for BibTeX versions 0.99a or later,
21 % for LaTeX versions 2.09 and 2e.
22 %
23 % For use with the `natbib.sty' package; emulates the corresponding
24 % member of the `plain' family, but with author-year citations.
25 %
26 % With version 6.0 of `natbib.sty', it may also be used for numerical
27 % citations, while retaining the commands \citeauthor, \citefullauthor,
28 % and \citeyear to print the corresponding information.
29 %
30 % For version 7.0 of `natbib.sty', the KEY field replaces missing
31 % authors/editors, and the date is left blank in \bibitem.
32 %
33 % Includes field EID for the sequence/citation number of electronic journals
34 % which is used instead of page numbers.
35 %
36 % Includes fields ISBN and ISSN.
37 %
38 % Includes field URL for Internet addresses.
39 %
40 % Includes field DOI for Digital Object Idenfifiers.
41 %
42 % Works best with the url.sty package of Donald Arseneau.
43 %
44 % Works with identical authors and year are further sorted by
45 % citation key, to preserve any natural sequence.
46 %
47 ENTRY
48 { address
49 author
50 booktitle
51 chapter
52 doi
53 eid
54 edition
55 editor
56 howpublished
57 institution
58 isbn
59 issn
60 journal
61 key
62 month
63 note
64 number
65 organization
66 pages
67 publisher
68 school
69 series
70 title
71 type
72 url
73 urldate
74 volume
75 year
76 }
77 {}
78 { label extra.label sort.label short.list }
79
80 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
81
82 FUNCTION {init.state.consts}
83 { #0 'before.all :=
84 #1 'mid.sentence :=
85 #2 'after.sentence :=
86 #3 'after.block :=
87 }
88
89 STRINGS { s t }
90
91 FUNCTION {output.nonnull}
92 { 's :=
93 output.state mid.sentence =
94 { ", " * write$ }
95 { output.state after.block =
96 { add.period$ write$
97 newline$
98 "\newblock " write$
99 }
100 { output.state before.all =
101 'write$
102 { add.period$ " " * write$ }
103 if$
104 }
105 if$
106 mid.sentence 'output.state :=
107 }
108 if$
109 s
110 }
111
112 FUNCTION {output}
113 { duplicate$ empty$
114 'pop$
115 'output.nonnull
116 if$
117 }
118
119 FUNCTION {output.check}
120 { 't :=
121 duplicate$ empty$
122 { pop$ "empty " t * " in " * cite$ * warning$ }
123 'output.nonnull
124 if$
125 }
126
127 FUNCTION {fin.entry}
128 { add.period$
129 write$
130 newline$
131 }
132
133 FUNCTION {new.block}
134 { output.state before.all =
135 'skip$
136 { after.block 'output.state := }
137 if$
138 }
139
140 FUNCTION {new.sentence}
141 { output.state after.block =
142 'skip$
143 { output.state before.all =
144 'skip$
145 { after.sentence 'output.state := }
146 if$
147 }
148 if$
149 }
150
151 FUNCTION {not}
152 { { #0 }
153 { #1 }
154 if$
155 }
156
157 FUNCTION {and}
158 { 'skip$
159 { pop$ #0 }
160 if$
161 }
162
163 FUNCTION {or}
164 { { pop$ #1 }
165 'skip$
166 if$
167 }
168
169 FUNCTION {new.block.checka}
170 { empty$
171 'skip$
172 'new.block
173 if$
174 }
175
176 FUNCTION {new.block.checkb}
177 { empty$
178 swap$ empty$
179 and
180 'skip$
181 'new.block
182 if$
183 }
184
185 FUNCTION {new.sentence.checka}
186 { empty$
187 'skip$
188 'new.sentence
189 if$
190 }
191
192 FUNCTION {new.sentence.checkb}
193 { empty$
194 swap$ empty$
195 and
196 'skip$
197 'new.sentence
198 if$
199 }
200
201 FUNCTION {field.or.null}
202 { duplicate$ empty$
203 { pop$ "" }
204 'skip$
205 if$
206 }
207
208 FUNCTION {emphasize}
209 { duplicate$ empty$
210 { pop$ "" }
211 { "\emph{" swap$ * "}" * }
212 if$
213 }
214
215 INTEGERS { nameptr namesleft numnames }
216
217 FUNCTION {format.names}
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.key}
247 { empty$
248 { key field.or.null }
249 { "" }
250 if$
251 }
252
253 FUNCTION {format.authors}
254 { author empty$
255 { "" }
256 { author format.names }
257 if$
258 }
259
260 FUNCTION {format.editors}
261 { editor empty$
262 { "" }
263 { editor format.names
264 editor num.names$ #1 >
265 { ", editors" * }
266 { ", editor" * }
267 if$
268 }
269 if$
270 }
271
272 FUNCTION {format.isbn}
273 { isbn empty$
274 { "" }
275 { new.block "ISBN " isbn * }
276 if$
277 }
278
279 FUNCTION {format.issn}
280 { issn empty$
281 { "" }
282 { new.block "ISSN " issn * }
283 if$
284 }
285
286 FUNCTION {format.url}
287 { url empty$
288 { "" }
289 { new.block "URL \url{" url * "}" * }
290 if$
291 }
292 FUNCTION {format.urldate}
293 { urldate empty$
294 { "" }
295 {new.block "accessed-on: " urldate * }
296 if$
297 }
298
299 FUNCTION {format.doi}
300 { doi empty$
301 { "" }
302 { new.block "\doi{" doi * "}" * }
303 if$
304 }
305
306 FUNCTION {format.title}
307 { title empty$
308 { "" }
309 { title "t" change.case$ }
310 if$
311 }
312
313 FUNCTION {format.full.names}
314 {'s :=
315 #1 'nameptr :=
316 s num.names$ 'numnames :=
317 numnames 'namesleft :=
318 { namesleft #0 > }
319 { s nameptr
320 "{vv~}{ll}" format.name$ 't :=
321 nameptr #1 >
322 {
323 namesleft #1 >
324 { ", " * t * }
325 {
326 numnames #2 >
327 { "," * }
328 'skip$
329 if$
330 t "others" =
331 { " et~al." * }
332 { " and " * t * }
333 if$
334 }
335 if$
336 }
337 't
338 if$
339 nameptr #1 + 'nameptr :=
340 namesleft #1 - 'namesleft :=
341 }
342 while$
343 }
344
345 FUNCTION {author.editor.full}
346 { author empty$
347 { editor empty$
348 { "" }
349 { editor format.full.names }
350 if$
351 }
352 { author format.full.names }
353 if$
354 }
355
356 FUNCTION {author.full}
357 { author empty$
358 { "" }
359 { author format.full.names }
360 if$
361 }
362
363 FUNCTION {editor.full}
364 { editor empty$
365 { "" }
366 { editor format.full.names }
367 if$
368 }
369
370 FUNCTION {make.full.names}
371 { type$ "book" =
372 type$ "inbook" =
373 or
374 'author.editor.full
375 { type$ "proceedings" =
376 'editor.full
377 'author.full
378 if$
379 }
380 if$
381 }
382
383 FUNCTION {output.bibitem}
384 { newline$
385 "\bibitem[" write$
386 label write$
387 ")" make.full.names duplicate$ short.list =
388 { pop$ }
389 { * }
390 if$
391 "]{" * write$
392 cite$ write$
393 "}" write$
394 newline$
395 ""
396 before.all 'output.state :=
397 }
398
399 FUNCTION {n.dashify}
400 { 't :=
401 ""
402 { t empty$ not }
403 { t #1 #1 substring$ "-" =
404 { t #1 #2 substring$ "--" = not
405 { "--" *
406 t #2 global.max$ substring$ 't :=
407 }
408 { { t #1 #1 substring$ "-" = }
409 { "-" *
410 t #2 global.max$ substring$ 't :=
411 }
412 while$
413 }
414 if$
415 }
416 { t #1 #1 substring$ *
417 t #2 global.max$ substring$ 't :=
418 }
419 if$
420 }
421 while$
422 }
423
424 FUNCTION {format.date}
425 { year duplicate$ empty$
426 { "empty year in " cite$ * warning$
427 pop$ "" }
428 'skip$
429 if$
430 month empty$
431 'skip$
432 { month
433 " " * swap$ *
434 }
435 if$
436 extra.label *
437 }
438
439 FUNCTION {format.btitle}
440 { title emphasize
441 }
442
443 FUNCTION {tie.or.space.connect}
444 { duplicate$ text.length$ #3 <
445 { "~" }
446 { " " }
447 if$
448 swap$ * *
449 }
450
451 FUNCTION {either.or.check}
452 { empty$
453 'pop$
454 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
455 if$
456 }
457
458 FUNCTION {format.bvolume}
459 { volume empty$
460 { "" }
461 { "volume" volume tie.or.space.connect
462 series empty$
463 'skip$
464 { " of " * series emphasize * }
465 if$
466 "volume and number" number either.or.check
467 }
468 if$
469 }
470
471 FUNCTION {format.number.series}
472 { volume empty$
473 { number empty$
474 { series field.or.null }
475 { output.state mid.sentence =
476 { "number" }
477 { "Number" }
478 if$
479 number tie.or.space.connect
480 series empty$
481 { "there's a number but no series in " cite$ * warning$ }
482 { " in " * series * }
483 if$
484 }
485 if$
486 }
487 { "" }
488 if$
489 }
490
491 FUNCTION {format.edition}
492 { edition empty$
493 { "" }
494 { output.state mid.sentence =
495 { edition "l" change.case$ " edition" * }
496 { edition "t" change.case$ " edition" * }
497 if$
498 }
499 if$
500 }
501
502 INTEGERS { multiresult }
503
504 FUNCTION {multi.page.check}
505 { 't :=
506 #0 'multiresult :=
507 { multiresult not
508 t empty$ not
509 and
510 }
511 { t #1 #1 substring$
512 duplicate$ "-" =
513 swap$ duplicate$ "," =
514 swap$ "+" =
515 or or
516 { #1 'multiresult := }
517 { t #2 global.max$ substring$ 't := }
518 if$
519 }
520 while$
521 multiresult
522 }
523
524 FUNCTION {format.pages}
525 { pages empty$
526 { "" }
527 { pages multi.page.check
528 { "pages" pages n.dashify tie.or.space.connect }
529 { "page" pages tie.or.space.connect }
530 if$
531 }
532 if$
533 }
534
535 FUNCTION {format.eid}
536 { eid empty$
537 { "" }
538 { "art." eid tie.or.space.connect }
539 if$
540 }
541
542 FUNCTION {format.vol.num.pages}
543 { volume field.or.null
544 number empty$
545 'skip$
546 { "\penalty0 (" number * ")" * *
547 volume empty$
548 { "there's a number but no volume in " cite$ * warning$ }
549 'skip$
550 if$
551 }
552 if$
553 pages empty$
554 'skip$
555 { duplicate$ empty$
556 { pop$ format.pages }
557 { ":\penalty0 " * pages n.dashify * }
558 if$
559 }
560 if$
561 }
562
563 FUNCTION {format.vol.num.eid}
564 { volume field.or.null
565 number empty$
566 'skip$
567 { "\penalty0 (" number * ")" * *
568 volume empty$
569 { "there's a number but no volume in " cite$ * warning$ }
570 'skip$
571 if$
572 }
573 if$
574 eid empty$
575 'skip$
576 { duplicate$ empty$
577 { pop$ format.eid }
578 { ":\penalty0 " * eid * }
579 if$
580 }
581 if$
582 }
583
584 FUNCTION {format.chapter.pages}
585 { chapter empty$
586 'format.pages
587 { type empty$
588 { "chapter" }
589 { type "l" change.case$ }
590 if$
591 chapter tie.or.space.connect
592 pages empty$
593 'skip$
594 { ", " * format.pages * }
595 if$
596 }
597 if$
598 }
599
600 FUNCTION {format.in.ed.booktitle}
601 { booktitle empty$
602 { "" }
603 { editor empty$
604 { "In " booktitle emphasize * }
605 { "In " format.editors * ", " * booktitle emphasize * }
606 if$
607 }
608 if$
609 }
610
611 FUNCTION {empty.misc.check}
612 { author empty$ title empty$ howpublished empty$
613 month empty$ year empty$ note empty$
614 and and and and and
615 key empty$ not and
616 { "all relevant fields are empty in " cite$ * warning$ }
617 'skip$
618 if$
619 }
620
621 FUNCTION {format.thesis.type}
622 { type empty$
623 'skip$
624 { pop$
625 type "t" change.case$
626 }
627 if$
628 }
629
630 FUNCTION {format.tr.number}
631 { type empty$
632 { "Technical Report" }
633 'type
634 if$
635 number empty$
636 { "t" change.case$ }
637 { number tie.or.space.connect }
638 if$
639 }
640
641 FUNCTION {format.article.crossref}
642 { key empty$
643 { journal empty$
644 { "need key or journal for " cite$ * " to crossref " * crossref *
645 warning$
646 ""
647 }
648 { "In \emph{" journal * "}" * }
649 if$
650 }
651 { "In " }
652 if$
653 " \citet{" * crossref * "}" *
654 }
655
656 FUNCTION {format.book.crossref}
657 { volume empty$
658 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
659 "In "
660 }
661 { "Volume" volume tie.or.space.connect
662 " of " *
663 }
664 if$
665 editor empty$
666 editor field.or.null author field.or.null =
667 or
668 { key empty$
669 { series empty$
670 { "need editor, key, or series for " cite$ * " to crossref " *
671 crossref * warning$
672 "" *
673 }
674 { "\emph{" * series * "}" * }
675 if$
676 }
677 'skip$
678 if$
679 }
680 'skip$
681 if$
682 " \citet{" * crossref * "}" *
683 }
684
685 FUNCTION {format.incoll.inproc.crossref}
686 { editor empty$
687 editor field.or.null author field.or.null =
688 or
689 { key empty$
690 { booktitle empty$
691 { "need editor, key, or booktitle for " cite$ * " to crossref " *
692 crossref * warning$
693 ""
694 }
695 { "In \emph{" booktitle * "}" * }
696 if$
697 }
698 { "In " }
699 if$
700 }
701 { "In " }
702 if$
703 " \citet{" * crossref * "}" *
704 }
705
706 FUNCTION {article}
707 { output.bibitem
708 format.authors "author" output.check
709 author format.key output
710 new.block
711 format.title "title" output.check
712 new.block
713 crossref missing$
714 { journal emphasize "journal" output.check
715 eid empty$
716 { format.vol.num.pages output }
717 { format.vol.num.eid output }
718 if$
719 format.date "year" output.check
720 }
721 { format.article.crossref output.nonnull
722 eid empty$
723 { format.pages output }
724 { format.eid output }
725 if$
726 }
727 if$
728 format.issn output
729 format.doi output
730 format.url output
731 new.block
732 note output
733 fin.entry
734 }
735
736 FUNCTION {book}
737 { output.bibitem
738 author empty$
739 { format.editors "author and editor" output.check
740 editor format.key output
741 }
742 { format.authors output.nonnull
743 crossref missing$
744 { "author and editor" editor either.or.check }
745 'skip$
746 if$
747 }
748 if$
749 new.block
750 format.btitle "title" output.check
751 crossref missing$
752 { format.bvolume output
753 new.block
754 format.number.series output
755 new.sentence
756 publisher "publisher" output.check
757 address output
758 }
759 { new.block
760 format.book.crossref output.nonnull
761 }
762 if$
763 format.edition output
764 format.date "year" output.check
765 format.isbn output
766 format.doi output
767 format.url output
768 new.block
769 note output
770 fin.entry
771 }
772
773 FUNCTION {booklet}
774 { output.bibitem
775 format.authors output
776 author format.key output
777 new.block
778 format.title "title" output.check
779 howpublished address new.block.checkb
780 howpublished output
781 address output
782 format.date output
783 format.isbn output
784 format.doi output
785 format.url output
786 new.block
787 note output
788 fin.entry
789 }
790
791 FUNCTION {inbook}
792 { output.bibitem
793 author empty$
794 { format.editors "author and editor" output.check
795 editor format.key output
796 }
797 { format.authors output.nonnull
798 crossref missing$
799 { "author and editor" editor either.or.check }
800 'skip$
801 if$
802 }
803 if$
804 new.block
805 format.btitle "title" output.check
806 crossref missing$
807 { format.bvolume output
808 format.chapter.pages "chapter and pages" output.check
809 new.block
810 format.number.series output
811 new.sentence
812 publisher "publisher" output.check
813 address output
814 }
815 { format.chapter.pages "chapter and pages" output.check
816 new.block
817 format.book.crossref output.nonnull
818 }
819 if$
820 format.edition output
821 format.date "year" output.check
822 format.isbn output
823 format.doi output
824 format.url output
825 new.block
826 note output
827 fin.entry
828 }
829
830 FUNCTION {incollection}
831 { output.bibitem
832 format.authors "author" output.check
833 author format.key output
834 new.block
835 format.title "title" output.check
836 new.block
837 crossref missing$
838 { format.in.ed.booktitle "booktitle" output.check
839 format.bvolume output
840 format.number.series output
841 format.chapter.pages output
842 new.sentence
843 publisher "publisher" output.check
844 address output
845 format.edition output
846 format.date "year" output.check
847 }
848 { format.incoll.inproc.crossref output.nonnull
849 format.chapter.pages output
850 }
851 if$
852 format.isbn output
853 format.doi output
854 format.url output
855 new.block
856 note output
857 fin.entry
858 }
859
860 FUNCTION {inproceedings}
861 { output.bibitem
862 format.authors "author" output.check
863 author format.key output
864 new.block
865 format.title "title" output.check
866 new.block
867 crossref missing$
868 { format.in.ed.booktitle "booktitle" output.check
869 format.bvolume output
870 format.number.series output
871 format.pages output
872 address empty$
873 { organization publisher new.sentence.checkb
874 organization output
875 publisher output
876 format.date "year" output.check
877 }
878 { address output.nonnull
879 format.date "year" output.check
880 new.sentence
881 organization output
882 publisher output
883 }
884 if$
885 }
886 { format.incoll.inproc.crossref output.nonnull
887 format.pages output
888 }
889 if$
890 format.isbn output
891 format.doi output
892 format.url output
893 new.block
894 note output
895 fin.entry
896 }
897
898 FUNCTION {conference} { inproceedings }
899
900 FUNCTION {manual}
901 { output.bibitem
902 format.authors output
903 author format.key output
904 new.block
905 format.btitle "title" output.check
906 organization address new.block.checkb
907 organization output
908 address output
909 format.edition output
910 format.date output
911 format.url output
912 new.block
913 note output
914 fin.entry
915 }
916
917 FUNCTION {mastersthesis}
918 { output.bibitem
919 format.authors "author" output.check
920 author format.key output
921 new.block
922 format.title "title" output.check
923 new.block
924 "Master's thesis" format.thesis.type output.nonnull
925 school "school" output.check
926 address output
927 format.date "year" output.check
928 format.url output
929 new.block
930 note output
931 fin.entry
932 }
933
934 FUNCTION {misc}
935 { output.bibitem
936 format.authors output
937 author format.key output
938 title howpublished new.block.checkb
939 format.title output
940 howpublished new.block.checka
941 howpublished output
942 format.date output
943 format.issn output
944 format.url output
945 new.block
946 note output
947 format.urldate output
948 fin.entry
949 empty.misc.check
950 }
951
952 FUNCTION {phdthesis}
953 { output.bibitem
954 format.authors "author" output.check
955 author format.key output
956 new.block
957 format.btitle "title" output.check
958 new.block
959 "PhD thesis" format.thesis.type output.nonnull
960 school "school" output.check
961 address output
962 format.date "year" output.check
963 format.url output
964 new.block
965 note output
966 fin.entry
967 }
968
969 FUNCTION {proceedings}
970 { output.bibitem
971 format.editors output
972 editor format.key output
973 new.block
974 format.btitle "title" output.check
975 format.bvolume output
976 format.number.series output
977 address output
978 format.date "year" output.check
979 new.sentence
980 organization output
981 publisher output
982 format.isbn output
983 format.doi output
984 format.url output
985 new.block
986 note output
987 fin.entry
988 }
989
990 FUNCTION {techreport}
991 { output.bibitem
992 format.authors "author" output.check
993 author format.key output
994 new.block
995 format.title "title" output.check
996 new.block
997 format.tr.number output.nonnull
998 institution "institution" output.check
999 address output
1000 format.date "year" output.check
1001 format.url output
1002 new.block
1003 note output
1004 fin.entry
1005 }
1006
1007 FUNCTION {unpublished}
1008 { output.bibitem
1009 format.authors "author" output.check
1010 author format.key output
1011 new.block
1012 format.title "title" output.check
1013 new.block
1014 note "note" output.check
1015 format.date output
1016 format.url output
1017 fin.entry
1018 }
1019
1020 FUNCTION {default.type} { misc }
1021
1022
1023 MACRO {jan} {"Jan."}
1024
1025 MACRO {feb} {"Feb."}
1026
1027 MACRO {mar} {"Mar."}
1028
1029 MACRO {apr} {"Apr."}
1030
1031 MACRO {may} {"May"}
1032
1033 MACRO {jun} {"June"}
1034
1035 MACRO {jul} {"July"}
1036
1037 MACRO {aug} {"Aug."}
1038
1039 MACRO {sep} {"Sept."}
1040
1041 MACRO {oct} {"Oct."}
1042
1043 MACRO {nov} {"Nov."}
1044
1045 MACRO {dec} {"Dec."}
1046
1047
1048
1049 MACRO {acmcs} {"ACM Comput. Surv."}
1050
1051 MACRO {acta} {"Acta Inf."}
1052
1053 MACRO {cacm} {"Commun. ACM"}
1054
1055 MACRO {ibmjrd} {"IBM J. Res. Dev."}
1056
1057 MACRO {ibmsj} {"IBM Syst.~J."}
1058
1059 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
1060
1061 MACRO {ieeetc} {"IEEE Trans. Comput."}
1062
1063 MACRO {ieeetcad}
1064 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
1065
1066 MACRO {ipl} {"Inf. Process. Lett."}
1067
1068 MACRO {jacm} {"J.~ACM"}
1069
1070 MACRO {jcss} {"J.~Comput. Syst. Sci."}
1071
1072 MACRO {scp} {"Sci. Comput. Programming"}
1073
1074 MACRO {sicomp} {"SIAM J. Comput."}
1075
1076 MACRO {tocs} {"ACM Trans. Comput. Syst."}
1077
1078 MACRO {tods} {"ACM Trans. Database Syst."}
1079
1080 MACRO {tog} {"ACM Trans. Gr."}
1081
1082 MACRO {toms} {"ACM Trans. Math. Softw."}
1083
1084 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
1085
1086 MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
1087
1088 MACRO {tcs} {"Theoretical Comput. Sci."}
1089
1090
1091 READ
1092
1093 FUNCTION {sortify}
1094 { purify$
1095 "l" change.case$
1096 }
1097
1098 INTEGERS { len }
1099
1100 FUNCTION {chop.word}
1101 { 's :=
1102 'len :=
1103 s #1 len substring$ =
1104 { s len #1 + global.max$ substring$ }
1105 's
1106 if$
1107 }
1108
1109 FUNCTION {format.lab.names}
1110 { 's :=
1111 s #1 "{vv~}{ll}" format.name$
1112 s num.names$ duplicate$
1113 #2 >
1114 { pop$ " et~al." * }
1115 { #2 <
1116 'skip$
1117 { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1118 { " et~al." * }
1119 { " and " * s #2 "{vv~}{ll}" format.name$ * }
1120 if$
1121 }
1122 if$
1123 }
1124 if$
1125 }
1126
1127 FUNCTION {author.key.label}
1128 { author empty$
1129 { key empty$
1130 { cite$ #1 #3 substring$ }
1131 'key
1132 if$
1133 }
1134 { author format.lab.names }
1135 if$
1136 }
1137
1138 FUNCTION {author.editor.key.label}
1139 { author empty$
1140 { editor empty$
1141 { key empty$
1142 { cite$ #1 #3 substring$ }
1143 'key
1144 if$
1145 }
1146 { editor format.lab.names }
1147 if$
1148 }
1149 { author format.lab.names }
1150 if$
1151 }
1152
1153 FUNCTION {author.key.organization.label}
1154 { author empty$
1155 { key empty$
1156 { organization empty$
1157 { cite$ #1 #3 substring$ }
1158 { "The " #4 organization chop.word #3 text.prefix$ }
1159 if$
1160 }
1161 'key
1162 if$
1163 }
1164 { author format.lab.names }
1165 if$
1166 }
1167
1168 FUNCTION {editor.key.organization.label}
1169 { editor empty$
1170 { key empty$
1171 { organization empty$
1172 { cite$ #1 #3 substring$ }
1173 { "The " #4 organization chop.word #3 text.prefix$ }
1174 if$
1175 }
1176 'key
1177 if$
1178 }
1179 { editor format.lab.names }
1180 if$
1181 }
1182
1183 FUNCTION {calc.short.authors}
1184 { type$ "book" =
1185 type$ "inbook" =
1186 or
1187 'author.editor.key.label
1188 { type$ "proceedings" =
1189 'editor.key.organization.label
1190 { type$ "manual" =
1191 'author.key.organization.label
1192 'author.key.label
1193 if$
1194 }
1195 if$
1196 }
1197 if$
1198 'short.list :=
1199 }
1200
1201 FUNCTION {calc.label}
1202 { calc.short.authors
1203 short.list
1204 "("
1205 *
1206 year duplicate$ empty$
1207 short.list key field.or.null = or
1208 { pop$ "" }
1209 'skip$
1210 if$
1211 *
1212 'label :=
1213 }
1214
1215 FUNCTION {sort.format.names}
1216 { 's :=
1217 #1 'nameptr :=
1218 ""
1219 s num.names$ 'numnames :=
1220 numnames 'namesleft :=
1221 { namesleft #0 > }
1222 {
1223 s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't :=
1224 nameptr #1 >
1225 {
1226 " " *
1227 namesleft #1 = t "others" = and
1228 { "zzzzz" * }
1229 { numnames #2 > nameptr #2 = and
1230 { "zz" * year field.or.null * " " * }
1231 'skip$
1232 if$
1233 t sortify *
1234 }
1235 if$
1236 }
1237 { t sortify * }
1238 if$
1239 nameptr #1 + 'nameptr :=
1240 namesleft #1 - 'namesleft :=
1241 }
1242 while$
1243 }
1244
1245 FUNCTION {sort.format.title}
1246 { 't :=
1247 "A " #2
1248 "An " #3
1249 "The " #4 t chop.word
1250 chop.word
1251 chop.word
1252 sortify
1253 #1 global.max$ substring$
1254 }
1255
1256 FUNCTION {author.sort}
1257 { author empty$
1258 { key empty$
1259 { "to sort, need author or key in " cite$ * warning$
1260 ""
1261 }
1262 { key sortify }
1263 if$
1264 }
1265 { author sort.format.names }
1266 if$
1267 }
1268
1269 FUNCTION {author.editor.sort}
1270 { author empty$
1271 { editor empty$
1272 { key empty$
1273 { "to sort, need author, editor, or key in " cite$ * warning$
1274 ""
1275 }
1276 { key sortify }
1277 if$
1278 }
1279 { editor sort.format.names }
1280 if$
1281 }
1282 { author sort.format.names }
1283 if$
1284 }
1285
1286 FUNCTION {author.organization.sort}
1287 { author empty$
1288 { organization empty$
1289 { key empty$
1290 { "to sort, need author, organization, or key in " cite$ * warning$
1291 ""
1292 }
1293 { key sortify }
1294 if$
1295 }
1296 { "The " #4 organization chop.word sortify }
1297 if$
1298 }
1299 { author sort.format.names }
1300 if$
1301 }
1302
1303 FUNCTION {editor.organization.sort}
1304 { editor empty$
1305 { organization empty$
1306 { key empty$
1307 { "to sort, need editor, organization, or key in " cite$ * warning$
1308 ""
1309 }
1310 { key sortify }
1311 if$
1312 }
1313 { "The " #4 organization chop.word sortify }
1314 if$
1315 }
1316 { editor sort.format.names }
1317 if$
1318 }
1319
1320
1321 FUNCTION {presort}
1322 { calc.label
1323 label sortify
1324 " "
1325 *
1326 type$ "book" =
1327 type$ "inbook" =
1328 or
1329 'author.editor.sort
1330 { type$ "proceedings" =
1331 'editor.organization.sort
1332 { type$ "manual" =
1333 'author.organization.sort
1334 'author.sort
1335 if$
1336 }
1337 if$
1338 }
1339 if$
1340 " "
1341 *
1342 year field.or.null sortify
1343 *
1344 " "
1345 *
1346 cite$
1347 *
1348 #1 entry.max$ substring$
1349 'sort.label :=
1350 sort.label *
1351 #1 entry.max$ substring$
1352 'sort.key$ :=
1353 }
1354
1355 ITERATE {presort}
1356
1357 SORT
1358
1359 STRINGS { longest.label last.label next.extra }
1360
1361 INTEGERS { longest.label.width last.extra.num number.label }
1362
1363 FUNCTION {initialize.longest.label}
1364 { "" 'longest.label :=
1365 #0 int.to.chr$ 'last.label :=
1366 "" 'next.extra :=
1367 #0 'longest.label.width :=
1368 #0 'last.extra.num :=
1369 #0 'number.label :=
1370 }
1371
1372 FUNCTION {forward.pass}
1373 { last.label label =
1374 { last.extra.num #1 + 'last.extra.num :=
1375 last.extra.num int.to.chr$ 'extra.label :=
1376 }
1377 { "a" chr.to.int$ 'last.extra.num :=
1378 "" 'extra.label :=
1379 label 'last.label :=
1380 }
1381 if$
1382 number.label #1 + 'number.label :=
1383 }
1384
1385 FUNCTION {reverse.pass}
1386 { next.extra "b" =
1387 { "a" 'extra.label := }
1388 'skip$
1389 if$
1390 extra.label 'next.extra :=
1391 extra.label
1392 duplicate$ empty$
1393 'skip$
1394 { "{\natexlab{" swap$ * "}}" * }
1395 if$
1396 'extra.label :=
1397 label extra.label * 'label :=
1398 }
1399
1400 EXECUTE {initialize.longest.label}
1401
1402 ITERATE {forward.pass}
1403
1404 REVERSE {reverse.pass}
1405
1406 FUNCTION {bib.sort.order}
1407 { sort.label 'sort.key$ :=
1408 }
1409
1410 ITERATE {bib.sort.order}
1411
1412 SORT
1413
1414 FUNCTION {begin.bib}
1415 { preamble$ empty$
1416 'skip$
1417 { preamble$ write$ newline$ }
1418 if$
1419 "\begin{thebibliography}{" number.label int.to.str$ * "}" *
1420 write$ newline$
1421 "\providecommand{\natexlab}[1]{#1}"
1422 write$ newline$
1423 "\providecommand{\url}[1]{\texttt{#1}}"
1424 write$ newline$
1425 "\expandafter\ifx\csname urlstyle\endcsname\relax"
1426 write$ newline$
1427 " \providecommand{\doi}[1]{doi: #1}\else"
1428 write$ newline$
1429 " \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
1430 write$ newline$
1431 }
1432
1433 EXECUTE {begin.bib}
1434
1435 EXECUTE {init.state.consts}
1436
1437 ITERATE {call.type$}
1438
1439 FUNCTION {end.bib}
1440 { newline$
1441 "\end{thebibliography}" write$ newline$
1442 }
1443
1444 EXECUTE {end.bib}