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.
40 { author.duplicate author.shared }
43 INTEGERS { output.state before.all mid.sentence after.sentence after.block after.title author.different author.last author.flast }
45 % Rearranged such that true values require capital letters
46 FUNCTION {init.consts}
53 #0 'author.different :=
56 %#3 'author.firstlast :=
59 STRINGS { s t u } % Added u
61 % Puts the period inside any quotes
64 duplicate$ #-1 #3 substring$ "'''" =
65 { duplicate$ text.length$ #3 - text.prefix$ add.period$ "'\thinspace''" * }
66 { duplicate$ #-1 #3 substring$ "''}" =
67 { #2 global.max$ substring$ duplicate$
68 text.length$ #2 - text.prefix$ add.period$ "{" swap$ * "''}" * }
69 { duplicate$ #-1 #2 substring$ "''" =
70 { duplicate$ text.length$ #2 - text.prefix$ add.period$ "''" * }
79 % Switched to do.period and added after.title
80 FUNCTION {output.nonnull}
82 output.state mid.sentence =
84 { output.state after.block =
89 { output.state before.all =
91 { output.state after.title =
93 { do.period " " * write$ }
99 mid.sentence 'output.state :=
112 FUNCTION {output.check}
115 { pop$ "empty " t * " in " * cite$ * warning$ }
120 % Switched to do.period
128 { output.state before.all =
130 { after.block 'output.state := }
134 FUNCTION {new.sentence}
135 { output.state after.block =
137 { output.state before.all =
139 { after.sentence 'output.state := }
146 %{ output.state after.block =
148 % { output.state before.all =
150 % { after.title 'output.state := }
174 FUNCTION {new.block.checka}
181 FUNCTION {new.block.checkb}
190 FUNCTION {new.sentence.checka}
197 FUNCTION {new.sentence.checkb}
206 FUNCTION {field.or.null}
216 { "{\em " swap$ * "}" * }
220 INTEGERS { nameptr namesleft numnames }
222 FUNCTION {format.names.custom}
226 s num.names$ 'numnames :=
227 numnames 'namesleft :=
229 { s nameptr u format.name$ 't :=
246 nameptr #1 + 'nameptr :=
247 namesleft #1 - 'namesleft :=
252 FUNCTION {format.names}
253 { "{ff~}{vv~}{ll}{, jj}" format.names.custom }
255 % Changed first author to last name first
256 FUNCTION {format.names.beginning}
259 s num.names$ 'numnames :=
260 numnames 'namesleft :=
263 { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$
264 duplicate$ #1 #1 substring$ "u" change.case$ swap$
265 duplicate$ #-1 swap$ text.length$ #1 - substring$ * 't := }
266 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
284 nameptr #1 + 'nameptr :=
285 namesleft #1 - 'namesleft :=
290 % Added check for duplicate authors
291 FUNCTION {format.authors}
294 { author.duplicate #1 =
296 { author format.names.beginning }
302 % Changed to MLA editor abbreviations
303 % author.duplicate also applies
304 FUNCTION {format.editors}
307 { author empty$ author.duplicate #1 = and
309 { editor format.names.beginning }
311 editor num.names$ #1 >
319 FUNCTION {format.editors.mid}
323 editor num.names$ #1 >
327 editor format.names *
332 % Formats the address and publisher
333 FUNCTION {format.publisher}
336 { address ": " * publisher * }
340 % Changed to preserve case and use quotes
341 FUNCTION {format.title}
344 { title #1 text.prefix$ "`" =
345 { "``\thinspace" title * "''" * }
346 { "``" title * "''" *}
356 { t #1 #1 substring$ "-" =
357 { t #1 #2 substring$ "--" = not
359 t #2 global.max$ substring$ 't :=
361 { { t #1 #1 substring$ "-" = }
363 t #2 global.max$ substring$ 't :=
369 { t #1 #1 substring$ *
370 t #2 global.max$ substring$ 't :=
377 FUNCTION {format.date}
381 { "there's a month but no year in " cite$ * warning$
388 { month "~" * year * }
394 FUNCTION {format.btitle}
398 FUNCTION {tie.or.space.connect}
399 { duplicate$ text.length$ #3 <
406 FUNCTION {either.or.check}
409 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
413 FUNCTION {format.bvolume.or.num.series}
416 { series field.or.null }
419 { number "there's a number but no series in " cite$ * warning$ }
421 %output.state mid.sentence =
425 number tie.or.space.connect
431 { "Vol." volume tie.or.space.connect
434 { " of " * series emphasize * add.period$ }
438 { number * " vols." * }
440 %"volume and number" number either.or.check
445 FUNCTION {format.number.series}
452 % Changed edition to MLA abbreviation
453 FUNCTION {format.edition}
457 { "Vers.~" version *}
460 { edition "l" change.case$ 's := edition 't :=
462 "10th" "tenth" "9th" "ninth" "8th" "eighth" "7th" "seventh" "6th" "sixth"
463 "5th" "fifth" "4th" "fourth" "3rd" "third" "2nd" "second" "1st" "first"
464 {duplicate$ empty$ { pop$ #0 }{ #1 } if$ }{ s = { 't := }{ pop$ } if$ }
467 "edition and version" version either.or.check
472 INTEGERS { multiresult }
474 FUNCTION {multi.page.check}
483 swap$ duplicate$ "," =
486 { #1 'multiresult := }
487 { t #2 global.max$ substring$ 't := }
494 FUNCTION {format.pages}
497 { %pages multi.page.check
498 % { "pages" pages n.dashify tie.or.space.connect }
499 % { "page" pages tie.or.space.connect }
506 FUNCTION {format.vol.num.year.pages}
510 { "there's a number but no volume in " cite$ * warning$ }
519 " (" * format.date * ")" *
524 { ", " * format.edition * }
528 { ": " * pages n.dashify * }
533 FUNCTION {format.vol.num.pages}
534 { volume field.or.null
537 { "(" number * ")" * *
539 { "there's a number but no volume in " cite$ * warning$ }
547 { pop$ format.pages }
548 { ":" * pages n.dashify * }
554 % chapter might be useful if type is set to "pars."
555 FUNCTION {format.chapter.pages}
560 { type "t" change.case$ }
562 chapter n.dashify tie.or.space.connect
565 { ", " * format.pages * }
571 FUNCTION {format.in.ed.booktitle}
575 { "In " booktitle emphasize * }
576 { booktitle emphasize add.period$ format.editors.mid * }
582 FUNCTION {empty.misc.check}
583 { author empty$ title empty$ howpublished empty$
584 month empty$ year empty$ note empty$
587 { "all relevant fields are empty in " cite$ * warning$ }
592 FUNCTION {format.thesis.type}
596 type "t" change.case$
601 FUNCTION {format.tr.number}
603 { "Technical Report" }
608 { number tie.or.space.connect }
612 FUNCTION {format.url}
616 { "There's a url but no accessdate in " cite$ * warning$ "" }
619 "$<$" * url * "$>$" *
622 { do.period " Path: " * urlpath * }
628 FUNCTION {format.article.crossref}
631 %{ "need key or journal for " cite$ * " to crossref " * crossref *
635 %{ "In {\em " journal * "\/}" * }
640 pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
641 "{" * crossref * "}" *
644 FUNCTION {format.crossref.editor}
645 { editor #1 "{vv~}{ll}" format.name$
646 editor num.names$ duplicate$
651 { editor #2 "{ff }{vv }{ll}{, jj}" format.name$ "others" =
653 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
661 FUNCTION {format.book.crossref}
663 % { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
666 % { "Vol." volume tie.or.space.connect add.period$
670 % editor field.or.null author field.or.null =
674 %{ "need editor, key, or series for " cite$ * " to crossref " *
675 % crossref * warning$
678 %{ "{\em " * series * "\/}" * }
684 % { format.crossref.editor * }
686 %" \citeN{" * crossref * "}" *
687 pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
688 "{" * crossref * "}" *
691 FUNCTION {format.incoll.inproc.crossref}
693 % editor field.or.null author field.or.null =
697 % { "need editor, key, or booktitle for " cite$ * " to crossref " *
698 % crossref * warning$
701 % { "In {\em " booktitle * "\/}" * }
707 % { "In " format.crossref.editor * }
709 % " \citeN{" * crossref * "}" *
710 pages empty$ { " \citeN" } { " \citeN[" format.chapter.pages * "]" * } if$
711 "{" * crossref * "}" *
714 FUNCTION {cite.title}
715 { title empty$ journal empty$ not and
716 { key empty$ { journal }{ key } if$ emphasize }
717 { title empty$ key empty$ and
718 { "empty title and key in " cite$ * warning$ "" }
719 { key empty$ {title}{key} if$
724 type$ "proceedings" =
729 type$ "incollection" =
730 type$ "inproceedings" =
731 type$ "mastersthesis" =
734 type$ "unpublished" =
736 {"``" swap$ * "''" * }
747 FUNCTION {cite.label}
750 % { editor empty$ { organization field.or.null 'a := }{ editor 'a :=} if$}
765 author.shared author.different =
766 { "{vv~}{ll}" format.names.custom }
767 { author.shared author.last =
768 { "{f.~}{vv~}{ll}{, jj}" format.names.custom }
769 { author.shared author.flast =
770 { "{ff~}{vv~}{ll}{, jj}" format.names.custom }
771 { "{vv~}{ll}" format.names.custom ", " * cite.title * }
777 author.duplicate { ", " * cite.title * }{} if$
788 FUNCTION {output.bibitem}
797 before.all 'output.state :=
802 format.authors "author" output.check
804 format.title "title" output.check
807 { journal emphasize "journal" output.check after.title 'output.state :=
808 %format.date "year" output.check
810 format.vol.num.year.pages output
812 { format.article.crossref output.nonnull
826 { format.editors "author and editor" output.check }
827 { format.authors output.nonnull }
830 format.btitle "title" output.check
833 { author empty$ 'skip$ { format.editors.mid output new.sentence } if$
834 format.edition output
836 format.bvolume.or.num.series output
838 format.publisher "publisher" output.check
839 format.date "year" output.check
841 {% format.date "year" output
843 format.book.crossref output.nonnull
855 format.authors output
857 format.title "title" output.check
858 howpublished address new.block.checkb
870 { format.editors "author and editor" output.check }
871 { format.authors output.nonnull }
874 format.btitle "title" output.check
877 { author empty$ 'skip$ { format.editors.mid output new.sentence } if$
878 format.edition output
880 format.bvolume.or.num.series output
882 format.publisher "publisher" output.check
883 format.date "year" output.check
885 format.chapter.pages "chapter and pages" output.check
888 {% format.chapter.pages "chapter and pages" output.check
890 format.book.crossref output.nonnull
899 FUNCTION {incollection}
901 format.authors "author" output.check
903 { new.block type output }
907 format.title "title" output.check
911 booktitle emphasize "booktitle" output.check
913 format.editors.mid "editor" output.check
915 format.edition output
917 format.bvolume.or.num.series output
919 format.publisher "publisher" output.check
921 format.date "year" output.check
923 format.chapter.pages output
925 { format.incoll.inproc.crossref output.nonnull
926 %format.chapter.pages output
936 FUNCTION {inproceedings}
938 format.authors "author" output.check
940 format.title "title" output.check
943 { %format.in.ed.booktitle "booktitle" output.check
944 booktitle "booktitle" output.check
946 format.editors.mid output
948 format.edition output
950 format.bvolume.or.num.series output
952 format.edition output
954 format.publisher output
955 format.date "year" output.check
957 %{ organization publisher new.sentence.checkb
958 % organization output
960 % format.date "year" output.check
962 %{ address output.nonnull
963 % format.date "year" output.check
965 % organization output
972 { format.incoll.inproc.crossref output.nonnull
983 FUNCTION {conference} { inproceedings }
988 { organization empty$
990 { organization output.nonnull
995 { format.authors output.nonnull }
998 format.btitle "title" output.check
1000 format.edition output
1003 { organization empty$
1004 { address new.block.checka
1010 { organization address new.block.checkb
1023 FUNCTION {mastersthesis}
1025 format.authors "author" output.check
1027 format.title "title" output.check
1029 "Diss." format.thesis.type output.nonnull
1030 after.title 'output.state :=
1031 school "school" output.check
1033 format.date "year" output.check
1043 format.authors output
1044 title howpublished new.block.checkb
1047 %howpublished new.block.checka
1058 FUNCTION {phdthesis}
1060 format.authors "author" output.check
1062 format.btitle "title" output.check
1064 "Diss." format.thesis.type output.nonnull
1065 after.title 'output.state :=
1066 school "school" output.check
1068 format.date "year" output.check
1076 FUNCTION {proceedings}
1079 { organization output }
1080 { format.editors output.nonnull }
1083 format.btitle "title" output.check
1085 format.bvolume.or.num.series output
1088 { publisher new.sentence.checka }
1089 { organization publisher new.sentence.checkb
1094 format.date "year" output.check
1096 { address output.nonnull
1097 format.date "year" output.check
1101 { organization output }
1113 FUNCTION {techreport}
1115 format.authors "author" output.check
1117 format.title "title" output.check
1119 format.tr.number output.nonnull
1120 institution "institution" output.check
1122 format.date "year" output.check
1128 FUNCTION {unpublished}
1130 format.authors "author" output.check
1132 format.title "title" output.check
1136 note "note" output.check
1141 FUNCTION {default.type} { misc }
1143 MACRO {jan} {"Jan."}
1145 MACRO {feb} {"Feb."}
1147 MACRO {mar} {"Mar."}
1149 MACRO {apr} {"Apr."}
1153 MACRO {jun} {"June"}
1155 MACRO {jul} {"July"}
1157 MACRO {aug} {"Aug."}
1159 MACRO {sep} {"Sept."}
1161 MACRO {oct} {"Oct."}
1163 MACRO {nov} {"Nov."}
1165 MACRO {dec} {"Dec."}
1167 MACRO {acmcs} {"ACM Computing Surveys"}
1169 MACRO {acta} {"Acta Informatica"}
1171 MACRO {cacm} {"Communications of the ACM"}
1173 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1175 MACRO {ibmsj} {"IBM Systems Journal"}
1177 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1179 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1182 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1184 MACRO {ipl} {"Information Processing Letters"}
1186 MACRO {jacm} {"Journal of the ACM"}
1188 MACRO {jcss} {"Journal of Computer and System Sciences"}
1190 MACRO {scp} {"Science of Computer Programming"}
1192 MACRO {sicomp} {"SIAM Journal on Computing"}
1194 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1196 MACRO {tods} {"ACM Transactions on Database Systems"}
1198 MACRO {tog} {"ACM Transactions on Graphics"}
1200 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1202 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1204 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1206 MACRO {tcs} {"Theoretical Computer Science"}
1217 FUNCTION {chop.word}
1220 s #1 len substring$ =
1221 { s len #1 + global.max$ substring$ }
1226 FUNCTION {sort.format.names}
1230 s num.names$ 'numnames :=
1231 numnames 'namesleft :=
1237 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1238 nameptr numnames = t "others" = and
1242 nameptr #1 + 'nameptr :=
1243 namesleft #1 - 'namesleft :=
1248 FUNCTION {sort.format.title}
1252 "The " #4 t chop.word
1256 #1 global.max$ substring$
1259 FUNCTION {author.sort}
1262 { "to sort, need author or key in " cite$ * warning$
1268 { author sort.format.names }
1272 FUNCTION {author.editor.sort}
1276 { "to sort, need author, editor, or key in " cite$ * warning$
1282 { editor sort.format.names }
1285 { author sort.format.names }
1289 FUNCTION {author.organization.sort}
1291 { organization empty$
1293 { "to sort, need author, organization, or key in " cite$ * warning$
1299 { "The " #4 organization chop.word sortify }
1302 { author sort.format.names }
1306 FUNCTION {editor.organization.sort}
1308 { organization empty$
1310 { "to sort, need editor, organization, or key in " cite$ * warning$
1316 { "The " #4 organization chop.word sortify }
1319 { editor sort.format.names }
1328 { type$ "proceedings" =
1329 'editor.organization.sort
1331 'author.organization.sort
1338 duplicate$ empty$ 'skip$ { " " * } if$
1340 { title field.or.null sort.format.title * " " * booktitle field.or.null sort.format.title * }
1345 year field.or.null sortify
1347 #1 entry.max$ substring$
1358 FUNCTION {init.vars}
1359 { #0 int.to.chr$ 'a :=
1360 #0 int.to.chr$ 'b :=
1365 FUNCTION {forward.author.dup.check}
1368 { editor empty$ { organization field.or.null 'a := }{ editor 'a :=} if$}
1374 { b "{ff~}{vv~}{ll}{, jj}" format.names.custom purify$
1375 a "{ff~}{vv~}{ll}{, jj}" format.names.custom purify$ =
1376 { #1 'author.duplicate := }
1377 { #0 'author.duplicate := }
1384 FUNCTION {forward.author.share.check}
1386 % Pass through all entries, comparing current author to last one.
1388 { author.duplicate author empty$ or
1389 { author.duplicate { i 'author.shared := }{} if$}
1390 { b "{f.~}{vv~}{ll}{, jj}" format.names.custom purify$
1391 author field.or.null "{f.~}{vv~}{ll}{, jj}" format.names.custom purify$ =
1392 { author.flast 'author.shared := }
1393 { b "{vv~}{ll}" format.names.custom purify$
1394 author field.or.null "{vv~}{ll}" format.names.custom purify$ =
1395 { author.last 'author.shared := }
1396 { author.different 'author.shared := }
1401 author field.or.null 'b :=
1406 FUNCTION {reverse.author}
1410 { i 'author.shared := }
1415 { author.shared i 'author.shared := 'i := }
1416 { author.shared 'i := }
1420 j #1 = author.duplicate not and { #2 'author.duplicate := } {} if$
1421 author.duplicate 'j :=
1424 EXECUTE {init.consts}
1427 ITERATE {forward.author.dup.check}
1430 ITERATE {forward.author.share.check}
1433 REVERSE {reverse.author}
1435 %INTEGERS { number.label longest.label.width }
1437 %FUNCTION {initialize.longest.label}
1438 %{ "" 'longest.label :=
1439 % #1 'number.label :=
1440 % #0 'longest.label.width :=
1443 %FUNCTION {longest.label.pass}
1444 %{ number.label int.to.str$ 'label :=
1445 % number.label #1 + 'number.label :=
1446 % label width$ longest.label.width >
1447 % { label 'longest.label :=
1448 % label width$ 'longest.label.width :=
1454 %EXECUTE {initialize.longest.label}
1456 %ITERATE {longest.label.pass}
1458 FUNCTION {begin.bib}
1461 { preamble$ write$ newline$ }
1463 "\begin{thebibliography}{\rule{.5in}{0pt}}" write$ newline$
1464 "\ifx\undefined\citeN\let\citeN\cite\fi" write$ newline$
1469 ITERATE {call.type$}
1473 "\end{thebibliography}" write$ newline$