1 % BibTeX bibliography style -- hacked version of the default 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.
10 % Hacked by Martin Mares
38 { label extra.label sort.label }
40 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
42 FUNCTION {init.state.consts}
51 FUNCTION {output.nonnull}
53 output.state mid.sentence =
55 { output.state after.block =
60 { output.state before.all =
62 { add.period$ " " * write$ }
66 mid.sentence 'output.state :=
79 FUNCTION {output.check}
82 { pop$ "empty " t * " in " * cite$ * warning$ }
87 FUNCTION {output.bibitem}
96 before.all 'output.state :=
106 { output.state before.all =
108 { after.block 'output.state := }
112 FUNCTION {new.sentence}
113 { output.state after.block =
115 { output.state before.all =
117 { after.sentence 'output.state := }
141 FUNCTION {new.block.checka}
148 FUNCTION {new.block.checkb}
157 FUNCTION {new.sentence.checka}
164 FUNCTION {new.sentence.checkb}
173 FUNCTION {field.or.null}
183 { "\em{" swap$ * "}" * }
187 INTEGERS { nameptr namesleft numnames }
189 FUNCTION {format.names}
192 s num.names$ 'numnames :=
193 numnames 'namesleft :=
195 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
212 nameptr #1 + 'nameptr :=
213 namesleft #1 - 'namesleft :=
218 FUNCTION {format.authors}
221 { author format.names }
225 FUNCTION {format.editors}
228 { editor format.names
229 editor num.names$ #1 >
237 FUNCTION {format.title}
240 { title "t" change.case$ }
248 { t #1 #1 substring$ "-" =
249 { t #1 #2 substring$ "--" = not
251 t #2 global.max$ substring$ 't :=
253 { { t #1 #1 substring$ "-" = }
255 t #2 global.max$ substring$ 't :=
261 { t #1 #1 substring$ *
262 t #2 global.max$ substring$ 't :=
269 FUNCTION {format.date}
273 { "there's a month but no year in " cite$ * warning$
280 { month " " * year * }
286 FUNCTION {format.btitle}
290 FUNCTION {tie.or.space.connect}
291 { duplicate$ text.length$ #3 <
298 FUNCTION {either.or.check}
301 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
305 FUNCTION {format.bvolume}
308 { "volume" volume tie.or.space.connect
311 { " of " * series emphasize * }
313 "volume and number" number either.or.check
318 FUNCTION {format.number.series}
321 { series field.or.null }
322 { output.state mid.sentence =
326 number tie.or.space.connect
328 { "there's a number but no series in " cite$ * warning$ }
329 { " in " * series * }
338 FUNCTION {format.edition}
341 { output.state mid.sentence =
342 { edition "l" change.case$ " edition" * }
343 { edition "t" change.case$ " edition" * }
349 INTEGERS { multiresult }
351 FUNCTION {multi.page.check}
360 swap$ duplicate$ "," =
363 { #1 'multiresult := }
364 { t #2 global.max$ substring$ 't := }
371 FUNCTION {format.pages}
374 { pages multi.page.check
375 { "pages" pages n.dashify tie.or.space.connect }
376 { "page" pages tie.or.space.connect }
382 FUNCTION {format.vol.num.pages}
383 { volume field.or.null
386 { "(" number * ")" * *
388 { "there's a number but no volume in " cite$ * warning$ }
396 { pop$ format.pages }
397 { ":" * pages n.dashify * }
403 FUNCTION {format.chapter.pages}
408 { type "l" change.case$ }
410 chapter tie.or.space.connect
413 { ", " * format.pages * }
419 FUNCTION {format.in.ed.booktitle}
423 { "In " booktitle emphasize * }
424 { "In " format.editors * ", " * booktitle emphasize * }
430 FUNCTION {empty.misc.check}
431 { author empty$ title empty$ howpublished empty$
432 month empty$ year empty$ note empty$
435 { "all relevant fields are empty in " cite$ * warning$ }
440 FUNCTION {format.thesis.type}
444 type "t" change.case$
449 FUNCTION {format.tr.number}
451 { "Technical Report" }
456 { number tie.or.space.connect }
460 FUNCTION {format.article.crossref}
463 { "need key or journal for " cite$ * " to crossref " * crossref *
467 { "In \em{" journal * "\/}" * }
472 " \cite{" * crossref * "}" *
475 FUNCTION {format.crossref.editor}
476 { editor #1 "{vv~}{ll}" format.name$
477 editor num.names$ duplicate$
482 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
484 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
492 FUNCTION {format.book.crossref}
494 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
497 { "Volume" volume tie.or.space.connect
502 editor field.or.null author field.or.null =
506 { "need editor, key, or series for " cite$ * " to crossref " *
510 { "\em{" * series * "\/}" * }
516 { format.crossref.editor * }
518 " \cite{" * crossref * "}" *
521 FUNCTION {format.incoll.inproc.crossref}
523 editor field.or.null author field.or.null =
527 { "need editor, key, or booktitle for " cite$ * " to crossref " *
531 { "In \em{" booktitle * "\/}" * }
537 { "In " format.crossref.editor * }
539 " \cite{" * crossref * "}" *
544 format.authors "author" output.check
546 format.title "title" output.check
549 { journal emphasize "journal" output.check
550 format.vol.num.pages output
551 publisher empty$ { } {
553 publisher "publisher" output.check
556 format.date "year" output.check
558 { format.article.crossref output.nonnull
570 { format.editors "author and editor" output.check }
571 { format.authors output.nonnull
573 { "author and editor" editor either.or.check }
579 format.btitle "title" output.check
581 { format.bvolume output
583 format.number.series output
585 publisher "publisher" output.check
589 format.book.crossref output.nonnull
592 format.edition output
593 format.date "year" output.check
601 format.authors output
603 format.title "title" output.check
604 howpublished address new.block.checkb
616 { format.editors "author and editor" output.check }
617 { format.authors output.nonnull
619 { "author and editor" editor either.or.check }
625 format.btitle "title" output.check
627 { format.bvolume output
628 format.chapter.pages "chapter and pages" output.check
630 format.number.series output
632 publisher "publisher" output.check
635 { format.chapter.pages "chapter and pages" output.check
637 format.book.crossref output.nonnull
640 format.edition output
641 format.date "year" output.check
647 FUNCTION {incollection}
649 format.authors "author" output.check
651 format.title "title" output.check
654 { format.in.ed.booktitle "booktitle" output.check
655 format.bvolume output
656 format.number.series output
657 format.chapter.pages output
659 publisher "publisher" output.check
661 format.edition output
662 format.date "year" output.check
664 { format.incoll.inproc.crossref output.nonnull
665 format.chapter.pages output
673 FUNCTION {inproceedings}
675 format.authors "author" output.check
677 format.title "title" output.check
680 { format.in.ed.booktitle "booktitle" output.check
681 format.bvolume output
682 format.number.series output
685 { organization publisher new.sentence.checkb
688 format.date "year" output.check
690 { address output.nonnull
691 format.date "year" output.check
698 { format.incoll.inproc.crossref output.nonnull
707 FUNCTION {conference} { inproceedings }
712 { organization empty$
714 { organization output.nonnull
719 { format.authors output.nonnull }
722 format.btitle "title" output.check
724 { organization empty$
725 { address new.block.checka
731 { organization address new.block.checkb
736 format.edition output
743 FUNCTION {mastersthesis}
745 format.authors "author" output.check
747 format.title "title" output.check
749 "Master's thesis" format.thesis.type output.nonnull
750 school "school" output.check
752 format.date "year" output.check
760 format.authors output
761 title howpublished new.block.checkb
763 howpublished new.block.checka
774 format.authors "author" output.check
776 format.btitle "title" output.check
778 "PhD thesis" format.thesis.type output.nonnull
779 school "school" output.check
781 format.date "year" output.check
787 FUNCTION {proceedings}
790 { organization output }
791 { format.editors output.nonnull }
794 format.btitle "title" output.check
795 format.bvolume output
796 format.number.series output
799 { publisher new.sentence.checka }
800 { organization publisher new.sentence.checkb
805 format.date "year" output.check
807 { address output.nonnull
808 format.date "year" output.check
812 { organization output }
822 FUNCTION {techreport}
824 format.authors "author" output.check
826 format.title "title" output.check
828 format.tr.number output.nonnull
829 institution "institution" output.check
831 format.date "year" output.check
837 FUNCTION {unpublished}
839 format.authors "author" output.check
841 format.title "title" output.check
843 note "note" output.check
845 note "seeurl" output.check
851 format.authors "author" output.check
853 format.title "title" output.check
855 note "note" output.check
857 "{\it " url * "}" * output
861 FUNCTION {default.type} { misc }
863 MACRO {jan} {"January"}
865 MACRO {feb} {"February"}
867 MACRO {mar} {"March"}
869 MACRO {apr} {"April"}
877 MACRO {aug} {"August"}
879 MACRO {sep} {"September"}
881 MACRO {oct} {"October"}
883 MACRO {nov} {"November"}
885 MACRO {dec} {"December"}
887 MACRO {acmcs} {"ACM Computing Surveys"}
889 MACRO {acta} {"Acta Informatica"}
891 MACRO {cacm} {"Communications of the ACM"}
893 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
895 MACRO {ibmsj} {"IBM Systems Journal"}
897 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
899 MACRO {ieeetc} {"IEEE Transactions on Computers"}
902 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
904 MACRO {ipl} {"Information Processing Letters"}
906 MACRO {jacm} {"Journal of the ACM"}
908 MACRO {jcss} {"Journal of Computer and System Sciences"}
910 MACRO {scp} {"Science of Computer Programming"}
912 MACRO {sicomp} {"SIAM Journal on Computing"}
914 MACRO {tocs} {"ACM Transactions on Computer Systems"}
916 MACRO {tods} {"ACM Transactions on Database Systems"}
918 MACRO {tog} {"ACM Transactions on Graphics"}
920 MACRO {toms} {"ACM Transactions on Mathematical Software"}
922 MACRO {toois} {"ACM Transactions on Office Information Systems"}
924 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
926 MACRO {tcs} {"Theoretical Computer Science"}
940 s #1 len substring$ =
941 { s len #1 + global.max$ substring$ }
946 INTEGERS { et.al.char.used }
948 FUNCTION {initialize.et.al.char.used}
949 { #0 'et.al.char.used :=
952 EXECUTE {initialize.et.al.char.used}
954 FUNCTION {format.lab.names}
956 s num.names$ 'numnames :=
960 { numnames 'namesleft := }
966 { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
968 #1 'et.al.char.used :=
970 { s nameptr "{v{}}{l{}}" format.name$ * }
973 { s nameptr "{v{}}{l{}}" format.name$ * }
975 nameptr #1 + 'nameptr :=
976 namesleft #1 - 'namesleft :=
981 #1 'et.al.char.used :=
986 { s #1 "{v{}}{l{}}" format.name$
987 duplicate$ text.length$ #2 <
988 { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
995 FUNCTION {author.key.label}
998 { cite$ #1 #3 substring$ }
999 { key #3 text.prefix$ }
1002 { author format.lab.names }
1006 FUNCTION {author.editor.key.label}
1010 { cite$ #1 #3 substring$ }
1011 { key #3 text.prefix$ }
1014 { editor format.lab.names }
1017 { author format.lab.names }
1021 FUNCTION {author.key.organization.label}
1024 { organization empty$
1025 { cite$ #1 #3 substring$ }
1026 { "The " #4 organization chop.word #3 text.prefix$ }
1029 { key #3 text.prefix$ }
1032 { author format.lab.names }
1036 FUNCTION {editor.key.organization.label}
1039 { organization empty$
1040 { cite$ #1 #3 substring$ }
1041 { "The " #4 organization chop.word #3 text.prefix$ }
1044 { key #3 text.prefix$ }
1047 { editor format.lab.names }
1051 FUNCTION {calc.label}
1055 'author.editor.key.label
1056 { type$ "proceedings" =
1057 'editor.key.organization.label
1059 'author.key.organization.label
1067 year field.or.null purify$ #-1 #2 substring$
1070 year field.or.null purify$ #-1 #4 substring$
1072 sortify 'sort.label :=
1075 FUNCTION {sort.format.names}
1079 s num.names$ 'numnames :=
1080 numnames 'namesleft :=
1086 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1087 nameptr numnames = t "others" = and
1091 nameptr #1 + 'nameptr :=
1092 namesleft #1 - 'namesleft :=
1097 FUNCTION {sort.format.title}
1101 "The " #4 t chop.word
1105 #1 global.max$ substring$
1108 FUNCTION {author.sort}
1111 { "to sort, need author or key in " cite$ * warning$
1117 { author sort.format.names }
1121 FUNCTION {author.editor.sort}
1125 { "to sort, need author, editor, or key in " cite$ * warning$
1131 { editor sort.format.names }
1134 { author sort.format.names }
1138 FUNCTION {author.organization.sort}
1140 { organization empty$
1142 { "to sort, need author, organization, or key in " cite$ * warning$
1148 { "The " #4 organization chop.word sortify }
1151 { author sort.format.names }
1155 FUNCTION {editor.organization.sort}
1157 { organization empty$
1159 { "to sort, need editor, organization, or key in " cite$ * warning$
1165 { "The " #4 organization chop.word sortify }
1168 { editor sort.format.names }
1181 { type$ "proceedings" =
1182 'editor.organization.sort
1184 'author.organization.sort
1194 year field.or.null sortify
1201 #1 entry.max$ substring$
1209 STRINGS { longest.label last.sort.label next.extra }
1211 INTEGERS { longest.label.width last.extra.num }
1213 FUNCTION {initialize.longest.label}
1214 { "" 'longest.label :=
1215 #0 int.to.chr$ 'last.sort.label :=
1217 #0 'longest.label.width :=
1218 #0 'last.extra.num :=
1221 FUNCTION {forward.pass}
1222 { last.sort.label sort.label =
1223 { last.extra.num #1 + 'last.extra.num :=
1224 last.extra.num int.to.chr$ 'extra.label :=
1226 { "a" chr.to.int$ 'last.extra.num :=
1228 sort.label 'last.sort.label :=
1233 FUNCTION {reverse.pass}
1235 { "a" 'extra.label := }
1238 label extra.label * 'label :=
1239 label width$ longest.label.width >
1240 { label 'longest.label :=
1241 label width$ 'longest.label.width :=
1245 extra.label 'next.extra :=
1248 EXECUTE {initialize.longest.label}
1250 ITERATE {forward.pass}
1252 REVERSE {reverse.pass}
1254 FUNCTION {begin.bib}
1256 { "\newcommand{\etalchar}[1]{$^{#1}$}" write$ newline$ }
1261 { preamble$ write$ newline$ }
1263 "\begin{thebibliography}{" longest.label * "}" * write$ newline$
1268 EXECUTE {init.state.consts}
1270 ITERATE {call.type$}
1274 "\end{thebibliography}" write$ newline$