1 % BibTeX bibliography style `html-long'
2 % spits out HTML-formatted bibliography in place of bbl output
3 % by David Kotz dfk@cs.dartmouth.edu
4 % $Id: html-long.bst,v 1.4 2005/07/21 21:29:50 hjunes Exp $
6 % BibTeX standard bibliography style `alpha'
7 % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
8 % Copyright (C) 1985, all rights reserved.
9 % Copying of this file is authorized only if either
10 % (1) you make absolutely no changes to your copy, including name, or
11 % (2) if you do make changes, you name it something other than
12 % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
13 % This restriction helps ensure that all standard styles are identical.
14 % The file btxbst.doc has the documentation for this style.
16 % DFK added abstract, comment, earlier, keyword, later, URL
49 { label extra.label sort.label }
51 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
53 FUNCTION {init.state.consts}
62 FUNCTION {output.nonnull}
64 output.state mid.sentence =
66 { output.state after.block =
70 { output.state before.all =
72 { add.period$ " " * write$ }
76 mid.sentence 'output.state :=
89 FUNCTION {output.check}
92 { pop$ "empty " t * " in " * cite$ * warning$ }
97 % DFK changed to use cite$ for the label
98 % DFK changed to HTML, and use URL to make cite key a link
99 FUNCTION {output.bibitem}
102 { "<DT> <A NAME=" quote$ * cite$ * quote$ *
103 "> " * cite$ * ":</A> </DT>" * write$
105 { "<DT><A NAME=" quote$ * cite$ * quote$ * " HREF=" * quote$ *
106 URL * quote$ * "> " * cite$ * ":</A></DT>" * write$
110 "<DD>" write$ newline$
112 before.all 'output.state :=
115 % DFK changed to HTML
122 { "<br>" write$ newline$
123 "See also earlier version <A HREF=" quote$ * "#" * earlier * quote$ *
124 ">" * earlier * "</A>." * write$ newline$
129 { "<br>" write$ newline$
130 "See also later version <A HREF=" quote$ * "#" * later * quote$ *
131 ">" * later * "</A>." * write$ newline$
134 "</DD>" write$ newline$
138 { output.state before.all =
140 { after.block 'output.state := }
144 FUNCTION {new.sentence}
145 { output.state after.block =
147 { output.state before.all =
149 { after.sentence 'output.state := }
173 FUNCTION {new.block.checka}
180 FUNCTION {new.block.checkb}
189 FUNCTION {new.sentence.checka}
196 FUNCTION {new.sentence.checkb}
205 FUNCTION {field.or.null}
212 % DFK changed to HTML
216 { "<EM>" swap$ * "</EM>" * }
220 % DFK added for HTML strong emphasis
224 { "<STRONG>" swap$ * "</STRONG>" * }
228 INTEGERS { nameptr namesleft numnames }
230 % DFK added this, to strip {} and ~ from titles and authors
231 % It's not a great idea, because it will screw up in math mode and some
232 % special characters... but it makes most things much prettier.
233 FUNCTION {author.title.purify}
237 { t #1 #1 substring$ "{" =
238 t #1 #1 substring$ "}" = or
240 { t #1 #1 substring$ "~" =
242 { t #1 #1 substring$ * }
246 t #2 global.max$ substring$ 't :=
251 FUNCTION {format.names}
254 s num.names$ 'numnames :=
255 numnames 'namesleft :=
257 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
274 nameptr #1 + 'nameptr :=
275 namesleft #1 - 'namesleft :=
280 FUNCTION {format.authors}
283 { author format.names author.title.purify }
287 FUNCTION {format.editors}
290 { editor format.names
291 editor num.names$ #1 >
299 % DFK added strong, so it will be bold.
300 FUNCTION {format.title}
303 { title "t" change.case$ author.title.purify strong }
311 { t #1 #1 substring$ "-" =
312 { t #1 #2 substring$ "--" = not
314 t #2 global.max$ substring$ 't :=
316 { { t #1 #1 substring$ "-" = }
318 t #2 global.max$ substring$ 't :=
324 { t #1 #1 substring$ *
325 t #2 global.max$ substring$ 't :=
332 FUNCTION {format.date}
336 { "there's a month but no year in " cite$ * warning$
343 { month " " * year * }
349 % DFK changed emphasize to strong
350 FUNCTION {format.btitle}
351 { title author.title.purify strong
354 FUNCTION {tie.or.space.connect}
355 { duplicate$ text.length$ #3 <
362 FUNCTION {either.or.check}
365 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
369 FUNCTION {format.bvolume}
372 { "volume" volume tie.or.space.connect
375 { " of " * series emphasize * }
377 "volume and number" number either.or.check
382 FUNCTION {format.number.series}
385 { series field.or.null }
386 { output.state mid.sentence =
390 number tie.or.space.connect
392 { "there's a number but no series in " cite$ * warning$ }
393 { " in " * series * }
402 FUNCTION {format.edition}
405 { output.state mid.sentence =
406 { edition "l" change.case$ " edition" * }
407 { edition "t" change.case$ " edition" * }
413 INTEGERS { multiresult }
415 FUNCTION {multi.page.check}
424 swap$ duplicate$ "," =
427 { #1 'multiresult := }
428 { t #2 global.max$ substring$ 't := }
435 FUNCTION {format.pages}
438 { pages multi.page.check
439 { "pages" pages n.dashify tie.or.space.connect }
440 { "page" pages tie.or.space.connect }
446 FUNCTION {format.vol.num.pages}
447 { volume field.or.null
450 { "(" number * ")" * *
452 { "there's a number but no volume in " cite$ * warning$ }
460 { pop$ format.pages }
461 { ":" * pages n.dashify * }
467 FUNCTION {format.chapter.pages}
472 { type "l" change.case$ }
474 chapter tie.or.space.connect
477 { ", " * format.pages * }
483 FUNCTION {format.in.ed.booktitle}
487 { "In " booktitle emphasize * }
488 { "In " format.editors * ", " * booktitle emphasize * }
494 FUNCTION {empty.misc.check}
495 { author empty$ title empty$ howpublished empty$
496 month empty$ year empty$ note empty$
499 { "all relevant fields are empty in " cite$ * warning$ }
504 FUNCTION {format.thesis.type}
508 type "t" change.case$
513 FUNCTION {format.tr.number}
515 { "Technical Report" }
520 { number tie.or.space.connect }
524 FUNCTION {format.article.crossref}
527 { "need key or journal for " cite$ * " to crossref " * crossref *
531 { "In {\em " journal * "\/}" * }
536 " \cite{" * crossref * "}" *
539 FUNCTION {format.crossref.editor}
540 { editor #1 "{vv~}{ll}" format.name$
541 editor num.names$ duplicate$
543 { pop$ " et al." * }
546 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
548 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
556 FUNCTION {format.book.crossref}
558 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
561 { "Volume" volume tie.or.space.connect
566 editor field.or.null author field.or.null =
570 { "need editor, key, or series for " cite$ * " to crossref " *
574 { "{\em " * series * "\/}" * }
580 { format.crossref.editor * }
582 " \cite{" * crossref * "}" *
585 FUNCTION {format.incoll.inproc.crossref}
587 editor field.or.null author field.or.null =
591 { "need editor, key, or booktitle for " cite$ * " to crossref " *
595 { "In {\em " booktitle * "\/}" * }
601 { "In " format.crossref.editor * }
603 " \cite{" * crossref * "}" *
608 % top of stack is the string we want to be a quoted paragraph
609 FUNCTION {format.quotedParagraph}
612 { "<P><QUOTE> " swap$ * " </QUOTE></P>" *}
617 % DFK added, to support comment, private, keyword, etc
618 % next-to-top is field name (eg, "Comment")
619 % top is field value (eg, value of comment)
620 % both are popped; resulting top is either empty,
621 % or string describing field
622 FUNCTION {format.dfkfield}
626 "<strong> " swap$ * ":</strong> " * swap$ * }
633 "Abstract" abstract format.dfkfield format.quotedParagraph write$ newline$
634 "Keyword" keyword format.dfkfield format.quotedParagraph write$ newline$
635 "Comment" comment format.dfkfield format.quotedParagraph write$ newline$
638 % DFK: added a call to dfk.stuff in all entry-type functions below
642 format.authors "author" output.check
644 format.title "title" output.check
647 { journal emphasize "journal" output.check
648 format.vol.num.pages output
649 format.date "year" output.check
651 { format.article.crossref output.nonnull
664 { format.editors "author and editor" output.check }
665 { format.authors output.nonnull
667 { "author and editor" editor either.or.check }
673 format.btitle "title" output.check
675 { format.bvolume output
677 format.number.series output
679 publisher "publisher" output.check
683 format.book.crossref output.nonnull
686 format.edition output
687 format.date "year" output.check
696 format.authors output
698 format.title "title" output.check
699 howpublished address new.block.checkb
712 { format.editors "author and editor" output.check }
713 { format.authors output.nonnull
715 { "author and editor" editor either.or.check }
721 format.btitle "title" output.check
723 { format.bvolume output
724 format.chapter.pages "chapter and pages" output.check
726 format.number.series output
728 publisher "publisher" output.check
731 { format.chapter.pages "chapter and pages" output.check
733 format.book.crossref output.nonnull
736 format.edition output
737 format.date "year" output.check
744 FUNCTION {incollection}
746 format.authors "author" output.check
748 format.title "title" output.check
751 { format.in.ed.booktitle "booktitle" output.check
752 format.bvolume output
753 format.number.series output
754 format.chapter.pages output
756 publisher "publisher" output.check
758 format.edition output
759 format.date "year" output.check
761 { format.incoll.inproc.crossref output.nonnull
762 format.chapter.pages output
771 FUNCTION {inproceedings}
773 format.authors "author" output.check
775 format.title "title" output.check
778 { format.in.ed.booktitle "booktitle" output.check
779 format.bvolume output
780 format.number.series output
783 { organization publisher new.sentence.checkb
786 format.date "year" output.check
788 { address output.nonnull
789 format.date "year" output.check
796 { format.incoll.inproc.crossref output.nonnull
806 FUNCTION {conference} { inproceedings }
811 { organization empty$
813 { organization output.nonnull
818 { format.authors output.nonnull }
821 format.btitle "title" output.check
823 { organization empty$
824 { address new.block.checka
830 { organization address new.block.checkb
835 format.edition output
843 FUNCTION {mastersthesis}
845 format.authors "author" output.check
847 format.title "title" output.check
849 "Master's thesis" format.thesis.type output.nonnull
850 school "school" output.check
852 format.date "year" output.check
861 format.authors output
862 title howpublished new.block.checkb
864 howpublished new.block.checka
876 format.authors "author" output.check
878 format.btitle "title" output.check
880 "PhD thesis" format.thesis.type output.nonnull
881 school "school" output.check
883 format.date "year" output.check
890 FUNCTION {proceedings}
893 { organization output }
894 { format.editors output.nonnull }
897 format.btitle "title" output.check
898 format.bvolume output
899 format.number.series output
902 { publisher new.sentence.checka }
903 { organization publisher new.sentence.checkb
908 format.date "year" output.check
910 { address output.nonnull
911 format.date "year" output.check
915 { organization output }
926 FUNCTION {techreport}
928 format.authors "author" output.check
930 format.title "title" output.check
932 format.tr.number output.nonnull
933 institution "institution" output.check
935 format.date "year" output.check
942 FUNCTION {unpublished}
944 format.authors "author" output.check
946 format.title "title" output.check
948 note "note" output.check
954 FUNCTION {default.type} { misc }
956 MACRO {jan} {"January"}
958 MACRO {feb} {"February"}
960 MACRO {mar} {"March"}
962 MACRO {apr} {"April"}
970 MACRO {aug} {"August"}
972 MACRO {sep} {"September"}
974 MACRO {oct} {"October"}
976 MACRO {nov} {"November"}
978 MACRO {dec} {"December"}
980 MACRO {acmcs} {"ACM Computing Surveys"}
982 MACRO {acta} {"Acta Informatica"}
984 MACRO {cacm} {"Communications of the ACM"}
986 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
988 MACRO {ibmsj} {"IBM Systems Journal"}
990 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
992 MACRO {ieeetc} {"IEEE Transactions on Computers"}
995 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
997 MACRO {ipl} {"Information Processing Letters"}
999 MACRO {jacm} {"Journal of the ACM"}
1001 MACRO {jcss} {"Journal of Computer and System Sciences"}
1003 MACRO {scp} {"Science of Computer Programming"}
1005 MACRO {sicomp} {"SIAM Journal on Computing"}
1007 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1009 MACRO {tods} {"ACM Transactions on Database Systems"}
1011 MACRO {tog} {"ACM Transactions on Graphics"}
1013 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1015 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1017 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1019 MACRO {tcs} {"Theoretical Computer Science"}
1030 FUNCTION {chop.word}
1033 s #1 len substring$ =
1034 { s len #1 + global.max$ substring$ }
1039 INTEGERS { et.al.char.used }
1041 FUNCTION {initialize.et.al.char.used}
1042 { #0 'et.al.char.used :=
1045 EXECUTE {initialize.et.al.char.used}
1047 FUNCTION {format.lab.names}
1049 s num.names$ 'numnames :=
1052 { #3 'namesleft := }
1053 { numnames 'namesleft := }
1058 { nameptr numnames =
1059 { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1060 { "{\etalchar{+}}" *
1061 #1 'et.al.char.used :=
1063 { s nameptr "{v{}}{l{}}" format.name$ * }
1066 { s nameptr "{v{}}{l{}}" format.name$ * }
1068 nameptr #1 + 'nameptr :=
1069 namesleft #1 - 'namesleft :=
1073 { "{\etalchar{+}}" *
1074 #1 'et.al.char.used :=
1079 { s #1 "{v{}}{l{}}" format.name$
1080 duplicate$ text.length$ #2 <
1081 { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
1088 FUNCTION {author.key.label}
1091 { cite$ #1 #3 substring$ }
1092 { key #3 text.prefix$ }
1095 { author format.lab.names }
1099 FUNCTION {author.editor.key.label}
1103 { cite$ #1 #3 substring$ }
1104 { key #3 text.prefix$ }
1107 { editor format.lab.names }
1110 { author format.lab.names }
1114 FUNCTION {author.key.organization.label}
1117 { organization empty$
1118 { cite$ #1 #3 substring$ }
1119 { "The " #4 organization chop.word #3 text.prefix$ }
1122 { key #3 text.prefix$ }
1125 { author format.lab.names }
1129 FUNCTION {editor.key.organization.label}
1132 { organization empty$
1133 { cite$ #1 #3 substring$ }
1134 { "The " #4 organization chop.word #3 text.prefix$ }
1137 { key #3 text.prefix$ }
1140 { editor format.lab.names }
1144 FUNCTION {calc.label}
1148 'author.editor.key.label
1149 { type$ "proceedings" =
1150 'editor.key.organization.label
1152 'author.key.organization.label
1160 year field.or.null purify$ #-1 #2 substring$
1163 year field.or.null purify$ #-1 #4 substring$
1165 sortify 'sort.label :=
1168 FUNCTION {sort.format.names}
1172 s num.names$ 'numnames :=
1173 numnames 'namesleft :=
1179 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1180 nameptr numnames = t "others" = and
1184 nameptr #1 + 'nameptr :=
1185 namesleft #1 - 'namesleft :=
1190 FUNCTION {sort.format.title}
1194 "The " #4 t chop.word
1198 #1 global.max$ substring$
1201 FUNCTION {author.sort}
1204 { "to sort, need author or key in " cite$ * warning$
1210 { author sort.format.names }
1214 FUNCTION {author.editor.sort}
1218 { "to sort, need author, editor, or key in " cite$ * warning$
1224 { editor sort.format.names }
1227 { author sort.format.names }
1231 FUNCTION {author.organization.sort}
1233 { organization empty$
1235 { "to sort, need author, organization, or key in " cite$ * warning$
1241 { "The " #4 organization chop.word sortify }
1244 { author sort.format.names }
1248 FUNCTION {editor.organization.sort}
1250 { organization empty$
1252 { "to sort, need editor, organization, or key in " cite$ * warning$
1258 { "The " #4 organization chop.word sortify }
1261 { editor sort.format.names }
1274 { type$ "proceedings" =
1275 'editor.organization.sort
1277 'author.organization.sort
1287 year field.or.null sortify
1294 % DFK throw away stuff above and use cite$ for sort key
1297 #1 entry.max$ substring$
1305 STRINGS { longest.label last.sort.label next.extra }
1307 INTEGERS { longest.label.width last.extra.num }
1309 FUNCTION {initialize.longest.label}
1310 { "" 'longest.label :=
1311 #0 int.to.chr$ 'last.sort.label :=
1313 #0 'longest.label.width :=
1314 #0 'last.extra.num :=
1317 FUNCTION {forward.pass}
1318 { last.sort.label sort.label =
1319 { last.extra.num #1 + 'last.extra.num :=
1320 last.extra.num int.to.chr$ 'extra.label :=
1322 { "a" chr.to.int$ 'last.extra.num :=
1324 sort.label 'last.sort.label :=
1329 FUNCTION {reverse.pass}
1331 { "a" 'extra.label := }
1334 label extra.label * 'label :=
1335 label width$ longest.label.width >
1336 { label 'longest.label :=
1337 label width$ 'longest.label.width :=
1341 extra.label 'next.extra :=
1344 EXECUTE {initialize.longest.label}
1346 ITERATE {forward.pass}
1348 REVERSE {reverse.pass}
1350 % DFK removed code about et.al.char
1351 % DFK changed to HTML
1352 FUNCTION {begin.bib}
1353 { "<HTML>" write$ newline$
1354 "<HEAD><TITLE> Bibliography </TITLE>" write$ newline$
1355 "</HEAD>" write$ newline$
1356 "<BODY BGCOLOR=#EEEEEE>" write$ newline$
1357 "<DL>" write$ newline$
1362 EXECUTE {init.state.consts}
1364 ITERATE {call.type$}
1366 % DFK changed to HTML
1369 "</DL>" write$ newline$
1370 "</BODY>" write$ newline$
1371 "</HTML>" write$ newline$