Debian Codegraph @

texmf-dist/bibtex/bst/economic/aer.bst

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