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 :=
81 FUNCTION {output.check}
84 { pop$ "empty " t * " in " * cite$ * warning$ }
89 FUNCTION {output.bibitem}
94 { "\xbiblabel{" write$
108 before.all 'output.state :=
118 { output.state before.all =
120 { after.block 'output.state := }
124 FUNCTION {new.sentence}
125 { output.state after.block =
127 { output.state before.all =
129 { after.sentence 'output.state := }
153 FUNCTION {new.block.checka}
160 FUNCTION {new.block.checkb}
169 FUNCTION {new.sentence.checka}
176 FUNCTION {new.sentence.checkb}
185 FUNCTION {field.or.null}
195 { "{\em " swap$ * "}" * }
199 INTEGERS { nameptr namesleft numnames }
201 FUNCTION {format.names}
204 s num.names$ 'numnames :=
205 numnames 'namesleft :=
207 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
224 nameptr #1 + 'nameptr :=
225 namesleft #1 - 'namesleft :=
230 FUNCTION {format.authors}
233 { author format.names }
237 FUNCTION {format.editors}
240 { editor format.names
241 editor num.names$ #1 >
249 FUNCTION {format.title}
252 { title "t" change.case$ }
260 { t #1 #1 substring$ "-" =
261 { t #1 #2 substring$ "--" = not
263 t #2 global.max$ substring$ 't :=
265 { { t #1 #1 substring$ "-" = }
267 t #2 global.max$ substring$ 't :=
273 { t #1 #1 substring$ *
274 t #2 global.max$ substring$ 't :=
281 FUNCTION {format.date}
285 { "there's a month but no year in " cite$ * warning$
292 { month " " * year * }
298 FUNCTION {format.btitle}
302 FUNCTION {tie.or.space.connect}
303 { duplicate$ text.length$ #3 <
310 FUNCTION {either.or.check}
313 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
317 FUNCTION {format.bvolume}
320 { "volume" volume tie.or.space.connect
323 { " of " * series emphasize * }
325 "volume and number" number either.or.check
330 FUNCTION {format.number.series}
333 { series field.or.null }
334 { output.state mid.sentence =
338 number tie.or.space.connect
340 { "there's a number but no series in " cite$ * warning$ }
341 { " in " * series * }
350 FUNCTION {format.edition}
353 { output.state mid.sentence =
354 { edition "l" change.case$ " edition" * }
355 { edition "t" change.case$ " edition" * }
361 INTEGERS { multiresult }
363 FUNCTION {multi.page.check}
372 swap$ duplicate$ "," =
375 { #1 'multiresult := }
376 { t #2 global.max$ substring$ 't := }
383 FUNCTION {format.pages}
386 { pages multi.page.check
387 { "pages" pages n.dashify tie.or.space.connect }
388 { "page" pages tie.or.space.connect }
394 FUNCTION {format.vol.num.pages}
395 { volume field.or.null
398 { "(" number * ")" * *
400 { "there's a number but no volume in " cite$ * warning$ }
408 { pop$ format.pages }
409 { ":" * pages n.dashify * }
415 FUNCTION {format.chapter.pages}
420 { type "l" change.case$ }
422 chapter tie.or.space.connect
425 { ", " * format.pages * }
431 FUNCTION {format.in.ed.booktitle}
435 { "In " booktitle emphasize * }
436 { "In " format.editors * ", " * booktitle emphasize * }
442 FUNCTION {empty.misc.check}
443 { author empty$ title empty$ howpublished empty$
444 month empty$ year empty$ note empty$
447 { "all relevant fields are empty in " cite$ * warning$ }
452 FUNCTION {format.thesis.type}
456 type "t" change.case$
461 FUNCTION {format.tr.number}
463 { "Technical Report" }
468 { number tie.or.space.connect }
472 FUNCTION {format.article.crossref}
475 { "need key or journal for " cite$ * " to crossref " * crossref *
479 { "In {\em " journal * "\/}" * }
484 " \cite{" * crossref * "}" *
487 FUNCTION {format.crossref.editor}
488 { editor #1 "{vv~}{ll}" format.name$
489 editor num.names$ duplicate$
494 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
496 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
504 FUNCTION {format.book.crossref}
506 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
509 { "Volume" volume tie.or.space.connect
514 editor field.or.null author field.or.null =
518 { "need editor, key, or series for " cite$ * " to crossref " *
522 { "{\em " * series * "\/}" * }
528 { format.crossref.editor * }
530 " \cite{" * crossref * "}" *
533 FUNCTION {format.incoll.inproc.crossref}
535 editor field.or.null author field.or.null =
539 { "need editor, key, or booktitle for " cite$ * " to crossref " *
543 { "In {\em " booktitle * "\/}" * }
549 { "In " format.crossref.editor * }
551 " \cite{" * crossref * "}" *
556 format.authors "author" output.check
558 format.title "title" output.check
561 { journal emphasize "journal" output.check
562 format.vol.num.pages output
563 format.date "year" output.check
565 { format.article.crossref output.nonnull
577 { format.editors "author and editor" output.check }
578 { format.authors output.nonnull
580 { "author and editor" editor either.or.check }
586 format.btitle "title" output.check
588 { format.bvolume output
590 format.number.series output
592 publisher "publisher" output.check
596 format.book.crossref output.nonnull
599 format.edition output
600 format.date "year" output.check
608 format.authors output
610 format.title "title" output.check
611 howpublished address new.block.checkb
623 { format.editors "author and editor" output.check }
624 { format.authors output.nonnull
626 { "author and editor" editor either.or.check }
632 format.btitle "title" output.check
634 { format.bvolume output
635 format.chapter.pages "chapter and pages" output.check
637 format.number.series output
639 publisher "publisher" output.check
642 { format.chapter.pages "chapter and pages" output.check
644 format.book.crossref output.nonnull
647 format.edition output
648 format.date "year" output.check
654 FUNCTION {incollection}
656 format.authors "author" output.check
658 format.title "title" output.check
661 { format.in.ed.booktitle "booktitle" output.check
662 format.bvolume output
663 format.number.series output
664 format.chapter.pages output
666 publisher "publisher" output.check
668 format.edition output
669 format.date "year" output.check
671 { format.incoll.inproc.crossref output.nonnull
672 format.chapter.pages output
680 FUNCTION {inproceedings}
682 format.authors "author" output.check
684 format.title "title" output.check
687 { format.in.ed.booktitle "booktitle" output.check
688 format.bvolume output
689 format.number.series output
692 { organization publisher new.sentence.checkb
695 format.date "year" output.check
697 { address output.nonnull
698 format.date "year" output.check
705 { format.incoll.inproc.crossref output.nonnull
714 FUNCTION {conference} { inproceedings }
719 { organization empty$
721 { organization output.nonnull
726 { format.authors output.nonnull }
729 format.btitle "title" output.check
731 { organization empty$
732 { address new.block.checka
738 { organization address new.block.checkb
743 format.edition output
750 FUNCTION {mastersthesis}
752 format.authors "author" output.check
754 format.title "title" output.check
756 "Master's thesis" format.thesis.type output.nonnull
757 school "school" output.check
759 format.date "year" output.check
767 format.authors output
768 title howpublished new.block.checkb
770 howpublished new.block.checka
781 format.authors "author" output.check
783 format.btitle "title" output.check
785 "PhD thesis" format.thesis.type output.nonnull
786 school "school" output.check
788 format.date "year" output.check
794 FUNCTION {proceedings}
797 { organization output }
798 { format.editors output.nonnull }
801 format.btitle "title" output.check
802 format.bvolume output
803 format.number.series output
806 { publisher new.sentence.checka }
807 { organization publisher new.sentence.checkb
812 format.date "year" output.check
814 { address output.nonnull
815 format.date "year" output.check
819 { organization output }
829 FUNCTION {techreport}
831 format.authors "author" output.check
833 format.title "title" output.check
835 format.tr.number output.nonnull
836 institution "institution" output.check
838 format.date "year" output.check
844 FUNCTION {unpublished}
846 format.authors "author" output.check
848 format.title "title" output.check
850 note "note" output.check
855 FUNCTION {default.type} { misc }
857 MACRO {jan} {"January"}
859 MACRO {feb} {"February"}
861 MACRO {mar} {"March"}
863 MACRO {apr} {"April"}
871 MACRO {aug} {"August"}
873 MACRO {sep} {"September"}
875 MACRO {oct} {"October"}
877 MACRO {nov} {"November"}
879 MACRO {dec} {"December"}
881 MACRO {acmcs} {"ACM Computing Surveys"}
883 MACRO {acta} {"Acta Informatica"}
885 MACRO {cacm} {"Communications of the ACM"}
887 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
889 MACRO {ibmsj} {"IBM Systems Journal"}
891 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
893 MACRO {ieeetc} {"IEEE Transactions on Computers"}
896 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
898 MACRO {ipl} {"Information Processing Letters"}
900 MACRO {jacm} {"Journal of the ACM"}
902 MACRO {jcss} {"Journal of Computer and System Sciences"}
904 MACRO {scp} {"Science of Computer Programming"}
906 MACRO {sicomp} {"SIAM Journal on Computing"}
908 MACRO {tocs} {"ACM Transactions on Computer Systems"}
910 MACRO {tods} {"ACM Transactions on Database Systems"}
912 MACRO {tog} {"ACM Transactions on Graphics"}
914 MACRO {toms} {"ACM Transactions on Mathematical Software"}
916 MACRO {toois} {"ACM Transactions on Office Information Systems"}
918 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
920 MACRO {tcs} {"Theoretical Computer Science"}
934 s #1 len substring$ =
935 { s len #1 + global.max$ substring$ }
940 INTEGERS { et.al.char.used }
942 FUNCTION {initialize.et.al.char.used}
943 { #0 'et.al.char.used :=
946 EXECUTE {initialize.et.al.char.used}
948 FUNCTION {format.lab.names}
950 s num.names$ 'numnames :=
954 { numnames 'namesleft := }
960 { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
962 #1 'et.al.char.used :=
964 { s nameptr "{v{}}{l{}}" format.name$ * }
967 { s nameptr "{v{}}{l{}}" format.name$ * }
969 nameptr #1 + 'nameptr :=
970 namesleft #1 - 'namesleft :=
975 #1 'et.al.char.used :=
980 { s #1 "{v{}}{l{}}" format.name$
981 duplicate$ text.length$ #2 <
982 { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
989 FUNCTION {author.key.label}
992 { cite$ #1 #3 substring$ }
993 { key #3 text.prefix$ }
996 { author format.lab.names }
1000 FUNCTION {author.editor.key.label}
1004 { cite$ #1 #3 substring$ }
1005 { key #3 text.prefix$ }
1008 { editor format.lab.names }
1011 { author format.lab.names }
1015 FUNCTION {author.key.organization.label}
1018 { organization empty$
1019 { cite$ #1 #3 substring$ }
1020 { "The " #4 organization chop.word #3 text.prefix$ }
1023 { key #3 text.prefix$ }
1026 { author format.lab.names }
1030 FUNCTION {editor.key.organization.label}
1033 { organization empty$
1034 { cite$ #1 #3 substring$ }
1035 { "The " #4 organization chop.word #3 text.prefix$ }
1038 { key #3 text.prefix$ }
1041 { editor format.lab.names }
1045 FUNCTION {calc.label}
1049 'author.editor.key.label
1050 { type$ "proceedings" =
1051 'editor.key.organization.label
1053 'author.key.organization.label
1061 year field.or.null purify$ #-1 #2 substring$
1064 year field.or.null purify$ #-1 #4 substring$
1066 sortify 'sort.label :=
1069 FUNCTION {sort.format.names}
1073 s num.names$ 'numnames :=
1074 numnames 'namesleft :=
1080 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1081 nameptr numnames = t "others" = and
1085 nameptr #1 + 'nameptr :=
1086 namesleft #1 - 'namesleft :=
1091 FUNCTION {sort.format.title}
1095 "The " #4 t chop.word
1099 #1 global.max$ substring$
1102 FUNCTION {author.sort}
1105 { "to sort, need author or key in " cite$ * warning$
1111 { author sort.format.names }
1115 FUNCTION {author.editor.sort}
1119 { "to sort, need author, editor, or key in " cite$ * warning$
1125 { editor sort.format.names }
1128 { author sort.format.names }
1132 FUNCTION {author.organization.sort}
1134 { organization empty$
1136 { "to sort, need author, organization, or key in " cite$ * warning$
1142 { "The " #4 organization chop.word sortify }
1145 { author sort.format.names }
1149 FUNCTION {editor.organization.sort}
1151 { organization empty$
1153 { "to sort, need editor, organization, or key in " cite$ * warning$
1159 { "The " #4 organization chop.word sortify }
1162 { editor sort.format.names }
1175 { type$ "proceedings" =
1176 'editor.organization.sort
1178 'author.organization.sort
1188 year field.or.null sortify
1195 #1 entry.max$ substring$
1203 STRINGS { longest.label last.sort.label next.extra }
1205 INTEGERS { longest.label.width last.extra.num }
1207 FUNCTION {initialize.longest.label}
1208 { "" 'longest.label :=
1209 #0 int.to.chr$ 'last.sort.label :=
1211 #0 'longest.label.width :=
1212 #0 'last.extra.num :=
1215 FUNCTION {forward.pass}
1216 { last.sort.label sort.label =
1217 { last.extra.num #1 + 'last.extra.num :=
1218 last.extra.num int.to.chr$ 'extra.label :=
1220 { "a" chr.to.int$ 'last.extra.num :=
1222 sort.label 'last.sort.label :=
1227 FUNCTION {reverse.pass}
1229 { "a" 'extra.label := }
1232 label extra.label * 'label :=
1233 label width$ longest.label.width >
1234 { label 'longest.label :=
1235 label width$ 'longest.label.width :=
1239 extra.label 'next.extra :=
1242 EXECUTE {initialize.longest.label}
1244 ITERATE {forward.pass}
1246 REVERSE {reverse.pass}
1248 FUNCTION {begin.bib}
1250 { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
1253 "\makeatletter" write$ newline$
1254 "\@ifundefined{xbiblabel}{\newcommand{\xbiblabel}[4]{#4}}{}" write$ newline$
1255 "\let\@oldbiblabel\@biblabel" write$ newline$
1256 "\renewcommand{\@biblabel}[1]%" write$ newline$
1257 " {{\def\xbiblabel##1##2##3##4{\hyperref{##1}{##2}{##3}{##4}}%"
1259 " \@oldbiblabel{#1}}}" write$ newline$
1260 "\makeatother" write$ newline$
1265 { preamble$ write$ newline$ }
1267 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
1272 EXECUTE {init.state.consts}
1274 ITERATE {call.type$}
1278 "\end{thebibliography}" write$ newline$