2 %%% ====================================================================
3 %%% @BibTeX-style-file{
4 %%% author = "Nelson H. F. Beebe, Boris Veytsman and Gerald Murray",
6 %%% date = "14 June 2017",
7 %%% filename = "ACM-Reference-Format.bst",
8 %%% email = "borisv@lk.net, boris@varphi.com",
9 %%% codetable = "ISO/ASCII",
10 %%% keywords = "ACM Transactions bibliography style; BibTeX",
11 %%% license = "public domain",
12 %%% supported = "yes",
15 %%% ====================================================================
17 %%% Revision history: see source in git
51 issue % UTAH: used in, e.g., ACM SIGSAM Bulletin and ACM Communications in Computer Algebra
54 day % UTAH: needed for newspapers, weeklies, bi-weeklies
59 lastaccessed % UTAH: used only for @Misc{...}
67 { label.year extra.label sort.year sort.label basic.label.year}
69 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
71 INTEGERS { show-isbn-10-and-13 } % initialized below in begin.bib
73 INTEGERS { nameptr namesleft numnames }
75 INTEGERS { multiresult }
79 INTEGERS { last.extra.num }
81 STRINGS { s t t.org u }
83 STRINGS { last.label next.extra }
85 STRINGS { p1 p2 p3 page.count }
110 FUNCTION { dump.stack.1 }
112 duplicate$ "STACK[top] = [" swap$ * "]" * warning$
115 FUNCTION { dump.stack.2 }
117 duplicate$ "STACK[top ] = [" swap$ * "]" * warning$
119 duplicate$ "STACK[top-1] = [" swap$ * "]" * warning$
123 FUNCTION { empty.or.unknown }
125 %% Examine the top stack entry, and push 1 if it is empty, or
126 %% consists only of whitespace, or is a string beginning with two
127 %% queries (??), and otherwise, push 0.
129 %% This function provides a replacement for empty$, with the
130 %% convenient feature that unknown values marked by two leading
131 %% queries are treated the same as missing values, and thus, do not
132 %% appear in the output .bbl file, and yet, their presence in .bib
133 %% file(s) serves to mark values which are temporarily missing, but
134 %% are expected to be filled in eventually once more data is
135 %% obtained. The TeX User Group and BibNet bibliography archives
136 %% make extensive use of this practice.
138 %% An empty string cannot serve the same purpose, because just as in
139 %% statistics data processing, an unknown value is not the same as an
142 %% At entry: stack = ... top:[string]
143 %% At exit: stack = ... top:[0 or 1]
147 { #1 #2 substring$ "??" = }
153 %% In BibTeX style files, the sequences
155 %% ... "one" "two" output
156 %% ... "one" "two" output.xxx
158 %% ship "one" to the output file, possibly following by punctuation,
159 %% leaving the stack with
163 %% There is thus a one-string lag in output processing that must be
164 %% carefully handled to avoid duplicating a string in the output
165 %% file. Unless otherwise noted, all output.xxx functions leave
166 %% just one new string on the stack, and that model should be born
167 %% in mind when reading or writing function code.
169 %% BibTeX's asynchronous buffering of output from strings from the
170 %% stack is confusing because newline$ bypasses the buffer. It
171 %% would have been so much easier for newline to be a character
172 %% rather than a state of the output-in-progress.
174 %% The documentation in btxhak.dvi is WRONG: it says
176 %% newline$ Writes onto the bbl file what's accumulated in the
177 %% output buffer. It writes a blank line if and only
178 %% if the output buffer is empty. Since write$ does
179 %% reasonable line breaking, you should use this
180 %% function only when you want a blank line or an
181 %% explicit line break.
183 %% write$ Pops the top (string) literal and writes it on the
184 %% output buffer (which will result in stuff being
185 %% written onto the bbl file when the buffer fills
188 %% Examination of the BibTeX source code shows that write$ does
189 %% indeed behave as claimed, but newline$ sends a newline character
190 %% directly to the output file, leaving the stack unchanged. The
191 %% first line "Writes onto ... buffer." is therefore wrong.
193 %% The original BibTeX style files almost always use "write$ newline$"
194 %% in that order, so it makes sense to hide that pair in a private
195 %% function like this one, named after a statement in Pascal,
196 %% the programming language embedded in the BibTeX Web program.
198 write$ % output top-of-stack string
199 newline$ % immediate write of newline (not via stack)
202 FUNCTION { init.state.consts }
206 #2 'after.sentence :=
210 FUNCTION { output.nonnull }
211 { % Stack in: ... R S T Stack out: ... R T File out: S<comma><space>
213 output.state mid.sentence =
218 output.state after.block =
224 output.state before.all =
229 add.period$ " " * write$
234 mid.sentence 'output.state :=
240 FUNCTION { output.nonnull.dot.space }
241 { % Stack in: ... R S T Stack out: ... R T File out: S<dot><space>
243 output.state mid.sentence = % { "<DEBUG output.nonnull.dot.space>. " * write$ }
248 output.state after.block =
250 add.period$ writeln "\newblock " write$
253 output.state before.all =
258 add.period$ " " * write$
263 mid.sentence 'output.state :=
269 FUNCTION { output.nonnull.remove }
270 { % Stack in: ... R S T Stack out: ... R T File out: S<space>
272 output.state mid.sentence =
277 output.state after.block =
279 add.period$ writeln "\newblock " write$
282 output.state before.all =
287 add.period$ " " * write$
292 mid.sentence 'output.state :=
298 FUNCTION { output.nonnull.removenospace }
299 { % Stack in: ... R S T Stack out: ... R T File out: S
301 output.state mid.sentence =
306 output.state after.block =
308 add.period$ writeln "\newblock " write$
311 output.state before.all =
316 add.period$ " " * write$
321 mid.sentence 'output.state :=
328 { % discard top token if empty, else like output.nonnull
329 duplicate$ empty.or.unknown
335 FUNCTION { output.dot.space }
336 { % discard top token if empty, else like output.nonnull.dot.space
337 duplicate$ empty.or.unknown
339 'output.nonnull.dot.space
343 FUNCTION { output.removenospace }
344 { % discard top token if empty, else like output.nonnull.removenospace
345 duplicate$ empty.or.unknown
347 'output.nonnull.removenospace
351 FUNCTION { output.check }
352 { % like output, but warn if key name on top-of-stack is not set
354 duplicate$ empty.or.unknown
355 { pop$ "empty " t * " in " * cite$ * warning$ }
360 FUNCTION { bibinfo.output.check }
361 { % like output.check, adding bibinfo field
363 duplicate$ empty.or.unknown
364 { pop$ "empty " t * " in " * cite$ * warning$ }
365 { "\bibinfo{" t "}{" * * swap$ * "}" *
370 FUNCTION { output.check.dot.space }
371 { % like output.dot.space, but warn if key name on top-of-stack is not set
373 duplicate$ empty.or.unknown
374 { pop$ "empty " t * " in " * cite$ * warning$ }
375 'output.nonnull.dot.space
379 FUNCTION { fin.block }
380 { % functionally, but not logically, identical to fin.entry
385 FUNCTION { fin.entry }
391 FUNCTION { new.sentence }
392 { % update sentence state, with neither output nor stack change
393 output.state after.block =
396 output.state before.all =
398 { after.sentence 'output.state := }
404 FUNCTION { fin.sentence }
412 FUNCTION { new.block }
414 output.state before.all =
416 { after.block 'output.state := }
420 FUNCTION { output.coden } % UTAH
421 { % output non-empty CODEN as one-line sentence (stack untouched)
422 coden empty.or.unknown
424 { "\showCODEN{" coden * "}" * writeln }
428 FUNCTION { format.articleno }
430 articleno empty.or.unknown not eid empty.or.unknown not and
431 { "Both articleno and eid are defined for " cite$ * warning$ }
434 articleno empty.or.unknown eid empty.or.unknown and
437 numpages empty.or.unknown
438 { "articleno or eid field, but no numpages field, in "
443 { "Article \bibinfo{articleno}{" articleno * "}" * }
444 { "Article \bibinfo{articleno}{" eid * "}" * }
450 FUNCTION { format.year }
451 { % push year string or "[n. d.]" onto output stack
452 %% Because year is a mandatory field, we always force SOMETHING
455 year empty.or.unknown
462 FUNCTION { format.day.month }
463 { % push "day month " or "month " or "" onto output stack
466 month empty.or.unknown
468 { "\bibinfo{date}{" month * "} " *}
472 month empty.or.unknown
474 { "\bibinfo{date}{" day * " " * month * "} " *}
480 FUNCTION { format.day.month.year } % UTAH
481 { % if month is empty, push "" else push "(MON.)" or "(DD MON.)"
482 % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
483 % acm-*.bst addition: prefix parenthesized date string with
485 articleno empty.or.unknown eid empty.or.unknown and
487 { output.state after.block =
488 {", " format.articleno * }
493 " (" * format.day.month * format.year * ")" *
496 FUNCTION { output.day.month.year } % UTAH
497 { % if month is empty value, do nothing; else output stack top and
498 % leave with new top string "(MON.)" or "(DD MON.)"
499 % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
500 format.day.month.year
501 output.nonnull.remove
504 FUNCTION { strip.doi } % UTAH
505 { % Strip any Web address prefix to recover the bare DOI, leaving the
506 % result on the output stack, as recommended by CrossRef DOI
508 % For example, reduce "http://doi.acm.org/10.1145/1534530.1534545" to
509 % "10.1145/1534530.1534545". That is later typeset and displayed as
510 % doi:10.1145/1534530.1534545 as the LAST item in the reference list
511 % entry. Publisher Web sites wrap this with a suitable link to a real
512 % URL to resolve the DOI, and the master https://doi.org/ address is
513 % preferred, since publisher-specific URLs can disappear in response
514 % to economic events. All journals are encouraged by the DOI
515 % authorities to use that typeset format and link procedures for
516 % uniformity across all publications that include DOIs in reference
518 % The numeric prefix is guaranteed to start with "10.", so we use
520 % 2017-02-04 Added stripping of https:// (Boris)
521 doi #1 #3 substring$ "10." =
524 doi 't := % get modifiable copy of DOI
526 % Change https:// to http:// to strip both prefixes (BV)
528 t #1 #8 substring$ "https://" =
529 { "http://" t #9 t text.length$ #8 - substring$ * 't := }
533 t #1 #7 substring$ "http://" =
535 t #8 t text.length$ #7 - substring$ 't :=
537 "INTERNAL STYLE-FILE ERROR" 's :=
539 % search for next "/" and assign its suffix to s
543 t #1 #1 substring$ "/" =
545 % save rest of string as true DOI (should be 10.xxxx/yyyy)
546 t #2 t text.length$ #1 - substring$ 's :=
547 "" 't := % empty string t terminates the loop
550 % discard first character and continue loop: t <= substring(t,2,last)
551 t #2 t text.length$ #1 - substring$ 't :=
557 % check for valid DOI (should be 10.xxxx/yyyy)
558 s #1 #3 substring$ "10." =
560 { "unrecognized DOI substring " s * " in DOI value [" * doi * "]" * warning$ }
563 s % push the stripped DOI on the output stack
567 "unrecognized DOI value [" doi * "]" * warning$
568 doi % push the unrecognized original DOI on the output stack
576 % Change by BV: added standard prefix to URL
578 FUNCTION { output.doi } % UTAH
579 { % output non-empty DOI as one-line sentence (stack untouched)
583 %% Use \urldef here for the same reason it is used in output.url,
584 %% see output.url for further discussion.
585 "\urldef\tempurl%" writeln
586 "\url{https://doi.org/" strip.doi * "}" * writeln
587 "\showDOI{\tempurl}" writeln
592 FUNCTION { output.isbn } % UTAH
593 { % output non-empty ISBN-10 and/or ISBN-13 as one-line sentences (stack untouched)
596 %% show both 10- and 13-digit ISBNs
597 isbn empty.or.unknown
600 "\showISBNx{" isbn * "}" * writeln
603 isbn-13 empty.or.unknown
606 "\showISBNxiii{" isbn-13 * "}" * writeln
611 %% show 10-digit ISBNs only if 13-digit ISBNs not available
612 isbn-13 empty.or.unknown
614 isbn empty.or.unknown
617 "\showISBNx{" isbn * "}" * writeln
622 "\showISBNxiii{" isbn-13 * "}" * writeln
629 FUNCTION { output.issn } % UTAH
630 { % output non-empty ISSN as one-line sentence (stack untouched)
631 issn empty.or.unknown
633 { "\showISSN{" issn * "}" * writeln }
637 FUNCTION { output.issue }
638 { % output non-empty issue number as a one-line sentence (stack untouched)
639 issue empty.or.unknown
641 { "Issue " issue * "." * writeln }
645 FUNCTION { output.lccn } % UTAH
646 { % return with stack untouched
647 lccn empty.or.unknown
649 { "\showLCCN{" lccn * "}" * writeln }
653 FUNCTION { output.note } % UTAH
654 { % return with stack empty
655 note empty.or.unknown
657 { "\shownote{" note add.period$ * "}" * writeln }
661 FUNCTION { output.note.check } % UTAH
662 { % return with stack empty
663 note empty.or.unknown
664 { "empty note in " cite$ * warning$ }
665 { "\shownote{" note add.period$ * "}" * writeln }
669 FUNCTION { output.eprint } %
670 { % return with stack empty
671 eprint empty.or.unknown
674 archiveprefix empty.or.unknown
675 { eprinttype empty.or.unknown
677 { "[" eprinttype "]" * * * }
680 { "[" archiveprefix "l" change.case$ "]" * * * }
683 primaryclass empty.or.unknown
684 { eprintclass empty.or.unknown
686 { eprintclass "/" * * }
689 { primaryclass "/" * * }
699 % Changes by BV 2011/04/15. Do not output
700 % url if doi is defined
702 FUNCTION { output.url } % UTAH
703 { % return with stack untouched
704 % output URL and associated lastaccessed fields
710 %% Use \urldef, outside \showURL, so that %nn, #, etc in URLs work
711 %% correctly. Put the actual URL on its own line to reduce the
712 %% likelihood of BibTeX's nasty line wrapping after column 79.
713 %% \url{} can undo this, but if that doesn't work for some reason
714 %% the .bbl file would have to be repaired manually.
715 "\urldef\tempurl%" writeln
716 "\url{" url * "}" * writeln
719 lastaccessed empty.or.unknown
721 { "Retrieved " lastaccessed * " from " * }
723 "\tempurl}" * writeln
731 FUNCTION { output.year.check }
732 { % warn if year empty, output top string and leave " YEAR<label>" on stack in mid-sentence
733 year empty.or.unknown
734 { "empty year in " cite$ * warning$
736 " \bibinfo{year}{[n. d.]}"
737 "\natexlab{" extra.label * "}" * *
738 mid.sentence 'output.state :=
741 " \bibinfo{year}{" year * "}" *
742 "\natexlab{" extra.label * "}" * *
743 mid.sentence 'output.state :=
751 %% test whether first number is less than or equal to second number
753 %% stack out: if n1 <= n2 then 1 else 0
755 %% "DEBUG: le " cite$ * warning$
761 %% test whether first number is greater than or equal to second number
763 %% stack out: if n1 >= n2 then 1 else 0
765 %% "DEBUG: ge " cite$ * warning$
769 FUNCTION { is.leading.digit }
771 %% test whether first character of string is a digit
773 %% stack out: if first-char-is-digit then 1 else 0
775 #1 #1 substring$ % replace string by string[1:1]
776 duplicate$ % string[1:1] string[1:1]
778 "0" chr.to.int$ swap$ le % "0" <= string[1:1] --> 0-or-1
779 swap$ % 0-or-1 string[1:1]
781 "9" chr.to.int$ le % string[1:1} <= "9" --> 0-or-1
785 FUNCTION { skip.digits }
787 %% skip over leading digits in string
789 %% stack out: rest-of-string leading-digits
791 %% "DEBUG: enter skip.digits " cite$ * warning$
802 %% "=================DEBUG: skip.digits t = [" t * "]" * warning$
804 { t #2 t text.length$ #1 - substring$ }
815 t.org #1 t.org text.length$ u text.length$ - substring$ % leading digits
817 %% "DEBUG: t.org = [" t.org * "]" * warning$
818 %% "DEBUG: u = [" u * "]" * warning$
822 %% "DEBUG: leave skip.digits " cite$ * warning$
825 FUNCTION { skip.nondigits }
827 %% skip over leading nondigits in string
829 %% stack out: rest-of-string
831 %% "DEBUG: enter skip.nondigits " cite$ * warning$
838 %% "=================DEBUG: skip.nondigits t = [" t * "]" * warning$
844 { t #2 t text.length$ #1 - substring$ }
853 %% "DEBUG: leave skip.nondigits " cite$ * warning$
856 FUNCTION { parse.next.number }
859 %% stack out: rest-of-string next-numeric-part-of-string
861 %% stack in: "123:1--123:59"
862 %% stack out: ":1--123:59" "123"
865 s skip.nondigits 's :=
869 FUNCTION { reduce.pages.to.page.count }
871 %% Stack in: arbitrary-and-unused
872 %% Stack out: unchanged
874 %% For the new-style pagination with article number and numpages or
875 %% pages, we expect to have BibTeX entries containing something like
878 %% with output "Article 17, 23 pages",
882 %% with output "Article 17, 23 pages",
885 %% pages = "17:1--17:23",
886 %% with output "Article 17, 23 pages",
888 %% If articleno is missing or empty, then we should output "1--23",
889 %% "23" (with a warning of a missing articleno), or "17:1--17:23",
892 %% "DEBUG: enter reduce.pages.to.page.count " cite$ * warning$
894 %% "DEBUG: pages = [" pages * "]" * warning$
897 parse.next.number 'p1 :=
898 parse.next.number 'p2 :=
899 parse.next.number 'p3 :=
900 parse.next.number 'page.count :=
906 duplicate$ "unexpected trailing garbage [" swap$ *
907 "] after n:p1--n:p2 in pages = [" *
917 %% "DEBUG: reduce.pages.to.page.count: "
921 %% " p4 = " page.count * *
922 %% " in " cite$ * * warning$
924 p1 p3 = p2 "1" = and numpages empty.or.unknown and
925 { "INFO: reduced pages = [" pages * "] to numpages = [" * page.count * "]" * warning$ }
927 numpages empty.or.unknown
935 p1 "1" = p3 empty.or.unknown and numpages empty.or.unknown and
938 "INFO: reduced pages = [" pages * "] to numpages = [" * page.count * "]" * warning$
941 numpages empty.or.unknown
949 %% "DEBUG: leave reduce.pages.to.page.count " cite$ * warning$
952 FUNCTION { new.block.checkb }
953 { % issue a new.block only if at least one of top two stack strings is not empty
955 swap$ empty.or.unknown
962 FUNCTION { field.or.null }
963 { % convert empty value to null string, else return value
964 duplicate$ empty.or.unknown
972 FUNCTION { emphasize }
973 { % emphasize a non-empty top string on the stack
974 duplicate$ empty.or.unknown
976 { "\emph{" swap$ * "}" * }
981 { % convert empty string to null string, or brace string and add trailing comma
982 duplicate$ empty.or.unknown
984 { "{" swap$ * "}," * }
988 FUNCTION { format.names }
990 % Format bibliographical entries with the first author last name first,
991 % and subsequent authors with initials followed by last name.
992 % All names are formatted in this routine.
995 #1 'nameptr := % nameptr = 1;
996 s num.names$ 'numnames := % numnames = num.name$(s);
997 numnames 'namesleft :=
1000 %NO: BAD ORDER: {"{" s nameptr "{ff~}{ll}{, jj}{, vv}" format.name$ * "}" * 't := }
1001 %NO: BAD ORDER: {"{" s nameptr "{ff~}{ll}{, jj}{, vv}" format.name$ * "}" * 't := }
1002 {"\bibinfo{person}{" s nameptr "{ff }{vv }{ll}{, jj}" format.name$ * "}" * 't := }
1003 {"\bibinfo{person}{" s nameptr "{ff }{vv }{ll}{, jj}" format.name$ * "}" * 't := }
1014 t "\bibinfo{person}{others}" =
1015 { " {et~al\mbox{.}}" * } % jrh: avoid spacing problems
1016 { " {and} " * t * } % from Chicago Manual of Style
1023 nameptr #1 + 'nameptr := % nameptr += 1;
1024 namesleft #1 - 'namesleft := % namesleft =- 1;
1029 FUNCTION { my.full.label }
1032 #1 'nameptr := % nameptr = 1;
1033 s num.names$ 'numnames := % numnames = num.name$(s);
1034 numnames 'namesleft :=
1037 { s nameptr "{vv~}{ll}" format.name$ 't := % get the next name
1048 { " et~al\mbox{.}" * } % jrh: avoid spacing problems
1049 { " and " * t * } % from Chicago Manual of Style
1056 nameptr #1 + 'nameptr := % nameptr += 1;
1057 namesleft #1 - 'namesleft := % namesleft =- 1;
1063 FUNCTION { format.names.fml }
1065 % Format names in "familiar" format, with first initial followed by
1066 % last name. Like format.names, ALL names are formatted.
1067 % jtb: The names are NOT put in small caps
1070 #1 'nameptr := % nameptr = 1;
1071 s num.names$ 'numnames := % numnames = num.name$(s);
1072 numnames 'namesleft :=
1076 "\bibinfo{person}{" s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ * "}" * 't :=
1087 t "\bibinfo{person}{others}" =
1088 { " {et~al\mbox{.}}" * }
1096 nameptr #1 + 'nameptr := % nameptr += 1;
1097 namesleft #1 - 'namesleft := % namesleft =- 1;
1102 FUNCTION { format.authors }
1104 author empty.or.unknown
1107 "\bibfield{author}{"
1108 author format.names add.period$ * "}" *} % jtb: add period if none before
1112 FUNCTION { format.key }
1115 { key field.or.null }
1120 FUNCTION { format.no.key }
1128 FUNCTION { format.editors.fml }
1130 % Format editor names for use in the "in" types: inbook, incollection,
1131 % inproceedings: first initial, then last names. When editors are the
1132 % LABEL for an entry, then format.editor is used which lists editors
1133 % by last name first.
1135 editor empty.or.unknown
1138 "\bibfield{editor}{"
1139 editor format.names.fml
1141 editor num.names$ #1 >
1149 FUNCTION { format.editors }
1150 { % format editor names for use in labels, last names first.
1151 editor empty.or.unknown
1154 "\bibfield{editor}{"
1157 editor num.names$ #1 >
1165 FUNCTION { format.articletitle }
1167 title empty.or.unknown
1169 % Use this to preserve lettercase in titles:
1170 { "\showarticletitle{" title * "}" * }
1171 % Use this for downcase title style:
1172 % { \showarticletitle{" title "t" change.case$ * "}" * }
1176 FUNCTION { format.title }
1178 title empty.or.unknown
1180 % Use this to preserve lettercase in titles:
1181 { "\bibinfo{title}{" title * "}" * }
1182 % Use this for downcase title style:
1183 % { title "t" change.case$ }
1187 FUNCTION { n.dashify }
1191 { t empty.or.unknown not }
1193 t #1 #1 substring$ "-" =
1195 t #1 #2 substring$ "--" = not
1197 t #2 global.max$ substring$ 't :=
1200 { t #1 #1 substring$ "-" = }
1203 t #2 global.max$ substring$ 't :=
1210 t #1 #1 substring$ *
1211 t #2 global.max$ substring$ 't :=
1218 FUNCTION { format.a.title.with.edition }
1220 "\bibinfo{booktitle}{"
1222 edition empty.or.unknown
1224 { " (\bibinfo{edition}{" * edition "l" change.case$ *
1225 "} ed.)" * } % jtb: no parens for ed.
1230 FUNCTION { format.btitle }
1231 { title format.a.title.with.edition }
1233 FUNCTION { format.emphasize.booktitle }
1234 { booktitle format.a.title.with.edition }
1236 FUNCTION { format.city }
1238 % jtb: if the preceding string (the title of the conference) is non-empty,
1239 % jtb: append the location, otherwise leave empty (so as to trigger the
1240 % jtb: error message in output.check
1242 duplicate$ empty.or.unknown
1245 city empty.or.unknown
1247 date empty.or.unknown
1249 { " (" * date * ")" * }
1253 date empty.or.unknown
1254 { " (" * city * ")" * }
1255 { " (" * city * ", " * date * ")" * }
1263 FUNCTION { tie.or.space.connect }
1265 duplicate$ text.length$ #3 <
1272 FUNCTION { either.or.check }
1276 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
1280 FUNCTION { format.bvolume }
1282 % jtb: If there is a series, this is added and the volume trails after it.
1283 % jtb: Otherwise, "Vol" is Capitalized.
1285 volume empty.or.unknown
1288 series empty.or.unknown
1289 { "Vol.~\bibinfo{volume}{" volume "}" * *}
1290 { "\bibinfo{series}{" series "}, " * *
1291 "Vol.~\bibinfo{volume}{" volume "}" * * *}
1293 "volume and number" number either.or.check
1298 FUNCTION { format.bvolume.noseries }
1300 volume empty.or.unknown
1302 { "Vol.~\bibinfo{volume}{" volume "}" * *
1303 "volume and number" number either.or.check
1308 FUNCTION { format.series }
1310 series empty.or.unknown
1312 {" \emph{(\bibinfo{series}{" * series "})}" *}
1316 FUNCTION { format.number.series }
1318 volume empty.or.unknown
1320 number empty.or.unknown
1322 volume empty.or.unknown
1325 series empty.or.unknown
1327 { " (\bibinfo{series}{" series * "})" * }
1331 } % { series field.or.null }
1333 output.state mid.sentence =
1334 { "Number" } % gnp - changed to mixed case always
1337 number tie.or.space.connect series empty.or.unknown
1338 { "there's a number but no series in " cite$ * warning$ }
1339 { " in \bibinfo{series}{" * series * "}" * }
1350 FUNCTION { multi.page.check }
1355 t empty.or.unknown not
1358 { t #1 #1 substring$
1360 swap$ duplicate$ "," =
1363 { #1 'multiresult := }
1364 { t #2 global.max$ substring$ 't := }
1371 FUNCTION { format.pages }
1373 pages empty.or.unknown
1375 { "\bibinfo{pages}{"
1376 pages multi.page.check
1377 { pages n.dashify } % gnp - removed () % jtb: removed pp.
1385 FUNCTION { format.pages.check.without.articleno }
1386 { %% format pages field only if articleno is absent
1387 %% Stack out: pages-specification
1388 numpages missing$ pages missing$ and
1389 { "page numbers missing in both pages and numpages fields in " cite$ * warning$ }
1393 articleno empty.or.unknown eid empty.or.unknown and
1404 FUNCTION { format.pages.check }
1406 pages empty.or.unknown
1407 { "page numbers missing in " cite$ * warning$ "" }
1412 FUNCTION { format.bookpages }
1414 bookpages empty.or.unknown
1416 { bookpages "book pages" tie.or.space.connect }
1420 FUNCTION { format.named.pages }
1422 pages empty.or.unknown
1424 { format.pages "pages" tie.or.space.connect }
1429 % Changed by Boris Veytsman, 2011-03-13
1430 % Now the word "pages" is printed even if
1431 % there field pages is not empty.
1434 FUNCTION { format.page.count }
1436 page.count empty.or.unknown
1438 { "\bibinfo{numpages}{" page.count * "}~pages" * }
1442 FUNCTION { format.articleno.numpages }
1444 %% There are seven possible outputs, depending on which fields are set.
1446 %% These four are handled here:
1448 %% articleno, numpages, pages -> "Article articleno-value, numpages-value pages"
1449 %% articleno, numpages -> "Article articleno-value, numpages-value pages"
1450 %% articleno, pages -> "Article articleno-value, reduced-pages-value pages"
1451 %% articleno -> "Article articleno-value" and warn about missing numpages
1453 %% The remaining three have already been handled by
1454 %% format.pages.check.without.articleno:
1456 %% numpages, pages -> "pages-value"
1457 %% numpages -> "numpages-value"
1458 %% pages -> "pages-value"
1460 articleno empty.or.unknown eid empty.or.unknown and
1462 numpages empty.or.unknown
1464 { "numpages field, but no articleno or eid field, in "
1470 numpages empty.or.unknown
1472 pages empty.or.unknown
1474 "articleno or eid, but no pages or numpages field in "
1478 { reduce.pages.to.page.count }
1481 { numpages 'page.count := }
1484 %% The Article number is now handled in format.day.month.year because
1485 %% ACM prefers the style "Digital Libraries 12, 3, Article 5 (July 2008)"
1486 %% over "Digital Libraries 12, 3 (July 2008), Article 5"
1487 %% format.articleno output
1493 FUNCTION {calc.format.page.count}
1495 numpages empty.or.unknown
1497 pages empty.or.unknown
1501 { reduce.pages.to.page.count }
1504 { numpages 'page.count := }
1510 FUNCTION { journal.canon.abbrev }
1512 % Returns a canonical abbreviation for 'journal', or else 'journal'
1514 journal "ACM Computing Surveys" = { "Comput. Surveys" } {
1515 journal "{ACM} Computing Surveys" = { "Comput. Surveys" } {
1516 journal "ACM Transactions on Mathematical Software" = { "ACM Trans. Math. Software" } {
1517 journal "{ACM} Transactions on Mathematical Software" = { "ACM Trans. Math. Software" } {
1518 journal "ACM SIGNUM Newsletter" = { "ACM SIGNUM Newslett." } {
1519 journal "ACM {SIGNUM} Newsletter" = { "ACM SIGNUM Newslett." } {
1520 journal "{ACM} SIGNUM Newsletter" = { "ACM SIGNUM Newslett." } {
1521 journal "{ACM} {SIGNUM} Newsletter" = { "ACM SIGNUM Newslett." } {
1522 journal "American Journal of Sociology" = { "Amer. J. Sociology" } {
1523 journal "American Mathematical Monthly" = { "Amer. Math. Monthly" } {
1524 journal "American Mathematical Society Translations" = { "Amer. Math. Soc. Transl." } {
1525 journal "Applied Mathematics and Computation" = { "Appl. Math. Comput." } {
1526 journal "British Journal of Mathematical and Statistical Psychology" = { "Brit. J. Math. Statist. Psych." } {
1527 journal "Bulletin of the American Mathematical Society" = { "Bull. Amer. Math. Soc." } {
1528 journal "Canadian Mathematical Bulletin" = { "Canad. Math. Bull." } {
1529 journal "Communications of the ACM" = { "Commun. ACM" } {
1530 journal "Communications of the {ACM}" = { "Commun. ACM" } {
1531 journal "Computers and Structures" = { "Comput. \& Structures" } {
1532 journal "Contemporary Mathematics" = { "Contemp. Math." } {
1533 journal "Crelle's Journal" = { "Crelle's J." } {
1534 journal "Giornale di Mathematiche" = { "Giorn. Mat." } {
1535 journal "IEEE Transactions on Aerospace and Electronic Systems" = { "IEEE Trans. Aerospace Electron. Systems" } {
1536 journal "{IEEE} Transactions on Aerospace and Electronic Systems" = { "IEEE Trans. Aerospace Electron. Systems" } {
1537 journal "IEEE Transactions on Automatic Control" = { "IEEE Trans. Automat. Control" } {
1538 journal "{IEEE} Transactions on Automatic Control" = { "IEEE Trans. Automat. Control" } {
1539 journal "IEEE Transactions on Computers" = { "IEEE Trans. Comput." } {
1540 journal "{IEEE} Transactions on Computers" = { "IEEE Trans. Comput." } {
1541 journal "IMA Journal of Numerical Analysis" = { "IMA J. Numer. Anal." } {
1542 journal "{IMA} Journal of Numerical Analysis" = { "IMA J. Numer. Anal." } {
1543 journal "Information Processing Letters" = { "Inform. Process. Lett." } {
1544 journal "International Journal for Numerical Methods in Engineering" = { "Internat. J. Numer. Methods Engrg." } {
1545 journal "International Journal of Control" = { "Internat. J. Control" } {
1546 journal "International Journal of Supercomputing Applications" = { "Internat. J. Supercomputing Applic." } {
1547 journal "Journal of Computational Physics" = { "J. Comput. Phys." } {
1548 journal "Journal of Computational and Applied Mathematics" = { "J. Comput. Appl. Math." } {
1549 journal "Journal of Computer and System Sciences" = { "J. Comput. System Sci." } {
1550 journal "Journal of Mathematical Analysis and Applications" = { "J. Math. Anal. Appl." } {
1551 journal "Journal of Mathematical Physics" = { "J. Math. Phys." } {
1552 journal "Journal of Parallel and Distributed Computing" = { "J. Parallel and Distrib. Comput." } {
1553 journal "Journal of Research of the National Bureau of Standards" = { "J. Res. Nat. Bur. Standards" } {
1554 journal "Journal of VLSI and Computer Systems" = { "J. VLSI Comput. Syst." } {
1555 journal "Journal of {VLSI} and Computer Systems" = { "J. VLSI Comput. Syst." } {
1556 journal "Journal of the ACM" = { "J. ACM" } {
1557 journal "Journal of the American Statistical Association" = { "J. Amer. Statist. Assoc." } {
1558 journal "Journal of the Institute of Mathematics and its Applications" = { "J. Inst. Math. Appl." } {
1559 journal "Journal of the Society for Industrial and Applied Mathematics" = { "J. Soc. Indust. Appl. Math." } {
1560 journal "Journal of the Society for Industrial and Applied Mathematics, Series B, Numerical Analysis" = { "J. Soc. Indust. Appl. Math. Ser. B Numer. Anal." } {
1561 journal "Linear Algebra and its Applications" = { "Linear Algebra Appl." } {
1562 journal "Mathematica Scandinavica" = { "Math. Scand." } {
1563 journal "Mathematical Tables and Other Aids to Computation" = { "Math. Tables Aids Comput." } {
1564 journal "Mathematics of Computation" = { "Math. Comp." } {
1565 journal "Mathematische Annalen" = { "Math. Ann." } {
1566 journal "Numerische Mathematik" = { "Numer. Math." } {
1567 journal "Pacific Journal of Mathematics" = { "Pacific J. Math." } {
1568 journal "Parallel Computing" = { "Parallel Comput." } {
1569 journal "Philosophical Magazine" = { "Philos. Mag." } {
1570 journal "Proceedings of the American Mathematical Society" = { "Proc. Amer. Math. Soc." } {
1571 journal "Proceedings of the IEEE" = { "Proc. IEEE" } {
1572 journal "Proceedings of the {IEEE}" = { "Proc. IEEE" } {
1573 journal "Proceedings of the National Academy of Sciences of the USA" = { "Proc. Nat. Acad. Sci. U. S. A." } {
1574 journal "Quarterly Journal of Mathematics, Oxford, Series (2)" = { "Quart. J. Math. Oxford Ser. (2)" } {
1575 journal "Quarterly of Applied Mathematics" = { "Quart. Appl. Math." } {
1576 journal "Review of the International Statisical Institute" = { "Rev. Inst. Internat. Statist." } {
1577 journal "SIAM Journal on Algebraic and Discrete Methods" = { "SIAM J. Algebraic Discrete Methods" } {
1578 journal "{SIAM} Journal on Algebraic and Discrete Methods" = { "SIAM J. Algebraic Discrete Methods" } {
1579 journal "SIAM Journal on Applied Mathematics" = { "SIAM J. Appl. Math." } {
1580 journal "{SIAM} Journal on Applied Mathematics" = { "SIAM J. Appl. Math." } {
1581 journal "SIAM Journal on Computing" = { "SIAM J. Comput." } {
1582 journal "{SIAM} Journal on Computing" = { "SIAM J. Comput." } {
1583 journal "SIAM Journal on Matrix Analysis and Applications" = { "SIAM J. Matrix Anal. Appl." } {
1584 journal "{SIAM} Journal on Matrix Analysis and Applications" = { "SIAM J. Matrix Anal. Appl." } {
1585 journal "SIAM Journal on Numerical Analysis" = { "SIAM J. Numer. Anal." } {
1586 journal "{SIAM} Journal on Numerical Analysis" = { "SIAM J. Numer. Anal." } {
1587 journal "SIAM Journal on Scientific and Statistical Computing" = { "SIAM J. Sci. Statist. Comput." } {
1588 journal "{SIAM} Journal on Scientific and Statistical Computing" = { "SIAM J. Sci. Statist. Comput." } {
1589 journal "SIAM Review" = { "SIAM Rev." } {
1590 journal "{SIAM} Review" = { "SIAM Rev." } {
1591 journal "Software Practice and Experience" = { "Software Prac. Experience" } {
1592 journal "Statistical Science" = { "Statist. Sci." } {
1593 journal "The Computer Journal" = { "Comput. J." } {
1594 journal "Transactions of the American Mathematical Society" = { "Trans. Amer. Math. Soc." } {
1595 journal "USSR Computational Mathematics and Mathematical Physics" = { "U. S. S. R. Comput. Math. and Math. Phys." } {
1596 journal "{USSR} Computational Mathematics and Mathematical Physics" = { "U. S. S. R. Comput. Math. and Math. Phys." } {
1597 journal "Zeitschrift fur Angewandte Mathematik und Mechanik" = { "Z. Angew. Math. Mech." } {
1598 journal "Zeitschrift fur Angewandte Mathematik und Physik" = { "Z. Angew. Math. Phys." } {
1600 } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
1601 } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
1602 } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
1603 } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
1604 } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
1605 } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
1606 } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
1607 } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
1610 FUNCTION { format.journal.volume.number.day.month.year }
1612 % By Young (and Spencer)
1613 % GNP - fixed bugs with missing volume, number, and/or pages
1615 % Format journal, volume, number, pages for article types.
1617 journal empty.or.unknown
1618 { "no journal in " cite$ * warning$ "" }
1619 { "\bibinfo{journal}{"
1620 journal.canon.abbrev emphasize *
1624 number empty.or.unknown
1626 volume empty.or.unknown
1627 { "no number and no volume in " cite$ * warning$ "" * }
1628 { " " * " \bibinfo{volume}{" * volume * "}" * }
1632 volume empty.or.unknown
1634 "unusual to have number, but no volume, for " cite$ * warning$
1635 " \bibinfo{number}{" * number * "}" *
1637 { " \bibinfo{volume}{" * volume * "}, \bibinfo{number}{" *
1642 after.block 'output.state :=
1644 % Sometimes proceedings are published in journals
1645 % In this case we do not want to put year, day and month here
1647 type$ "inproceedings" =
1649 {format.day.month.year * }
1653 FUNCTION { format.chapter.pages }
1655 chapter empty.or.unknown
1657 { type empty.or.unknown
1658 { "Chapter" } % gnp - changed to mixed case
1659 { type "t" change.case$ }
1661 chapter tie.or.space.connect
1662 pages empty.or.unknown
1663 {"page numbers missing in " cite$ * warning$} % gnp - added check
1664 { ", " * format.pages * }
1670 FUNCTION { format.in.emphasize.booktitle }
1671 { % jtb: format for collections or proceedings not appearing in a journal
1672 booktitle empty.or.unknown
1674 { "In " format.emphasize.booktitle * }
1678 FUNCTION { format.in.booktitle }
1679 { % jtb: format for proceedings appearing in a journal
1680 booktitle empty.or.unknown
1682 { "In \bibinfo{booktitle}{" booktitle * "}" * }
1686 FUNCTION { format.in.ed.booktitle }
1688 booktitle empty.or.unknown
1690 { editor empty.or.unknown
1691 { "In " format.emphasize.booktitle * }
1692 % jtb: swapped editor location
1693 { "In " format.emphasize.booktitle * ", " * format.editors.fml * }
1699 FUNCTION { format.thesis.type }
1700 { % call with default type on stack top
1701 type empty.or.unknown
1702 'skip$ % use default type
1704 pop$ % discard default type
1705 % NO: it is silly to have to brace protect every degree type!: type "t" change.case$
1711 FUNCTION { format.tr.number }
1714 type empty.or.unknown
1715 { "{T}echnical {R}eport" }
1719 number empty.or.unknown
1720 { "t" change.case$ }
1721 %% LOOKS BAD: { "." * number tie.or.space.connect }
1722 %% Prefer "Research report RJ687." to "Research report. RJ687."
1723 { number tie.or.space.connect }
1727 FUNCTION { format.advisor }
1729 advisor empty.or.unknown
1731 { "Advisor(s) " advisor * }
1735 FUNCTION { format.article.crossref }
1737 "\citeN{" * crossref * "}" *
1740 FUNCTION { format.crossref.editor }
1742 editor #1 "{vv~}{ll}" format.name$
1743 editor num.names$ duplicate$
1745 { pop$ " et~al\mbox{.}" * } % jrh: avoid spacing problems
1748 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1749 { " et~al\mbox{.}" * } % jrh: avoid spacing problems
1750 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
1758 FUNCTION { format.book.crossref }
1760 volume empty.or.unknown
1761 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
1764 { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
1768 editor empty.or.unknown
1769 editor field.or.null author field.or.null =
1771 { key empty.or.unknown
1772 { series empty.or.unknown
1773 { "need editor, key, or series for " cite$ * " to crossref " *
1777 { series emphasize * }
1783 { format.crossref.editor * }
1785 " \citeN{" * crossref * "}" *
1788 FUNCTION { format.incoll.inproc.crossref }
1790 " \citeN{" * crossref * "}" *
1793 FUNCTION { format.lab.names }
1797 % determines "short" names for the abbreviated author information.
1798 % "Long" labels are created in calc.label, using the routine my.full.label
1799 % to format author and editor fields.
1801 % There are 4 cases for labels. (n=3 in the example)
1803 % b) one to n Foo, Bar and Baz
1804 % c) use of "and others" Foo, Bar et al.
1805 % d) more than n Foo et al.
1808 s num.names$ 'numnames :=
1809 numnames #2 > % change number to number of others allowed before
1811 { s #1 "{vv~}{ll}" format.name$ " et~al\mbox{.}" * } % jrh: \mbox{} added
1813 numnames #1 - 'namesleft :=
1815 s #1 "{vv~}{ll}" format.name$
1817 { nameptr numnames =
1818 { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1819 { " et~al\mbox{.}" * } % jrh: avoid spacing problems
1820 { " and " * s nameptr "{vv~}{ll}" format.name$ * }
1823 { ", " * s nameptr "{vv~}{ll}" format.name$ * }
1825 nameptr #1 + 'nameptr :=
1826 namesleft #1 - 'namesleft :=
1833 FUNCTION { author.key.label }
1835 author empty.or.unknown
1836 { key empty.or.unknown
1837 { "no key, author in " cite$ * warning$
1838 cite$ #1 #3 substring$ }
1842 { author format.lab.names }
1846 FUNCTION { editor.key.organization.label }
1847 { % added - gnp. Provide label formatting by organization if editor is null.
1848 editor empty.or.unknown
1849 { organization empty.or.unknown
1850 { key empty.or.unknown
1851 { "no key, editor or organization in " cite$ * warning$
1852 cite$ #1 #3 substring$ }
1859 { editor format.lab.names }
1863 FUNCTION { author.editor.key.label }
1865 author empty.or.unknown
1866 { editor empty.or.unknown
1867 { key empty.or.unknown
1868 { "no key, author, or editor in " cite$ * warning$
1869 cite$ #1 #3 substring$ }
1873 { editor format.lab.names }
1876 { author format.lab.names }
1880 FUNCTION { author.editor.key.organization.label }
1881 { % added - gnp. Provide label formatting by organization if author is null.
1882 author empty.or.unknown
1883 { editor empty.or.unknown
1884 { organization empty.or.unknown
1885 { key empty.or.unknown
1886 { "no key, author, editor or organization in " cite$ * warning$
1887 cite$ #1 #3 substring$ }
1894 { editor format.lab.names }
1897 { author format.lab.names }
1901 % Calculate label and leave it on stack
1902 FUNCTION { calc.basic.label }
1909 'author.editor.key.label
1910 { type$ "proceedings" =
1911 type$ "periodical" =
1913 'editor.key.organization.label
1915 'author.editor.key.organization.label
1923 year empty.or.unknown
1925 { year field.or.null purify$ #-1 #4 substring$}
1928 'basic.label.year :=
1931 FUNCTION { calc.label }
1933 % Changed - GNP. See also author.editor.organization.sort, editor.organization.sort
1934 % Form label for BibTeX entry. The classification of which fields are used
1935 % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
1936 % The change here from newapa is to also include organization as a
1937 % citation label if author or editor is missing.
1941 author empty.or.unknown % generate the full label citation information.
1943 editor empty.or.unknown
1945 organization empty.or.unknown
1947 key empty.or.unknown
1949 "no author, editor, organization, or key in " cite$ * warning$
1958 { editor my.full.label }
1961 { author my.full.label }
1964 % leave label on the stack, to be popped when required.
1966 "}{" * swap$ * "}{" *
1967 % year field.or.null purify$ #-1 #4 substring$ *
1969 % save the year for sort processing afterwards (adding a, b, c, etc.)
1971 year empty.or.unknown
1973 { year field.or.null purify$ #-1 #4 substring$}
1979 FUNCTION { output.bibitem }
1982 "\bibitem[\protect\citeauthoryear{" write$
1990 before.all 'output.state :=
1994 FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint }
1995 { % enter and return with stack empty
1996 %% We switch now from buffered output to output of complete lines, so
1997 %% that the Issue .. URL data have their own lines, and are less likely
1998 %% to be line-wrapped by BibTeX's short-sighted algorithm, which wraps
1999 %% lines longer than 79 characters, backtracking to what it thinks is
2000 %% a break point in the string. Any such wrapping MUST be undone to
2001 %% prevent percent-newline from appearing in DOIs and URLs. The
2002 %% output data are intentionally wrapped in \showxxx{} macros at
2003 %% beginning of line, and that supply their own punctuation (if they
2004 %% are not defined to suppress output entirely), to make it easier for
2005 %% other software to recover them from .bbl files.
2007 %% It also makes it possible to later change the macro definitions
2008 %% to suppress particular output values, or alter their appearance.
2010 %% Note that it is possible for theses, technical reports, and
2011 %% manuals to have ISBNs, and anything that has an ISBN may also
2012 %% have an ISSN. When there are no values for these keys, there
2013 %% is no output generated for them here.
2016 after.block 'output.state :=
2020 output.coden % CODEN is functionally like ISSN, so output them sequentially
2023 output.doi % DOI is ALWAYS last according to CrossRef DOI documentation
2025 output.url % but ACM wants URL last
2028 FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint.note }
2029 { % enter with stack empty, return with empty string on stack
2030 output.issue.doi.coden.isxn.lccn.url.eprint
2031 note empty.or.unknown
2041 FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint.note.check }
2042 { % enter with stack empty, return with empty string on stack
2043 output.issue.doi.coden.isxn.lccn.url.eprint
2044 note empty.or.unknown
2054 FUNCTION { article }
2058 author empty.or.unknown
2060 editor empty.or.unknown
2061 { "neither author and editor supplied for " cite$ * warning$ }
2062 { format.editors "editor" output.check }
2065 { format.authors "author" output.check }
2068 author format.no.key output % added
2069 output.year.check % added
2071 format.articletitle "title" output.check
2073 howpublished empty.or.unknown
2075 { "\bibinfo{howpublished}{" howpublished "}" * * output }
2079 { format.journal.volume.number.day.month.year output}
2081 "cross reference in @Article{...} is unusual" warning$
2082 format.article.crossref output.nonnull
2086 format.pages.check.without.articleno output
2087 format.articleno.numpages output
2089 output.issue.doi.coden.isxn.lccn.url.eprint.note
2096 author empty.or.unknown
2097 { format.editors "author and editor" output.check }
2098 { format.authors output.nonnull
2100 { "author and editor" editor either.or.check }
2105 output.year.check % added
2107 format.btitle "title" output.check
2109 { new.sentence % jtb: start a new sentence for series/volume
2110 format.bvolume output
2112 format.number.series output
2114 publisher "publisher" bibinfo.output.check
2115 address "address" bibinfo.output.check % jtb: require address
2117 pages empty.or.unknown
2118 { format.bookpages } % use bookpages when pages empty
2119 { format.pages.check "pages" tie.or.space.connect }
2124 format.book.crossref output.nonnull
2128 output.issue.doi.coden.isxn.lccn.url.eprint.note
2132 FUNCTION { booklet }
2135 format.authors output
2136 author format.key output % added
2137 output.year.check % added
2139 format.title "title" output.check
2141 howpublished empty.or.unknown
2143 { "\bibinfo{howpublished}{" howpublished "}" * * output }
2147 output.issue.doi.coden.isxn.lccn.url.eprint.note
2154 author empty.or.unknown
2156 "author and editor" output.check
2158 { format.authors output.nonnull
2160 { "author and editor" editor either.or.check }
2165 output.year.check % added
2167 format.btitle "title" output.check
2169 { new.sentence % jtb: start a new sentence for series/volume
2170 format.bvolume output
2172 format.number.series output
2174 publisher "publisher" bibinfo.output.check
2175 address "address" bibinfo.output.check % jtb: require address
2176 format.bookpages output
2177 format.chapter.pages
2178 "chapter and pages" output.check % jtb: moved from before publisher
2181 format.bookpages output
2182 format.chapter.pages "chapter and pages" output.check
2184 format.book.crossref output.nonnull
2188 output.issue.doi.coden.isxn.lccn.url.eprint.note
2192 FUNCTION { incollection }
2195 format.authors "author" output.check
2196 author format.key output % added
2197 output.year.check % added
2199 format.articletitle "title" output.check
2202 { format.in.ed.booktitle "booktitle" output.check
2203 new.sentence % jtb: start a new sentence for series/volume
2204 format.bvolume output
2205 format.number.series output
2207 publisher "publisher" bibinfo.output.check
2208 address "address" bibinfo.output.check % jtb: require address
2209 format.bookpages output
2210 format.chapter.pages output % gnp - was special.output.nonnull
2211 % left out comma before page numbers
2212 % jtb: moved from before publisher
2215 format.incoll.inproc.crossref output.nonnull
2216 format.chapter.pages output
2220 output.issue.doi.coden.isxn.lccn.url.eprint.note
2224 FUNCTION { inproceedings }
2227 format.authors "author" output.check
2228 author format.key output % added
2229 output.year.check % added
2231 format.articletitle "title" output.check
2232 howpublished empty.or.unknown
2234 { "\bibinfo{howpublished}{" howpublished "}" * * output.dot.space }
2238 journal missing$ % jtb: proceedings appearing in journals
2239 { format.in.emphasize.booktitle format.city "booktitle" output.check.dot.space
2240 format.series output.removenospace
2241 format.editors.fml output % BV 2011/09/27 Moved dot to comma
2242 format.bvolume.noseries output
2245 publisher "publisher" bibinfo.output.check % jtb: require publisher (?)
2246 address "address" bibinfo.output.check % jtb: require address
2247 format.bookpages output
2250 format.in.booktitle format.city "booktitle" output.check
2251 format.editors.fml output
2253 format.journal.volume.number.day.month.year output
2256 format.articleno output
2257 format.pages.check.without.articleno output
2260 format.incoll.inproc.crossref output.nonnull
2261 format.articleno output
2262 format.pages.check.without.articleno output
2265 format.articleno.numpages output
2267 output.issue.doi.coden.isxn.lccn.url.eprint.note
2271 FUNCTION { conference } { inproceedings }
2276 author empty.or.unknown
2277 { editor empty.or.unknown
2278 { organization "organization" output.check
2279 organization format.key output } % if all else fails, use key
2280 { format.editors "author and editor" output.check }
2283 { format.authors output.nonnull }
2285 output.year.check % added
2287 format.btitle "title" output.check
2288 organization address new.block.checkb
2289 % jtb: back to normal style: organization, address
2290 organization "organization" output.check
2293 output.issue.doi.coden.isxn.lccn.url.eprint.note
2297 FUNCTION { mastersthesis }
2300 format.authors "author" output.check
2301 author format.key output % added
2302 output.year.check % added
2304 format.title emphasize "title" output.check % NB: ACM style requires emphasized thesis title
2306 "\bibinfo{thesistype}{Master's\ thesis}" format.thesis.type output
2308 school "school" bibinfo.output.check
2309 address empty.or.unknown
2311 { "\bibinfo{address}{" address * "}" * output }
2314 format.advisor output
2316 output.issue.doi.coden.isxn.lccn.url.eprint.note
2323 format.authors "author" output.check
2324 author format.key output % added
2325 output.year.check % added
2326 title howpublished new.block.checkb
2329 howpublished empty.or.unknown
2331 { "\bibinfo{howpublished}{" howpublished "}" * * output }
2333 "" output.nonnull.dot.space
2334 output.day.month.year
2335 calc.format.page.count output
2337 output.issue.doi.coden.isxn.lccn.url.eprint.note
2341 FUNCTION { online } { misc }
2343 FUNCTION { game } { misc }
2346 FUNCTION { phdthesis }
2349 format.authors "author" output.check
2350 author format.key output % added
2351 output.year.check % added
2353 format.title emphasize "title" output.check % NB: ACM style requires emphasized thesis title
2355 "\bibinfo{thesistype}{Ph.D. Dissertation}" format.thesis.type output
2357 school "school" bibinfo.output.check
2358 address empty.or.unknown
2360 { "\bibinfo{address}{" address * "}" * output }
2363 format.advisor output
2365 output.issue.doi.coden.isxn.lccn.url.eprint.note
2369 FUNCTION {format.date}
2370 { year empty.or.unknown
2371 { month empty.or.unknown
2373 "" % output empty date if year/month both empty
2374 day empty.or.unknown
2376 { "there's a day but no month or year in " cite$ * warning$ }
2379 { "there's a month but no year in " cite$ * warning$
2381 day empty.or.unknown
2388 { month empty.or.unknown
2390 year % output only year if month empty
2391 day empty.or.unknown
2393 { "there's a day and year but no month in " cite$ * warning$ }
2398 day empty.or.unknown
2409 FUNCTION {new.block.checka}
2417 FUNCTION { periodical }
2420 editor empty.or.unknown
2421 { organization output }
2422 { format.editors output.nonnull }
2427 format.articletitle "title" output.check
2428 format.journal.volume.number.day.month.year output
2429 calc.format.page.count output
2433 FUNCTION { proceedings }
2436 editor empty.or.unknown
2437 { organization output
2438 organization format.key output } % gnp - changed from author format.key
2439 { format.editors output.nonnull }
2441 % author format.key output % gnp - removed (should be either
2442 % editor or organization
2443 output.year.check % added (newapa)
2445 format.btitle format.city "title" output.check % jtb: added city
2447 format.bvolume output
2448 format.number.series output
2451 % jtb: normal order: publisher, address
2452 publisher empty.or.unknown
2454 { "\bibinfo{publisher}{" publisher * "}" * output }
2456 address empty.or.unknown
2458 { "\bibinfo{address}{" address * "}" * output }
2461 output.issue.doi.coden.isxn.lccn.url.eprint.note
2465 FUNCTION { collection } { proceedings }
2467 FUNCTION { techreport }
2470 format.authors "author" output.check
2471 author format.key output % added
2472 output.year.check % added
2474 format.btitle "title" output.check
2476 % format.tr.number output % jtb: moved month ...
2477 format.tr.number output new.sentence % Gerry - need dot 2011/09/28
2478 institution "institution" bibinfo.output.check
2479 address empty.or.unknown
2481 { "\bibinfo{address}{" address "}" * * output }
2484 format.named.pages output
2485 % ACM omits year at end in transactions style
2486 % format.day.month.year output.nonnull.dot.space % jtb: ... to here (no parens)
2488 output.issue.doi.coden.isxn.lccn.url.eprint.note
2492 FUNCTION { unpublished }
2496 "author" output.check
2497 author format.key output % added
2498 output.year.check % added
2500 format.title "title" output.check
2502 output.day.month.year % UTAH
2503 calc.format.page.count output
2505 output.issue.doi.coden.isxn.lccn.url.eprint.note.check
2509 FUNCTION { default.type } { misc }
2511 %%% ACM journal-style month definitions: full name if 1--5 letters, else
2512 %%% abbreviation of 3 or 4 characters and a dot
2514 MACRO {jan} {"Jan."}
2516 MACRO {feb} {"Feb."}
2518 MACRO {mar} {"March"}
2520 MACRO {apr} {"April"}
2524 MACRO {jun} {"June"}
2526 MACRO {jul} {"July"}
2528 MACRO {aug} {"Aug."}
2530 MACRO {sep} {"Sept."}
2532 MACRO {oct} {"Oct."}
2534 MACRO {nov} {"Nov."}
2536 MACRO {dec} {"Dec."}
2542 FUNCTION { sortify }
2548 FUNCTION { chop.word }
2552 s #1 len substring$ =
2553 { s len #1 + global.max$ substring$ }
2558 FUNCTION { sort.format.names }
2563 s num.names$ 'numnames :=
2564 numnames 'namesleft :=
2570 s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't :=
2571 nameptr numnames = t "others" = and
2575 nameptr #1 + 'nameptr :=
2576 namesleft #1 - 'namesleft :=
2581 FUNCTION { sort.format.title }
2586 "The " #4 t chop.word
2590 #1 global.max$ substring$
2593 FUNCTION { author.sort }
2595 author empty.or.unknown
2596 { key empty.or.unknown
2597 { "to sort, need author or key in " cite$ * warning$
2602 { author sort.format.names }
2606 FUNCTION { author.editor.sort }
2608 author empty.or.unknown
2610 editor empty.or.unknown
2612 key empty.or.unknown
2613 { "to sort, need author, editor, or key in " cite$ * warning$
2619 { editor sort.format.names }
2622 { author sort.format.names }
2626 FUNCTION { editor.organization.sort }
2628 % added - GNP. Stack editor or organization for sorting (from alpha.bst).
2629 % Unlike alpha.bst, we need entire names, not abbreviations
2631 editor empty.or.unknown
2632 { organization empty.or.unknown
2633 { key empty.or.unknown
2634 { "to sort, need editor, organization, or key in " cite$ * warning$
2640 { organization sortify }
2643 { editor sort.format.names }
2647 FUNCTION { author.editor.organization.sort }
2649 % added - GNP. Stack author or organization for sorting (from alpha.bst).
2650 % Unlike alpha.bst, we need entire names, not abbreviations
2652 author empty.or.unknown
2654 editor empty.or.unknown
2655 { organization empty.or.unknown
2656 { key empty.or.unknown
2657 { "to sort, need author, editor, or key in " cite$ * warning$
2663 { organization sortify }
2666 { editor sort.format.names }
2669 { author sort.format.names }
2673 FUNCTION { presort }
2675 % Presort creates the bibentry's label via a call to calc.label, and then
2676 % sorts the entries based on entry type. Chicago.bst adds support for
2677 % including organizations as the sort key; the following is stolen from
2689 year field.or.null purify$ #-1 #4 substring$ * % add year
2698 { type$ "proceedings" =
2699 type$ "periodical" =
2701 'editor.organization.sort
2703 'author.editor.organization.sort
2710 #1 entry.max$ substring$ % added for newapa
2711 'sort.label := % added for newapa
2712 sort.label % added for newapa
2719 #1 entry.max$ substring$
2727 SORT % by label, year, author/editor, title
2730 STRINGS { longest.label }
2732 INTEGERS { longest.label.width number.label }
2734 FUNCTION {initialize.longest.label}
2735 { "" 'longest.label :=
2736 #0 int.to.chr$ 'last.label :=
2738 #0 'longest.label.width :=
2739 #0 'last.extra.num :=
2745 FUNCTION { initialize.extra.label.stuff }
2746 { #0 int.to.chr$ 'last.label :=
2748 #0 'last.extra.num :=
2751 FUNCTION { forward.pass }
2753 % Pass through all entries, comparing current entry to last one.
2754 % Need to concatenate year to the stack (done by calc.label) to determine
2755 % if two entries are the same (see presort)
2758 calc.basic.label year field.or.null purify$ #-1 #4 substring$ * % add year
2759 #1 entry.max$ substring$ = % are they equal?
2760 { last.extra.num #1 + 'last.extra.num :=
2761 last.extra.num int.to.chr$ 'extra.label :=
2763 { "a" chr.to.int$ 'last.extra.num :=
2765 calc.basic.label year field.or.null purify$ #-1 #4 substring$ * % add year
2766 #1 entry.max$ substring$ 'last.label := % assign to last.label
2769 number.label #1 + 'number.label :=
2772 FUNCTION { reverse.pass }
2775 { "a" 'extra.label := }
2778 label.year extra.label * 'sort.year :=
2779 extra.label 'next.extra :=
2782 EXECUTE {initialize.extra.label.stuff}
2783 EXECUTE {initialize.longest.label}
2786 ITERATE {forward.pass}
2788 REVERSE {reverse.pass}
2790 FUNCTION { bib.sort.order }
2795 year field.or.null sortify
2802 #1 entry.max$ substring$
2806 ITERATE { bib.sort.order }
2808 SORT % by sort.label, year, title --- giving final bib. order.
2810 FUNCTION { begin.bib }
2812 %% Set to #0 show 13-digit ISBN in preference to 10-digit ISBN.
2813 %% Set to #1 to show both 10-digit and 13-digit ISBNs.
2814 #1 'show-isbn-10-and-13 :=
2816 "%%% -*-BibTeX-*-" writeln
2817 "%%% Do NOT edit. File created by BibTeX with style" writeln
2818 "%%% ACM-Reference-Format-Journals [18-Jan-2012]." writeln
2821 preamble$ empty.or.unknown
2823 { preamble$ writeln }
2825 "\begin{thebibliography}{" number.label int.to.str$ * "}" * writeln
2827 "%%% ====================================================================" writeln
2828 "%%% NOTE TO THE USER: you can override these defaults by providing" writeln
2829 "%%% customized versions of any of these macros before the \bibliography" writeln
2830 "%%% command. Each of them MUST provide its own final punctuation," writeln
2831 "%%% except for \shownote{}, \showDOI{}, and \showURL{}. The latter two" writeln
2832 "%%% do not use final punctuation, in order to avoid confusing it with" writeln
2833 "%%% the Web address." writeln
2835 "%%% To suppress output of a particular field, define its macro to expand" writeln
2836 "%%% to an empty string, or better, \unskip, like this:" writeln
2838 "%%% \newcommand{\showDOI}[1]{\unskip} % LaTeX syntax" writeln
2840 "%%% \def \showDOI #1{\unskip} % plain TeX syntax" writeln
2842 "%%% ====================================================================" writeln
2845 %% ACM publications do not use CODEN, ISSN, and LCCN data, so their default
2846 %% macro wrappers expand to \unskip, discarding their values and unwanted
2849 %% For other publications, prior definitions like these may be useful:
2852 %% \def \showCODEN #1{CODEN #1.}
2853 %% \def \showISSN #1{ISSN #1.}
2854 %% \def \showLCCN #1{LCCN #1.}
2857 %% \newcommand{\showCODEN}[1]{CODEN #1.}
2858 %% \newcommand{\showISSN}[1]#1{ISSN #1.}
2859 %% \newcommand{\showLCCN}[1]{LCCN #1.}
2861 "\ifx \showCODEN \undefined \def \showCODEN #1{\unskip} \fi" writeln
2862 "\ifx \showDOI \undefined \def \showDOI #1{#1}\fi" writeln
2863 % ACM styles omit ISBNs, but they can be included by suitable definitions of
2864 % \showISBNx and \showISBNxiii before the .bbl file is read
2865 "\ifx \showISBNx \undefined \def \showISBNx #1{\unskip} \fi" writeln
2866 "\ifx \showISBNxiii \undefined \def \showISBNxiii #1{\unskip} \fi" writeln
2867 "\ifx \showISSN \undefined \def \showISSN #1{\unskip} \fi" writeln
2868 "\ifx \showLCCN \undefined \def \showLCCN #1{\unskip} \fi" writeln
2869 "\ifx \shownote \undefined \def \shownote #1{#1} \fi" writeln % NB: final period supplied by add.period$ above
2870 "\ifx \showarticletitle \undefined \def \showarticletitle #1{#1} \fi" writeln
2871 "\ifx \showURL \undefined \def \showURL {\relax} \fi" writeln
2872 "% The following commands are used for tagged output and should be " writeln
2873 "% invisible to TeX" writeln
2874 "\providecommand\bibfield[2]{#2}" writeln
2875 "\providecommand\bibinfo[2]{#2}" writeln
2876 "\providecommand\natexlab[1]{#1}" writeln
2877 "\providecommand\showeprint[2][]{arXiv:#2}" writeln
2882 EXECUTE {init.state.consts}
2884 ITERATE {call.type$}
2886 FUNCTION { end.bib }
2889 "\end{thebibliography}"