1 % Update to have a sorting order by year, by authors.
3 % ACM Transactions bibliography style (24-Jan-88 version)
4 % A lot like abbrv.bst, but names come out "Last, initials", and in \sc.
5 % Some dates are parenthesized.
8 % 2/ 6/86 (HWT) Original version, by Howard Trickey.
9 % 3/ 5/86 (HWT) Put in pp. everywhere but articles, as per ACM style.
10 % 1/24/88 (OP&HWT) Updated for BibTeX version 0.99a, Oren Patashnik;
11 % corrected the abbreviations to "Mar." and "Sept.";
12 % THIS `acm' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
13 % 07/09/13 (SG) Adapted for PHD thesis.
42 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
44 FUNCTION {init.state.consts}
53 FUNCTION {output.nonnull}
55 output.state mid.sentence =
57 { output.state after.block =
62 { output.state before.all =
64 { add.period$ " " * write$ }
68 mid.sentence 'output.state :=
81 FUNCTION {output.check}
84 { pop$ "empty " t * " in " * cite$ * warning$ }
89 FUNCTION {output.bibitem}
96 before.all 'output.state :=
107 { output.state before.all =
109 { after.block 'output.state := }
113 FUNCTION {new.sentence}
114 { output.state after.block =
116 { output.state before.all =
118 { after.sentence 'output.state := }
142 FUNCTION {new.block.checka}
149 FUNCTION {new.block.checkb}
158 FUNCTION {field.or.null}
168 { "\phdthesisbibemph{" swap$ * "}" * }
172 FUNCTION {emphasizeic}
175 { "\phdthesisbibemph{" swap$ * "}" * }
182 { "{\sc " swap$ * "}" * }
186 INTEGERS { nameptr namesleft numnames }
188 FUNCTION {format.names}
191 s num.names$ 'numnames :=
192 numnames 'namesleft :=
194 { s nameptr "{ll}" format.name$
195 purify$ "l" change.case$ 'nt :=
196 s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=
197 "\underlineifauthor{" nt * "}{" * t * "}" * 't :=
210 nameptr #1 + 'nameptr :=
211 namesleft #1 - 'namesleft :=
216 % For names inside entries (e.g., editors of an "In ...");
217 % this is exactly ABBRV.BST's `format.names' function.
218 FUNCTION {format.innames}
221 s num.names$ 'numnames :=
222 numnames 'namesleft :=
224 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
241 nameptr #1 + 'nameptr :=
242 namesleft #1 - 'namesleft :=
247 FUNCTION {format.authors}
250 { author format.names scapify }
254 FUNCTION {format.editors}
257 { editor format.names scapify
258 editor num.names$ #1 >
266 FUNCTION {format.ineditors}
269 { editor format.innames
270 editor num.names$ #1 >
278 FUNCTION {format.title}
281 { "\phdthesisbibEmph{" title "t" change.case$ * "}" * }
289 { t #1 #1 substring$ "-" =
290 { t #1 #2 substring$ "--" = not
292 t #2 global.max$ substring$ 't :=
294 { { t #1 #1 substring$ "-" = }
296 t #2 global.max$ substring$ 't :=
302 { t #1 #1 substring$ *
303 t #2 global.max$ substring$ 't :=
310 FUNCTION {format.date}
314 { "there's a month but no year in " cite$ * warning$
321 { month " " * year * }
327 FUNCTION {format.btitle}
328 { "\phdthesisbibEmph{" title * "}" *
331 FUNCTION {tie.or.space.connect}
332 { duplicate$ text.length$ #3 <
339 FUNCTION {either.or.check}
342 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
346 FUNCTION {format.bvolume}
352 { " of " * series emphasize * }
354 "volume and number" number either.or.check
359 FUNCTION {format.number.series}
362 { series field.or.null }
363 { output.state mid.sentence =
369 { "there's a number but no series in " cite$ * warning$ }
370 { " in " * series * }
379 FUNCTION {format.edition}
382 { output.state mid.sentence =
383 { edition "l" change.case$ "~ed." * }
384 { edition "t" change.case$ "~ed." * }
390 FUNCTION {format.pages}
397 INTEGERS { multiresult }
399 FUNCTION {multi.page.check}
408 swap$ duplicate$ "," =
411 { #1 'multiresult := }
412 { t #2 global.max$ substring$ 't := }
419 FUNCTION {format.pp.pages}
422 { pages multi.page.check
423 { "pp.~" pages n.dashify * }
430 FUNCTION {format.journal.vol.num.date}
432 { "empty journal in " cite$ * warning$
442 { emphasize ", " * number * }
445 { "empty year in " cite$ * warning$ }
446 { " (" * format.date * ")" * }
452 FUNCTION {format.chapter.pages}
457 { type "l" change.case$ chapter tie.or.space.connect }
461 { ", " * format.pp.pages * }
467 FUNCTION {format.in.ed.booktitle}
470 { "In " booktitle emphasize *
473 { ", " * format.ineditors * }
479 % The proceedings title (it's on the stack) gets an (address, date) appended
480 FUNCTION {format.proc.date}
484 { "empty year in " cite$ * warning$
488 " (" * address * ")" *
506 FUNCTION {format.in.proc.date}
509 { "In " booktitle format.proc.date * }
513 FUNCTION {empty.misc.check}
514 { author empty$ title empty$ howpublished empty$
515 month empty$ year empty$ note empty$
518 { "all relevant fields are empty in " cite$ * warning$ }
523 FUNCTION {format.thesis.type}
527 type "t" change.case$
532 FUNCTION {format.tr.number}
539 { number tie.or.space.connect }
543 FUNCTION {format.article.crossref}
546 { "need key or journal for " cite$ * " to crossref " * crossref *
550 { "In {\em " journal * "}" * }
555 " \cite{" * crossref * "}" *
558 FUNCTION {format.crossref.editor}
559 { editor #1 "{vv~}{ll}" format.name$
560 editor num.names$ duplicate$
565 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
567 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
575 FUNCTION {format.book.crossref}
577 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
585 editor field.or.null author field.or.null =
589 { "need editor, key, or series for " cite$ * " to crossref " *
593 { "{\em " * series * "}" * }
599 { format.crossref.editor * }
601 " \cite{" * crossref * "}" *
604 FUNCTION {format.incoll.inproc.crossref}
606 editor field.or.null author field.or.null =
610 { "need editor, key, or booktitle for " cite$ * " to crossref " *
614 { "In {\em " booktitle * "}" * }
620 { "In " format.crossref.editor * }
622 " \cite{" * crossref * "}" *
627 format.authors "author" output.check
629 format.title "title" output.check
632 { format.journal.vol.num.date output
635 { format.article.crossref output.nonnull
636 format.pp.pages output
647 { format.editors "author and editor" output.check }
648 { format.authors output.nonnull
650 { "author and editor" editor either.or.check }
656 format.btitle "title" output.check
657 format.edition output
659 { format.bvolume output
661 format.number.series output
663 publisher "publisher" output.check
667 format.book.crossref output.nonnull
670 format.date "year" output.check
678 format.authors output
680 format.title "title" output.check
681 howpublished address new.block.checkb
693 { format.editors "author and editor" output.check }
694 { format.authors output.nonnull
696 { "author and editor" editor either.or.check }
702 format.btitle "title" output.check
703 format.edition output
705 { format.bvolume output
707 format.number.series output
709 publisher "publisher" output.check
713 format.book.crossref output.nonnull
716 format.date "year" output.check
717 format.chapter.pages "chapter and pages" output.check
723 FUNCTION {incollection}
725 format.authors "author" output.check
727 format.title "title" output.check
730 { format.in.ed.booktitle "booktitle" output.check
731 format.edition output
732 format.bvolume output
733 format.number.series output
735 publisher "publisher" output.check
737 format.date "year" output.check
739 { format.incoll.inproc.crossref output.nonnull }
741 format.chapter.pages output
747 FUNCTION {inproceedings}
749 format.authors "author" output.check
751 format.title "title" output.check
754 { format.in.proc.date "booktitle" output.check
755 format.ineditors output
756 format.bvolume output
757 format.number.series output
761 { format.incoll.inproc.crossref output.nonnull }
763 format.pp.pages output
769 FUNCTION {conference} { inproceedings }
774 { organization scapify output }
775 { format.authors output.nonnull }
778 format.btitle "title" output.check
779 format.edition output
781 { address new.block.checka }
782 { organization address new.block.checkb
793 FUNCTION {mastersthesis}
795 format.authors "author" output.check
797 format.title "title" output.check
799 "Master's thesis" format.thesis.type output.nonnull
800 school "school" output.check
802 format.date "year" output.check
810 format.authors output
811 title howpublished new.block.checkb
813 howpublished new.block.checka
824 format.authors "author" output.check
826 format.btitle "title" output.check
828 "PhD thesis" format.thesis.type output.nonnull
829 school "school" output.check
831 format.date "year" output.check
837 FUNCTION {proceedings}
840 { organization scapify output }
841 { format.editors output.nonnull }
844 title format.proc.date "title" output.check
845 format.bvolume output
846 format.number.series output
849 { organization output }
857 FUNCTION {techreport}
859 format.authors "author" output.check
861 format.title "title" output.check
863 format.tr.number output.nonnull
864 institution "institution" output.check
866 format.date "year" output.check
872 FUNCTION {unpublished}
874 format.authors "author" output.check
876 format.title "title" output.check
878 note "note" output.check
883 FUNCTION {default.type} { misc }
901 MACRO {sep} {"Sept."}
909 MACRO {acmcs} {"ACM Comput. Surv."}
911 MACRO {acta} {"Acta Inf."}
913 MACRO {cacm} {"Commun. ACM"}
915 MACRO {ibmjrd} {"IBM J. Res. Dev."}
917 MACRO {ibmsj} {"IBM Syst.~J."}
919 MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
921 MACRO {ieeetc} {"IEEE Trans. Comput."}
924 {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
926 MACRO {ipl} {"Inf. Process. Lett."}
928 MACRO {jacm} {"J.~ACM"}
930 MACRO {jcss} {"J.~Comput. Syst. Sci."}
932 MACRO {scp} {"Sci. Comput. Programming"}
934 MACRO {sicomp} {"SIAM J. Comput."}
936 MACRO {tocs} {"ACM Trans. Comput. Syst."}
938 MACRO {tods} {"ACM Trans. Database Syst."}
940 MACRO {tog} {"ACM Trans. Gr."}
942 MACRO {toms} {"ACM Trans. Math. Softw."}
944 MACRO {toois} {"ACM Trans. Office Inf. Syst."}
946 MACRO {toplas} {"ACM Trans. Program. Lang. Syst."}
948 MACRO {tcs} {"Theoretical Comput. Sci."}
962 s #1 len substring$ =
963 { s len #1 + global.max$ substring$ }
968 FUNCTION {sort.format.names}
972 s num.names$ 'numnames :=
973 numnames 'namesleft :=
979 s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't :=
980 nameptr numnames = t "others" = and
984 nameptr #1 + 'nameptr :=
985 namesleft #1 - 'namesleft :=
990 FUNCTION {sort.format.title}
994 "The " #4 t chop.word
998 #1 global.max$ substring$
1001 FUNCTION {year.author.sort}
1004 { "to sort, need year or author in " cite$ * warning$
1007 { author sort.format.names }
1014 FUNCTION {year.author.editor.sort}
1019 { "to sort, need yeary, author, editor, or key in " cite$ * warning$
1025 { editor sort.format.names }
1028 { author sort.format.names }
1035 FUNCTION {year.author.organization.sort}
1038 { organization empty$
1040 { "to sort, need year, author, organization, or key in " cite$ * warning$
1046 { "The " #4 organization chop.word sortify }
1049 { author sort.format.names }
1056 FUNCTION {year.editor.organization.sort}
1059 { organization empty$
1061 { "to sort, need year, editor, organization, or key in " cite$ * warning$
1067 { "The " #4 organization chop.word sortify }
1070 { editor sort.format.names }
1081 'year.author.editor.sort
1082 { type$ "proceedings" =
1083 'year.editor.organization.sort
1085 'year.author.organization.sort
1094 author field.or.null sort.format.names
1098 editor field.or.null sort.format.names
1105 #1 entry.max$ substring$
1113 STRINGS { longest.label }
1115 INTEGERS { number.label longest.label.width }
1117 FUNCTION {initialize.longest.label}
1118 { "" 'longest.label :=
1120 #0 'longest.label.width :=
1123 FUNCTION {longest.label.pass}
1124 { number.label int.to.str$ 'label :=
1125 number.label #1 + 'number.label :=
1126 label width$ longest.label.width >
1127 { label 'longest.label :=
1128 label width$ 'longest.label.width :=
1134 EXECUTE {initialize.longest.label}
1136 ITERATE {longest.label.pass}
1138 FUNCTION {begin.bib}
1141 { preamble$ write$ newline$ }
1143 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
1148 EXECUTE {init.state.consts}
1150 ITERATE {call.type$}
1154 "\end{thebibliography}" write$ newline$