1 % BibTeX standard bibliography style `plain'
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.
35 { author.duplicate author.shared }
38 INTEGERS { output.state before.all mid.sentence after.sentence after.block after.title author.different author.last author.flast }
40 % Rearranged such that true values require capital letters
41 FUNCTION {init.consts}
48 #0 'author.different :=
51 %#3 'author.firstlast :=
54 STRINGS { s t u } % Added u
56 % Puts the period inside any quotes
59 duplicate$ #-1 #3 substring$ "'''" =
60 { duplicate$ text.length$ #3 - text.prefix$ add.period$ "'\thinspace''" * }
61 { duplicate$ #-1 #3 substring$ "''}" =
62 { #2 global.max$ substring$ duplicate$
63 text.length$ #2 - text.prefix$ add.period$ "{" swap$ * "''}" * }
64 { duplicate$ #-1 #2 substring$ "''" =
65 { duplicate$ text.length$ #2 - text.prefix$ add.period$ "''" * }
74 % Switched to do.period and added after.title
75 FUNCTION {output.nonnull}
77 output.state mid.sentence =
79 { output.state after.block =
84 { output.state before.all =
86 { output.state after.title =
88 { do.period " " * write$ }
94 mid.sentence 'output.state :=
107 FUNCTION {output.check}
110 { pop$ "empty " t * " in " * cite$ * warning$ }
115 % Switched to do.period
123 { output.state before.all =
125 { after.block 'output.state := }
129 FUNCTION {new.sentence}
130 { output.state after.block =
132 { output.state before.all =
134 { after.sentence 'output.state := }
141 %{ output.state after.block =
143 % { output.state before.all =
145 % { after.title 'output.state := }
169 FUNCTION {new.block.checka}
176 FUNCTION {new.block.checkb}
185 FUNCTION {new.sentence.checka}
192 FUNCTION {new.sentence.checkb}
201 FUNCTION {field.or.null}
211 { "{\em " swap$ * "}" * }
215 INTEGERS { nameptr namesleft numnames }
217 FUNCTION {format.names.custom}
221 s num.names$ 'numnames :=
222 numnames 'namesleft :=
224 { s nameptr u format.name$ 't :=
241 nameptr #1 + 'nameptr :=
242 namesleft #1 - 'namesleft :=
247 FUNCTION {format.names}
248 { "{ff~}{vv~}{ll}{, jj}" format.names.custom }
250 % Changed first author to last name first
251 FUNCTION {format.names.beginning}
254 s num.names$ 'numnames :=
255 numnames 'namesleft :=
258 { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$
259 duplicate$ #1 #1 substring$ "u" change.case$ swap$
260 duplicate$ #-1 swap$ text.length$ #1 - substring$ * 't := }
261 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
279 nameptr #1 + 'nameptr :=
280 namesleft #1 - 'namesleft :=
285 % Added check for duplicate authors
286 FUNCTION {format.authors}
289 { author.duplicate #1 =
291 { author format.names.beginning }
297 % Changed to MLA editor abbreviations
298 % author.duplicate also applies
299 FUNCTION {format.editors}
302 { author empty$ author.duplicate #1 = and
304 { editor format.names.beginning }
306 editor num.names$ #1 >
314 FUNCTION {format.editors.mid}
318 editor num.names$ #1 >
322 editor format.names *
327 % Formats the address and publisher
328 FUNCTION {format.publisher}
331 { address ": " * publisher * }
335 % Changed to preserve case and use quotes
336 FUNCTION {format.title}
339 { title #1 text.prefix$ "`" =
340 { "``\thinspace" title * "''" * }
341 { "``" title * "''" *}
351 { t #1 #1 substring$ "-" =
352 { t #1 #2 substring$ "--" = not
354 t #2 global.max$ substring$ 't :=
356 { { t #1 #1 substring$ "-" = }
358 t #2 global.max$ substring$ 't :=
364 { t #1 #1 substring$ *
365 t #2 global.max$ substring$ 't :=
372 FUNCTION {format.date}
376 { "there's a month but no year in " cite$ * warning$
383 { month " " * year * }
389 FUNCTION {format.btitle}
393 FUNCTION {tie.or.space.connect}
394 { duplicate$ text.length$ #3 <
401 FUNCTION {either.or.check}
404 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
408 FUNCTION {format.bvolume.or.num.series}
411 { series field.or.null }
414 { number "there's a number but no series in " cite$ * warning$ }
416 %output.state mid.sentence =
420 number tie.or.space.connect
426 { "Vol." volume tie.or.space.connect
429 { " of " * series emphasize * add.period$ }
433 { number * " vols." * }
435 %"volume and number" number either.or.check
440 FUNCTION {format.number.series}
447 % Changed edition to MLA abbreviation
448 FUNCTION {format.edition}
451 { edition "l" change.case$ 's := edition 't :=
452 "" "9th" "ninth" "8th" "eighth" "7th" "seventh" "6th" "sixth" "5th" "fifth" "4th" "fourth" "3rd" "third" "2nd" "second" "1st" "first"
453 {duplicate$ empty$ { pop$ #0 }{ #1 } if$ }{ s = { 't := }{ pop$ } if$ }
455 % output.state mid.sentence =
456 % { edition "l" change.case$ " ed." * }
457 % { edition "t" change.case$ " ed." * }
464 INTEGERS { multiresult }
466 FUNCTION {multi.page.check}
475 swap$ duplicate$ "," =
478 { #1 'multiresult := }
479 { t #2 global.max$ substring$ 't := }
486 FUNCTION {format.pages}
489 { %pages multi.page.check
490 % { "pages" pages n.dashify tie.or.space.connect }
491 % { "page" pages tie.or.space.connect }
498 FUNCTION {format.vol.num.year.pages}
502 { "there's a number but no volume in " cite$ * warning$ }
511 " (" * format.date * ")" *
516 { ", " * format.edition * }
520 { ": " * pages n.dashify * }
525 FUNCTION {format.vol.num.pages}
526 { volume field.or.null
529 { "(" number * ")" * *
531 { "there's a number but no volume in " cite$ * warning$ }
539 { pop$ format.pages }
540 { ":" * pages n.dashify * }
546 % chapter might be useful if type is set to "pars."
547 FUNCTION {format.chapter.pages}
552 { type "t" change.case$ }
554 chapter n.dashify tie.or.space.connect
557 { ", " * format.pages * }
563 FUNCTION {format.in.ed.booktitle}
567 { "In " booktitle emphasize * }
568 { booktitle emphasize add.period$ format.editors.mid * }
574 FUNCTION {empty.misc.check}
575 { author empty$ title empty$ howpublished empty$
576 month empty$ year empty$ note empty$
579 { "all relevant fields are empty in " cite$ * warning$ }
584 FUNCTION {format.thesis.type}
588 type "t" change.case$
593 FUNCTION {format.tr.number}
595 { "Technical Report" }
600 { number tie.or.space.connect }
604 FUNCTION {format.article.crossref}
607 %{ "need key or journal for " cite$ * " to crossref " * crossref *
611 %{ "In {\em " journal * "\/}" * }
616 pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
617 "{" * crossref * "}" *
620 FUNCTION {format.crossref.editor}
621 { editor #1 "{vv~}{ll}" format.name$
622 editor num.names$ duplicate$
627 { editor #2 "{ff }{vv }{ll}{, jj}" format.name$ "others" =
629 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
637 FUNCTION {format.book.crossref}
639 % { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
642 % { "Vol." volume tie.or.space.connect add.period$
646 % editor field.or.null author field.or.null =
650 %{ "need editor, key, or series for " cite$ * " to crossref " *
651 % crossref * warning$
654 %{ "{\em " * series * "\/}" * }
660 % { format.crossref.editor * }
662 %" \citeN{" * crossref * "}" *
663 pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
664 "{" * crossref * "}" *
667 FUNCTION {format.incoll.inproc.crossref}
669 % editor field.or.null author field.or.null =
673 % { "need editor, key, or booktitle for " cite$ * " to crossref " *
674 % crossref * warning$
677 % { "In {\em " booktitle * "\/}" * }
683 % { "In " format.crossref.editor * }
685 % " \citeN{" * crossref * "}" *
686 pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
687 "{" * crossref * "}" *
690 FUNCTION {cite.title}
691 { title empty$ journal empty$ not and
692 { key empty$ { journal }{ key } if$ emphasize }
693 { title empty$ key empty$ and
694 { "empty title and key in " cite$ * warning$ "" }
695 { key empty$ {title}{key} if$
700 type$ "proceedings" =
705 type$ "incollection" =
706 type$ "inproceedings" =
707 type$ "mastersthesis" =
710 type$ "unpublished" =
712 {"``" swap$ * "''" * }
723 FUNCTION {cite.label}
726 % { editor empty$ { organization field.or.null 'a := }{ editor 'a :=} if$}
741 author.shared author.different =
742 { "{vv~}{ll}" format.names.custom }
743 { author.shared author.last =
744 { "{f.~}{vv~}{ll}{, jj}" format.names.custom }
745 { author.shared author.flast =
746 { "{ff~}{vv~}{ll}{, jj}" format.names.custom }
747 { "{vv~}{ll}" format.names.custom ", " * cite.title * }
753 author.duplicate { ", " * cite.title * }{} if$
764 FUNCTION {output.bibitem}
773 before.all 'output.state :=
778 format.authors "author" output.check
780 format.title "title" output.check
783 { journal emphasize "journal" output.check after.title 'output.state :=
784 %format.date "year" output.check
786 format.vol.num.year.pages output
788 { format.article.crossref output.nonnull
800 { format.editors "author and editor" output.check }
801 { format.authors output.nonnull }
804 format.btitle "title" output.check
807 { author empty$ 'skip$ { format.editors.mid output new.sentence } if$
808 format.edition output
810 format.bvolume.or.num.series output
812 format.publisher "publisher" output.check
813 format.date "year" output.check
815 {% format.date "year" output
817 format.book.crossref output.nonnull
827 format.authors output
829 format.title "title" output.check
830 howpublished address new.block.checkb
842 { format.editors "author and editor" output.check }
843 { format.authors output.nonnull }
846 format.btitle "title" output.check
849 { author empty$ 'skip$ { format.editors.mid output new.sentence } if$
850 format.edition output
852 format.bvolume.or.num.series output
854 format.publisher "publisher" output.check
855 format.date "year" output.check
857 format.chapter.pages "chapter and pages" output.check
860 {% format.chapter.pages "chapter and pages" output.check
862 format.book.crossref output.nonnull
869 FUNCTION {incollection}
871 format.authors "author" output.check
873 { new.block type output }
877 format.title "title" output.check
881 booktitle emphasize "booktitle" output.check
883 format.editors.mid "editor" output.check
885 format.edition output
887 format.bvolume.or.num.series output
889 format.publisher "publisher" output.check
891 format.date "year" output.check
893 format.chapter.pages output
895 { format.incoll.inproc.crossref output.nonnull
896 %format.chapter.pages output
904 FUNCTION {inproceedings}
906 format.authors "author" output.check
908 format.title "title" output.check
911 { %format.in.ed.booktitle "booktitle" output.check
912 booktitle "booktitle" output.check
914 format.editors.mid output
916 format.edition output
918 format.bvolume.or.num.series output
920 format.edition output
922 format.publisher output
923 format.date "year" output.check
925 %{ organization publisher new.sentence.checkb
926 % organization output
928 % format.date "year" output.check
930 %{ address output.nonnull
931 % format.date "year" output.check
933 % organization output
940 { format.incoll.inproc.crossref output.nonnull
949 FUNCTION {conference} { inproceedings }
954 { organization empty$
956 { organization output.nonnull
961 { format.authors output.nonnull }
964 format.btitle "title" output.check
966 format.edition output
969 { organization empty$
970 { address new.block.checka
976 { organization address new.block.checkb
987 FUNCTION {mastersthesis}
989 format.authors "author" output.check
991 format.title "title" output.check
993 "Diss." format.thesis.type output.nonnull
994 after.title 'output.state :=
995 school "school" output.check
997 format.date "year" output.check
1005 format.authors output
1006 title howpublished new.block.checkb
1007 format.title output after.sentence 'output.state :=
1008 howpublished new.block.checka
1017 FUNCTION {phdthesis}
1019 format.authors "author" output.check
1021 format.btitle "title" output.check
1023 "Diss." format.thesis.type output.nonnull
1024 after.title 'output.state :=
1025 school "school" output.check
1027 format.date "year" output.check
1033 FUNCTION {proceedings}
1036 { organization output }
1037 { format.editors output.nonnull }
1040 format.btitle "title" output.check
1042 format.bvolume.or.num.series output
1045 { publisher new.sentence.checka }
1046 { organization publisher new.sentence.checkb
1051 format.date "year" output.check
1053 { address output.nonnull
1054 format.date "year" output.check
1058 { organization output }
1068 FUNCTION {techreport}
1070 format.authors "author" output.check
1072 format.title "title" output.check
1074 format.tr.number output.nonnull
1075 institution "institution" output.check
1077 format.date "year" output.check
1083 FUNCTION {unpublished}
1085 format.authors "author" output.check
1087 format.title "title" output.check
1089 note "note" output.check
1094 FUNCTION {default.type} { misc }
1096 MACRO {jan} {"Jan."}
1098 MACRO {feb} {"Feb."}
1100 MACRO {mar} {"Mar."}
1102 MACRO {apr} {"Apr."}
1106 MACRO {jun} {"June"}
1108 MACRO {jul} {"July"}
1110 MACRO {aug} {"Aug."}
1112 MACRO {sep} {"Sept."}
1114 MACRO {oct} {"Oct."}
1116 MACRO {nov} {"Nov."}
1118 MACRO {dec} {"Dec."}
1120 MACRO {acmcs} {"ACM Computing Surveys"}
1122 MACRO {acta} {"Acta Informatica"}
1124 MACRO {cacm} {"Communications of the ACM"}
1126 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1128 MACRO {ibmsj} {"IBM Systems Journal"}
1130 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1132 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1135 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1137 MACRO {ipl} {"Information Processing Letters"}
1139 MACRO {jacm} {"Journal of the ACM"}
1141 MACRO {jcss} {"Journal of Computer and System Sciences"}
1143 MACRO {scp} {"Science of Computer Programming"}
1145 MACRO {sicomp} {"SIAM Journal on Computing"}
1147 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1149 MACRO {tods} {"ACM Transactions on Database Systems"}
1151 MACRO {tog} {"ACM Transactions on Graphics"}
1153 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1155 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1157 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1159 MACRO {tcs} {"Theoretical Computer Science"}
1170 FUNCTION {chop.word}
1173 s #1 len substring$ =
1174 { s len #1 + global.max$ substring$ }
1179 FUNCTION {sort.format.names}
1183 s num.names$ 'numnames :=
1184 numnames 'namesleft :=
1190 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1191 nameptr numnames = t "others" = and
1195 nameptr #1 + 'nameptr :=
1196 namesleft #1 - 'namesleft :=
1201 FUNCTION {sort.format.title}
1205 "The " #4 t chop.word
1209 #1 global.max$ substring$
1212 FUNCTION {author.sort}
1215 { "to sort, need author or key in " cite$ * warning$
1221 { author sort.format.names }
1225 FUNCTION {author.editor.sort}
1229 { "to sort, need author, editor, or key in " cite$ * warning$
1235 { editor sort.format.names }
1238 { author sort.format.names }
1242 FUNCTION {author.organization.sort}
1244 { organization empty$
1246 { "to sort, need author, organization, or key in " cite$ * warning$
1252 { "The " #4 organization chop.word sortify }
1255 { author sort.format.names }
1259 FUNCTION {editor.organization.sort}
1261 { organization empty$
1263 { "to sort, need editor, organization, or key in " cite$ * warning$
1269 { "The " #4 organization chop.word sortify }
1272 { editor sort.format.names }
1281 { type$ "proceedings" =
1282 'editor.organization.sort
1284 'author.organization.sort
1291 duplicate$ empty$ 'skip$ { " " * } if$
1293 { title field.or.null sort.format.title * " " * booktitle field.or.null sort.format.title * }
1298 year field.or.null sortify
1300 #1 entry.max$ substring$
1311 FUNCTION {init.vars}
1312 { #0 int.to.chr$ 'a :=
1313 #0 int.to.chr$ 'b :=
1318 FUNCTION {forward.author.dup.check}
1321 { editor empty$ { organization field.or.null 'a := }{ editor 'a :=} if$}
1327 { b "{ff~}{vv~}{ll}{, jj}" format.names.custom purify$
1328 a "{ff~}{vv~}{ll}{, jj}" format.names.custom purify$ =
1329 { #1 'author.duplicate := }
1330 { #0 'author.duplicate := }
1337 FUNCTION {forward.author.share.check}
1339 % Pass through all entries, comparing current author to last one.
1341 { author.duplicate author empty$ or
1342 { author.duplicate { i 'author.shared := }{} if$}
1343 { b "{f.~}{vv~}{ll}{, jj}" format.names.custom purify$
1344 author field.or.null "{f.~}{vv~}{ll}{, jj}" format.names.custom purify$ =
1345 { author.flast 'author.shared := }
1346 { b "{vv~}{ll}" format.names.custom purify$
1347 author field.or.null "{vv~}{ll}" format.names.custom purify$ =
1348 { author.last 'author.shared := }
1349 { author.different 'author.shared := }
1354 author field.or.null 'b :=
1359 FUNCTION {reverse.author}
1363 { i 'author.shared := }
1368 { author.shared i 'author.shared := 'i := }
1369 { author.shared 'i := }
1373 j #1 = author.duplicate not and { #2 'author.duplicate := } {} if$
1374 author.duplicate 'j :=
1377 EXECUTE {init.consts}
1380 ITERATE {forward.author.dup.check}
1383 ITERATE {forward.author.share.check}
1386 REVERSE {reverse.author}
1388 %INTEGERS { number.label longest.label.width }
1390 %FUNCTION {initialize.longest.label}
1391 %{ "" 'longest.label :=
1392 % #1 'number.label :=
1393 % #0 'longest.label.width :=
1396 %FUNCTION {longest.label.pass}
1397 %{ number.label int.to.str$ 'label :=
1398 % number.label #1 + 'number.label :=
1399 % label width$ longest.label.width >
1400 % { label 'longest.label :=
1401 % label width$ 'longest.label.width :=
1407 %EXECUTE {initialize.longest.label}
1409 %ITERATE {longest.label.pass}
1411 FUNCTION {begin.bib}
1414 { preamble$ write$ newline$ }
1416 "\begin{thebibliography}{\rule{.5in}{0pt}}" write$ newline$
1417 "\ifx\undefined\citeN\let\citeN\cite\fi" write$ newline$
1422 ITERATE {call.type$}
1426 "\end{thebibliography}" write$ newline$