1 % Derived from BibTeX standard bibliography style `alpha'
2 % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
3 % Copyright (C) 1985, all rights reserved.
4 % Copying of this file is authorized only if either
5 % (1) you make absolutely no changes to your copy, including name, or
6 % (2) if you do make changes, you name it something other than
7 % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
8 % This restriction helps ensure that all standard styles are identical.
9 % The file btxbst.doc has the documentation for this style.
11 % Now recognize url field. If present produce a hyperref on the
12 % bibliography label with a link to url.
40 { label extra.label sort.label }
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 :=
80 FUNCTION {output.check}
83 { pop$ "empty " t * " in " * cite$ * warning$ }
88 FUNCTION {output.bibitem}
93 { "\xbiblabel{" write$
107 before.all 'output.state :=
111 { output.state before.all =
113 { after.block 'output.state := }
117 FUNCTION {output.url}
136 FUNCTION {new.sentence}
137 { output.state after.block =
139 { output.state before.all =
141 { after.sentence 'output.state := }
165 FUNCTION {new.block.checka}
172 FUNCTION {new.block.checkb}
181 FUNCTION {new.sentence.checka}
188 FUNCTION {new.sentence.checkb}
197 FUNCTION {field.or.null}
207 { "{\em " swap$ * "}" * }
211 INTEGERS { nameptr namesleft numnames }
213 FUNCTION {format.names}
216 s num.names$ 'numnames :=
217 numnames 'namesleft :=
219 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
236 nameptr #1 + 'nameptr :=
237 namesleft #1 - 'namesleft :=
242 FUNCTION {format.authors}
245 { author format.names }
249 FUNCTION {format.editors}
252 { editor format.names
253 editor num.names$ #1 >
261 FUNCTION {format.title}
264 { title "t" change.case$ }
272 { t #1 #1 substring$ "-" =
273 { t #1 #2 substring$ "--" = not
275 t #2 global.max$ substring$ 't :=
277 { { t #1 #1 substring$ "-" = }
279 t #2 global.max$ substring$ 't :=
285 { t #1 #1 substring$ *
286 t #2 global.max$ substring$ 't :=
293 FUNCTION {format.date}
297 { "there's a month but no year in " cite$ * warning$
304 { month " " * year * }
310 FUNCTION {format.btitle}
314 FUNCTION {tie.or.space.connect}
315 { duplicate$ text.length$ #3 <
322 FUNCTION {either.or.check}
325 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
329 FUNCTION {format.bvolume}
332 { "volume" volume tie.or.space.connect
335 { " of " * series emphasize * }
337 "volume and number" number either.or.check
342 FUNCTION {format.number.series}
345 { series field.or.null }
346 { output.state mid.sentence =
350 number tie.or.space.connect
352 { "there's a number but no series in " cite$ * warning$ }
353 { " in " * series * }
362 FUNCTION {format.edition}
365 { output.state mid.sentence =
366 { edition "l" change.case$ " edition" * }
367 { edition "t" change.case$ " edition" * }
373 INTEGERS { multiresult }
375 FUNCTION {multi.page.check}
384 swap$ duplicate$ "," =
387 { #1 'multiresult := }
388 { t #2 global.max$ substring$ 't := }
395 FUNCTION {format.pages}
398 { pages multi.page.check
399 { "pages" pages n.dashify tie.or.space.connect }
400 { "page" pages tie.or.space.connect }
406 FUNCTION {format.vol.num.pages}
407 { volume field.or.null
410 { "(" number * ")" * *
412 { "there's a number but no volume in " cite$ * warning$ }
420 { pop$ format.pages }
421 { ":" * pages n.dashify * }
427 FUNCTION {format.chapter.pages}
432 { type "l" change.case$ }
434 chapter tie.or.space.connect
437 { ", " * format.pages * }
443 FUNCTION {format.in.ed.booktitle}
447 { "In " booktitle emphasize * }
448 { "In " format.editors * ", " * booktitle emphasize * }
454 FUNCTION {empty.misc.check}
455 { author empty$ title empty$ howpublished empty$
456 month empty$ year empty$ note empty$
459 { "all relevant fields are empty in " cite$ * warning$ }
464 FUNCTION {format.thesis.type}
468 type "t" change.case$
473 FUNCTION {format.tr.number}
475 { "Technical Report" }
480 { number tie.or.space.connect }
484 FUNCTION {format.article.crossref}
487 { "need key or journal for " cite$ * " to crossref " * crossref *
491 { "In {\em " journal * "\/}" * }
496 " \cite{" * crossref * "}" *
499 FUNCTION {format.crossref.editor}
500 { editor #1 "{vv~}{ll}" format.name$
501 editor num.names$ duplicate$
506 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
508 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
516 FUNCTION {format.book.crossref}
518 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
521 { "Volume" volume tie.or.space.connect
526 editor field.or.null author field.or.null =
530 { "need editor, key, or series for " cite$ * " to crossref " *
534 { "{\em " * series * "\/}" * }
540 { format.crossref.editor * }
542 " \cite{" * crossref * "}" *
545 FUNCTION {format.incoll.inproc.crossref}
547 editor field.or.null author field.or.null =
551 { "need editor, key, or booktitle for " cite$ * " to crossref " *
555 { "In {\em " booktitle * "\/}" * }
561 { "In " format.crossref.editor * }
563 " \cite{" * crossref * "}" *
568 format.authors "author" output.check
570 format.title "title" output.check
573 { journal emphasize "journal" output.check
574 format.vol.num.pages output
575 format.date "year" output.check
577 { format.article.crossref output.nonnull
589 { format.editors "author and editor" output.check }
590 { format.authors output.nonnull
592 { "author and editor" editor either.or.check }
598 format.btitle "title" output.check
600 { format.bvolume output
602 format.number.series output
604 publisher "publisher" output.check
608 format.book.crossref output.nonnull
611 format.edition output
612 format.date "year" output.check
620 format.authors output
622 format.title "title" output.check
623 howpublished address new.block.checkb
635 { format.editors "author and editor" output.check }
636 { format.authors output.nonnull
638 { "author and editor" editor either.or.check }
644 format.btitle "title" output.check
646 { format.bvolume output
647 format.chapter.pages "chapter and pages" output.check
649 format.number.series output
651 publisher "publisher" output.check
654 { format.chapter.pages "chapter and pages" output.check
656 format.book.crossref output.nonnull
659 format.edition output
660 format.date "year" output.check
666 FUNCTION {incollection}
668 format.authors "author" output.check
670 format.title "title" output.check
673 { format.in.ed.booktitle "booktitle" output.check
674 format.bvolume output
675 format.number.series output
676 format.chapter.pages output
678 publisher "publisher" output.check
680 format.edition output
681 format.date "year" output.check
683 { format.incoll.inproc.crossref output.nonnull
684 format.chapter.pages output
692 FUNCTION {inproceedings}
694 format.authors "author" output.check
696 format.title "title" output.check
699 { format.in.ed.booktitle "booktitle" output.check
700 format.bvolume output
701 format.number.series output
704 { organization publisher new.sentence.checkb
707 format.date "year" output.check
709 { address output.nonnull
710 format.date "year" output.check
717 { format.incoll.inproc.crossref output.nonnull
726 FUNCTION {conference} { inproceedings }
731 { organization empty$
733 { organization output.nonnull
738 { format.authors output.nonnull }
741 format.btitle "title" output.check
743 { organization empty$
744 { address new.block.checka
750 { organization address new.block.checkb
755 format.edition output
762 FUNCTION {mastersthesis}
764 format.authors "author" output.check
766 format.title "title" output.check
768 "Master's thesis" format.thesis.type output.nonnull
769 school "school" output.check
771 format.date "year" output.check
779 format.authors output
780 title howpublished new.block.checkb
782 howpublished new.block.checka
793 format.authors "author" output.check
795 format.btitle "title" output.check
797 "PhD thesis" format.thesis.type output.nonnull
798 school "school" output.check
800 format.date "year" output.check
806 FUNCTION {proceedings}
809 { organization output }
810 { format.editors output.nonnull }
813 format.btitle "title" output.check
814 format.bvolume output
815 format.number.series output
818 { publisher new.sentence.checka }
819 { organization publisher new.sentence.checkb
824 format.date "year" output.check
826 { address output.nonnull
827 format.date "year" output.check
831 { organization output }
841 FUNCTION {techreport}
843 format.authors "author" output.check
845 format.title "title" output.check
847 format.tr.number output.nonnull
848 institution "institution" output.check
850 format.date "year" output.check
856 FUNCTION {unpublished}
858 format.authors "author" output.check
860 format.title "title" output.check
862 note "note" output.check
867 FUNCTION {default.type} { misc }
869 MACRO {jan} {"January"}
871 MACRO {feb} {"February"}
873 MACRO {mar} {"March"}
875 MACRO {apr} {"April"}
883 MACRO {aug} {"August"}
885 MACRO {sep} {"September"}
887 MACRO {oct} {"October"}
889 MACRO {nov} {"November"}
891 MACRO {dec} {"December"}
893 MACRO {acmcs} {"ACM Computing Surveys"}
895 MACRO {acta} {"Acta Informatica"}
897 MACRO {cacm} {"Communications of the ACM"}
899 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
901 MACRO {ibmsj} {"IBM Systems Journal"}
903 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
905 MACRO {ieeetc} {"IEEE Transactions on Computers"}
908 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
910 MACRO {ipl} {"Information Processing Letters"}
912 MACRO {jacm} {"Journal of the ACM"}
914 MACRO {jcss} {"Journal of Computer and System Sciences"}
916 MACRO {scp} {"Science of Computer Programming"}
918 MACRO {sicomp} {"SIAM Journal on Computing"}
920 MACRO {tocs} {"ACM Transactions on Computer Systems"}
922 MACRO {tods} {"ACM Transactions on Database Systems"}
924 MACRO {tog} {"ACM Transactions on Graphics"}
926 MACRO {toms} {"ACM Transactions on Mathematical Software"}
928 MACRO {toois} {"ACM Transactions on Office Information Systems"}
930 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
932 MACRO {tcs} {"Theoretical Computer Science"}
946 s #1 len substring$ =
947 { s len #1 + global.max$ substring$ }
952 INTEGERS { et.al.char.used }
954 FUNCTION {initialize.et.al.char.used}
955 { #0 'et.al.char.used :=
958 EXECUTE {initialize.et.al.char.used}
960 FUNCTION {format.lab.names}
962 s num.names$ 'numnames :=
966 { numnames 'namesleft := }
972 { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
974 #1 'et.al.char.used :=
976 { s nameptr "{v{}}{l{}}" format.name$ * }
979 { s nameptr "{v{}}{l{}}" format.name$ * }
981 nameptr #1 + 'nameptr :=
982 namesleft #1 - 'namesleft :=
987 #1 'et.al.char.used :=
992 { s #1 "{v{}}{l{}}" format.name$
993 duplicate$ text.length$ #2 <
994 { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
1001 FUNCTION {author.key.label}
1004 { cite$ #1 #3 substring$ }
1005 { key #3 text.prefix$ }
1008 { author format.lab.names }
1012 FUNCTION {author.editor.key.label}
1016 { cite$ #1 #3 substring$ }
1017 { key #3 text.prefix$ }
1020 { editor format.lab.names }
1023 { author format.lab.names }
1027 FUNCTION {author.key.organization.label}
1030 { organization empty$
1031 { cite$ #1 #3 substring$ }
1032 { "The " #4 organization chop.word #3 text.prefix$ }
1035 { key #3 text.prefix$ }
1038 { author format.lab.names }
1042 FUNCTION {editor.key.organization.label}
1045 { organization empty$
1046 { cite$ #1 #3 substring$ }
1047 { "The " #4 organization chop.word #3 text.prefix$ }
1050 { key #3 text.prefix$ }
1053 { editor format.lab.names }
1057 FUNCTION {calc.label}
1061 'author.editor.key.label
1062 { type$ "proceedings" =
1063 'editor.key.organization.label
1065 'author.key.organization.label
1073 year field.or.null purify$ #-1 #2 substring$
1076 year field.or.null purify$ #-1 #4 substring$
1078 sortify 'sort.label :=
1081 FUNCTION {sort.format.names}
1085 s num.names$ 'numnames :=
1086 numnames 'namesleft :=
1092 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1093 nameptr numnames = t "others" = and
1097 nameptr #1 + 'nameptr :=
1098 namesleft #1 - 'namesleft :=
1103 FUNCTION {sort.format.title}
1107 "The " #4 t chop.word
1111 #1 global.max$ substring$
1114 FUNCTION {author.sort}
1117 { "to sort, need author or key in " cite$ * warning$
1123 { author sort.format.names }
1127 FUNCTION {author.editor.sort}
1131 { "to sort, need author, editor, or key in " cite$ * warning$
1137 { editor sort.format.names }
1140 { author sort.format.names }
1144 FUNCTION {author.organization.sort}
1146 { organization empty$
1148 { "to sort, need author, organization, or key in " cite$ * warning$
1154 { "The " #4 organization chop.word sortify }
1157 { author sort.format.names }
1161 FUNCTION {editor.organization.sort}
1163 { organization empty$
1165 { "to sort, need editor, organization, or key in " cite$ * warning$
1171 { "The " #4 organization chop.word sortify }
1174 { editor sort.format.names }
1187 { type$ "proceedings" =
1188 'editor.organization.sort
1190 'author.organization.sort
1200 year field.or.null sortify
1207 #1 entry.max$ substring$
1215 STRINGS { longest.label last.sort.label next.extra }
1217 INTEGERS { longest.label.width last.extra.num }
1219 FUNCTION {initialize.longest.label}
1220 { "" 'longest.label :=
1221 #0 int.to.chr$ 'last.sort.label :=
1223 #0 'longest.label.width :=
1224 #0 'last.extra.num :=
1227 FUNCTION {forward.pass}
1228 { last.sort.label sort.label =
1229 { last.extra.num #1 + 'last.extra.num :=
1230 last.extra.num int.to.chr$ 'extra.label :=
1232 { "a" chr.to.int$ 'last.extra.num :=
1234 sort.label 'last.sort.label :=
1239 FUNCTION {reverse.pass}
1241 { "a" 'extra.label := }
1244 label extra.label * 'label :=
1245 label width$ longest.label.width >
1246 { label 'longest.label :=
1247 label width$ 'longest.label.width :=
1251 extra.label 'next.extra :=
1254 EXECUTE {initialize.longest.label}
1256 ITERATE {forward.pass}
1258 REVERSE {reverse.pass}
1260 FUNCTION {begin.bib}
1262 { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
1265 "\makeatletter" write$ newline$
1266 "\@ifundefined{xbiblabel}{\newcommand{\xbiblabel}[4]{#4}}{}" write$ newline$
1267 "\let\@oldbiblabel\@biblabel" write$ newline$
1268 "\renewcommand{\@biblabel}[1]%" write$ newline$
1269 " {{\def\xbiblabel##1##2##3##4{\hyperref{##1}{##2}{##3}{##4}}%"
1271 " \@oldbiblabel{#1}}}" write$ newline$
1272 "\makeatother" write$ newline$
1277 { preamble$ write$ newline$ }
1279 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
1284 EXECUTE {init.state.consts}
1286 ITERATE {call.type$}
1290 "\end{thebibliography}" write$ newline$