ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/iceWater2/pnas-natbib.bst
Revision: 4245
Committed: Wed Dec 10 20:49:40 2014 UTC (10 years, 9 months ago) by gezelter
File size: 31367 byte(s)
Log Message:
New stuff

File Contents

# User Rev Content
1 gezelter 4245 %% BibTex style file of Proceedings of the National Academy of the USA (PNAS)
2     %% (c) 2002 Oliver Beckstein
3     %% Placed in the Public Domain 2008.
4     %%
5     %% $Id: pnas-natbib.bst,v 1.3 2002/10/02 23:07:22 oliver Exp $
6     %% $Log: pnas-natbib.bst,v $
7     %% Revision 1.3 2002/10/02 23:07:22 oliver
8     %% seems to work
9     %%
10     %% Author: Oliver Beckstein <orbeckst@gmx.net>
11     %%
12     %% PNAS style, use with natbib as:
13     %% \usepackage[round,numbers,sort&compress]{natbib}
14     %% and pnas.sty
15     %% ----------------------------------------
16     %% % pnas.sty
17     %% % biblabel: N. (eg: 13. Knudson, D. & Gnatter, G)
18     %% \def\@biblabel#1{#1.}
19     %% ----------------------------------------
20     %%
21     %%
22     %% based on:
23     %% File: `unsrtnat.bst'
24     %% A modification of `unsrt.bst' for use with natbib package
25     %%
26     %% Copyright 1993-1999 Patrick W Daly
27     %% Max-Planck-Institut f\"ur Aeronomie
28     %% Max-Planck-Str. 2
29     %% D-37191 Katlenburg-Lindau
30     %% Germany
31     %% E-mail: daly@linmpi.mpg.de
32     %%
33     %% This program can be redistributed and/or modified under the terms
34     %% of the LaTeX Project Public License Distributed from CTAN
35     %% archives in directory macros/latex/base/lppl.txt; either
36     %% version 1 of the License, or any later version.
37     %%
38     % Version and source file information:
39     % \ProvidesFile{natbst.mbs}[1999/05/11 1.6 (PWD)]
40     %
41     % BibTeX `plainnat' family
42     % version 0.99b for BibTeX versions 0.99a or later,
43     % for LaTeX versions 2.09 and 2e.
44     %
45     % For use with the `natbib.sty' package; emulates the corresponding
46     % member of the `plain' family, but with author-year citations.
47     %
48     % With version 6.0 of `natbib.sty', it may also be used for numerical
49     % citations, while retaining the commands \citeauthor, \citefullauthor,
50     % and \citeyear to print the corresponding information.
51     %
52     % For version 7.0 of `natbib.sty', the KEY field replaces missing
53     % authors/editors, and the date is left blank in \bibitem.
54     %
55     % Includes field URL for Internet addresses (best used with
56     % with the url.sty package of Donald Arseneau
57     %
58     ENTRY
59     { address
60     author
61     booktitle
62     chapter
63     edition
64     editor
65     howpublished
66     institution
67     journal
68     key
69     month
70     note
71     number
72     organization
73     pages
74     publisher
75     school
76     series
77     title
78     type
79     url
80     volume
81     year
82     }
83     {}
84     { label extra.label sort.label short.list }
85    
86     INTEGERS { output.state before.all mid.sentence after.sentence after.block }
87    
88     FUNCTION {init.state.consts}
89     { #0 'before.all :=
90     #1 'mid.sentence :=
91     #2 'after.sentence :=
92     #3 'after.block :=
93     }
94    
95     STRINGS { s t }
96    
97     FUNCTION {output.nonnull}
98     { 's :=
99     output.state mid.sentence =
100     { ", " * write$ }
101     { output.state after.block =
102     { add.period$ write$
103     newline$
104     "\newblock " write$
105     }
106     { output.state before.all =
107     'write$
108     { add.period$ " " * write$ }
109     if$
110     }
111     if$
112     mid.sentence 'output.state :=
113     }
114     if$
115     s
116     }
117    
118     FUNCTION {output}
119     { duplicate$ empty$
120     'pop$
121     'output.nonnull
122     if$
123     }
124    
125     FUNCTION {output.check}
126     { 't :=
127     duplicate$ empty$
128     { pop$ "empty " t * " in " * cite$ * warning$ }
129     'output.nonnull
130     if$
131     }
132    
133     FUNCTION {fin.entry}
134     { add.period$
135     write$
136     newline$
137     }
138    
139     FUNCTION {new.block}
140     { output.state before.all =
141     'skip$
142     { after.block 'output.state := }
143     if$
144     }
145    
146     FUNCTION {new.sentence}
147     { output.state after.block =
148     'skip$
149     { output.state before.all =
150     'skip$
151     { after.sentence 'output.state := }
152     if$
153     }
154     if$
155     }
156    
157    
158     FUNCTION {add.blank}
159     { " " * before.all 'output.state :=
160     }
161    
162     FUNCTION {date.block}
163     {
164     add.blank
165     }
166    
167    
168     FUNCTION {not}
169     { { #0 }
170     { #1 }
171     if$
172     }
173    
174     FUNCTION {and}
175     { 'skip$
176     { pop$ #0 }
177     if$
178     }
179    
180     FUNCTION {or}
181     { { pop$ #1 }
182     'skip$
183     if$
184     }
185    
186     FUNCTION {new.block.checka}
187     { empty$
188     'skip$
189     'new.block
190     if$
191     }
192    
193     FUNCTION {new.block.checkb}
194     { empty$
195     swap$ empty$
196     and
197     'skip$
198     'new.block
199     if$
200     }
201    
202     FUNCTION {new.sentence.checka}
203     { empty$
204     'skip$
205     'new.sentence
206     if$
207     }
208    
209     FUNCTION {new.sentence.checkb}
210     { empty$
211     swap$ empty$
212     and
213     'skip$
214     'new.sentence
215     if$
216     }
217    
218     FUNCTION {field.or.null}
219     { duplicate$ empty$
220     { pop$ "" }
221     'skip$
222     if$
223     }
224    
225     FUNCTION {emphasize}
226     { duplicate$ empty$
227     { pop$ "" }
228     { "{\em " swap$ * "}" * }
229     if$
230     }
231    
232     FUNCTION {bolden}
233     { duplicate$ empty$
234     { pop$ "" }
235     { "\textbf{" swap$ * "}" * }
236     if$
237     }
238    
239     FUNCTION {capitalize}
240     { "u" change.case$ "t" change.case$ }
241    
242     FUNCTION {space.word}
243     { " " swap$ * " " * }
244    
245     % Here are the language-specific definitions for explicit words.
246     % Each function has a name bbl.xxx where xxx is the English word.
247     %-------------------------------------------------------------------
248     % Begin module:
249     % \ProvidesFile{english.mbs}[1999/02/24 1.3 (PWD)]
250    
251     % The language selected here is ENGLISH
252     FUNCTION {bbl.and}
253     { "and"}
254    
255     FUNCTION {bbl.etal}
256     { "et~al." }
257    
258     FUNCTION {bbl.editors}
259     { "eds." }
260    
261     FUNCTION {bbl.editor}
262     { "ed." }
263    
264     FUNCTION {bbl.edby}
265     { "edited by" }
266    
267     FUNCTION {bbl.edition}
268     { "ed." }
269    
270     FUNCTION {bbl.volume}
271     { "vol." }
272    
273     FUNCTION {bbl.of}
274     { "of" }
275    
276     FUNCTION {bbl.number}
277     { "no." }
278    
279     FUNCTION {bbl.nr}
280     { "no." }
281    
282     FUNCTION {bbl.in}
283     { "in" }
284    
285     FUNCTION {bbl.pages}
286     { "pp." }
287    
288     FUNCTION {bbl.page}
289     { "p." }
290    
291     FUNCTION {bbl.chapter}
292     { "chap." }
293    
294     FUNCTION {bbl.techrep}
295     { "Tech. Rep." }
296    
297     FUNCTION {bbl.mthesis}
298     { "Master's thesis" }
299    
300     FUNCTION {bbl.phdthesis}
301     { "Ph.D. thesis" }
302    
303     FUNCTION {bbl.first}
304     { "1st" }
305    
306     FUNCTION {bbl.second}
307     { "2nd" }
308    
309     FUNCTION {bbl.third}
310     { "3rd" }
311    
312     FUNCTION {bbl.fourth}
313     { "4th" }
314    
315     FUNCTION {bbl.fifth}
316     { "5th" }
317    
318     FUNCTION {bbl.st}
319     { "st" }
320    
321     FUNCTION {bbl.nd}
322     { "nd" }
323    
324     FUNCTION {bbl.rd}
325     { "rd" }
326    
327     FUNCTION {bbl.th}
328     { "th" }
329    
330     FUNCTION {eng.ord}
331     { duplicate$ "1" swap$ *
332     #-2 #1 substring$ "1" =
333     { bbl.th * }
334     { duplicate$ #-1 #1 substring$
335     duplicate$ "1" =
336     { pop$ bbl.st * }
337     { duplicate$ "2" =
338     { pop$ bbl.nd * }
339     { "3" =
340     { bbl.rd * }
341     { bbl.th * }
342     if$
343     }
344     if$
345     }
346     if$
347     }
348     if$
349     }
350    
351     MACRO {jan} {"Jan."}
352    
353     MACRO {feb} {"Feb."}
354    
355     MACRO {mar} {"Mar."}
356    
357     MACRO {apr} {"Apr."}
358    
359     MACRO {may} {"May"}
360    
361     MACRO {jun} {"Jun."}
362    
363     MACRO {jul} {"Jul."}
364    
365     MACRO {aug} {"Aug."}
366    
367     MACRO {sep} {"Sep."}
368    
369     MACRO {oct} {"Oct."}
370    
371     MACRO {nov} {"Nov."}
372    
373     MACRO {dec} {"Dec."}
374    
375     % End module: english.mbs
376     %% Copyright 1994-1999 Patrick W Daly
377     MACRO {acmcs} {"ACM Comput. Surv."}
378    
379     MACRO {acta} {"Acta Inf."}
380    
381     MACRO {cacm} {"Commun. ACM"}
382    
383     MACRO {ibmjrd} {"IBM J. Res. Dev."}
384    
385     MACRO {ibmsj} {"IBM Syst.~J."}
386    
387     MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
388    
389     MACRO {ieeetc} {"IEEE Trans. Comput."}
390    
391     MACRO {ieeetcad}
392     {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
393    
394     MACRO {ipl} {"Inf. Process. Lett."}
395    
396     MACRO {jacm} {"J.~ACM"}
397    
398     MACRO {jcss} {"J.~Comput. Syst. Sci."}
399    
400     MACRO {scp} {"Sci. Comput. Programming"}
401    
402     MACRO {sicomp} {"SIAM J. Comput."}
403    
404     MACRO {tocs} {"ACM Trans. Comput. Syst."}
405    
406     MACRO {tods} {"ACM Trans. Database Syst."}
407    
408     MACRO {tog} {"ACM Trans. Gr."}
409    
410     MACRO {toms} {"ACM Trans. Math. Softw."}
411    
412     MACRO {toois} {"ACM Trans. Office Inf. Syst."}
413    
414     MACRO {toplas} {"ACM Trans. Prog. Lang. Syst."}
415    
416     MACRO {tcs} {"Theoretical Comput. Sci."}
417    
418    
419     INTEGERS { nameptr namesleft numnames }
420    
421     %
422     % pnas format.names
423     %
424    
425     FUNCTION {format.names}
426     { 's :=
427     "" 't :=
428     #1 'nameptr :=
429     s num.names$ 'numnames :=
430     numnames 'namesleft :=
431     { namesleft #0 > }
432     { s nameptr
433     "{vv~}{ll}{, jj}{, f.}" format.name$
434     't :=
435     nameptr #1 >
436     {
437     namesleft #1 >
438     { ", " * t * }
439     {
440     numnames #2 >
441     { "," * }
442     'skip$
443     if$
444     s nameptr "{ll}" format.name$ duplicate$ "others" =
445     { 't := }
446     { pop$ }
447     if$
448     t "others" =
449     {
450     " " * bbl.etal *
451     }
452     { "\&"
453     space.word * t *
454     }
455     if$
456     }
457     if$
458     }
459     't
460     if$
461     nameptr #1 + 'nameptr :=
462     namesleft #1 - 'namesleft :=
463     }
464     while$
465     }
466    
467     FUNCTION {format.key}
468     { empty$
469     { key field.or.null }
470     { "" }
471     if$
472     }
473    
474     FUNCTION {format.names.ed}
475     { 's :=
476     "" 't :=
477     #1 'nameptr :=
478     s num.names$ 'numnames :=
479     numnames 'namesleft :=
480     { namesleft #0 > }
481     { s nameptr
482     "{f.~}{vv~}{ll}{, jj}"
483     format.name$
484     't :=
485     nameptr #1 >
486     {
487     namesleft #1 >
488     { ", " * t * }
489     {
490     numnames #2 >
491     { "," * }
492     'skip$
493     if$
494     s nameptr "{ll}" format.name$ duplicate$ "others" =
495     { 't := }
496     { pop$ }
497     if$
498     t "others" =
499     {
500    
501     " " * bbl.etal *
502     }
503     { "\&"
504     space.word * t *
505     }
506     if$
507     }
508     if$
509     }
510     't
511     if$
512     nameptr #1 + 'nameptr :=
513     namesleft #1 - 'namesleft :=
514     }
515     while$
516     }
517    
518    
519     FUNCTION {format.authors}
520     { author empty$
521     { "" }
522     { author format.names }
523     if$
524     }
525    
526     FUNCTION {format.editors}
527     { editor empty$
528     { "" }
529     { editor format.names
530     ", " *
531     editor num.names$ #1 >
532     'bbl.editors
533     'bbl.editor
534     if$
535     *
536     }
537     if$
538     }
539    
540     FUNCTION {format.in.editors}
541     { editor empty$
542     { "" }
543     { editor format.names.ed
544     editor num.names$ #1 >
545     { ", " * bbl.editors * }
546     { ", " * bbl.editor * }
547     if$
548     }
549     if$
550     }
551    
552     FUNCTION {format.note}
553     {
554     note empty$
555     { "" }
556     { note #1 #1 substring$
557     duplicate$ "{" =
558     'skip$
559     { output.state mid.sentence =
560     { "l" }
561     { "u" }
562     if$
563     change.case$
564     }
565     if$
566     note #2 global.max$ substring$ *
567     }
568     if$
569     }
570    
571     FUNCTION {format.url}
572     { url empty$
573     { "" }
574     { new.block "\url{" url * "}" * }
575     if$
576     }
577    
578    
579     FUNCTION {format.title}
580     { title empty$
581     { "" }
582     { title "t" change.case$ }
583     if$
584     }
585    
586     FUNCTION {format.full.names}
587     {'s :=
588     #1 'nameptr :=
589     s num.names$ 'numnames :=
590     numnames 'namesleft :=
591     { namesleft #0 > }
592     { s nameptr
593     "{vv~}{ll}" format.name$ 't :=
594     nameptr #1 >
595     {
596     namesleft #1 >
597     { ", " * t * }
598     {
599     numnames #2 >
600     { "," * }
601     'skip$
602     if$
603     t "others" =
604     { " et~al." * }
605     { " and " * t * }
606     if$
607     }
608     if$
609     }
610     't
611     if$
612     nameptr #1 + 'nameptr :=
613     namesleft #1 - 'namesleft :=
614     }
615     while$
616     }
617    
618     FUNCTION {author.editor.full}
619     { author empty$
620     { editor empty$
621     { "" }
622     { editor format.full.names }
623     if$
624     }
625     { author format.full.names }
626     if$
627     }
628    
629     FUNCTION {author.full}
630     { author empty$
631     { "" }
632     { author format.full.names }
633     if$
634     }
635    
636     FUNCTION {editor.full}
637     { editor empty$
638     { "" }
639     { editor format.full.names }
640     if$
641     }
642    
643    
644    
645     FUNCTION {make.full.names}
646     { type$ "book" =
647     type$ "inbook" =
648     or
649     'author.editor.full
650     { type$ "proceedings" =
651     'editor.full
652     'author.full
653     if$
654     }
655     if$
656     }
657    
658     FUNCTION {output.bibitem}
659     { newline$
660     "\bibitem[" write$
661     label write$
662     ")" make.full.names duplicate$ short.list =
663     { pop$ }
664     { * }
665     if$
666     "]{" * write$
667     cite$ write$
668     "}" write$
669     newline$
670     ""
671     before.all 'output.state :=
672     }
673    
674     FUNCTION {n.dashify}
675     { 't :=
676     ""
677     { t empty$ not }
678     { t #1 #1 substring$ "-" =
679     { t #1 #2 substring$ "--" = not
680     { "--" *
681     t #2 global.max$ substring$ 't :=
682     }
683     { { t #1 #1 substring$ "-" = }
684     { "-" *
685     t #2 global.max$ substring$ 't :=
686     }
687     while$
688     }
689     if$
690     }
691     { t #1 #1 substring$ *
692     t #2 global.max$ substring$ 't :=
693     }
694     if$
695     }
696     while$
697     }
698    
699     FUNCTION {word.in}
700     { bbl.in capitalize
701     " " * }
702    
703     %
704     % natbib date (month??)
705     %
706     %FUNCTION {format.date}
707     %{ year duplicate$ empty$
708     % { "empty year in " cite$ * warning$
709     % pop$ "" }
710     % 'skip$
711     % if$
712     % month empty$
713     % 'skip$
714     % { month
715     % " " * swap$ *
716     % }
717     % if$
718     % extra.label *
719     %}
720    
721     FUNCTION {format.date}
722     { year empty$
723     { "" }
724     'year
725     if$
726     duplicate$ empty$
727     'skip$
728     {
729     before.all 'output.state :=
730     " (" swap$ * ")" *
731     }
732     if$
733     }
734    
735    
736     FUNCTION {format.btitle}
737     { title emphasize
738     }
739    
740     FUNCTION {tie.or.space.connect}
741     { duplicate$ text.length$ #3 <
742     { "~" }
743     { " " }
744     if$
745     swap$ * *
746     }
747    
748     FUNCTION {either.or.check}
749     { empty$
750     'pop$
751     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
752     if$
753     }
754    
755     FUNCTION {format.bvolume}
756     { volume empty$
757     { "" }
758     { bbl.volume volume tie.or.space.connect
759     series empty$
760     'skip$
761     { bbl.of space.word * series emphasize * }
762     if$
763     "volume and number" number either.or.check
764     }
765     if$
766     }
767    
768     FUNCTION {format.number.series}
769     { volume empty$
770     { number empty$
771     { series field.or.null }
772     { output.state mid.sentence =
773     { bbl.number }
774     { bbl.number capitalize }
775     if$
776     number tie.or.space.connect
777     series empty$
778     { "there's a number but no series in " cite$ * warning$ }
779     { bbl.in space.word * series * }
780     if$
781     }
782     if$
783     }
784     { "" }
785     if$
786     }
787    
788     FUNCTION {is.num}
789     { chr.to.int$
790     duplicate$ "0" chr.to.int$ < not
791     swap$ "9" chr.to.int$ > not and
792     }
793    
794     FUNCTION {extract.num}
795     { duplicate$ 't :=
796     "" 's :=
797     { t empty$ not }
798     { t #1 #1 substring$
799     t #2 global.max$ substring$ 't :=
800     duplicate$ is.num
801     { s swap$ * 's := }
802     { pop$ "" 't := }
803     if$
804     }
805     while$
806     s empty$
807     'skip$
808     { pop$ s }
809     if$
810     }
811    
812     FUNCTION {convert.edition}
813     { edition extract.num "l" change.case$ 's :=
814     s "first" = s "1" = or
815     { bbl.first 't := }
816     { s "second" = s "2" = or
817     { bbl.second 't := }
818     { s "third" = s "3" = or
819     { bbl.third 't := }
820     { s "fourth" = s "4" = or
821     { bbl.fourth 't := }
822     { s "fifth" = s "5" = or
823     { bbl.fifth 't := }
824     { s #1 #1 substring$ is.num
825     { s eng.ord 't := }
826     { edition 't := }
827     if$
828     }
829     if$
830     }
831     if$
832     }
833     if$
834     }
835     if$
836     }
837     if$
838     t
839     }
840    
841     FUNCTION {format.edition}
842     { edition empty$
843     { "" }
844     { output.state mid.sentence =
845     { convert.edition "l" change.case$ " " * bbl.edition * }
846     { convert.edition "t" change.case$ " " * bbl.edition * }
847     if$
848     }
849     if$
850     }
851    
852     INTEGERS { multiresult }
853    
854     FUNCTION {multi.page.check}
855     { 't :=
856     #0 'multiresult :=
857     { multiresult not
858     t empty$ not
859     and
860     }
861     { t #1 #1 substring$
862     duplicate$ "-" =
863     swap$ duplicate$ "," =
864     swap$ "+" =
865     or or
866     { #1 'multiresult := }
867     { t #2 global.max$ substring$ 't := }
868     if$
869     }
870     while$
871     multiresult
872     }
873    
874     FUNCTION {format.pages}
875     { pages empty$
876     { "" }
877     { pages multi.page.check
878     { pages n.dashify }
879     { pages }
880     if$
881     }
882     if$
883     }
884    
885     FUNCTION {format.journal.pages}
886     { pages empty$
887     'skip$
888     { duplicate$ empty$
889     { pop$ format.pages }
890     {
891     ", " *
892     pages n.dashify *
893     }
894     if$
895     }
896     if$
897     }
898    
899     FUNCTION {format.vol.num.pages}
900     { volume field.or.null
901     bolden
902     format.journal.pages
903     }
904    
905     FUNCTION {format.chapter.pages}
906     { chapter empty$
907     'format.pages
908     { type empty$
909     { bbl.chapter }
910     { type "l" change.case$ }
911     if$
912     chapter tie.or.space.connect
913     pages empty$
914     'skip$
915     { ", " * format.pages * }
916     if$
917     }
918     if$
919     }
920    
921     FUNCTION {format.in.ed.booktitle}
922     { booktitle empty$
923     { "" }
924     { editor empty$
925     { word.in booktitle emphasize * }
926     { word.in format.in.editors * ", " *
927     booktitle emphasize * }
928     if$
929     }
930     if$
931     }
932    
933     FUNCTION {empty.misc.check}
934     { author empty$ title empty$ howpublished empty$
935     month empty$ year empty$ note empty$
936     and and and and and
937     { "all relevant fields are empty in " cite$ * warning$ }
938     'skip$
939     if$
940     }
941    
942     FUNCTION {format.thesis.type}
943     { type empty$
944     'skip$
945     { pop$
946     type "t" change.case$
947     }
948     if$
949     }
950    
951     FUNCTION {format.tr.number}
952     { type empty$
953     { bbl.techrep }
954     'type
955     if$
956     number empty$
957     { "t" change.case$ }
958     { number tie.or.space.connect }
959     if$
960     }
961    
962     FUNCTION {format.article.crossref}
963     {
964     key empty$
965     { journal empty$
966     { "need key or journal for " cite$ * " to crossref " * crossref *
967     warning$
968     ""
969     }
970     { word.in journal emphasize * }
971     if$
972     }
973     { word.in key * " " *}
974     if$
975     " \cite{" * crossref * "}" *
976     }
977    
978     FUNCTION {format.crossref.editor}
979     { editor #1 "{vv~}{ll}" format.name$
980     editor num.names$ duplicate$
981     #2 >
982     { pop$
983     " " * bbl.etal *
984     }
985     { #2 <
986     'skip$
987     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
988     {
989     " " * bbl.etal *
990     }
991     { " \& " * editor #2 "{vv~}{ll}" format.name$
992     * }
993     if$
994     }
995     if$
996     }
997     if$
998     }
999    
1000     FUNCTION {format.book.crossref}
1001     { volume empty$
1002     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
1003     word.in
1004     }
1005     { bbl.volume capitalize
1006     volume tie.or.space.connect
1007     bbl.of space.word *
1008     }
1009     if$
1010     editor empty$
1011     editor field.or.null author field.or.null =
1012     or
1013     { key empty$
1014     { series empty$
1015     { "need editor, key, or series for " cite$ * " to crossref " *
1016     crossref * warning$
1017     "" *
1018     }
1019     { series emphasize * }
1020     if$
1021     }
1022     { key * }
1023     if$
1024     }
1025     { format.crossref.editor * }
1026     if$
1027     " \cite{" * crossref * "}" *
1028     }
1029    
1030     FUNCTION {format.incoll.inproc.crossref}
1031     {
1032     editor empty$
1033     editor field.or.null author field.or.null =
1034     or
1035     { key empty$
1036     { booktitle empty$
1037     { "need editor, key, or booktitle for " cite$ * " to crossref " *
1038     crossref * warning$
1039     ""
1040     }
1041     { word.in booktitle emphasize * }
1042     if$
1043     }
1044     { word.in key * " " *}
1045     if$
1046     }
1047     { word.in format.crossref.editor * " " *}
1048     if$
1049     " \cite{" * crossref * "}" *
1050     }
1051    
1052     FUNCTION {format.org.or.pub}
1053     { 't :=
1054     ""
1055     address empty$ t empty$ and
1056     'skip$
1057     {
1058     add.blank "(" *
1059     t empty$
1060     { address empty$
1061     'skip$
1062     { address * }
1063     if$
1064     }
1065     { t *
1066     address empty$
1067     'skip$
1068     { ", " * address * }
1069     if$
1070     }
1071     if$
1072     ")" *
1073     }
1074     if$
1075     }
1076    
1077     FUNCTION {format.publisher.address}
1078     { publisher empty$
1079     { "empty publisher in " cite$ * warning$
1080     ""
1081     }
1082     { publisher }
1083     if$
1084     format.org.or.pub
1085     }
1086    
1087     FUNCTION {format.organization.address}
1088     { organization empty$
1089     { "" }
1090     { organization }
1091     if$
1092     format.org.or.pub
1093     }
1094    
1095     FUNCTION {article}
1096     { output.bibitem
1097     format.authors "author" output.check
1098     author format.key output
1099     format.date "year" output.check
1100     date.block
1101     crossref missing$
1102     { journal
1103     emphasize
1104     "journal" output.check
1105     add.blank
1106     format.vol.num.pages output
1107     }
1108     { format.article.crossref output.nonnull
1109     format.pages output
1110     }
1111     if$
1112     format.url output
1113     new.block
1114     format.note output
1115     fin.entry
1116     }
1117    
1118    
1119     FUNCTION {book}
1120     { output.bibitem
1121     author empty$
1122     { format.editors "author and editor" output.check
1123     editor format.key output
1124     }
1125     { format.authors output.nonnull
1126     crossref missing$
1127     { "author and editor" editor either.or.check }
1128     'skip$
1129     if$
1130     }
1131     if$
1132     format.date "year" output.check
1133     date.block
1134     format.btitle "title" output.check
1135     crossref missing$
1136     { format.bvolume output
1137     new.block
1138     format.number.series output
1139     new.sentence
1140     format.publisher.address output
1141     }
1142     { new.block
1143     format.book.crossref output.nonnull
1144     }
1145     if$
1146     format.edition output
1147     format.url output
1148     new.block
1149     note output
1150     fin.entry
1151     }
1152    
1153     FUNCTION {booklet}
1154     { output.bibitem
1155     format.authors output
1156     author format.key output
1157     format.date output
1158     date.block
1159     format.title "title" output.check
1160     new.block
1161     howpublished output
1162     address output
1163     new.block
1164     format.note output
1165     fin.entry
1166     }
1167    
1168     FUNCTION {inbook}
1169     { output.bibitem
1170     author empty$
1171     { format.editors "author and editor" output.check
1172     editor format.key output
1173     }
1174     { format.authors output.nonnull
1175     crossref missing$
1176     { "author and editor" editor either.or.check }
1177     'skip$
1178     if$
1179     }
1180     if$
1181     format.date "year" output.check
1182     date.block
1183     format.btitle "title" output.check
1184     crossref missing$
1185     {
1186     format.publisher.address output
1187     format.bvolume output
1188     format.chapter.pages "chapter and pages" output.check
1189     new.block
1190     format.number.series output
1191     new.sentence
1192     }
1193     {
1194     format.chapter.pages "chapter and pages" output.check
1195     new.block
1196     format.book.crossref output.nonnull
1197     }
1198     if$
1199     format.edition output
1200     format.url output
1201     new.block
1202     format.note output
1203     fin.entry
1204     }
1205    
1206     FUNCTION {incollection}
1207     { output.bibitem
1208     format.authors "author" output.check
1209     author format.key output
1210     format.date "year" output.check
1211     date.block
1212     format.title "title" output.check
1213     new.block
1214     crossref missing$
1215     { format.in.ed.booktitle "booktitle" output.check
1216     format.publisher.address output
1217     format.bvolume output
1218     format.number.series output
1219     format.chapter.pages output
1220     new.sentence
1221     format.edition output
1222     }
1223     { format.incoll.inproc.crossref output.nonnull
1224     format.chapter.pages output
1225     }
1226     if$
1227     format.url output
1228     new.block
1229     format.note output
1230     fin.entry
1231     }
1232    
1233     FUNCTION {inproceedings}
1234     { output.bibitem
1235     format.authors "author" output.check
1236     author format.key output
1237     format.date "year" output.check
1238     date.block
1239     format.title "title" output.check
1240     new.block
1241     crossref missing$
1242     { format.in.ed.booktitle "booktitle" output.check
1243     new.sentence
1244     publisher empty$
1245     { format.organization.address output }
1246     { organization output
1247     format.publisher.address output
1248     }
1249     if$
1250     format.bvolume output
1251     format.number.series output
1252     format.pages output
1253     }
1254     { format.incoll.inproc.crossref output.nonnull
1255     format.pages output
1256     }
1257     if$
1258     format.url output
1259     new.block
1260     format.note output
1261     fin.entry
1262     }
1263    
1264     FUNCTION {conference} { inproceedings }
1265    
1266     FUNCTION {manual}
1267     { output.bibitem
1268     format.authors output
1269     author format.key output
1270     new.block
1271     format.date output
1272     date.block
1273     format.btitle "title" output.check
1274     organization address new.block.checkb
1275     organization output
1276     address output
1277     format.edition output
1278     format.url output
1279     new.block
1280     format.note output
1281     fin.entry
1282     }
1283    
1284     FUNCTION {mastersthesis}
1285     { output.bibitem
1286     format.authors "author" output.check
1287     author format.key output
1288     format.date "year" output.check
1289     date.block
1290     format.title "title" output.check
1291     new.block
1292     bbl.mthesis format.thesis.type output.nonnull
1293     school "school" output.check
1294     address output
1295     format.url output
1296     new.block
1297     format.note output
1298     fin.entry
1299     }
1300    
1301     FUNCTION {misc}
1302     { output.bibitem
1303     format.authors output
1304     author format.key output
1305     format.date output
1306     title howpublished new.block.checkb
1307     format.title output
1308     howpublished new.block.checka
1309     howpublished output
1310     new.block
1311     format.url output
1312     new.block
1313     format.note output
1314     fin.entry
1315     empty.misc.check
1316     }
1317    
1318     FUNCTION {phdthesis}
1319     { output.bibitem
1320     format.authors "author" output.check
1321     author format.key output
1322     format.date "year" output.check
1323     date.block
1324     format.btitle "title" output.check
1325     new.block
1326     bbl.phdthesis format.thesis.type output.nonnull
1327     school "school" output.check
1328     address output
1329     format.url output
1330     new.block
1331     format.note output
1332     fin.entry
1333     }
1334    
1335     FUNCTION {proceedings}
1336     { output.bibitem
1337     format.editors output
1338     editor format.key output
1339     format.date "year" output.check
1340     date.block
1341     format.btitle "title" output.check
1342     format.bvolume output
1343     format.number.series output
1344     editor empty$
1345     { publisher empty$
1346     'skip$
1347     {
1348     new.sentence
1349     format.publisher.address output
1350     }
1351     if$
1352     }
1353     { publisher empty$
1354     {
1355     new.sentence
1356     format.organization.address output }
1357     {
1358     new.sentence
1359     organization output
1360     format.publisher.address output
1361     }
1362     if$
1363     }
1364     if$
1365     new.sentence
1366     format.url output
1367     new.block
1368     format.note output
1369     fin.entry
1370     }
1371    
1372     FUNCTION {techreport}
1373     { output.bibitem
1374     format.authors "author" output.check
1375     author format.key output
1376     format.date "year" output.check
1377     date.block
1378     format.title "title" output.check
1379     new.block
1380     format.tr.number output.nonnull
1381     institution "institution" output.check
1382     address output
1383     new.block
1384     format.url output
1385     new.block
1386     format.note output
1387     fin.entry
1388     }
1389    
1390     FUNCTION {unpublished}
1391     { output.bibitem
1392     format.authors "author" output.check
1393     author format.key output
1394     format.date output
1395     date.block
1396     format.title "title" output.check
1397     new.block
1398     format.note "note" output.check
1399     fin.entry
1400     }
1401    
1402     FUNCTION {default.type} { misc }
1403    
1404    
1405     READ
1406    
1407     FUNCTION {sortify}
1408     { purify$
1409     "l" change.case$
1410     }
1411    
1412     INTEGERS { len }
1413    
1414     FUNCTION {chop.word}
1415     { 's :=
1416     'len :=
1417     s #1 len substring$ =
1418     { s len #1 + global.max$ substring$ }
1419     's
1420     if$
1421     }
1422    
1423     FUNCTION {format.lab.names}
1424     { 's :=
1425     s #1 "{vv~}{ll}" format.name$
1426     s num.names$ duplicate$
1427     #2 >
1428     { pop$ " et~al." * }
1429     { #2 <
1430     'skip$
1431     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1432     { " et~al." * }
1433     { " and " * s #2 "{vv~}{ll}" format.name$ * }
1434     if$
1435     }
1436     if$
1437     }
1438     if$
1439     }
1440    
1441     FUNCTION {author.key.label}
1442     { author empty$
1443     { key empty$
1444     { cite$ #1 #3 substring$ }
1445     'key
1446     if$
1447     }
1448     { author format.lab.names }
1449     if$
1450     }
1451    
1452     FUNCTION {author.editor.key.label}
1453     { author empty$
1454     { editor empty$
1455     { key empty$
1456     { cite$ #1 #3 substring$ }
1457     'key
1458     if$
1459     }
1460     { editor format.lab.names }
1461     if$
1462     }
1463     { author format.lab.names }
1464     if$
1465     }
1466    
1467     FUNCTION {author.key.organization.label}
1468     { author empty$
1469     { key empty$
1470     { organization empty$
1471     { cite$ #1 #3 substring$ }
1472     { "The " #4 organization chop.word #3 text.prefix$ }
1473     if$
1474     }
1475     'key
1476     if$
1477     }
1478     { author format.lab.names }
1479     if$
1480     }
1481    
1482     FUNCTION {editor.key.organization.label}
1483     { editor empty$
1484     { key empty$
1485     { organization empty$
1486     { cite$ #1 #3 substring$ }
1487     { "The " #4 organization chop.word #3 text.prefix$ }
1488     if$
1489     }
1490     'key
1491     if$
1492     }
1493     { editor format.lab.names }
1494     if$
1495     }
1496    
1497     FUNCTION {calc.short.authors}
1498     { type$ "book" =
1499     type$ "inbook" =
1500     or
1501     'author.editor.key.label
1502     { type$ "proceedings" =
1503     'editor.key.organization.label
1504     { type$ "manual" =
1505     'author.key.organization.label
1506     'author.key.label
1507     if$
1508     }
1509     if$
1510     }
1511     if$
1512     'short.list :=
1513     }
1514    
1515     FUNCTION {calc.label}
1516     { calc.short.authors
1517     short.list
1518     "("
1519     *
1520     year duplicate$ empty$
1521     short.list key field.or.null = or
1522     { pop$ "" }
1523     'skip$
1524     if$
1525     *
1526     'label :=
1527     }
1528    
1529     FUNCTION {sort.format.names}
1530     { 's :=
1531     #1 'nameptr :=
1532     ""
1533     s num.names$ 'numnames :=
1534     numnames 'namesleft :=
1535     { namesleft #0 > }
1536     { nameptr #1 >
1537     { " " * }
1538     'skip$
1539     if$
1540     s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1541     nameptr numnames = t "others" = and
1542     { "et al" * }
1543     { t sortify * }
1544     if$
1545     nameptr #1 + 'nameptr :=
1546     namesleft #1 - 'namesleft :=
1547     }
1548     while$
1549     }
1550    
1551     FUNCTION {sort.format.title}
1552     { 't :=
1553     "A " #2
1554     "An " #3
1555     "The " #4 t chop.word
1556     chop.word
1557     chop.word
1558     sortify
1559     #1 global.max$ substring$
1560     }
1561    
1562     FUNCTION {author.sort}
1563     { author empty$
1564     { key empty$
1565     { "to sort, need author or key in " cite$ * warning$
1566     ""
1567     }
1568     { key sortify }
1569     if$
1570     }
1571     { author sort.format.names }
1572     if$
1573     }
1574    
1575     FUNCTION {author.editor.sort}
1576     { author empty$
1577     { editor empty$
1578     { key empty$
1579     { "to sort, need author, editor, or key in " cite$ * warning$
1580     ""
1581     }
1582     { key sortify }
1583     if$
1584     }
1585     { editor sort.format.names }
1586     if$
1587     }
1588     { author sort.format.names }
1589     if$
1590     }
1591    
1592     FUNCTION {author.organization.sort}
1593     { author empty$
1594     { organization empty$
1595     { key empty$
1596     { "to sort, need author, organization, or key in " cite$ * warning$
1597     ""
1598     }
1599     { key sortify }
1600     if$
1601     }
1602     { "The " #4 organization chop.word sortify }
1603     if$
1604     }
1605     { author sort.format.names }
1606     if$
1607     }
1608    
1609     FUNCTION {editor.organization.sort}
1610     { editor empty$
1611     { organization empty$
1612     { key empty$
1613     { "to sort, need editor, organization, or key in " cite$ * warning$
1614     ""
1615     }
1616     { key sortify }
1617     if$
1618     }
1619     { "The " #4 organization chop.word sortify }
1620     if$
1621     }
1622     { editor sort.format.names }
1623     if$
1624     }
1625    
1626     INTEGERS { seq.num }
1627    
1628     FUNCTION {init.seq}
1629     { #0 'seq.num :=}
1630    
1631     EXECUTE {init.seq}
1632    
1633     FUNCTION {int.to.fix}
1634     { "000000000" swap$ int.to.str$ *
1635     #-1 #10 substring$
1636     }
1637    
1638     FUNCTION {presort}
1639     { calc.label
1640     label sortify
1641     " "
1642     *
1643     seq.num #1 + 'seq.num :=
1644     seq.num int.to.fix
1645     'sort.label :=
1646     sort.label *
1647     #1 entry.max$ substring$
1648     'sort.key$ :=
1649     }
1650    
1651     ITERATE {presort}
1652    
1653     SORT
1654    
1655     STRINGS { longest.label last.label next.extra }
1656    
1657     INTEGERS { longest.label.width last.extra.num number.label }
1658    
1659     FUNCTION {initialize.longest.label}
1660     { "" 'longest.label :=
1661     #0 int.to.chr$ 'last.label :=
1662     "" 'next.extra :=
1663     #0 'longest.label.width :=
1664     #0 'last.extra.num :=
1665     #0 'number.label :=
1666     }
1667    
1668     FUNCTION {forward.pass}
1669     { last.label label =
1670     { last.extra.num #1 + 'last.extra.num :=
1671     last.extra.num int.to.chr$ 'extra.label :=
1672     }
1673     { "a" chr.to.int$ 'last.extra.num :=
1674     "" 'extra.label :=
1675     label 'last.label :=
1676     }
1677     if$
1678     number.label #1 + 'number.label :=
1679     }
1680    
1681     FUNCTION {reverse.pass}
1682     { next.extra "b" =
1683     { "a" 'extra.label := }
1684     'skip$
1685     if$
1686     extra.label 'next.extra :=
1687     extra.label
1688     duplicate$ empty$
1689     'skip$
1690     { "{\natexlab{" swap$ * "}}" * }
1691     if$
1692     'extra.label :=
1693     label extra.label * 'label :=
1694     }
1695    
1696     EXECUTE {initialize.longest.label}
1697    
1698     ITERATE {forward.pass}
1699    
1700     REVERSE {reverse.pass}
1701    
1702     FUNCTION {bib.sort.order}
1703     { sort.label 'sort.key$ :=
1704     }
1705    
1706     ITERATE {bib.sort.order}
1707    
1708     SORT
1709    
1710     FUNCTION {begin.bib}
1711     { preamble$ empty$
1712     'skip$
1713     { preamble$ write$ newline$ }
1714     if$
1715     "\begin{thebibliography}{" number.label int.to.str$ * "}" *
1716     write$ newline$
1717     "\expandafter\ifx\csname natexlab\endcsname\relax\def\natexlab#1{#1}\fi"
1718     write$ newline$
1719     "\expandafter\ifx\csname url\endcsname\relax" write$ newline$
1720     " \def\url#1{{\tt #1}}\fi" write$ newline$
1721     }
1722    
1723     EXECUTE {begin.bib}
1724    
1725     EXECUTE {init.state.consts}
1726    
1727     ITERATE {call.type$}
1728    
1729     FUNCTION {end.bib}
1730     { newline$
1731     "\end{thebibliography}" write$ newline$
1732     }
1733    
1734     EXECUTE {end.bib}