Debian Codegraph @

texmf-dist/bibtex/bst/apalike2/apalike2.bst

raw
1 % BibTeX `apalike' bibliography style (24-Jan-88 version)
2 % Adapted from the `alpha' style, version 0.99a; for BibTeX version 0.99a.
3 % Copyright (C) 1988, all rights reserved.
4 % Copying of this file is allowed, provided that if you make any changes at all
5 % you name it something other than `apalike.bst'.
6 % This restriction helps ensure that all copies are identical.
7 % Differences between this style and `alpha' are generally heralded by a `%'.
8 % The file btxbst.doc has the documentation for alpha.bst.
9 %
10 % This style should be used with the `apalike' LaTeX style (apalike.sty).
11 % \cite's come out like "(Jones, 1986)" in the text but there are no labels
12 % in the bibliography, and something like "(1986)" comes out immediately
13 % after the author. Author (and editor) names appear as last name, comma,
14 % initials. A `year' field is required for every entry, and so is either
15 % an author (or in some cases, an editor) field or a key field.
16 %
17 % Editorial note:
18 % Many journals require a style like `apalike', but I strongly, strongly,
19 % strongly recommend that you not use it if you have a choice---use something
20 % like `plain' instead. Mary-Claire van Leunen (A Handbook for Scholars,
21 % Knopf, 1979) argues convincingly that a style like `plain' encourages better
22 % writing than one like `apalike'. Furthermore the strongest arguments for
23 % using an author-date style like `apalike'---that it's "the most practical"
24 % (The Chicago Manual of Style, University of Chicago Press, thirteenth
25 % edition, 1982, pages 400--401)---fall flat on their face with the new
26 % computer-typesetting technology. For instance page 401 anachronistically
27 % states "The chief disadvantage of [a style like `plain'] is that additions
28 % or deletions cannot be made after the manuscript is typed without changing
29 % numbers in both text references and list." LaTeX sidesteps the disadvantage.
30 %
31 % History:
32 % 15-sep-86 (SK,OP) Original version, by Susan King and Oren Patashnik.
33 % 10-nov-86 (OP) Truncated the sort.key$ string to the correct length
34 % in bib.sort.order to eliminate error message.
35 % 24-jan-88 (OP) Updated for BibTeX version 0.99a, from alpha.bst 0.99a;
36 % apalike now sorts by author, then year, then title;
37 % THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
38 % Local modifications 10/89 -- Brian Reiser
39
40 ENTRY
41 { address
42 author
43 booktitle
44 chapter
45 edition
46 editor
47 howpublished
48 institution
49 journal
50 key
51 % month not used in apalike
52 note
53 number
54 organization
55 pages
56 publisher
57 school
58 series
59 title
60 type
61 volume
62 year
63 }
64 {}
65 { label extra.label sort.label }
66
67 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
68
69 FUNCTION {init.state.consts}
70 { #0 'before.all :=
71 #1 'mid.sentence :=
72 #2 'after.sentence :=
73 #3 'after.block :=
74 }
75
76 STRINGS { s t }
77
78 FUNCTION {output.nonnull}
79 { 's :=
80 output.state mid.sentence =
81 { ", " * write$ }
82 { output.state after.block =
83 { add.period$ write$
84 newline$
85 "\newblock " write$
86 }
87 { output.state before.all =
88 'write$
89 { add.period$ " " * write$ }
90 if$
91 }
92 if$
93 mid.sentence 'output.state :=
94 }
95 if$
96 s
97 }
98
99 FUNCTION {eho.special.output.nonnull}
100 { 's :=
101 output.state mid.sentence =
102 { " " * write$ }
103 { output.state after.block =
104 { % add.period$ write$
105 ": " write$
106 newline$
107 "\newblock " write$
108 }
109 { output.state before.all =
110 'write$
111 { % add.period$ " " * write$
112 ": " * write$
113 }
114 if$
115 }
116 if$
117 mid.sentence 'output.state :=
118 }
119 if$
120 s
121 }
122
123 FUNCTION {eho.special.output}
124 { duplicate$ empty$
125 'pop$
126 'eho.special.output.nonnull
127 if$
128 }
129
130 %% Added by Eric Ho <eho@word> on Wed Jan 10 20:13:56 1990
131 %% A special patch for output.nonnull in book environment.
132
133 FUNCTION {eho.output.nonnull}
134 { 's :=
135 output.state mid.sentence =
136 { ": " * write$ }
137 { output.state after.block =
138 { add.period$ write$
139 newline$
140 "\newblock " write$
141 }
142 { output.state before.all =
143 'write$
144 { add.period$ " " * write$ }
145 if$
146 }
147 if$
148 mid.sentence 'output.state :=
149 }
150 if$
151 s
152 }
153
154 FUNCTION {output}
155 { duplicate$ empty$
156 'pop$
157 'output.nonnull
158 if$
159 }
160
161 %% Added by Eric Ho <eho@word> on Wed Jan 10 20:13:56 1990
162 %% A special patch for output in book environment.
163
164 FUNCTION {eho.output}
165 { duplicate$ empty$
166 'pop$
167 'eho.output.nonnull
168 if$
169 }
170
171 FUNCTION {output.check}
172 { 't :=
173 duplicate$ empty$
174 { pop$ "empty " t * " in " * cite$ * warning$ }
175 'output.nonnull
176 if$
177 }
178
179 %% Added by Eric Ho <eho@word> on Wed Jan 10 20:13:56 1990
180 %% A special patch for output.check in book environment.
181
182 FUNCTION {eho.output.check}
183 { 't :=
184 duplicate$ empty$
185 { pop$ "empty " t * " in " * cite$ * warning$ }
186 'eho.output.nonnull
187 if$
188 }
189
190 % apalike needs this function because
191 % the year has special punctuation;
192 % apalike ignores the month
193 FUNCTION {output.year.check}
194 { year empty$
195 { "empty year in " cite$ * warning$ }
196 { write$
197 " (" year * extra.label * ")" *
198 mid.sentence 'output.state :=
199 }
200 if$
201 }
202
203 FUNCTION {output.bibitem}
204 { newline$
205 "\bibitem[" write$
206 label write$
207 "]{" write$
208 cite$ write$
209 "}" write$
210 newline$
211 ""
212 before.all 'output.state :=
213 }
214
215 FUNCTION {fin.entry}
216 { add.period$
217 write$
218 newline$
219 }
220
221 FUNCTION {new.block}
222 { output.state before.all =
223 'skip$
224 { after.block 'output.state := }
225 if$
226 }
227
228 FUNCTION {new.sentence}
229 { output.state after.block =
230 'skip$
231 { output.state before.all =
232 'skip$
233 { after.sentence 'output.state := }
234 if$
235 }
236 if$
237 }
238
239 FUNCTION {not}
240 { { #0 }
241 { #1 }
242 if$
243 }
244
245 FUNCTION {and}
246 { 'skip$
247 { pop$ #0 }
248 if$
249 }
250
251 FUNCTION {or}
252 { { pop$ #1 }
253 'skip$
254 if$
255 }
256
257 FUNCTION {new.block.checkb}
258 { empty$
259 swap$ empty$
260 and
261 'skip$
262 'new.block
263 if$
264 }
265
266 FUNCTION {field.or.null}
267 { duplicate$ empty$
268 { pop$ "" }
269 'skip$
270 if$
271 }
272
273 FUNCTION {emphasize}
274 { duplicate$ empty$
275 { pop$ "" }
276 { "{\em " swap$ * "}" * }
277 if$
278 }
279
280 INTEGERS { nameptr namesleft numnames }
281
282 FUNCTION {format.names}
283 { 's :=
284 #1 'nameptr :=
285 s num.names$ 'numnames :=
286 numnames 'namesleft :=
287 { namesleft #0 > }
288 { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := % last name first
289 nameptr #1 >
290 { namesleft #1 >
291 { ", " * t * }
292 { numnames #2 >
293 { "," * }
294 'skip$
295 if$
296 t "others" =
297 { " et~al." * }
298 { " \& " * t * } % changed from " and " for names -- BJR 10/5/89
299 if$
300 }
301 if$
302 }
303 't
304 if$
305 nameptr #1 + 'nameptr :=
306 namesleft #1 - 'namesleft :=
307 }
308 while$
309 }
310
311 %% Added by Fri Jan 12 19:03:22 1990 on Fri Jan 12 19:03:27 1990
312 %% Mainly to make sure that editors have initials before last names.
313
314 FUNCTION {eho.format.names}
315 { 's :=
316 #1 'nameptr :=
317 s num.names$ 'numnames :=
318 numnames 'namesleft :=
319 { namesleft #0 > }
320 { s nameptr "{f.} {vv~}{ll}{, jj}" format.name$ 't := %% initials first.
321 nameptr #1 >
322 { namesleft #1 >
323 { ", " * t * }
324 { numnames #2 >
325 { "," * }
326 'skip$
327 if$
328 t "others" =
329 { " et~al." * }
330 { " \& " * t * } % changed from " and " for names -- BJR 10/5/89
331 if$
332 }
333 if$
334 }
335 't
336 if$
337 nameptr #1 + 'nameptr :=
338 namesleft #1 - 'namesleft :=
339 }
340 while$
341 }
342
343 FUNCTION {format.authors}
344 { author empty$
345 { "" }
346 { author format.names }
347 if$
348 }
349
350 FUNCTION {format.key} % this function is just for apalike
351 { empty$
352 { key field.or.null }
353 { "" }
354 if$
355 }
356
357 FUNCTION {format.editors}
358 { editor empty$
359 { "" }
360 { editor format.names
361 editor num.names$ #1 >
362 { ", Eds." * } % changed from ", editors" -- BJR 10/5/89
363 { ", Ed." * } % changed from ", editor" -- BJR 10/5/89
364 if$
365 }
366 if$
367 }
368
369 %% Added by Eric Ho <eho@word> Fri Jan 12 19:11:12 1990
370 %% Mainly to call eho.format.names instead of format.names and
371 %% to make Eds or Ed to be surrounded by pararentheses instead of preceeded by
372 %% a comma.
373
374 FUNCTION {eho.format.editors}
375 { editor empty$
376 { "" }
377 { editor eho.format.names
378 editor num.names$ #1 >
379 { " (Eds.)" * } % changed from ", editors" -- BJR 10/5/89
380 { " (Ed.)" * } % changed from ", editor" -- BJR 10/5/89
381 if$
382 }
383 if$
384 }
385
386 FUNCTION {format.title}
387 { title empty$
388 { "" }
389 { title "t" change.case$ }
390 if$
391 }
392
393 FUNCTION {n.dashify}
394 { 't :=
395 ""
396 { t empty$ not }
397 { t #1 #1 substring$ "-" =
398 { t #1 #2 substring$ "--" = not
399 { "--" *
400 t #2 global.max$ substring$ 't :=
401 }
402 { { t #1 #1 substring$ "-" = }
403 { "-" *
404 t #2 global.max$ substring$ 't :=
405 }
406 while$
407 }
408 if$
409 }
410 { t #1 #1 substring$ *
411 t #2 global.max$ substring$ 't :=
412 }
413 if$
414 }
415 while$
416 }
417
418 FUNCTION {format.btitle}
419 { title emphasize
420 }
421
422 FUNCTION {tie.or.space.connect}
423 { duplicate$ text.length$ #3 <
424 { "~" }
425 { " " }
426 if$
427 swap$ * *
428 }
429
430 FUNCTION {either.or.check}
431 { empty$
432 'pop$
433 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
434 if$
435 }
436
437 FUNCTION {format.bvolume}
438 { volume empty$
439 { "" }
440 { "volume" volume tie.or.space.connect
441 series empty$
442 'skip$
443 { " of " * series emphasize * }
444 if$
445 "volume and number" number either.or.check
446 }
447 if$
448 }
449
450 FUNCTION {format.number.series}
451 { volume empty$
452 { number empty$
453 { series field.or.null }
454 { output.state mid.sentence =
455 { "number" }
456 { "Number" }
457 if$
458 number tie.or.space.connect
459 series empty$
460 { "there's a number but no series in " cite$ * warning$ }
461 { " in " * series * }
462 if$
463 }
464 if$
465 }
466 { "" }
467 if$
468 }
469
470 FUNCTION {format.edition}
471 { edition empty$
472 { "" }
473 { output.state mid.sentence =
474 { edition "l" change.case$ " edition" * }
475 { edition "t" change.case$ " edition" * }
476 if$
477 }
478 if$
479 }
480
481 INTEGERS { multiresult }
482
483 FUNCTION {multi.page.check}
484 { 't :=
485 #0 'multiresult :=
486 { multiresult not
487 t empty$ not
488 and
489 }
490 { t #1 #1 substring$
491 duplicate$ "-" =
492 swap$ duplicate$ "," =
493 swap$ "+" =
494 or or
495 { #1 'multiresult := }
496 { t #2 global.max$ substring$ 't := }
497 if$
498 }
499 while$
500 multiresult
501 }
502
503 FUNCTION {format.pages}
504 { pages empty$
505 { "" }
506 { pages multi.page.check
507 % { "pages" pages n.dashify tie.or.space.connect }
508 % { "page" pages tie.or.space.connect }
509 { "(pp.\" pages n.dashify tie.or.space.connect }
510 { "(pp.\" pages tie.or.space.connect }
511 if$
512 ")." *
513 }
514 if$
515 }
516
517 FUNCTION {format.vol.num.pages}
518 { volume field.or.null
519 number empty$
520 'skip$
521 { "(" number * ")" * *
522 volume empty$
523 { "there's a number but no volume in " cite$ * warning$ }
524 'skip$
525 if$
526 }
527 if$
528 pages empty$
529 'skip$
530 { duplicate$ empty$
531 { pop$ format.pages }
532 { ", " * pages n.dashify * } % changed from ":" for vol,pgs -- BJR 10/5/89
533 if$
534 }
535 if$
536 }
537
538 FUNCTION {format.chapter.pages}
539 { chapter empty$
540 'format.pages
541 { type empty$
542 { "chapter" }
543 { type "l" change.case$ }
544 if$
545 chapter tie.or.space.connect
546 pages empty$
547 'skip$
548 { ", " * format.pages * }
549 if$
550 }
551 if$
552 }
553
554 FUNCTION {format.in.ed.booktitle}
555 { booktitle empty$
556 { "" }
557 { editor empty$
558 { "In " booktitle emphasize * }
559 { "In " format.editors * ", " * booktitle emphasize * }
560 if$
561 }
562 if$
563 }
564
565 %% Added by Eric Ho <eho@word> Fri Jan 12 19:17:37 1990
566 %% Primarily to call eho.format.editors instead of format.editors.
567
568 FUNCTION {eho.format.in.ed.booktitle}
569 { booktitle empty$
570 { "" }
571 { editor empty$
572 { "In " booktitle emphasize * }
573 { "In " eho.format.editors * ", " * booktitle emphasize * }
574 if$
575 }
576 if$
577 }
578
579 FUNCTION {format.thesis.type}
580 { type empty$
581 'skip$
582 { pop$
583 type "t" change.case$
584 }
585 if$
586 }
587
588 FUNCTION {format.tr.number}
589 { type empty$
590 { "Technical Report" }
591 'type
592 if$
593 number empty$
594 { "t" change.case$ }
595 { number tie.or.space.connect }
596 if$
597 }
598
599 FUNCTION {format.article.crossref}
600 { "In" % this is for apalike
601 " \cite{" * crossref * "}" *
602 }
603
604 FUNCTION {format.book.crossref}
605 { volume empty$
606 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
607 "In "
608 }
609 { "Volume" volume tie.or.space.connect
610 " of " *
611 }
612 if$
613 "\cite{" * crossref * "}" * % this is for apalike
614 }
615
616 FUNCTION {format.incoll.inproc.crossref}
617 { "In" % this is for apalike
618 " \cite{" * crossref * "}" *
619 }
620
621 FUNCTION {article}
622 { output.bibitem
623 format.authors "author" output.check
624 author format.key output % special for
625 output.year.check % apalike
626 new.block
627 format.title "title" output.check
628 new.block
629 crossref missing$
630 { journal emphasize "journal" output.check
631 format.vol.num.pages output
632 }
633 { format.article.crossref output.nonnull
634 format.pages output
635 }
636 if$
637 new.block
638 note output
639 fin.entry
640 }
641
642 %% Modified by Eric Ho <eho@word> on Wed Jan 10 20:30:11 1990
643 %% Making it to call eho.output.check instead of output.check and eho.output
644 %% instead of output.
645
646 FUNCTION {book}
647 { output.bibitem
648 author empty$
649 { format.editors "author and editor" output.check
650 editor format.key output
651 }
652 { format.authors output.nonnull
653 crossref missing$
654 { "author and editor" editor either.or.check }
655 'skip$
656 if$
657 }
658 if$
659 output.year.check % special for apalike
660 new.block
661 format.btitle "title" output.check
662 crossref missing$
663 { format.bvolume output
664 new.block
665 format.number.series output
666 new.sentence
667 % publisher "publisher" output.check
668 % address output
669 % switched order of publisher and address for book -- BJR 10/5/89
670 address eho.output % Using eho.output instead of output.
671 publisher "publisher" eho.output.check % Using eho.output.check
672 % instead of output.check.
673 }
674 { new.block
675 format.book.crossref output.nonnull
676 }
677 if$
678 format.edition output
679 new.block
680 note output
681 fin.entry
682 }
683
684 FUNCTION {booklet}
685 { output.bibitem
686 format.authors output
687 author format.key output % special for
688 output.year.check % apalike
689 new.block
690 format.title "title" output.check
691 new.block
692 howpublished output
693 address output
694 new.block
695 note output
696 fin.entry
697 }
698
699 %% Modified by Eric Ho <eho@word> on Wed Jan 10 20:27:26 1990
700 %% Making it to call eho.output.check instead of output.check and eho.output
701 %% instead of output.
702
703 FUNCTION {inbook}
704 { output.bibitem
705 author empty$
706 { format.editors "author and editor" output.check
707 editor format.key output
708 }
709 { format.authors output.nonnull
710 crossref missing$
711 { "author and editor" editor either.or.check }
712 'skip$
713 if$
714 }
715 if$
716 output.year.check % special for apalike
717 new.block
718 format.btitle "title" output.check
719 crossref missing$
720 { format.bvolume output
721 format.chapter.pages "chapter and pages" output.check
722 new.block
723 format.number.series output
724 new.sentence
725 publisher "publisher" eho.output.check % Using eho.output.check instead
726 % of output.check.
727 address eho.output % Using eho.output instead of output.
728 }
729 { format.chapter.pages "chapter and pages" output.check
730 new.block
731 format.book.crossref output.nonnull
732 }
733 if$
734 format.edition output
735 new.block
736 note output
737 fin.entry
738 }
739
740 %% Modified by Eric Ho <eho@word> on Wed Jan 10 20:27:26 1990
741 %% Making it to call eho.output.check instead of output.check and eho.output
742 %% instead of output. Also modified by Eric Ho <eho@word> on Fri Jan 12
743 %% 19:21:59 1990 so as to call eho.format.in.ed.booktitle instead of the old
744 %% format.in.ed.booktitle.
745
746 FUNCTION {incollection}
747 { output.bibitem
748 format.authors "author" output.check
749 author format.key output % special for
750 output.year.check % apalike
751 new.block
752 format.title "title" output.check
753 new.block
754 crossref missing$
755 { eho.format.in.ed.booktitle "booktitle" output.check
756 % The above line is changed by Eric Ho <eho@word> on Fri Jan 12
757 % 19:20:28 1990 so that it'll call eho.format.in.ed.booktitle instead
758 % of format.in.ed.booktitle.
759
760 format.bvolume output
761 format.number.series output
762 format.chapter.pages eho.special.output
763 new.sentence
764 % publisher "publisher" output.check
765 % address output
766 % switched order of publisher and address for incollection -- BJR 1/3/90
767 address eho.output % Use eho.output instead of output.
768 publisher "publisher" eho.output.check % Use eho.output.check instead
769 % of output.check.
770 format.edition output
771 }
772 { format.incoll.inproc.crossref output.nonnull
773 format.chapter.pages output
774 }
775 if$
776 new.block
777 note output
778 fin.entry
779 }
780
781 FUNCTION {inproceedings}
782 { output.bibitem
783 format.authors "author" output.check
784 author format.key output % special for
785 output.year.check % apalike
786 new.block
787 format.title "title" output.check
788 new.block
789 crossref missing$
790 { % format.in.ed.booktitle "booktitle" output.check
791 eho.format.in.ed.booktitle "booktitle" output.check
792 format.bvolume output
793 format.number.series output
794 format.pages eho.special.output
795 address eho.special.output % for apalike
796 new.sentence % there's no year
797 organization eho.special.output % here so things
798 publisher eho.special.output % are simpler
799 }
800 { format.incoll.inproc.crossref output.nonnull
801 format.pages output
802 }
803 if$
804 new.block
805 note output
806 fin.entry
807 }
808
809 FUNCTION {conference} { inproceedings }
810
811 FUNCTION {manual}
812 { output.bibitem
813 format.authors output
814 author format.key output % special for
815 output.year.check % apalike
816 new.block
817 format.btitle "title" output.check
818 organization address new.block.checkb
819 organization output
820 address output
821 format.edition output
822 new.block
823 note output
824 fin.entry
825 }
826
827 FUNCTION {mastersthesis}
828 { output.bibitem
829 format.authors "author" output.check
830 author format.key output % special for
831 output.year.check % apalike
832 new.block
833 format.title "title" output.check
834 new.block
835 "Master's thesis" format.thesis.type output.nonnull
836 school "school" output.check
837 address output
838 new.block
839 note output
840 fin.entry
841 }
842
843 FUNCTION {misc}
844 { output.bibitem
845 format.authors output
846 author format.key output % special for
847 output.year.check % apalike
848 new.block
849 format.title output
850 new.block
851 howpublished output
852 new.block
853 note output
854 fin.entry
855 }
856
857 FUNCTION {phdthesis}
858 { output.bibitem
859 format.authors "author" output.check
860 author format.key output % special for
861 output.year.check % apalike
862 new.block
863 format.btitle "title" output.check
864 new.block
865 "PhD thesis" format.thesis.type output.nonnull
866 school "school" output.check
867 address output
868 new.block
869 note output
870 fin.entry
871 }
872
873 FUNCTION {proceedings}
874 { output.bibitem
875 format.editors output
876 editor format.key output % special for
877 output.year.check % apalike
878 new.block
879 format.btitle "title" output.check
880 format.bvolume output
881 format.number.series output
882 address output % for apalike
883 new.sentence % we always output
884 organization output % a nonempty organization
885 publisher output % here
886 new.block
887 note output
888 fin.entry
889 }
890
891 FUNCTION {techreport}
892 { output.bibitem
893 format.authors "author" output.check
894 author format.key output % special for
895 output.year.check % apalike
896 new.block
897 % format.title "title" output.check
898 format.btitle "title" output.check % change to ital title -- BJR
899 new.block
900 format.tr.number output.nonnull
901 institution "institution" output.check
902 address output
903 new.block
904 note output
905 fin.entry
906 }
907
908 FUNCTION {unpublished}
909 { output.bibitem
910 format.authors "author" output.check
911 author format.key output % special for
912 output.year.check % apalike
913 new.block
914 format.title "title" output.check
915 new.block
916 note "note" output.check
917 fin.entry
918 }
919
920 FUNCTION {default.type} { misc }
921
922 MACRO {jan} {"January"}
923
924 MACRO {feb} {"February"}
925
926 MACRO {mar} {"March"}
927
928 MACRO {apr} {"April"}
929
930 MACRO {may} {"May"}
931
932 MACRO {jun} {"June"}
933
934 MACRO {jul} {"July"}
935
936 MACRO {aug} {"August"}
937
938 MACRO {sep} {"September"}
939
940 MACRO {oct} {"October"}
941
942 MACRO {nov} {"November"}
943
944 MACRO {dec} {"December"}
945
946 MACRO {acmcs} {"ACM Computing Surveys"}
947
948 MACRO {acta} {"Acta Informatica"}
949
950 MACRO {cacm} {"Communications of the ACM"}
951
952 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
953
954 MACRO {ibmsj} {"IBM Systems Journal"}
955
956 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
957
958 MACRO {ieeetc} {"IEEE Transactions on Computers"}
959
960 MACRO {ieeetcad}
961 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
962
963 MACRO {ipl} {"Information Processing Letters"}
964
965 MACRO {jacm} {"Journal of the ACM"}
966
967 MACRO {jcss} {"Journal of Computer and System Sciences"}
968
969 MACRO {scp} {"Science of Computer Programming"}
970
971 MACRO {sicomp} {"SIAM Journal on Computing"}
972
973 MACRO {tocs} {"ACM Transactions on Computer Systems"}
974
975 MACRO {tods} {"ACM Transactions on Database Systems"}
976
977 MACRO {tog} {"ACM Transactions on Graphics"}
978
979 MACRO {toms} {"ACM Transactions on Mathematical Software"}
980
981 MACRO {toois} {"ACM Transactions on Office Information Systems"}
982
983 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
984
985 MACRO {tcs} {"Theoretical Computer Science"}
986
987 READ
988
989 FUNCTION {sortify}
990 { purify$
991 "l" change.case$
992 }
993
994 INTEGERS { len }
995
996 FUNCTION {chop.word}
997 { 's :=
998 'len :=
999 s #1 len substring$ =
1000 { s len #1 + global.max$ substring$ }
1001 's
1002 if$
1003 }
1004
1005 % There are three apalike cases: one person (Jones),
1006 % two (Jones and de~Bruijn), and more (Jones et~al.).
1007 % This function is much like format.crossref.editors.
1008 %
1009 FUNCTION {format.lab.names}
1010 { 's :=
1011 s #1 "{vv~}{ll}" format.name$
1012 s num.names$ duplicate$
1013 #2 >
1014 { pop$ " et~al." * }
1015 { #2 <
1016 'skip$
1017 { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1018 { " et~al." * }
1019 { " \& " * s #2 "{vv~}{ll}" format.name$ * } % " and " -- BJR 10/5/89
1020 if$
1021 }
1022 if$
1023 }
1024 if$
1025 }
1026
1027 FUNCTION {author.key.label}
1028 { author empty$
1029 { key empty$
1030 { cite$ #1 #3 substring$ }
1031 'key % apalike uses the whole key
1032 if$
1033 }
1034 { author format.lab.names }
1035 if$
1036 }
1037
1038 FUNCTION {author.editor.key.label}
1039 { author empty$
1040 { editor empty$
1041 { key empty$
1042 { cite$ #1 #3 substring$ }
1043 'key % apalike uses the whole key
1044 if$
1045 }
1046 { editor format.lab.names }
1047 if$
1048 }
1049 { author format.lab.names }
1050 if$
1051 }
1052
1053 FUNCTION {editor.key.label}
1054 { editor empty$
1055 { key empty$
1056 { cite$ #1 #3 substring$ }
1057 'key % apalike uses the whole key, no organization
1058 if$
1059 }
1060 { editor format.lab.names }
1061 if$
1062 }
1063
1064 FUNCTION {calc.label}
1065 { type$ "book" =
1066 type$ "inbook" =
1067 or
1068 'author.editor.key.label
1069 { type$ "proceedings" =
1070 'editor.key.label % apalike ignores organization
1071 'author.key.label % for labeling and sorting
1072 if$
1073 }
1074 if$
1075 ", " % these three lines are
1076 * % for apalike, which
1077 year field.or.null purify$ #-1 #4 substring$ % uses all four digits
1078 *
1079 'label :=
1080 }
1081
1082 FUNCTION {sort.format.names}
1083 { 's :=
1084 #1 'nameptr :=
1085 ""
1086 s num.names$ 'numnames :=
1087 numnames 'namesleft :=
1088 { namesleft #0 > }
1089 { nameptr #1 >
1090 { " " * }
1091 'skip$
1092 if$ % apalike uses initials
1093 s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := % <= here
1094 nameptr numnames = t "others" = and
1095 { "et al" * }
1096 { t sortify * }
1097 if$
1098 nameptr #1 + 'nameptr :=
1099 namesleft #1 - 'namesleft :=
1100 }
1101 while$
1102 }
1103
1104 FUNCTION {sort.format.title}
1105 { 't :=
1106 "A " #2
1107 "An " #3
1108 "The " #4 t chop.word
1109 chop.word
1110 chop.word
1111 sortify
1112 #1 global.max$ substring$
1113 }
1114
1115 FUNCTION {author.sort}
1116 { author empty$
1117 { key empty$
1118 { "to sort, need author or key in " cite$ * warning$
1119 ""
1120 }
1121 { key sortify }
1122 if$
1123 }
1124 { author sort.format.names }
1125 if$
1126 }
1127
1128 FUNCTION {author.editor.sort}
1129 { author empty$
1130 { editor empty$
1131 { key empty$
1132 { "to sort, need author, editor, or key in " cite$ * warning$
1133 ""
1134 }
1135 { key sortify }
1136 if$
1137 }
1138 { editor sort.format.names }
1139 if$
1140 }
1141 { author sort.format.names }
1142 if$
1143 }
1144
1145 FUNCTION {editor.sort}
1146 { editor empty$
1147 { key empty$
1148 { "to sort, need editor or key in " cite$ * warning$
1149 ""
1150 }
1151 { key sortify }
1152 if$
1153 }
1154 { editor sort.format.names }
1155 if$
1156 }
1157
1158 % apalike uses two sorting passes; the first one sets the
1159 % labels so that the `a's, `b's, etc. can be computed;
1160 % the second pass puts the references in "correct" order.
1161 % The presort function is for the first pass. It computes
1162 % label, sort.label, and title, and then concatenates.
1163 FUNCTION {presort}
1164 { calc.label
1165 label sortify
1166 " "
1167 *
1168 type$ "book" =
1169 type$ "inbook" =
1170 or
1171 'author.editor.sort
1172 { type$ "proceedings" =
1173 'editor.sort
1174 'author.sort
1175 if$
1176 }
1177 if$
1178 #1 entry.max$ substring$ % for
1179 'sort.label := % apalike
1180 sort.label % style
1181 *
1182 " "
1183 *
1184 title field.or.null
1185 sort.format.title
1186 *
1187 #1 entry.max$ substring$
1188 'sort.key$ :=
1189 }
1190
1191 ITERATE {presort}
1192
1193 SORT % by label, sort.label, title---for final label calculation
1194
1195 STRINGS { last.label next.extra } % apalike labels are only for the text;
1196
1197 INTEGERS { last.extra.num } % there are none in the bibliography
1198
1199 FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label'
1200 { #0 int.to.chr$ 'last.label :=
1201 "" 'next.extra :=
1202 #0 'last.extra.num :=
1203 }
1204
1205 FUNCTION {forward.pass}
1206 { last.label label =
1207 { last.extra.num #1 + 'last.extra.num :=
1208 last.extra.num int.to.chr$ 'extra.label :=
1209 }
1210 { "a" chr.to.int$ 'last.extra.num :=
1211 "" 'extra.label :=
1212 label 'last.label :=
1213 }
1214 if$
1215 }
1216
1217 FUNCTION {reverse.pass}
1218 { next.extra "b" =
1219 { "a" 'extra.label := }
1220 'skip$
1221 if$
1222 label extra.label * 'label :=
1223 extra.label 'next.extra :=
1224 }
1225
1226 EXECUTE {initialize.extra.label.stuff}
1227
1228 ITERATE {forward.pass}
1229
1230 REVERSE {reverse.pass}
1231
1232 % Now that the label is right we sort for real,
1233 % on sort.label then year then title. This is
1234 % for the second sorting pass.
1235 FUNCTION {bib.sort.order}
1236 { sort.label
1237 " "
1238 *
1239 year field.or.null sortify
1240 *
1241 " "
1242 *
1243 title field.or.null
1244 sort.format.title
1245 *
1246 #1 entry.max$ substring$
1247 'sort.key$ :=
1248 }
1249
1250 ITERATE {bib.sort.order}
1251
1252 SORT % by sort.label, year, title---giving final bibliography order
1253
1254 FUNCTION {begin.bib}
1255 { preamble$ empty$ % no \etalchar in apalike
1256 'skip$
1257 { preamble$ write$ newline$ }
1258 if$
1259 "\begin{thebibliography}{}" write$ newline$ % no labels in apalike
1260 }
1261
1262 EXECUTE {begin.bib}
1263
1264 EXECUTE {init.state.consts}
1265
1266 ITERATE {call.type$}
1267
1268 FUNCTION {end.bib}
1269 { newline$
1270 "\end{thebibliography}" write$ newline$
1271 }
1272
1273 EXECUTE {end.bib}