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