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.
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.
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.
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.
50
% month not used in apalike
64
{ label extra.label sort.label }
66
INTEGERS { output.state before.all mid.sentence after.sentence after.block }
68
FUNCTION {init.state.consts}
77
FUNCTION {output.nonnull}
79
output.state mid.sentence =
81
{ output.state after.block =
86
{ output.state before.all =
88
{ add.period$ " " * write$ }
92
mid.sentence 'output.state :=
105
FUNCTION {output.check}
108
{ pop$ "empty " t * " in " * cite$ * warning$ }
113
% apalike needs this function because
114
% the year has special punctuation;
115
% apalike ignores the month
116
FUNCTION {output.year.check}
118
{ "empty year in " cite$ * warning$ }
120
" (" year * extra.label * ")" *
121
mid.sentence 'output.state :=
126
FUNCTION {output.bibitem}
135
before.all 'output.state :=
145
{ output.state before.all =
147
{ after.block 'output.state := }
151
FUNCTION {new.sentence}
152
{ output.state after.block =
154
{ output.state before.all =
156
{ after.sentence 'output.state := }
180
FUNCTION {new.block.checkb}
189
FUNCTION {field.or.null}
199
{ "{\em " swap$ * "}" * }
203
INTEGERS { nameptr namesleft numnames }
205
FUNCTION {format.names}
208
s num.names$ 'numnames :=
209
numnames 'namesleft :=
211
{ s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := % last name first
228
nameptr #1 + 'nameptr :=
229
namesleft #1 - 'namesleft :=
234
FUNCTION {format.authors}
237
{ author format.names }
241
FUNCTION {format.key} % this function is just for apalike
243
{ key field.or.null }
248
FUNCTION {format.editors}
251
{ editor format.names
252
editor num.names$ #1 >
260
FUNCTION {format.title}
263
{ title "t" change.case$ }
271
{ t #1 #1 substring$ "-" =
272
{ t #1 #2 substring$ "--" = not
274
t #2 global.max$ substring$ 't :=
276
{ { t #1 #1 substring$ "-" = }
278
t #2 global.max$ substring$ 't :=
284
{ t #1 #1 substring$ *
285
t #2 global.max$ substring$ 't :=
292
FUNCTION {format.btitle}
296
FUNCTION {tie.or.space.connect}
297
{ duplicate$ text.length$ #3 <
304
FUNCTION {either.or.check}
307
{ "can't use both " swap$ * " fields in " * cite$ * warning$ }
311
FUNCTION {format.bvolume}
314
{ "volume" volume tie.or.space.connect
317
{ " of " * series emphasize * }
319
"volume and number" number either.or.check
324
FUNCTION {format.number.series}
327
{ series field.or.null }
328
{ output.state mid.sentence =
332
number tie.or.space.connect
334
{ "there's a number but no series in " cite$ * warning$ }
335
{ " in " * series * }
344
FUNCTION {format.edition}
347
{ output.state mid.sentence =
348
{ edition "l" change.case$ " edition" * }
349
{ edition "t" change.case$ " edition" * }
355
INTEGERS { multiresult }
357
FUNCTION {multi.page.check}
366
swap$ duplicate$ "," =
369
{ #1 'multiresult := }
370
{ t #2 global.max$ substring$ 't := }
377
FUNCTION {format.pages}
380
{ pages multi.page.check
381
{ "pages" pages n.dashify tie.or.space.connect }
382
{ "page" pages tie.or.space.connect }
388
FUNCTION {format.vol.num.pages}
389
{ volume field.or.null
392
{ "(" number * ")" * *
394
{ "there's a number but no volume in " cite$ * warning$ }
402
{ pop$ format.pages }
403
{ ":" * pages n.dashify * }
409
FUNCTION {format.chapter.pages}
414
{ type "l" change.case$ }
416
chapter tie.or.space.connect
419
{ ", " * format.pages * }
425
FUNCTION {format.in.ed.booktitle}
429
{ "In " booktitle emphasize * }
430
{ "In " format.editors * ", " * booktitle emphasize * }
436
FUNCTION {format.thesis.type}
440
type "t" change.case$
445
FUNCTION {format.tr.number}
447
{ "Technical Report" }
452
{ number tie.or.space.connect }
456
FUNCTION {format.article.crossref}
457
{ "In" % this is for apalike
458
" \cite{" * crossref * "}" *
461
FUNCTION {format.book.crossref}
463
{ "empty volume in " cite$ * "'s crossref of " * crossref * warning$
466
{ "Volume" volume tie.or.space.connect
470
"\cite{" * crossref * "}" * % this is for apalike
473
FUNCTION {format.incoll.inproc.crossref}
474
{ "In" % this is for apalike
475
" \cite{" * crossref * "}" *
480
format.authors "author" output.check
481
author format.key output % special for
482
output.year.check % apalike
484
format.title "title" output.check
487
{ journal emphasize "journal" output.check
488
format.vol.num.pages output
490
{ format.article.crossref output.nonnull
502
{ format.editors "author and editor" output.check
503
editor format.key output
505
{ format.authors output.nonnull
507
{ "author and editor" editor either.or.check }
512
output.year.check % special for apalike
514
format.btitle "title" output.check
516
{ format.bvolume output
518
format.number.series output
520
publisher "publisher" output.check
524
format.book.crossref output.nonnull
527
format.edition output
535
format.authors output
536
author format.key output % special for
537
output.year.check % apalike
539
format.title "title" output.check
551
{ format.editors "author and editor" output.check
552
editor format.key output
554
{ format.authors output.nonnull
556
{ "author and editor" editor either.or.check }
561
output.year.check % special for apalike
563
format.btitle "title" output.check
565
{ format.bvolume output
566
format.chapter.pages "chapter and pages" output.check
568
format.number.series output
570
publisher "publisher" output.check
573
{ format.chapter.pages "chapter and pages" output.check
575
format.book.crossref output.nonnull
578
format.edition output
584
FUNCTION {incollection}
586
format.authors "author" output.check
587
author format.key output % special for
588
output.year.check % apalike
590
format.title "title" output.check
593
{ format.in.ed.booktitle "booktitle" output.check
594
format.bvolume output
595
format.number.series output
596
format.chapter.pages output
598
publisher "publisher" output.check
600
format.edition output
602
{ format.incoll.inproc.crossref output.nonnull
603
format.chapter.pages output
611
FUNCTION {inproceedings}
613
format.authors "author" output.check
614
author format.key output % special for
615
output.year.check % apalike
617
format.title "title" output.check
620
{ format.in.ed.booktitle "booktitle" output.check
621
format.bvolume output
622
format.number.series output
624
address output % for apalike
625
new.sentence % there's no year
626
organization output % here so things
627
publisher output % are simpler
629
{ format.incoll.inproc.crossref output.nonnull
638
FUNCTION {conference} { inproceedings }
642
format.authors output
643
author format.key output % special for
644
output.year.check % apalike
646
format.btitle "title" output.check
647
organization address new.block.checkb
650
format.edition output
656
FUNCTION {mastersthesis}
658
format.authors "author" output.check
659
author format.key output % special for
660
output.year.check % apalike
662
format.title "title" output.check
664
"Master's thesis" format.thesis.type output.nonnull
665
school "school" output.check
674
format.authors output
675
author format.key output % special for
676
output.year.check % apalike
688
format.authors "author" output.check
689
author format.key output % special for
690
output.year.check % apalike
692
format.btitle "title" output.check
694
"PhD thesis" format.thesis.type output.nonnull
695
school "school" output.check
702
FUNCTION {proceedings}
704
format.editors output
705
editor format.key output % special for
706
output.year.check % apalike
708
format.btitle "title" output.check
709
format.bvolume output
710
format.number.series output
711
address output % for apalike
712
new.sentence % we always output
713
organization output % a nonempty organization
714
publisher output % here
720
FUNCTION {techreport}
722
format.authors "author" output.check
723
author format.key output % special for
724
output.year.check % apalike
726
format.title "title" output.check
728
format.tr.number output.nonnull
729
institution "institution" output.check
736
FUNCTION {unpublished}
738
format.authors "author" output.check
739
author format.key output % special for
740
output.year.check % apalike
742
format.title "title" output.check
744
note "note" output.check
748
FUNCTION {default.type} { misc }
750
MACRO {jan} {"January"}
752
MACRO {feb} {"February"}
754
MACRO {mar} {"March"}
756
MACRO {apr} {"April"}
764
MACRO {aug} {"August"}
766
MACRO {sep} {"September"}
768
MACRO {oct} {"October"}
770
MACRO {nov} {"November"}
772
MACRO {dec} {"December"}
774
MACRO {acmcs} {"ACM Computing Surveys"}
776
MACRO {acta} {"Acta Informatica"}
778
MACRO {cacm} {"Communications of the ACM"}
780
MACRO {ibmjrd} {"IBM Journal of Research and Development"}
782
MACRO {ibmsj} {"IBM Systems Journal"}
784
MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
786
MACRO {ieeetc} {"IEEE Transactions on Computers"}
789
{"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
791
MACRO {ipl} {"Information Processing Letters"}
793
MACRO {jacm} {"Journal of the ACM"}
795
MACRO {jcss} {"Journal of Computer and System Sciences"}
797
MACRO {scp} {"Science of Computer Programming"}
799
MACRO {sicomp} {"SIAM Journal on Computing"}
801
MACRO {tocs} {"ACM Transactions on Computer Systems"}
803
MACRO {tods} {"ACM Transactions on Database Systems"}
805
MACRO {tog} {"ACM Transactions on Graphics"}
807
MACRO {toms} {"ACM Transactions on Mathematical Software"}
809
MACRO {toois} {"ACM Transactions on Office Information Systems"}
811
MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
813
MACRO {tcs} {"Theoretical Computer Science"}
827
s #1 len substring$ =
828
{ s len #1 + global.max$ substring$ }
833
% There are three apalike cases: one person (Jones),
834
% two (Jones and de~Bruijn), and more (Jones et~al.).
835
% This function is much like format.crossref.editors.
837
FUNCTION {format.lab.names}
839
s #1 "{vv~}{ll}" format.name$
840
s num.names$ duplicate$
845
{ s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
847
{ " and " * s #2 "{vv~}{ll}" format.name$ * }
855
FUNCTION {author.key.label}
858
{ cite$ #1 #3 substring$ }
859
'key % apalike uses the whole key
862
{ author format.lab.names }
866
FUNCTION {author.editor.key.label}
870
{ cite$ #1 #3 substring$ }
871
'key % apalike uses the whole key
874
{ editor format.lab.names }
877
{ author format.lab.names }
881
FUNCTION {editor.key.label}
884
{ cite$ #1 #3 substring$ }
885
'key % apalike uses the whole key, no organization
888
{ editor format.lab.names }
892
FUNCTION {calc.label}
896
'author.editor.key.label
897
{ type$ "proceedings" =
898
'editor.key.label % apalike ignores organization
899
'author.key.label % for labeling and sorting
903
", " % these three lines are
904
* % for apalike, which
905
year field.or.null purify$ #-1 #4 substring$ % uses all four digits
910
FUNCTION {sort.format.names}
914
s num.names$ 'numnames :=
915
numnames 'namesleft :=
920
if$ % apalike uses initials
921
s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := % <= here
922
nameptr numnames = t "others" = and
926
nameptr #1 + 'nameptr :=
927
namesleft #1 - 'namesleft :=
932
FUNCTION {sort.format.title}
936
"The " #4 t chop.word
940
#1 global.max$ substring$
943
FUNCTION {author.sort}
946
{ "to sort, need author or key in " cite$ * warning$
952
{ author sort.format.names }
956
FUNCTION {author.editor.sort}
960
{ "to sort, need author, editor, or key in " cite$ * warning$
966
{ editor sort.format.names }
969
{ author sort.format.names }
973
FUNCTION {editor.sort}
976
{ "to sort, need editor or key in " cite$ * warning$
982
{ editor sort.format.names }
986
% apalike uses two sorting passes; the first one sets the
987
% labels so that the `a's, `b's, etc. can be computed;
988
% the second pass puts the references in "correct" order.
989
% The presort function is for the first pass. It computes
990
% label, sort.label, and title, and then concatenates.
1000
{ type$ "proceedings" =
1006
#1 entry.max$ substring$ % for
1007
'sort.label := % apalike
1015
#1 entry.max$ substring$
1021
SORT % by label, sort.label, title---for final label calculation
1023
STRINGS { last.label next.extra } % apalike labels are only for the text;
1025
INTEGERS { last.extra.num } % there are none in the bibliography
1027
FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label'
1028
{ #0 int.to.chr$ 'last.label :=
1030
#0 'last.extra.num :=
1033
FUNCTION {forward.pass}
1034
{ last.label label =
1035
{ last.extra.num #1 + 'last.extra.num :=
1036
last.extra.num int.to.chr$ 'extra.label :=
1038
{ "a" chr.to.int$ 'last.extra.num :=
1040
label 'last.label :=
1045
FUNCTION {reverse.pass}
1047
{ "a" 'extra.label := }
1050
label extra.label * 'label :=
1051
extra.label 'next.extra :=
1054
EXECUTE {initialize.extra.label.stuff}
1056
ITERATE {forward.pass}
1058
REVERSE {reverse.pass}
1060
% Now that the label is right we sort for real,
1061
% on sort.label then year then title. This is
1062
% for the second sorting pass.
1063
FUNCTION {bib.sort.order}
1067
year field.or.null sortify
1074
#1 entry.max$ substring$
1078
ITERATE {bib.sort.order}
1080
SORT % by sort.label, year, title---giving final bibliography order
1082
FUNCTION {begin.bib}
1083
{ preamble$ empty$ % no \etalchar in apalike
1085
{ preamble$ write$ newline$ }
1087
"\begin{thebibliography}{}" write$ newline$ % no labels in apalike
1092
EXECUTE {init.state.consts}
1094
ITERATE {call.type$}
1098
"\end{thebibliography}" write$ newline$