2 % Updates to prevent citation titles being written to the bibliography
3 % and get rid of - the ampersand is later translated to &
5 % - changed into texi-long.bst by Graham Percival for GNU LilyPond
6 % - only a minimum of changes were made; some html remains in
7 % this file, but it does not appear in our output
8 % BibTeX bibliography style `html-long'
9 % spits out texinfo-formatted bibliography in place of bbl output
10 % by David Kotz dfk@cs.dartmouth.edu
11 % $Id: html-long.bst,v 1.4 2005/07/21 21:29:50 hjunes Exp $
13 % BibTeX standard bibliography style `alpha'
14 % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
15 % Copyright (C) 1985, all rights reserved.
16 % Copying of this file is authorized only if either
17 % (1) you make absolutely no changes to your copy, including name, or
18 % (2) if you do make changes, you name it something other than
19 % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
20 % This restriction helps ensure that all standard styles are identical.
21 % The file btxbst.doc has the documentation for this style.
23 % DFK added abstract, comment, earlier, keyword, later, URL
56 { label extra.label sort.label }
58 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
60 FUNCTION {init.state.consts}
69 FUNCTION {output.nonnull}
71 output.state mid.sentence =
73 { output.state after.block =
77 { output.state before.all =
79 { add.period$ " " * write$ }
83 mid.sentence 'output.state :=
96 FUNCTION {output.check}
99 { pop$ "empty " t * " in " * cite$ * warning$ }
104 % DFK changed to use cite$ for the label
105 % DFK changed to texinfo, and use URL to make cite key a link
106 % PEH changed to stop writing citation to output
107 FUNCTION {output.bibitem}
110 % { "@item @code{[" cite$ * "]} " * write$ newline$
113 { "" quote$ * cite$ * quote$ * " HREF=" * quote$ *
114 URL * quote$ * "> " * cite$ * ":</A></DT>" * write$
120 before.all 'output.state :=
123 % DFK changed to HTML
130 { "<br>" write$ newline$
131 "See also earlier version <A HREF=" quote$ * "#" * earlier * quote$ *
132 ">" * earlier * "</A>." * write$ newline$
137 { "<br>" write$ newline$
138 "See also later version <A HREF=" quote$ * "#" * later * quote$ *
139 ">" * later * "</A>." * write$ newline$
146 { output.state before.all =
148 { after.block 'output.state := }
152 FUNCTION {new.sentence}
153 { output.state after.block =
155 { output.state before.all =
157 { after.sentence 'output.state := }
181 FUNCTION {new.block.checka}
188 FUNCTION {new.block.checkb}
197 FUNCTION {new.sentence.checka}
204 FUNCTION {new.sentence.checkb}
213 FUNCTION {field.or.null}
220 % DFK changed to texinfo
224 { "@emph{" swap$ * "}" * }
228 % DFK added for texinfo strong emphasis
232 { "@strong{" swap$ * "}" * }
236 INTEGERS { nameptr namesleft numnames }
238 % DFK added this, to strip {} and ~ from titles and authors
239 % It's not a great idea, because it will screw up in math mode and some
240 % special characters... but it makes most things much prettier.
241 FUNCTION {author.title.purify}
245 { t #1 #1 substring$ "{" =
246 t #1 #1 substring$ "}" = or
248 { t #1 #1 substring$ "~" =
250 { t #1 #1 substring$ * }
254 t #2 global.max$ substring$ 't :=
259 FUNCTION {format.names}
262 s num.names$ 'numnames :=
263 numnames 'namesleft :=
265 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
282 nameptr #1 + 'nameptr :=
283 namesleft #1 - 'namesleft :=
288 FUNCTION {format.authors}
291 { author format.names author.title.purify }
295 FUNCTION {format.editors}
298 { editor format.names author.title.purify
299 editor num.names$ #1 >
307 % DFK added strong, so it will be bold.
308 FUNCTION {format.title}
311 { title "t" change.case$ author.title.purify strong }
319 { t #1 #1 substring$ "-" =
320 { t #1 #2 substring$ "--" = not
322 t #2 global.max$ substring$ 't :=
324 { { t #1 #1 substring$ "-" = }
326 t #2 global.max$ substring$ 't :=
332 { t #1 #1 substring$ *
333 t #2 global.max$ substring$ 't :=
340 FUNCTION {format.date}
344 { "there's a month but no year in " cite$ * warning$
351 { month " " * year * }
357 % DFK changed emphasize to strong
358 FUNCTION {format.btitle}
359 { title author.title.purify strong
362 %PEH changed " " to " " in 2nd line to avoid & being changed to & later
363 % looks daft but going for minimum changes
364 FUNCTION {tie.or.space.connect}
365 { duplicate$ text.length$ #3 <
372 FUNCTION {either.or.check}
375 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
379 FUNCTION {format.bvolume}
382 { "volume" volume tie.or.space.connect
385 { " of " * series emphasize * }
387 "volume and number" number either.or.check
392 FUNCTION {format.number.series}
395 { series field.or.null }
396 { output.state mid.sentence =
400 number tie.or.space.connect
402 { "there's a number but no series in " cite$ * warning$ }
403 { " in " * series * }
412 FUNCTION {format.edition}
415 { output.state mid.sentence =
416 { edition "l" change.case$ " edition" * }
417 { edition "t" change.case$ " edition" * }
423 INTEGERS { multiresult }
425 FUNCTION {multi.page.check}
434 swap$ duplicate$ "," =
437 { #1 'multiresult := }
438 { t #2 global.max$ substring$ 't := }
445 FUNCTION {format.pages}
448 { pages multi.page.check
449 { "pages" pages n.dashify tie.or.space.connect }
450 { "page" pages tie.or.space.connect }
456 FUNCTION {format.vol.num.pages}
457 { volume field.or.null
460 { "(" number * ")" * *
462 { "there's a number but no volume in " cite$ * warning$ }
470 { pop$ format.pages }
471 { ":" * pages n.dashify * }
477 FUNCTION {format.chapter.pages}
482 { type "l" change.case$ }
484 chapter tie.or.space.connect
487 { ", " * format.pages * }
493 FUNCTION {format.in.ed.booktitle}
497 { "In " booktitle emphasize * }
498 { "In " format.editors * ", " * booktitle emphasize * }
504 FUNCTION {empty.misc.check}
505 { author empty$ title empty$ howpublished empty$
506 month empty$ year empty$ note empty$
509 { "all relevant fields are empty in " cite$ * warning$ }
514 FUNCTION {format.thesis.type}
518 type "t" change.case$
523 FUNCTION {format.tr.number}
525 { "Technical Report" }
530 { number tie.or.space.connect }
534 FUNCTION {format.article.crossref}
537 { "need key or journal for " cite$ * " to crossref " * crossref *
541 { "In {\em " journal * "\/}" * }
546 % " \cite{" * crossref * "}" *
547 " [" * crossref * "]" *
550 FUNCTION {format.crossref.editor}
551 { editor #1 "{vv~}{ll}" format.name$
552 editor num.names$ duplicate$
557 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
559 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
567 FUNCTION {format.book.crossref}
569 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
572 { "Volume" volume tie.or.space.connect
577 editor field.or.null author field.or.null =
581 { "need editor, key, or series for " cite$ * " to crossref " *
585 { "{\em " * series * "\/}" * }
591 { format.crossref.editor * }
593 % " \cite{" * crossref * "}" *
594 " [" * crossref * "]" *
597 FUNCTION {format.incoll.inproc.crossref}
599 editor field.or.null author field.or.null =
603 { "need editor, key, or booktitle for " cite$ * " to crossref " *
607 { "In {\em " booktitle * "\/}" * }
613 { "In " format.crossref.editor * }
615 % " \cite{" * crossref * "}" *
616 " [" * crossref * "]" *
621 % top of stack is the string we want to be a quoted paragraph
622 FUNCTION {format.quotedParagraph}
625 { "<P><QUOTE> " swap$ * " </QUOTE></P>" *}
630 % DFK added, to support comment, private, keyword, etc
631 % next-to-top is field name (eg, "Comment")
632 % top is field value (eg, value of comment)
633 % both are popped; resulting top is either empty,
634 % or string describing field
635 FUNCTION {format.dfkfield}
639 "<strong> " swap$ * ":</strong> " * swap$ * }
646 "Abstract" abstract format.dfkfield format.quotedParagraph write$ newline$
647 "Keyword" keyword format.dfkfield format.quotedParagraph write$ newline$
648 "Comment" comment format.dfkfield format.quotedParagraph write$ newline$
651 % DFK: added a call to dfk.stuff in all entry-type functions below
655 format.authors "author" output.check
657 format.title "title" output.check
660 { journal emphasize "journal" output.check
661 format.vol.num.pages output
662 format.date "year" output.check
664 { format.article.crossref output.nonnull
677 { format.editors "author and editor" output.check }
678 { format.authors output.nonnull
680 { "author and editor" editor either.or.check }
686 format.btitle "title" output.check
688 { format.bvolume output
690 format.number.series output
692 publisher "publisher" output.check
696 format.book.crossref output.nonnull
699 format.edition output
700 format.date "year" output.check
709 format.authors output
711 format.title "title" output.check
712 howpublished address new.block.checkb
725 { format.editors "author and editor" output.check }
726 { format.authors output.nonnull
728 { "author and editor" editor either.or.check }
734 format.btitle "title" output.check
736 { format.bvolume output
737 format.chapter.pages "chapter and pages" output.check
739 format.number.series output
741 publisher "publisher" output.check
744 { format.chapter.pages "chapter and pages" output.check
746 format.book.crossref output.nonnull
749 format.edition output
750 format.date "year" output.check
757 FUNCTION {incollection}
759 format.authors "author" output.check
761 format.title "title" output.check
764 { format.in.ed.booktitle "booktitle" output.check
765 format.bvolume output
766 format.number.series output
767 format.chapter.pages output
769 publisher "publisher" output.check
771 format.edition output
772 format.date "year" output.check
774 { format.incoll.inproc.crossref output.nonnull
775 format.chapter.pages output
784 FUNCTION {inproceedings}
786 format.authors "author" output.check
788 format.title "title" output.check
791 { format.in.ed.booktitle "booktitle" output.check
792 format.bvolume output
793 format.number.series output
796 { organization publisher new.sentence.checkb
799 format.date "year" output.check
801 { address output.nonnull
802 format.date "year" output.check
809 { format.incoll.inproc.crossref output.nonnull
819 FUNCTION {conference} { inproceedings }
824 { organization empty$
826 { organization output.nonnull
831 { format.authors output.nonnull }
834 format.btitle "title" output.check
836 { organization empty$
837 { address new.block.checka
843 { organization address new.block.checkb
848 format.edition output
856 FUNCTION {mastersthesis}
858 format.authors "author" output.check
860 format.title "title" output.check
862 "Master's thesis" format.thesis.type output.nonnull
863 school "school" output.check
865 format.date "year" output.check
874 format.authors output
875 title howpublished new.block.checkb
877 howpublished new.block.checka
889 format.authors "author" output.check
891 format.btitle "title" output.check
893 "PhD thesis" format.thesis.type output.nonnull
894 school "school" output.check
896 format.date "year" output.check
903 FUNCTION {proceedings}
906 { organization output }
907 { format.editors output.nonnull }
910 format.btitle "title" output.check
911 format.bvolume output
912 format.number.series output
915 { publisher new.sentence.checka }
916 { organization publisher new.sentence.checkb
921 format.date "year" output.check
923 { address output.nonnull
924 format.date "year" output.check
928 { organization output }
939 FUNCTION {techreport}
941 format.authors "author" output.check
943 format.title "title" output.check
945 format.tr.number output.nonnull
946 institution "institution" output.check
948 format.date "year" output.check
955 FUNCTION {unpublished}
957 format.authors "author" output.check
959 format.title "title" output.check
961 note "note" output.check
967 FUNCTION {default.type} { misc }
969 MACRO {jan} {"January"}
971 MACRO {feb} {"February"}
973 MACRO {mar} {"March"}
975 MACRO {apr} {"April"}
983 MACRO {aug} {"August"}
985 MACRO {sep} {"September"}
987 MACRO {oct} {"October"}
989 MACRO {nov} {"November"}
991 MACRO {dec} {"December"}
993 MACRO {acmcs} {"ACM Computing Surveys"}
995 MACRO {acta} {"Acta Informatica"}
997 MACRO {cacm} {"Communications of the ACM"}
999 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1001 MACRO {ibmsj} {"IBM Systems Journal"}
1003 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1005 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1008 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1010 MACRO {ipl} {"Information Processing Letters"}
1012 MACRO {jacm} {"Journal of the ACM"}
1014 MACRO {jcss} {"Journal of Computer and System Sciences"}
1016 MACRO {scp} {"Science of Computer Programming"}
1018 MACRO {sicomp} {"SIAM Journal on Computing"}
1020 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1022 MACRO {tods} {"ACM Transactions on Database Systems"}
1024 MACRO {tog} {"ACM Transactions on Graphics"}
1026 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1028 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1030 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1032 MACRO {tcs} {"Theoretical Computer Science"}
1043 FUNCTION {chop.word}
1046 s #1 len substring$ =
1047 { s len #1 + global.max$ substring$ }
1052 INTEGERS { et.al.char.used }
1054 FUNCTION {initialize.et.al.char.used}
1055 { #0 'et.al.char.used :=
1058 EXECUTE {initialize.et.al.char.used}
1060 FUNCTION {format.lab.names}
1062 s num.names$ 'numnames :=
1065 { #3 'namesleft := }
1066 { numnames 'namesleft := }
1071 { nameptr numnames =
1072 { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1073 { "{\etalchar{+}}" *
1074 #1 'et.al.char.used :=
1076 { s nameptr "{v{}}{l{}}" format.name$ * }
1079 { s nameptr "{v{}}{l{}}" format.name$ * }
1081 nameptr #1 + 'nameptr :=
1082 namesleft #1 - 'namesleft :=
1086 { "{\etalchar{+}}" *
1087 #1 'et.al.char.used :=
1092 { s #1 "{v{}}{l{}}" format.name$
1093 duplicate$ text.length$ #2 <
1094 { pop$ s #1 "{ll}" format.name$ #3 text.prefix$ }
1101 FUNCTION {author.key.label}
1104 { cite$ #1 #3 substring$ }
1105 { key #3 text.prefix$ }
1108 { author format.lab.names }
1112 FUNCTION {author.editor.key.label}
1116 { cite$ #1 #3 substring$ }
1117 { key #3 text.prefix$ }
1120 { editor format.lab.names }
1123 { author format.lab.names }
1127 FUNCTION {author.key.organization.label}
1130 { organization empty$
1131 { cite$ #1 #3 substring$ }
1132 { "The " #4 organization chop.word #3 text.prefix$ }
1135 { key #3 text.prefix$ }
1138 { author format.lab.names }
1142 FUNCTION {editor.key.organization.label}
1145 { organization empty$
1146 { cite$ #1 #3 substring$ }
1147 { "The " #4 organization chop.word #3 text.prefix$ }
1150 { key #3 text.prefix$ }
1153 { editor format.lab.names }
1157 FUNCTION {calc.label}
1161 'author.editor.key.label
1162 { type$ "proceedings" =
1163 'editor.key.organization.label
1165 'author.key.organization.label
1173 year field.or.null purify$ #-1 #2 substring$
1176 year field.or.null purify$ #-1 #4 substring$
1178 sortify 'sort.label :=
1181 FUNCTION {sort.format.names}
1185 s num.names$ 'numnames :=
1186 numnames 'namesleft :=
1192 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1193 nameptr numnames = t "others" = and
1197 nameptr #1 + 'nameptr :=
1198 namesleft #1 - 'namesleft :=
1203 FUNCTION {sort.format.title}
1207 "The " #4 t chop.word
1211 #1 global.max$ substring$
1214 FUNCTION {author.sort}
1217 { "to sort, need author or key in " cite$ * warning$
1223 { author sort.format.names }
1227 FUNCTION {author.editor.sort}
1231 { "to sort, need author, editor, or key in " cite$ * warning$
1237 { editor sort.format.names }
1240 { author sort.format.names }
1244 FUNCTION {author.organization.sort}
1246 { organization empty$
1248 { "to sort, need author, organization, or key in " cite$ * warning$
1254 { "The " #4 organization chop.word sortify }
1257 { author sort.format.names }
1261 FUNCTION {editor.organization.sort}
1263 { organization empty$
1265 { "to sort, need editor, organization, or key in " cite$ * warning$
1271 { "The " #4 organization chop.word sortify }
1274 { editor sort.format.names }
1287 { type$ "proceedings" =
1288 'editor.organization.sort
1290 'author.organization.sort
1300 year field.or.null sortify
1307 % DFK throw away stuff above and use cite$ for sort key
1310 #1 entry.max$ substring$
1318 STRINGS { longest.label last.sort.label next.extra }
1320 INTEGERS { longest.label.width last.extra.num }
1322 FUNCTION {initialize.longest.label}
1323 { "" 'longest.label :=
1324 #0 int.to.chr$ 'last.sort.label :=
1326 #0 'longest.label.width :=
1327 #0 'last.extra.num :=
1330 FUNCTION {forward.pass}
1331 { last.sort.label sort.label =
1332 { last.extra.num #1 + 'last.extra.num :=
1333 last.extra.num int.to.chr$ 'extra.label :=
1335 { "a" chr.to.int$ 'last.extra.num :=
1337 sort.label 'last.sort.label :=
1342 FUNCTION {reverse.pass}
1344 { "a" 'extra.label := }
1347 label extra.label * 'label :=
1348 label width$ longest.label.width >
1349 { label 'longest.label :=
1350 label width$ 'longest.label.width :=
1354 extra.label 'next.extra :=
1357 EXECUTE {initialize.longest.label}
1359 ITERATE {forward.pass}
1361 REVERSE {reverse.pass}
1363 % DFK removed code about et.al.char
1364 % DFK changed to texinfo
1365 FUNCTION {begin.bib}
1366 { "@c bib -> itexi intro" write$ newline$
1367 "@itemize" write$ newline$
1372 EXECUTE {init.state.consts}
1374 ITERATE {call.type$}
1376 % DFK changed to texinfo
1379 "@end itemize" write$ newline$
1380 "@c bib -> itexi end" write$ newline$