1 % BibTeX `apalike' bibliography style (version 0.99a, 8-Dec-10), adapted from
2 % the `alpha' style, version 0.99a; for BibTeX version 0.99a.
4 % Copyright (C) 1988, 2010 Oren Patashnik.
5 % Unlimited copying and redistribution of this file are permitted as long as
6 % it is unmodified. Modifications (and redistribution of modified versions)
7 % are also permitted, but only if the resulting file is renamed.
9 % Differences between this style and `alpha' are generally heralded by a `%'.
10 % The file btxbst.doc has the documentation for alpha.bst.
12 % This style should be used with the `apalike' LaTeX style (apalike.sty).
13 % \cite's come out like "(Jones, 1986)" in the text but there are no labels
14 % in the bibliography, and something like "(1986)" comes out immediately
15 % after the author. Author (and editor) names appear as last name, comma,
16 % initials. A `year' field is required for every entry, and so is either
17 % an author (or in some cases, an editor) field or a key field.
20 % Many journals require a style like `apalike', but I strongly, strongly,
21 % strongly recommend that you not use it if you have a choice---use something
22 % like `plain' instead. Mary-Claire van Leunen (A Handbook for Scholars,
23 % Knopf, 1979) argues convincingly that a style like `plain' encourages better
24 % writing than one like `apalike'. Furthermore the strongest arguments for
25 % using an author-date style like `apalike'---that it's "the most practical"
26 % (The Chicago Manual of Style, University of Chicago Press, thirteenth
27 % edition, 1982, pages 400--401)---fall flat on their face with the new
28 % computer-typesetting technology. For instance page 401 anachronistically
29 % states "The chief disadvantage of [a style like `plain'] is that additions
30 % or deletions cannot be made after the manuscript is typed without changing
31 % numbers in both text references and list." LaTeX sidesteps the disadvantage.
34 % 15-sep-86 (OP) Original version by Oren Patashnik, ideas from Susan King.
35 % 10-nov-86 (OP) Truncated the sort.key$ string to the correct length
36 % in bib.sort.order to eliminate error message.
37 % 24-jan-88 (OP) Updated for BibTeX version 0.99a, from alpha.bst 0.99a;
38 % apalike now sorts by author, then year, then title;
39 % THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
40 % 8-dec-10 (OP) Still version 0.99a, as the code itself was unchanged;
41 % this release clarified the license.
42 % 07/09/14 (SG) Adapted for PHD thesis.
55 % month not used in apalike
69 { label extra.label sort.label }
71 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
73 FUNCTION {init.state.consts}
82 FUNCTION {output.nonnull}
84 output.state mid.sentence =
86 { output.state after.block =
91 { output.state before.all =
93 { add.period$ " " * write$ }
97 mid.sentence 'output.state :=
110 FUNCTION {output.check}
113 { pop$ "empty " t * " in " * cite$ * warning$ }
118 % apalike needs this function because
119 % the year has special punctuation;
120 % apalike ignores the month
121 FUNCTION {output.year.check}
123 { "empty year in " cite$ * warning$ }
125 " (" year * extra.label * ")" *
126 mid.sentence 'output.state :=
131 FUNCTION {output.bibitem}
140 before.all 'output.state :=
150 { output.state before.all =
152 { after.block 'output.state := }
156 FUNCTION {new.sentence}
157 { output.state after.block =
159 { output.state before.all =
161 { after.sentence 'output.state := }
185 FUNCTION {new.block.checkb}
194 FUNCTION {field.or.null}
204 { "\phdthesisbibemph{" swap$ * "}" * }
208 INTEGERS { nameptr namesleft numnames }
210 FUNCTION {format.names}
213 s num.names$ 'numnames :=
214 numnames 'namesleft :=
216 { s nameptr "{ll}" format.name$
217 purify$ "l" change.case$ 'nt :=
218 s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=
219 "\underlineifauthor{" nt * "}{" * t * "}" * 't :=
224 { ", \phdthesisbiband" * }
225 { ", \phdthesisbiband" * t * }
232 nameptr #1 + 'nameptr :=
233 namesleft #1 - 'namesleft :=
238 FUNCTION {format.authors}
241 { author format.names }
245 FUNCTION {format.key} % this function is just for apalike
247 { key field.or.null }
252 FUNCTION {format.editors}
255 { editor format.names
256 editor num.names$ #1 >
257 { ", \phdthesisbibeditors" * }
258 { ", \phdthesisbibeditor" * }
264 FUNCTION {format.title}
267 { "\phdthesisbibEmph{" title "t" change.case$ * "}" * }
275 { t #1 #1 substring$ "-" =
276 { t #1 #2 substring$ "--" = not
278 t #2 global.max$ substring$ 't :=
280 { { t #1 #1 substring$ "-" = }
282 t #2 global.max$ substring$ 't :=
288 { t #1 #1 substring$ *
289 t #2 global.max$ substring$ 't :=
296 FUNCTION {format.btitle}
297 { "\phdthesisbibEmph{" title * "}" *
300 FUNCTION {tie.or.space.connect}
301 { duplicate$ text.length$ #3 <
308 FUNCTION {either.or.check}
311 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
315 FUNCTION {format.bvolume}
318 { "\phdthesisbibvolume" volume tie.or.space.connect
321 { " \phdthesisbibof " * series emphasize * }
323 "\phdthesisbibvolumenumber" number either.or.check
328 FUNCTION {format.number.series}
331 { series field.or.null }
332 { output.state mid.sentence =
333 { "\phdthesisbibnumber" }
334 { "\phdthesisbibNumber" }
336 number tie.or.space.connect
338 { "there's a number but no series in " cite$ * warning$ }
339 { " \phdthesisbibin " * series * }
348 FUNCTION {format.edition}
351 { output.state mid.sentence =
352 { edition "l" change.case$ " \phdthesisbibedition" * }
353 { edition "t" change.case$ " \phdthesisbibedition" * }
359 INTEGERS { multiresult }
361 FUNCTION {multi.page.check}
370 swap$ duplicate$ "," =
373 { #1 'multiresult := }
374 { t #2 global.max$ substring$ 't := }
381 FUNCTION {format.pages}
384 { pages multi.page.check
385 { "\phdthesisbibpages" pages n.dashify tie.or.space.connect }
386 { "\phdthesisbibpage" pages tie.or.space.connect }
392 FUNCTION {format.vol.num.pages}
393 { volume field.or.null
396 { "(" number * ")" * *
398 { "there's a number but no volume in " cite$ * warning$ }
406 { pop$ format.pages }
407 { ":" * pages n.dashify * }
413 FUNCTION {format.chapter.pages}
417 { "\phdthesisbibchapter" }
418 { type "l" change.case$ }
420 chapter tie.or.space.connect
423 { ", " * format.pages * }
429 FUNCTION {format.in.ed.booktitle}
433 { "\phdthesisbibIn " booktitle emphasize * }
434 { "\phdthesisbibIn " format.editors * ", " * booktitle emphasize * }
440 FUNCTION {format.thesis.type}
444 type "t" change.case$
449 FUNCTION {format.tr.number}
451 { "\phdthesisbibtechnicalreport" }
456 { number tie.or.space.connect }
460 FUNCTION {format.article.crossref}
461 { "\phdthesisbibIn\ " % this is for apalike
462 " \cite{" * crossref * "}" *
465 FUNCTION {format.book.crossref}
467 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
470 { "\phdthesisbibVolume" volume tie.or.space.connect
471 " \phdthesisbibof\ " *
474 "\cite{" * crossref * "}" * % this is for apalike
477 FUNCTION {format.incoll.inproc.crossref}
478 { "\phdthesisbibIn" % this is for apalike
479 " \cite{" * crossref * "}" *
484 format.authors "author" output.check
485 author format.key output % special for
486 output.year.check % apalike
488 format.title "title" output.check
491 { journal emphasize "journal" output.check
492 format.vol.num.pages output
494 { format.article.crossref output.nonnull
506 { format.editors "author and editor" output.check
507 editor format.key output
509 { format.authors output.nonnull
511 { "author and editor" editor either.or.check }
516 output.year.check % special for apalike
518 format.btitle "title" output.check
520 { format.bvolume output
522 format.number.series output
524 publisher "publisher" output.check
528 format.book.crossref output.nonnull
531 format.edition output
539 format.authors output
540 author format.key output % special for
541 output.year.check % apalike
543 format.title "title" output.check
555 { format.editors "author and editor" output.check
556 editor format.key output
558 { format.authors output.nonnull
560 { "author and editor" editor either.or.check }
565 output.year.check % special for apalike
567 format.btitle "title" output.check
569 { format.bvolume output
570 format.chapter.pages "chapter and pages" output.check
572 format.number.series output
574 publisher "publisher" output.check
577 { format.chapter.pages "chapter and pages" output.check
579 format.book.crossref output.nonnull
582 format.edition output
588 FUNCTION {incollection}
590 format.authors "author" output.check
591 author format.key output % special for
592 output.year.check % apalike
594 format.title "title" output.check
597 { format.in.ed.booktitle "booktitle" output.check
598 format.bvolume output
599 format.number.series output
600 format.chapter.pages output
602 publisher "publisher" output.check
604 format.edition output
606 { format.incoll.inproc.crossref output.nonnull
607 format.chapter.pages output
615 FUNCTION {inproceedings}
617 format.authors "author" output.check
618 author format.key output % special for
619 output.year.check % apalike
621 format.title "title" output.check
624 { format.in.ed.booktitle "booktitle" output.check
625 format.bvolume output
626 format.number.series output
628 address output % for apalike
629 new.sentence % there's no year
630 organization output % here so things
631 publisher output % are simpler
633 { format.incoll.inproc.crossref output.nonnull
642 FUNCTION {conference} { inproceedings }
646 format.authors output
647 author format.key output % special for
648 output.year.check % apalike
650 format.btitle "title" output.check
651 organization address new.block.checkb
654 format.edition output
660 FUNCTION {mastersthesis}
662 format.authors "author" output.check
663 author format.key output % special for
664 output.year.check % apalike
666 format.title "title" output.check
668 "Master's thesis" format.thesis.type output.nonnull
669 school "school" output.check
678 format.authors output
679 author format.key output % special for
680 output.year.check % apalike
692 format.authors "author" output.check
693 author format.key output % special for
694 output.year.check % apalike
696 format.btitle "title" output.check
698 "PhD thesis" format.thesis.type output.nonnull
699 school "school" output.check
706 FUNCTION {proceedings}
708 format.editors output
709 editor format.key output % special for
710 output.year.check % apalike
712 format.btitle "title" output.check
713 format.bvolume output
714 format.number.series output
715 address output % for apalike
716 new.sentence % we always output
717 organization output % a nonempty organization
718 publisher output % here
724 FUNCTION {techreport}
726 format.authors "author" output.check
727 author format.key output % special for
728 output.year.check % apalike
730 format.title "title" output.check
732 format.tr.number output.nonnull
733 institution "institution" output.check
740 FUNCTION {unpublished}
742 format.authors "author" output.check
743 author format.key output % special for
744 output.year.check % apalike
746 format.title "title" output.check
748 note "note" output.check
752 FUNCTION {default.type} { misc }
754 MACRO {jan} {"\phdthesisbibJanuary"}
756 MACRO {feb} {"\phdthesisbibFebruary"}
758 MACRO {mar} {"\phdthesisbibMarch"}
760 MACRO {apr} {"\phdthesisbibApril"}
762 MACRO {may} {"\phdthesisbibMay"}
764 MACRO {jun} {"\phdthesisbibJune"}
766 MACRO {jul} {"\phdthesisbibJuly"}
768 MACRO {aug} {"\phdthesisbibAugust"}
770 MACRO {sep} {"\phdthesisbibSeptember"}
772 MACRO {oct} {"\phdthesisbibOctober"}
774 MACRO {nov} {"\phdthesisbibNovember"}
776 MACRO {dec} {"\phdthesisbibDecember"}
778 MACRO {acmcs} {"ACM Computing Surveys"}
780 MACRO {acta} {"Acta Informatica"}
782 MACRO {cacm} {"Communications of the ACM"}
784 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
786 MACRO {ibmsj} {"IBM Systems Journal"}
788 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
790 MACRO {ieeetc} {"IEEE Transactions on Computers"}
793 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
795 MACRO {ipl} {"Information Processing Letters"}
797 MACRO {jacm} {"Journal of the ACM"}
799 MACRO {jcss} {"Journal of Computer and System Sciences"}
801 MACRO {scp} {"Science of Computer Programming"}
803 MACRO {sicomp} {"SIAM Journal on Computing"}
805 MACRO {tocs} {"ACM Transactions on Computer Systems"}
807 MACRO {tods} {"ACM Transactions on Database Systems"}
809 MACRO {tog} {"ACM Transactions on Graphics"}
811 MACRO {toms} {"ACM Transactions on Mathematical Software"}
813 MACRO {toois} {"ACM Transactions on Office Information Systems"}
815 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
817 MACRO {tcs} {"Theoretical Computer Science"}
831 s #1 len substring$ =
832 { s len #1 + global.max$ substring$ }
837 % There are three apalike cases: one person (Jones),
838 % two (Jones and de~Bruijn), and more (Jones et~al.).
839 % This function is much like format.crossref.editors.
841 % Note that if more than one name exist, the "et al." is output
842 FUNCTION {format.lab.names}
844 s #1 "{vv~}{ll}" format.name$
845 s num.names$ duplicate$
850 { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
851 { " \phdthesisbibetal" * }
852 { " \phdthesisbiband\ " * s #2 "{vv~}{ll}" format.name$ * }
860 FUNCTION {author.key.label}
863 { cite$ #1 #3 substring$ }
864 'key % apalike uses the whole key
867 { author format.lab.names }
871 FUNCTION {author.editor.key.label}
875 { cite$ #1 #3 substring$ }
876 'key % apalike uses the whole key
879 { editor format.lab.names }
882 { author format.lab.names }
886 FUNCTION {editor.key.label}
889 { cite$ #1 #3 substring$ }
890 'key % apalike uses the whole key, no organization
893 { editor format.lab.names }
897 FUNCTION {calc.label}
901 'author.editor.key.label
902 { type$ "proceedings" =
903 'editor.key.label % apalike ignores organization
904 'author.key.label % for labeling and sorting
908 ", " % these three lines are
909 * % for apalike, which
910 year field.or.null purify$ #-1 #4 substring$ % uses all four digits
915 FUNCTION {sort.format.names}
919 s num.names$ 'numnames :=
920 numnames 'namesleft :=
925 if$ % apalike uses initials
926 s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := % <= here
927 nameptr numnames = t "others" = and
931 nameptr #1 + 'nameptr :=
932 namesleft #1 - 'namesleft :=
937 FUNCTION {sort.format.title}
941 "The " #4 t chop.word
945 #1 global.max$ substring$
948 FUNCTION {author.sort}
951 { "to sort, need author or key in " cite$ * warning$
957 { author sort.format.names }
961 FUNCTION {author.editor.sort}
965 { "to sort, need author, editor, or key in " cite$ * warning$
971 { editor sort.format.names }
974 { author sort.format.names }
978 FUNCTION {editor.sort}
981 { "to sort, need editor or key in " cite$ * warning$
987 { editor sort.format.names }
991 % apalike uses two sorting passes; the first one sets the
992 % labels so that the `a's, `b's, etc. can be computed;
993 % the second pass puts the references in "correct" order.
994 % The presort function is for the first pass. It computes
995 % label, sort.label, and title, and then concatenates.
1005 { type$ "proceedings" =
1011 #1 entry.max$ substring$ % for
1012 'sort.label := % apalike
1020 #1 entry.max$ substring$
1026 SORT % by label, sort.label, title---for final label calculation
1028 STRINGS { last.label next.extra } % apalike labels are only for the text;
1030 INTEGERS { last.extra.num } % there are none in the bibliography
1032 FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label'
1033 { #0 int.to.chr$ 'last.label :=
1035 #0 'last.extra.num :=
1038 FUNCTION {forward.pass}
1039 { last.label label =
1040 { last.extra.num #1 + 'last.extra.num :=
1041 last.extra.num int.to.chr$ 'extra.label :=
1043 { "a" chr.to.int$ 'last.extra.num :=
1045 label 'last.label :=
1050 FUNCTION {reverse.pass}
1052 { "a" 'extra.label := }
1055 label extra.label * 'label :=
1056 extra.label 'next.extra :=
1059 EXECUTE {initialize.extra.label.stuff}
1061 ITERATE {forward.pass}
1063 REVERSE {reverse.pass}
1065 % Now that the label is right we sort for real,
1066 % on sort.label then year then title. This is
1067 % for the second sorting pass.
1068 FUNCTION {bib.sort.order}
1072 year field.or.null sortify
1079 #1 entry.max$ substring$
1083 ITERATE {bib.sort.order}
1085 SORT % by sort.label, year, title---giving final bibliography order
1087 FUNCTION {begin.bib}
1088 { preamble$ empty$ % no \etalchar in apalike
1090 { preamble$ write$ newline$ }
1092 "\begin{thebibliography}{}" write$ newline$ % no labels in apalike
1097 EXECUTE {init.state.consts}
1099 ITERATE {call.type$}
1103 "\end{thebibliography}" write$ newline$