exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

ACM-Reference-Format.bst (93993B)


      1 %%% -*-BibTeX-*-
      2 %%% ====================================================================
      3 %%%  @BibTeX-style-file{
      4 %%%     author          = "Nelson H. F. Beebe, Boris Veytsman and Gerald Murray",
      5 %%%     version         = "1.18",
      6 %%%     date            = "10 July 2016",
      7 %%%     filename        = "ACM-Reference-Format.bst",
      8 %%%     email           = "beebe@math.utah.edu, beebe@acm.org,
      9 %%%                        beebe@computer.org, borisv@lk.net, murray@hq.acm.org",
     10 %%%     codetable       = "ISO/ASCII",
     11 %%%     keywords        = "ACM Transactions bibliography style; BibTeX",
     12 %%%     license         = "public domain",
     13 %%%     supported       = "yes",
     14 %%%     abstract        = "",
     15 %%%  }
     16 %%% ====================================================================
     17 
     18 %  ACM BibTeX style, ACM-Reference-Format.bst
     19 %  for BibTeX version 0.99c, LaTeX version 3.141
     20 %  ACM extensions with code cleaned up, extended, and debugged 10--15-Nov-2008
     21 %  Revised 17-APRIL-2008 (Nelson)
     22 %  Revised 13-MARCH-2011 (Boris/Gerry)
     23 %  Revised 23-MARCH-2011 (Boris/Gerry)
     24 %  Revised 27-MARCH-2011 (Boris/Gerry)
     25 %  Revised 15-APRIL-2011 (Boris/Gerry)
     26 %  Revised 27-SEPTEMBER-2011 (Boris)
     27 %  Revised 10-JULY-2016 (Boris)
     28 %  Revised 04-FEB-2017 (Boris)
     29 %
     30 %
     31 % History (by Nelson)
     32 %
     33 % Based on 'acmtrans' (for ACM Journals)
     34 % Date: 28th April 2008
     35 %
     36 % 1. Avoid 'repeating' the 'month' values.
     37 % 2. Avoid incorrectly italicizing the volume number.
     38 % 3. Avoid non italicizing certain titles (book, inproceedings etc).
     39 % 4. NO series if there is NO volume.
     40 % 5. Sorting of reference with first surname.
     41 % 6. Article no added for Inproceedings.
     42 %
     43 % Date: 07th May 2008
     44 %
     45 % 1. Abbreviation list added
     46 %
     47 %   Citation format: [author-last-name year]
     48 %             [author-last-name and author-last-name year]
     49 %             [author-last-name, author-last-name, and author-last-name year]
     50 %             [author-last-name et al. year]
     51 %             [author-last-name]
     52 %             author-last-name [year]
     53 %             [author-last-name and author-last-name]
     54 %             [author-last-name et al.]
     55 %             [year] or [year,year]
     56 %             year or year,year
     57 %
     58 %   Reference list ordering: alphabetical by author or whatever passes
     59 %    for author in the absence of one.
     60 %
     61 % Features of the old acmtrans.bst:
     62 % =================================
     63 %
     64 % - all authors appear last name first.
     65 % - all pages are listed xx-xx, (no pp.) and are at the end of the reference
     66 % - publishers are identified as publisher, address
     67 % - conferences papers (inproceedings) may give city of conference,
     68 %   date of conference, and journal that the proceedings appear in.
     69 % - months abbreviated to max four letters (eg. Mar.)
     70 % - volume of a series indicated after the title of the series
     71 % - editors appear after edited title and are identified by a trailing "Eds."
     72 %   not in parentheses.  Editor names are not given in small caps.
     73 %   (unless there is no author line)
     74 % - names terminated with a period even if there is no first name.
     75 % - editions are indicated trailing after the work, not in parentheses.
     76 % - "et al." citations have a protected period to avoid bad spacing (jrh)
     77 % - "address" required when publisher given
     78 % - series (roman) and volume are in a sentence separate from (book-)title
     79 %
     80 %
     81 % Features of chicago.bst:
     82 % =======================
     83 %
     84 % - full names used in citations, but abbreviated citations are available
     85 %   (see above)
     86 % - if an entry has a "month", then the month and year are also printed
     87 %   as part of that bibitem.
     88 % - all conjunctions use "and" instead of "\&"
     89 % - major modification from Chicago Manual of Style (13th ed.) is that
     90 %   only the first author in a reference appears last name first-
     91 %   additional authors appear as J. Q. Public.
     92 % - pages are listed as "pp. xx-xx" in all entry types except
     93 %   article entries.
     94 % - book, inbook, and manual use "location: publisher" (or organization)
     95 %   for address and publisher. All other types list publishers separately.
     96 % - "pp." are used to identify page numbers for all entry types except
     97 %   articles.
     98 % - organization is used as a citation label if neither author nor editor
     99 %   is present (for manuals).
    100 % - "et al." is used for long author and editor lists, or when "others"
    101 %   is used.
    102 %
    103 % Modifications and bug fixes from newapa.bst:
    104 % ===========================================
    105 %
    106 %   - added month, year to bib entries if month is present
    107 %   - fixed bug with In proceedings, added necessary comma after title
    108 %   - all conjunctions changed to "and" from "\&"
    109 %   - fixed bug with author labels in my.full.label: "et al." now is
    110 %        generated when "others" is an author name
    111 %   - major modification from Chicago Manual of Style (13th ed.) is that
    112 %     only the first author in a reference appears last name first-
    113 %     additional authors appear as J. Q. Public.
    114 %   - pages are listed as "pp. xx-xx" in all entry types except
    115 %     article entries. Unnecessary (IMHO) "()" around page numbers
    116 %     were removed, and page numbers now don't end with a period.
    117 %   - created chicago.sty for use with this bibstyle (required).
    118 %   - fixed bugs in FUNCTION {format.vol.num.pages} for missing volume,
    119 %     number, and /or pages. Renamed to format.journal.volume.number.
    120 %   - fixed bug in formatting booktitles: additional period an error if
    121 %     book has a volume.
    122 %   - fixed bug: editors usually given redundant period before next clause
    123 %     (format.editors.dot) removed.
    124 %   - added label support for organizations, if both author and editor
    125 %     are missing (from alpha.bst). If organization is too long, then
    126 %     the key field is used for abbreviated citations.
    127 %   - In proceedings or books of several volumes, no comma was written
    128 %     between the "Volume x" and the page numbers (this was intentional
    129 %     in newapa.bst). Fixed.
    130 %   - Some journals may not have volumes/numbers, only month/year (eg.
    131 %     IEEE Computer). Fixed bug in article style that assumed volume/number
    132 %     was always present.
    133 %
    134 % Original documentation for newapa.sty:
    135 % =====================================
    136 %
    137 % This version was made by modifying the master file made by
    138 % Oren Patashnik (PATASHNIK@SCORE.STANFORD.EDU), and the 'named' BibTeX
    139 % style of Peter F. Patel-Schneider.
    140 %
    141 % Copyright (C) 1985, all rights reserved.
    142 % Copying of this file is authorized only if either
    143 % (1) you make absolutely no changes to your copy, including name, or
    144 % (2) if you do make changes, you name it something other than 'newapa.bst'.
    145 % There are undoubtably bugs in this style.  If you make bug fixes,
    146 % improvements, etc.  please let me know.  My e-mail address is:
    147 %    spencer@cgrg.ohio.state.edu or 71160.3141@compuserve.com
    148 %
    149 % This style was made from 'plain.bst', 'named.bst', and 'apalike.bst',
    150 % with lots of tweaking to make it look like APA style, along with tips
    151 % from Young Ryu and Brian Reiser's modifications of 'apalike.bst'.
    152 %
    153 %
    154 % Start of ACM-Reference-Format-Journals.bst
    155 %
    156 % Note: Many of the new bibentry 'fields' will only work with the
    157 % 'ACM-Reference-Format-Journals.bst' file. Legacy .bib files (which will, in all probability,
    158 % NOT contain these new fields) will _still_ work with the ACM-Reference-Format-Journals.bst.
    159 %
    160 %
    161 ENTRY
    162   { address
    163     advisor
    164     archiveprefix
    165     author
    166     booktitle
    167     chapter
    168     city        % jtb: added
    169     date        % jtb: added
    170     edition
    171     editor
    172     eprint
    173     howpublished
    174     institution
    175     journal
    176     key
    177     month
    178     note
    179     number
    180     organization
    181     pages
    182     primaryclass
    183     publisher
    184     school
    185     series
    186     title
    187     type
    188     volume
    189     year
    190         % New keys recognized
    191         issue         % UTAH: used in, e.g., ACM SIGSAM Bulletin and ACM Communications in Computer Algebra
    192         articleno
    193 	eid           
    194         day           % UTAH: needed for newspapers, weeklies, bi-weeklies
    195         doi           % UTAH
    196         url           % UTAH
    197         bookpages     % UTAH
    198         numpages
    199         lastaccessed  % UTAH: used only for @Misc{...}
    200         coden         % UTAH
    201         isbn          % UTAH
    202         isbn-13       % UTAH
    203         issn          % UTAH
    204         lccn          % UTAH
    205   }
    206   {}
    207   { label.year extra.label sort.year sort.label }
    208 
    209 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
    210 
    211 INTEGERS { show-isbn-10-and-13 }  % initialized below in begin.bib
    212 
    213 INTEGERS { nameptr namesleft numnames }
    214 
    215 INTEGERS { multiresult }
    216 
    217 INTEGERS { len }
    218 
    219 INTEGERS { last.extra.num }
    220 
    221 STRINGS { s t t.org u }
    222 
    223 STRINGS { last.label next.extra }
    224 
    225 STRINGS { p1 p2 p3 page.count }
    226 
    227 FUNCTION { not }
    228 {
    229     { #0 }
    230     { #1 }
    231   if$
    232 }
    233 
    234 FUNCTION { and }
    235 {
    236     'skip$
    237     { pop$ #0 }
    238   if$
    239 }
    240 
    241 FUNCTION { or }
    242 {
    243    { pop$ #1 }
    244     'skip$
    245   if$
    246 }
    247 
    248 
    249 FUNCTION { dump.stack.1 }
    250 {
    251     duplicate$ "STACK[top] = [" swap$ * "]" * warning$
    252 }
    253 
    254 FUNCTION { dump.stack.2 }
    255 {
    256     duplicate$ "STACK[top  ] = [" swap$ * "]" * warning$
    257     swap$
    258     duplicate$ "STACK[top-1] = [" swap$ * "]" * warning$
    259     swap$
    260 }
    261 
    262 FUNCTION { empty.or.unknown }
    263 {
    264   %% Examine the top stack entry, and push 1 if it is empty, or
    265   %% consists only of whitespace, or is a string beginning with two
    266   %% queries (??), and otherwise, push 0.
    267   %%
    268   %% This function provides a replacement for empty$, with the
    269   %% convenient feature that unknown values marked by two leading
    270   %% queries are treated the same as missing values, and thus, do not
    271   %% appear in the output .bbl file, and yet, their presence in .bib
    272   %% file(s) serves to mark values which are temporarily missing, but
    273   %% are expected to be filled in eventually once more data is
    274   %% obtained.  The TeX User Group and BibNet bibliography archives
    275   %% make extensive use of this practice.
    276   %%
    277   %% An empty string cannot serve the same purpose, because just as in
    278   %% statistics data processing, an unknown value is not the same as an
    279   %% empty value.
    280   %%
    281   %% At entry: stack = ... top:[string]
    282   %% At exit:  stack = ... top:[0 or 1]
    283 
    284   duplicate$ empty$
    285     { pop$ #1 }
    286     { #1 #2 substring$ "??" = }
    287   if$
    288 }
    289 
    290 FUNCTION { writeln }
    291 {
    292   %% In BibTeX style files, the sequences
    293   %%
    294   %%     ... "one" "two" output
    295   %%     ... "one" "two" output.xxx
    296   %%
    297   %% ship "one" to the output file, possibly following by punctuation,
    298   %% leaving the stack with
    299   %%
    300   %%     ... "two"
    301   %%
    302   %% There is thus a one-string lag in output processing that must be
    303   %% carefully handled to avoid duplicating a string in the output
    304   %% file.  Unless otherwise noted, all output.xxx functions leave
    305   %% just one new string on the stack, and that model should be born
    306   %% in mind when reading or writing function code.
    307   %%
    308   %% BibTeX's asynchronous buffering of output from strings from the
    309   %% stack is confusing because newline$ bypasses the buffer.  It
    310   %% would have been so much easier for newline to be a character
    311   %% rather than a state of the output-in-progress.
    312   %%
    313   %% The documentation in btxhak.dvi is WRONG:  it says
    314   %%
    315   %%    newline$ Writes onto the bbl file what's accumulated in the
    316   %%             output buffer. It writes a blank line if and only
    317   %%             if the output buffer is empty. Since write$ does
    318   %%             reasonable line breaking, you should use this
    319   %%             function only when you want a blank line or an
    320   %%             explicit line break.
    321   %%
    322   %%    write$   Pops the top (string) literal and writes it on the
    323   %%             output buffer (which will result in stuff being
    324   %%             written onto the bbl file when the buffer fills
    325   %%             up).
    326   %%
    327   %% Examination of the BibTeX source code shows that write$ does
    328   %% indeed behave as claimed, but newline$ sends a newline character
    329   %% directly to the output file, leaving the stack unchanged.  The
    330   %% first line "Writes onto ... buffer." is therefore wrong.
    331   %%
    332   %% The original BibTeX style files almost always use "write$ newline$"
    333   %% in that order, so it makes sense to hide that pair in a private
    334   %% function like this one, named after a statement in Pascal,
    335   %% the programming language embedded in the BibTeX Web program.
    336 
    337   write$                % output top-of-stack string
    338   newline$              % immediate write of newline (not via stack)
    339 }
    340 
    341 FUNCTION { init.state.consts }
    342 {
    343   #0 'before.all :=
    344   #1 'mid.sentence :=
    345   #2 'after.sentence :=
    346   #3 'after.block :=
    347 }
    348 
    349 FUNCTION { output.nonnull }
    350 { % Stack in: ... R S T  Stack out: ... R T   File out: S<comma><space>
    351   's :=
    352   output.state mid.sentence =
    353     {
    354       ", " * write$
    355     }
    356     {
    357       output.state after.block =
    358         {
    359           add.period$ writeln
    360           "\newblock " write$
    361         }
    362         {
    363           output.state before.all =
    364             {
    365               write$
    366             }
    367             {
    368               add.period$ " " * write$
    369             }
    370           if$
    371         }
    372       if$
    373       mid.sentence 'output.state :=
    374     }
    375   if$
    376   s
    377 }
    378 
    379 FUNCTION { output.nonnull.dot.space }
    380 { % Stack in: ... R S T  Stack out: ... R T   File out: S<dot><space>
    381   's :=
    382   output.state mid.sentence =           % { "<DEBUG output.nonnull.dot.space>. " * write$ }
    383     {
    384       ". " * write$
    385     }
    386     {
    387       output.state after.block =
    388         {
    389           add.period$ writeln "\newblock " write$
    390         }
    391         {
    392           output.state before.all =
    393             {
    394               write$
    395             }
    396             {
    397               add.period$ " " * write$
    398             }
    399           if$
    400         }
    401       if$
    402       mid.sentence 'output.state :=
    403     }
    404   if$
    405   s
    406 }
    407 
    408 FUNCTION { output.nonnull.remove }
    409 { % Stack in: ... R S T  Stack out: ... R T   File out: S<space>
    410   's :=
    411   output.state mid.sentence =
    412     {
    413       " " * write$
    414     }
    415     {
    416       output.state after.block =
    417         {
    418           add.period$ writeln "\newblock " write$
    419         }
    420         {
    421           output.state before.all =
    422             {
    423               write$
    424             }
    425             {
    426               add.period$ " " * write$
    427             }
    428           if$
    429         }
    430       if$
    431       mid.sentence 'output.state :=
    432     }
    433   if$
    434   s
    435 }
    436 
    437 FUNCTION { output.nonnull.removenospace }
    438 { % Stack in: ... R S T  Stack out: ... R T   File out: S
    439   's :=
    440   output.state mid.sentence =
    441     {
    442       "" * write$
    443     }
    444     {
    445       output.state after.block =
    446         {
    447           add.period$ writeln "\newblock " write$
    448         }
    449         {
    450           output.state before.all =
    451             {
    452               write$
    453             }
    454             {
    455               add.period$ " " * write$
    456             }
    457           if$
    458         }
    459       if$
    460       mid.sentence 'output.state :=
    461     }
    462   if$
    463   s
    464 }
    465 
    466 FUNCTION { output }
    467 { % discard top token if empty, else like output.nonnull
    468   duplicate$ empty.or.unknown
    469     'pop$
    470     'output.nonnull
    471   if$
    472 }
    473 
    474 FUNCTION { output.dot.space }
    475 { % discard top token if empty, else like output.nonnull.dot.space
    476   duplicate$ empty.or.unknown
    477     'pop$
    478     'output.nonnull.dot.space
    479   if$
    480 }
    481 
    482 FUNCTION { output.removenospace }
    483 { % discard top token if empty, else like output.nonnull.removenospace
    484   duplicate$ empty.or.unknown
    485     'pop$
    486     'output.nonnull.removenospace
    487   if$
    488 }
    489 
    490 FUNCTION { output.check }
    491 { % like output, but warn if key name on top-of-stack is not set
    492   't :=
    493   duplicate$ empty.or.unknown
    494     { pop$ "empty " t * " in " * cite$ * warning$ }
    495     'output.nonnull
    496   if$
    497 }
    498 
    499 FUNCTION { bibinfo.output.check }
    500 { % like output.check, adding bibinfo field
    501   't :=
    502   duplicate$ empty.or.unknown
    503     { pop$ "empty " t * " in " * cite$ * warning$ }
    504     { "\bibinfo{" t "}{" * * swap$ * "}" *
    505       output.nonnull }
    506   if$
    507 }
    508 
    509 FUNCTION { output.check.dot.space }
    510 { % like output.dot.space, but warn if key name on top-of-stack is not set
    511   't :=
    512   duplicate$ empty.or.unknown
    513     { pop$ "empty " t * " in " * cite$ * warning$ }
    514     'output.nonnull.dot.space
    515   if$
    516 }
    517 
    518 FUNCTION { fin.block }
    519 { % functionally, but not logically, identical to fin.entry
    520    add.period$
    521    writeln
    522 }
    523 
    524 FUNCTION { fin.entry }
    525 {
    526    add.period$
    527    writeln
    528 }
    529 
    530 FUNCTION { new.sentence }
    531 { % update sentence state, with neither output nor stack change
    532   output.state after.block =
    533     'skip$
    534     {
    535       output.state before.all =
    536         'skip$
    537         { after.sentence 'output.state := }
    538       if$
    539     }
    540   if$
    541 }
    542 
    543 FUNCTION { fin.sentence }
    544 {
    545    add.period$
    546    write$
    547    new.sentence
    548    ""
    549 }
    550 
    551 FUNCTION { new.block }
    552 {
    553   output.state before.all =
    554     'skip$
    555     { after.block 'output.state := }
    556   if$
    557 }
    558 
    559 FUNCTION { output.coden }       % UTAH
    560 { % output non-empty CODEN as one-line sentence (stack untouched)
    561   coden empty.or.unknown
    562     { }
    563     { "\showCODEN{" coden * "}" * writeln }
    564   if$
    565 }
    566 
    567 FUNCTION { format.articleno }
    568 {
    569   articleno empty.or.unknown not eid empty.or.unknown not and
    570      { "Both articleno and eid are defined for " cite$ * warning$ }
    571      'skip$
    572   if$
    573   articleno empty.or.unknown eid empty.or.unknown and
    574      { "" }
    575      {
    576         numpages empty.or.unknown
    577           { "articleno or eid field, but no numpages field, in " 
    578             cite$ * warning$ }
    579           { }
    580         if$
    581         eid empty.or.unknown 
    582           { "Article \bibinfo{articleno}{" articleno * "}" * }
    583           { "Article \bibinfo{articleno}{" eid * "}" * }
    584         if$
    585      }
    586   if$
    587 }
    588 
    589 FUNCTION { format.year }
    590 { % push year string or "????" onto output stack
    591   %% Because year is a mandatory field, we always force SOMETHING
    592   %% to be output
    593   "\bibinfo{year}{"
    594   year empty.or.unknown
    595     { "????" }
    596     { year }
    597   if$
    598   *  "}" *
    599 }
    600 
    601 FUNCTION { format.day.month }
    602 { % push "day month " or "month " or "" onto output stack
    603   day empty.or.unknown
    604     {
    605       month empty.or.unknown
    606         { "" }
    607         { "\bibinfo{date}{" month * "} " *}
    608       if$
    609     }
    610     {
    611       month empty.or.unknown
    612         { "" }
    613         { "\bibinfo{date}{" day * " " * month * "} " *}
    614       if$
    615     }
    616   if$
    617 }
    618 
    619 FUNCTION { format.day.month.year }     % UTAH
    620 { % if month is empty, push "" else push "(MON.)" or "(DD MON.)"
    621   % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
    622   % acm-*.bst addition: prefix parenthesized date string with
    623   % ", Article nnn "
    624   articleno empty.or.unknown eid empty.or.unknown and
    625     { "" }
    626     { output.state after.block =
    627        {", " format.articleno * }
    628        { format.articleno  }
    629       if$
    630     }
    631   if$
    632   " (" * format.day.month * format.year * ")" *
    633 }
    634 
    635 FUNCTION { output.day.month.year }     % UTAH
    636 { % if month is empty value, do nothing; else output stack top and
    637   % leave with new top string "(MON.)" or "(DD MON.)"
    638   % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
    639   format.day.month.year
    640   output.nonnull.remove
    641 }
    642 
    643 FUNCTION { strip.doi } % UTAH
    644 { % Strip any Web address prefix to recover the bare DOI, leaving the
    645   % result on the output stack, as recommended by CrossRef DOI
    646   % documentation.
    647   % For example, reduce "http://doi.acm.org/10.1145/1534530.1534545" to
    648   % "10.1145/1534530.1534545".  That is later typeset and displayed as
    649   % doi:10.1145/1534530.1534545 as the LAST item in the reference list
    650   % entry.  Publisher Web sites wrap this with a suitable link to a real
    651   % URL to resolve the DOI, and the master https://doi.org/ address is
    652   % preferred, since publisher-specific URLs can disappear in response
    653   % to economic events.  All journals are encouraged by the DOI
    654   % authorities to use that typeset format and link procedures for
    655   % uniformity across all publications that include DOIs in reference
    656   % lists.
    657   % The numeric prefix is guaranteed to start with "10.", so we use
    658   % that as a test.
    659   % 2017-02-04 Added stripping of https:// (Boris)
    660   doi #1 #3 substring$ "10." =
    661     { doi }
    662     {
    663       doi 't :=  % get modifiable copy of DOI
    664 
    665       % Change https:// to http:// to strip both prefixes (BV)
    666 
    667       t #1 #8 substring$ "https://" =
    668         { "http://"  t #9 t text.length$ #8 - substring$ * 't := }
    669         { }
    670       if$
    671 
    672       t #1 #7 substring$ "http://" =
    673         {
    674             t #8 t text.length$ #7 - substring$ 't :=
    675 
    676             "INTERNAL STYLE-FILE ERROR" 's :=
    677 
    678             % search for next "/" and assign its suffix to s
    679 
    680             { t text.length$ }
    681             {
    682               t #1 #1 substring$ "/" =
    683                 {
    684                   % save rest of string as true DOI (should be 10.xxxx/yyyy)
    685                   t #2 t text.length$ #1 - substring$ 's :=
    686                   "" 't :=    % empty string t terminates the loop
    687                 }
    688                 {
    689                   % discard first character and continue loop: t <= substring(t,2,last)
    690                   t #2 t text.length$ #1 - substring$ 't :=
    691                 }
    692               if$
    693             }
    694             while$
    695 
    696             % check for valid DOI (should be 10.xxxx/yyyy)
    697             s #1 #3 substring$ "10." =
    698               { }
    699               { "unrecognized DOI substring " s * " in DOI value [" * doi * "]" * warning$ }
    700             if$
    701 
    702             s   % push the stripped DOI on the output stack
    703 
    704         }
    705         {
    706           "unrecognized DOI value [" doi * "]" * warning$
    707           doi   % push the unrecognized original DOI on the output stack
    708         }
    709       if$
    710     }
    711   if$
    712 }
    713 
    714 %
    715 % Change by BV: added standard prefix to URL
    716 %
    717 FUNCTION { output.doi } % UTAH
    718 { % output non-empty DOI as one-line sentence (stack untouched)
    719   doi empty.or.unknown
    720     { }
    721     {
    722       %% NB: We want URLs at beginning of line to reduce likelihood of
    723       %% BibTeX's nasty line wrapping after column 79, which then requires
    724       %% manual (or automated) editing of the .bbl file to repair.
    725       %% The \url{} macro strips percent-newlines, and is thus safe in
    726       %% the presence of the line wrapping, but \path|...| and
    727       %% \verb|...| do not.
    728       "\showDOI{%" writeln
    729       "\url{https://doi.org/" strip.doi * "}}" * writeln
    730     }
    731   if$
    732 }
    733 
    734 FUNCTION { output.isbn }                % UTAH
    735 { % output non-empty ISBN-10 and/or ISBN-13 as one-line sentences (stack untouched)
    736   show-isbn-10-and-13
    737     {
    738       %% show both 10- and 13-digit ISBNs
    739       isbn empty.or.unknown
    740         { }
    741         {
    742           "\showISBNx{" isbn * "}" * writeln
    743         }
    744       if$
    745       isbn-13 empty.or.unknown
    746         { }
    747         {
    748           "\showISBNxiii{" isbn-13 * "}" * writeln
    749         }
    750       if$
    751     }
    752     {
    753       %% show 10-digit ISBNs only if 13-digit ISBNs not available
    754       isbn-13 empty.or.unknown
    755         {
    756           isbn empty.or.unknown
    757             { }
    758             {
    759               "\showISBNx{" isbn * "}" * writeln
    760             }
    761           if$
    762         }
    763         {
    764           "\showISBNxiii{" isbn-13 * "}" * writeln
    765         }
    766       if$
    767     }
    768   if$
    769 }
    770 
    771 FUNCTION { output.issn } % UTAH
    772 { % output non-empty ISSN as one-line sentence (stack untouched)
    773   issn empty.or.unknown
    774     { }
    775     { "\showISSN{" issn * "}" * writeln }
    776   if$
    777 }
    778 
    779 FUNCTION { output.issue }
    780 { % output non-empty issue number as a one-line sentence (stack untouched)
    781   issue empty.or.unknown
    782     { }
    783     { "Issue " issue * "." * writeln }
    784   if$
    785 }
    786 
    787 FUNCTION { output.lccn } % UTAH
    788 { % return with stack untouched
    789   lccn empty.or.unknown
    790     { }
    791     { "\showLCCN{" lccn * "}" * writeln }
    792   if$
    793 }
    794 
    795 FUNCTION { output.note } % UTAH
    796 { % return with stack empty
    797   note empty.or.unknown
    798     { }
    799     { "\shownote{" note add.period$ * "}" * writeln }
    800   if$
    801 }
    802 
    803 FUNCTION { output.note.check } % UTAH
    804 { % return with stack empty
    805   note empty.or.unknown
    806     { "empty note in " cite$ * warning$ }
    807     { "\shownote{" note add.period$ * "}" * writeln }
    808   if$
    809 }
    810 
    811 FUNCTION { output.eprint } %
    812 { % return with stack empty
    813   eprint empty.or.unknown
    814     { }
    815     { "\showeprint"
    816          archiveprefix empty.or.unknown
    817            { }
    818            { "["  archiveprefix "l" change.case$ "]" * * * }
    819          if$
    820          "{" *
    821          primaryclass empty.or.unknown
    822            { }
    823            { primaryclass "/" * *}
    824          if$
    825          eprint "}" * *
    826          writeln
    827     }
    828   if$
    829 }
    830 
    831 
    832 %
    833 % Changes by BV 2011/04/15.  Do not output
    834 % url if doi is defined
    835 %
    836 FUNCTION { output.url } % UTAH
    837 { % return with stack untouched
    838   % output URL and associated lastaccessed fields
    839   doi empty.or.unknown
    840   {
    841     url empty.or.unknown
    842       { }
    843       {
    844           %% NB: We want URLs at beginning of line to reduce likelihood of
    845           %% BibTeX's nasty line wrapping after column 79, which would require
    846           %% manual (or automated) editing of the .bbl file to repair.  However,
    847           %% the \url{} macro handles the unwrapping job automatically.
    848           "\showURL{%" writeln
    849           lastaccessed empty.or.unknown
    850             { "" }
    851             { "Retrieved " lastaccessed * " from " * }
    852           if$
    853 
    854           %% The URL field may contain a semicolon-separated list of Web
    855           %% addresses, and we locate and wrap each of them in \url{...}.
    856           %% The simplistic approach of putting the entire list into the
    857           %% macro argument is that the semicolons are typeset in a
    858           %% typewriter font, and no space follows them.
    859           %%
    860           %% We therefore replace the original code
    861           %%    "\url{" * url * "}}" * writeln
    862           %% with this character-at-a-time loop:
    863 
    864           "\url{" *
    865 
    866           url 't :=                       % get modifiable copy of URL list
    867 
    868           { t text.length$ }
    869           {
    870             t #1 #1 substring$ ";" =
    871               {                         % then split argument at separator
    872                 "};" * writeln
    873                 "\url{"
    874               }
    875               {                         % else concatenate nonblank character to argument
    876                 t #1 #1 substring$ " " =
    877                   { }
    878                   { t #1 #1 substring$ * }
    879                 if$
    880               }
    881             if$
    882 
    883             t #2 t text.length$ #1 - substring$ 't :=
    884           }
    885           while$
    886 
    887           "}}" * writeln
    888       }
    889     if$
    890   }
    891   { }
    892   if$
    893 }
    894 
    895 FUNCTION { output.year.check }
    896 { % warn if year empty, else output top string and leave " YEAR<label>" on stack in mid-sentence
    897   year empty.or.unknown
    898      { "empty year in " cite$ * warning$ }
    899      { write$
    900        " \bibinfo{year}{" year * "}"  *
    901        "\natexlab{" extra.label * "}" * *
    902        mid.sentence 'output.state :=
    903      }
    904   if$
    905 }
    906 
    907 
    908 FUNCTION { le }
    909 {
    910   %% test whether first number is less than or equal to second number
    911   %% stack in:  n1 n2
    912   %% stack out: if n1 <= n2 then 1 else 0
    913 
    914   %% "DEBUG: le " cite$ * warning$
    915   > { #0 } { #1 } if$
    916 }
    917 
    918 FUNCTION { ge }
    919 {
    920   %% test whether first number is greater than or equal to second number
    921   %% stack in:  n1 n2
    922   %% stack out: if n1 >= n2 then 1 else 0
    923 
    924   %% "DEBUG: ge " cite$ * warning$
    925   < { #0 } { #1 } if$
    926 }
    927 
    928 FUNCTION { is.leading.digit }
    929 {
    930   %% test whether first character of string is a digit
    931   %% stack in:  string
    932   %% stack out: if first-char-is-digit then 1 else 0
    933 
    934   #1 #1 substring$                      % replace string by string[1:1]
    935   duplicate$                            % string[1:1] string[1:1]
    936   chr.to.int$
    937   "0" chr.to.int$ swap$ le              % "0" <= string[1:1] --> 0-or-1
    938   swap$                                 % 0-or-1 string[1:1]
    939   chr.to.int$
    940   "9" chr.to.int$ le                    % string[1:1} <= "9" --> 0-or-1
    941   and
    942 }
    943 
    944 FUNCTION { skip.digits }
    945 {
    946   %% skip over leading digits in string
    947   %% stack in:  string
    948   %% stack out: rest-of-string leading-digits
    949 
    950   %% "DEBUG: enter skip.digits " cite$ * warning$
    951 
    952   %% dump.stack.1
    953 
    954   duplicate$
    955   't :=
    956   't.org :=
    957   "" 'u :=
    958 
    959   { t text.length$ }
    960   {
    961     %% "=================DEBUG: skip.digits   t = [" t * "]" * warning$
    962     t is.leading.digit
    963       { t #2 t text.length$ #1 - substring$ }
    964       {
    965         t 'u :=
    966         ""
    967       }
    968     if$
    969     't :=
    970   }
    971   while$
    972 
    973   u                                                             % rest of string
    974   t.org #1 t.org text.length$ u text.length$ - substring$       % leading digits
    975 
    976   %% "DEBUG: t.org = [" t.org * "]" * warning$
    977   %% "DEBUG: u     = [" u * "]" * warning$
    978 
    979   %% dump.stack.2
    980 
    981   %% "DEBUG: leave skip.digits " cite$ * warning$
    982 }
    983 
    984 FUNCTION { skip.nondigits }
    985 {
    986   %% skip over leading nondigits in string
    987   %% stack in:  string
    988   %% stack out: rest-of-string
    989 
    990   %% "DEBUG: enter skip.nondigits " cite$ * warning$
    991 
    992   't :=
    993   "" 'u :=
    994 
    995   { t text.length$ }
    996   {
    997     %% "=================DEBUG: skip.nondigits   t = [" t * "]" * warning$
    998     t is.leading.digit
    999       {
   1000         t 'u :=
   1001         ""
   1002       }
   1003       { t #2 t text.length$ #1 - substring$ }
   1004     if$
   1005     't :=
   1006   }
   1007   while$
   1008 
   1009   u                     % rest of string
   1010 
   1011   %% dump.stack.1
   1012   %% "DEBUG: leave skip.nondigits " cite$ * warning$
   1013 }
   1014 
   1015 FUNCTION { parse.next.number }
   1016 {
   1017   %% stack in:  string
   1018   %% stack out: rest-of-string next-numeric-part-of-string
   1019   %% Example:
   1020   %% stack in:  "123:1--123:59"
   1021   %% stack out: ":1--123:59" "123"
   1022 
   1023   's :=
   1024   s skip.nondigits 's :=
   1025   s skip.digits
   1026 }
   1027 
   1028 FUNCTION { reduce.pages.to.page.count }
   1029 {
   1030   %% Stack in:  arbitrary-and-unused
   1031   %% Stack out: unchanged
   1032   %%
   1033   %% For the new-style pagination with article number and numpages or
   1034   %% pages, we expect to have BibTeX entries containing something like
   1035   %%     articleno = "17",
   1036   %%     pages     = "1--23",
   1037   %% with output "Article 17, 23 pages",
   1038   %% or
   1039   %%     articleno = "17",
   1040   %%     numpages  = "23",
   1041   %% with output "Article 17, 23 pages",
   1042   %% or
   1043   %%     articleno = "17",
   1044   %%     pages     = "17:1--17:23",
   1045   %% with output "Article 17, 23 pages",
   1046   %%
   1047   %% If articleno is missing or empty, then we should output "1--23",
   1048   %% "23" (with a warning of a missing articleno), or "17:1--17:23",
   1049   %% respectively.
   1050 
   1051   %% "DEBUG: enter reduce.pages.to.page.count " cite$ * warning$
   1052 
   1053   %% "DEBUG: pages = [" pages * "]" * warning$
   1054 
   1055   pages
   1056   parse.next.number 'p1 :=
   1057   parse.next.number 'p2 :=
   1058   parse.next.number 'p3 :=
   1059   parse.next.number 'page.count :=
   1060 
   1061   duplicate$
   1062   empty.or.unknown
   1063     {  }
   1064     {
   1065       duplicate$ "unexpected trailing garbage [" swap$ *
   1066       "] after n:p1--n:p2 in pages = [" *
   1067       pages *
   1068       "] in " *
   1069       cite$ *
   1070       warning$
   1071     }
   1072   if$
   1073 
   1074   pop$
   1075 
   1076   %% "DEBUG: reduce.pages.to.page.count: "
   1077   %% " p1 = " p1 * *
   1078   %% " p2 = " p2 * *
   1079   %% " p3 = " p3 * *
   1080   %% " p4 = " page.count * *
   1081   %% " in " cite$ * * warning$
   1082 
   1083   p1 p3 =   p2 "1" =   and   numpages empty.or.unknown   and
   1084     { "INFO: reduced pages = [" pages * "] to numpages = [" * page.count * "]" * warning$ }
   1085     {
   1086       numpages empty.or.unknown
   1087         { pages }
   1088         { numpages }
   1089       if$
   1090       'page.count :=
   1091     }
   1092   if$
   1093 
   1094   p1 "1" =   p3 empty.or.unknown   and   numpages empty.or.unknown   and
   1095     {
   1096       p2 'page.count :=
   1097       "INFO: reduced pages = [" pages * "] to numpages = [" * page.count * "]" * warning$
   1098     }
   1099     {
   1100       numpages empty.or.unknown
   1101         { pages }
   1102         { numpages }
   1103       if$
   1104       'page.count :=
   1105     }
   1106   if$
   1107 
   1108   %% "DEBUG: leave reduce.pages.to.page.count " cite$ * warning$
   1109 }
   1110 
   1111 FUNCTION { new.block.checkb }
   1112 { % issue a new.block only if at least one of top two stack strings is not empty
   1113   empty.or.unknown
   1114   swap$ empty.or.unknown
   1115   and
   1116     'skip$
   1117     'new.block
   1118   if$
   1119 }
   1120 
   1121 FUNCTION { field.or.null }
   1122 { % convert empty value to null string, else return value
   1123   duplicate$ empty.or.unknown
   1124     { pop$ "" }
   1125     'skip$
   1126   if$
   1127 }
   1128 
   1129 FUNCTION { emphasize }
   1130 { % emphasize a non-empty top string on the stack (WITHOUT italic correction)
   1131   duplicate$ empty.or.unknown
   1132     { pop$ "" }
   1133     { "{\em " swap$ * "}" * }
   1134   if$
   1135 }
   1136 
   1137 FUNCTION { emphasize.with.italic.correction }
   1138 { % convert empty string to null string, or emphasize with a trailing italic correction
   1139   duplicate$ empty.or.unknown
   1140     { pop$ "" }
   1141     { "{\em " swap$ * "\/}" * }
   1142   if$
   1143 }
   1144 
   1145 FUNCTION { comma }
   1146 { % convert empty string to null string, or brace string and add trailing comma
   1147   duplicate$ empty.or.unknown
   1148     { pop$ "" }
   1149     { "{" swap$ * "}," * }
   1150   if$
   1151 }
   1152 
   1153 FUNCTION { format.names }
   1154 {
   1155   % Format bibliographical entries with the first author last name first,
   1156   % and subsequent authors with initials followed by last name.
   1157   % All names are formatted in this routine.
   1158 
   1159   's :=
   1160   #1 'nameptr :=               % nameptr = 1;
   1161   s num.names$ 'numnames :=    % numnames = num.name$(s);
   1162   numnames 'namesleft :=
   1163     { namesleft #0 > }
   1164     { nameptr #1 =
   1165         %NO: BAD ORDER: {"{" s nameptr "{ff~}{ll}{, jj}{, vv}" format.name$ * "}" * 't := }
   1166         %NO: BAD ORDER: {"{" s nameptr "{ff~}{ll}{, jj}{, vv}" format.name$ * "}" * 't := }
   1167         {"\bibinfo{person}{" s nameptr "{ff }{vv }{ll}{, jj}" format.name$ * "}" * 't := }
   1168         {"\bibinfo{person}{" s nameptr "{ff }{vv }{ll}{, jj}" format.name$ * "}" * 't := }
   1169       if$
   1170       nameptr #1 >
   1171         {
   1172           namesleft #1 >
   1173             { ", " * t * }
   1174             {
   1175               numnames #2 >
   1176                 { "," * }
   1177                 'skip$
   1178               if$
   1179               t "\bibinfo{person}{others}" =
   1180                 { " {et~al\mbox{.}}" * } % jrh: avoid spacing problems
   1181                 { " {and} " * t * } % from Chicago Manual of Style
   1182               if$
   1183             }
   1184           if$
   1185         }
   1186         't
   1187       if$
   1188       nameptr #1 + 'nameptr :=          % nameptr += 1;
   1189       namesleft #1 - 'namesleft :=      % namesleft =- 1;
   1190     }
   1191   while$
   1192 }
   1193 
   1194 FUNCTION { my.full.label }
   1195 {
   1196   's :=
   1197   #1 'nameptr :=               % nameptr = 1;
   1198   s num.names$ 'numnames :=    % numnames = num.name$(s);
   1199   numnames 'namesleft :=
   1200     { namesleft #0 > }
   1201 
   1202     { s nameptr "{vv~}{ll}" format.name$ 't :=  % get the next name
   1203       nameptr #1 >
   1204         {
   1205           namesleft #1 >
   1206             { ", " * t * }
   1207             {
   1208               numnames #2 >
   1209                 { "," * }
   1210                 'skip$
   1211               if$
   1212               t "others" =
   1213                 { " et~al\mbox{.}" * } % jrh: avoid spacing problems
   1214                 { " and " * t * } % from Chicago Manual of Style
   1215               if$
   1216             }
   1217           if$
   1218         }
   1219         't
   1220       if$
   1221       nameptr #1 + 'nameptr :=          % nameptr += 1;
   1222       namesleft #1 - 'namesleft :=      % namesleft =- 1;
   1223     }
   1224   while$
   1225 
   1226 }
   1227 
   1228 FUNCTION { format.names.fml }
   1229 {
   1230   % Format names in "familiar" format, with first initial followed by
   1231   % last name. Like format.names, ALL names are formatted.
   1232   % jtb: The names are NOT put in small caps
   1233 
   1234   's :=
   1235   #1 'nameptr :=               % nameptr = 1;
   1236   s num.names$ 'numnames :=    % numnames = num.name$(s);
   1237   numnames 'namesleft :=
   1238     { namesleft #0 > }
   1239 
   1240     {
   1241       "\bibinfo{person}{" s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ * "}" * 't :=
   1242 
   1243       nameptr #1 >
   1244         {
   1245           namesleft #1 >
   1246             { ", " * t * }
   1247             {
   1248               numnames #2 >
   1249                 { "," * }
   1250                 'skip$
   1251               if$
   1252               t "\bibinfo{person}{others}" =
   1253                 { " {et~al\mbox{.}}" * }
   1254                 { " {and} " * t * }
   1255               if$
   1256             }
   1257           if$
   1258         }
   1259         't
   1260       if$
   1261       nameptr #1 + 'nameptr :=          % nameptr += 1;
   1262       namesleft #1 - 'namesleft :=      % namesleft =- 1;
   1263     }
   1264   while$
   1265 }
   1266 
   1267 FUNCTION { format.authors }
   1268 {
   1269   author empty.or.unknown
   1270     { "" }
   1271     {
   1272       "\bibfield{author}{"
   1273       author format.names add.period$ * "}" *} % jtb: add period if none before
   1274   if$
   1275 }
   1276 
   1277 FUNCTION { format.key }
   1278 {
   1279   empty.or.unknown
   1280     { key field.or.null }
   1281     { "" }
   1282   if$
   1283 }
   1284 
   1285 FUNCTION { format.no.key }
   1286 {
   1287   empty.or.unknown
   1288     { "" }
   1289     { "" }
   1290   if$
   1291 }
   1292 
   1293 FUNCTION { format.editors.fml }
   1294 {
   1295   % Format editor names for use in the "in" types: inbook, incollection,
   1296   % inproceedings: first initial, then last names. When editors are the
   1297   % LABEL for an entry, then format.editor is used which lists editors
   1298   % by last name first.
   1299 
   1300   editor empty.or.unknown
   1301     { "" }
   1302     {
   1303       "\bibfield{editor}{"
   1304       editor format.names.fml
   1305       *  "}" *
   1306       editor num.names$ #1 >
   1307         { " (Eds.)" * }
   1308         { " (Ed.)" * }
   1309       if$
   1310     }
   1311   if$
   1312 }
   1313 
   1314 FUNCTION { format.editors }
   1315 { % format editor names for use in labels, last names first.
   1316   editor empty.or.unknown
   1317     { "" }
   1318     {
   1319       "\bibfield{editor}{"
   1320       editor format.names
   1321       *  "}" *
   1322       editor num.names$ #1 >
   1323         { " (Eds.)." * }
   1324         { " (Ed.)." * }
   1325       if$
   1326     }
   1327   if$
   1328 }
   1329 
   1330 FUNCTION { format.articletitle }
   1331 {
   1332   title empty.or.unknown
   1333     { "" }
   1334     % Use this to preserve lettercase in titles:
   1335     { "\showarticletitle{" title * "}" * }
   1336     % Use this for downcase title style:
   1337     % { \showarticletitle{" title "t" change.case$ * "}" * }
   1338   if$
   1339 }
   1340 
   1341 FUNCTION { format.title }
   1342 {
   1343   title empty.or.unknown
   1344     { "" }
   1345     % Use this to preserve lettercase in titles:
   1346     { "\bibinfo{title}{" title * "}" * }
   1347     % Use this for downcase title style:
   1348     % { title "t" change.case$ }
   1349   if$
   1350 }
   1351 
   1352 FUNCTION { n.dashify }
   1353 {
   1354   't :=
   1355   ""
   1356     { t empty.or.unknown not }
   1357     {
   1358       t #1 #1 substring$ "-" =
   1359         {
   1360           t #1 #2 substring$ "--" = not
   1361             { "--" *
   1362               t #2 global.max$ substring$ 't :=
   1363             }
   1364             {
   1365               { t #1 #1 substring$ "-" = }
   1366               {
   1367                 "-" *
   1368                 t #2 global.max$ substring$ 't :=
   1369               }
   1370               while$
   1371             }
   1372           if$
   1373         }
   1374         {
   1375           t #1 #1 substring$ *
   1376           t #2 global.max$ substring$ 't :=
   1377         }
   1378       if$
   1379     }
   1380   while$
   1381 }
   1382 
   1383 FUNCTION { format.btitle }
   1384 {
   1385   "\bibinfo{booktitle}{"
   1386   edition empty.or.unknown
   1387   { title emphasize }
   1388   { title empty.or.unknown
   1389     { title emphasize } % jtb: what is this supposed to do ?!?
   1390     { "{\em " title * "\/} (\bibinfo{edition}{" * edition "l" change.case$ *
   1391     "} ed.)" * } % jtb: no parens for ed.
   1392     if$
   1393   }
   1394   if$
   1395   * "}" *
   1396 }
   1397 
   1398 FUNCTION { format.emphasize.booktitle }
   1399 { % push "" or "{\em booktitle}" or "{\em booktitle}, (second ed.)" on stack
   1400   "\bibinfo{booktitle}{"
   1401   edition empty.or.unknown
   1402     { booktitle emphasize }
   1403     { booktitle empty.or.unknown
   1404       { "" }
   1405       { "{\em " booktitle * "} (\bibinfo{edition}{" *
   1406       edition "l" change.case$ * "} ed.)" * }
   1407       if$
   1408     }
   1409   if$
   1410   * "}" *
   1411 }
   1412 
   1413 FUNCTION { format.city }
   1414 {
   1415   % jtb: if the preceding string (the title of the conference) is non-empty,
   1416   % jtb: append the location, otherwise leave empty (so as to trigger the
   1417   % jtb: error message in output.check
   1418 
   1419   duplicate$ empty.or.unknown
   1420     { }
   1421     {
   1422       city empty.or.unknown
   1423         {
   1424           date empty.or.unknown
   1425             { }
   1426             { " (" * date * ")" * }
   1427           if$
   1428         }
   1429         {
   1430           date empty.or.unknown
   1431             { " (" * city * ")" * }
   1432             { " (" * city * ", " * date * ")" * }
   1433           if$
   1434         }
   1435       if$
   1436     }
   1437   if$
   1438 }
   1439 
   1440 FUNCTION { tie.or.space.connect }
   1441 {
   1442   duplicate$ text.length$ #3 <
   1443     { "~" }
   1444     { " " }
   1445   if$
   1446   swap$ * *
   1447 }
   1448 
   1449 FUNCTION { either.or.check }
   1450 {
   1451   empty.or.unknown
   1452     'pop$
   1453     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
   1454   if$
   1455 }
   1456 
   1457 FUNCTION { format.bvolume }
   1458 {
   1459   % jtb: If there is a series, this is added and the volume trails after it.
   1460   % jtb: Otherwise, "Vol" is Capitalized.
   1461 
   1462   volume empty.or.unknown
   1463     { "" }
   1464     {
   1465       series empty.or.unknown
   1466         { "Vol.~\bibinfo{volume}{" volume "}" * *}
   1467         { "\bibinfo{series}{" series "}, " * *
   1468           "Vol.~\bibinfo{volume}{" volume "}" * * *}
   1469       if$
   1470       "volume and number" number either.or.check
   1471     }
   1472   if$
   1473 }
   1474 
   1475 FUNCTION { format.bvolume.noseries }
   1476 {
   1477   volume empty.or.unknown
   1478     { "" }
   1479     { "Vol.~\bibinfo{volume}{" volume "}" * *
   1480       "volume and number" number either.or.check
   1481     }
   1482   if$
   1483 }
   1484 
   1485 FUNCTION { format.series }
   1486 {
   1487   series empty.or.unknown
   1488     {""}
   1489     {" {\em (\bibinfo{series}{" * series "})}" *}
   1490   if$
   1491 }
   1492 
   1493 FUNCTION { format.number.series }
   1494 {
   1495   volume empty.or.unknown
   1496     {
   1497       number empty.or.unknown
   1498         {
   1499           volume empty.or.unknown
   1500           { "" }
   1501           {
   1502             series empty.or.unknown
   1503               { "" }
   1504               { " (\bibinfo{series}{" series * "})" * }
   1505             if$
   1506           }
   1507           if$
   1508         }                                       %    { series field.or.null }
   1509         {
   1510           output.state mid.sentence =
   1511             { "Number" }                        % gnp - changed to mixed case always
   1512             { "Number" }
   1513           if$
   1514           number tie.or.space.connect series empty.or.unknown
   1515             { "there's a number but no series in " cite$ * warning$ }
   1516             { " in \bibinfo{series}{" * series * "}" * }
   1517           if$
   1518         }
   1519       if$
   1520     }
   1521     {
   1522       ""
   1523     }
   1524   if$
   1525 }
   1526 
   1527 FUNCTION { multi.page.check }
   1528 {
   1529   't :=
   1530   #0 'multiresult :=
   1531     { multiresult not
   1532       t empty.or.unknown not
   1533       and
   1534     }
   1535     { t #1 #1 substring$
   1536       duplicate$ "-" =
   1537       swap$ duplicate$ "," =
   1538       swap$ "+" =
   1539       or or
   1540     { #1 'multiresult := }
   1541     { t #2 global.max$ substring$ 't := }
   1542       if$
   1543     }
   1544   while$
   1545   multiresult
   1546 }
   1547 
   1548 FUNCTION { format.pages }
   1549 {
   1550   pages empty.or.unknown
   1551     { "" }
   1552     { "\bibinfo{pages}{"
   1553       pages multi.page.check
   1554         { pages n.dashify } % gnp - removed () % jtb: removed pp.
   1555         { pages }
   1556       if$
   1557       * "}" *
   1558     }
   1559   if$
   1560 }
   1561 
   1562 FUNCTION { format.pages.check.without.articleno }
   1563 { %% format pages field only if articleno is absent
   1564   %% Stack out: pages-specification
   1565   numpages missing$ pages missing$ and
   1566     { "page numbers missing in both pages and numpages fields in " cite$ * warning$ }
   1567     { }
   1568   if$
   1569 
   1570   articleno empty.or.unknown eid empty.or.unknown and
   1571     {
   1572       pages missing$
   1573         { numpages }
   1574         { format.pages }
   1575       if$
   1576     }
   1577     { "" }
   1578   if$
   1579 }
   1580 
   1581 FUNCTION { format.pages.check }
   1582 {
   1583   pages empty.or.unknown
   1584     { "page numbers missing in " cite$ * warning$ "" }
   1585     { pages n.dashify }
   1586   if$
   1587 }
   1588 
   1589 FUNCTION { format.bookpages }
   1590 {
   1591   bookpages empty.or.unknown
   1592     { "" }
   1593     { bookpages "book pages" tie.or.space.connect }
   1594   if$
   1595 }
   1596 
   1597 FUNCTION { format.named.pages }
   1598 {
   1599   pages empty.or.unknown
   1600     { "" }
   1601     { format.pages "pages" tie.or.space.connect }
   1602   if$
   1603 }
   1604 
   1605 %
   1606 % Changed by Boris Veytsman, 2011-03-13
   1607 % Now the word "pages" is printed even if
   1608 % there field pages is not empty.
   1609 %
   1610 
   1611 FUNCTION { format.page.count }
   1612 {
   1613   page.count empty.or.unknown
   1614     { "" }
   1615     { "\bibinfo{numpages}{" page.count * "}~pages" * }
   1616   if$
   1617 }
   1618 
   1619 FUNCTION { format.articleno.numpages }
   1620 {
   1621   %% There are seven possible outputs, depending on which fields are set.
   1622   %%
   1623   %% These four are handled here:
   1624   %%
   1625   %%     articleno, numpages, pages     -> "Article articleno-value, numpages-value pages"
   1626   %%     articleno, numpages            -> "Article articleno-value, numpages-value pages"
   1627   %%     articleno, pages               -> "Article articleno-value, reduced-pages-value pages"
   1628   %%     articleno                      -> "Article articleno-value" and warn about missing numpages
   1629   %%
   1630   %% The remaining three have already been handled by
   1631   %% format.pages.check.without.articleno:
   1632   %%
   1633   %%     numpages, pages                -> "pages-value"
   1634   %%     numpages                       -> "numpages-value"
   1635   %%     pages                          -> "pages-value"
   1636 
   1637   articleno empty.or.unknown eid empty.or.unknown and
   1638     {
   1639       numpages empty.or.unknown
   1640         { }
   1641         { "numpages field, but no articleno or eid field, in "
   1642 	  cite$ * warning$ }
   1643       if$
   1644       ""
   1645     }
   1646     {
   1647       numpages empty.or.unknown
   1648         {
   1649           pages empty.or.unknown
   1650             {
   1651               "articleno or eid, but no pages or numpages field in "
   1652 	         cite$ * warning$
   1653               "" 'page.count :=
   1654             }
   1655             { reduce.pages.to.page.count }
   1656           if$
   1657         }
   1658         { numpages 'page.count := }
   1659       if$
   1660 
   1661       %% The Article number is now handled in format.day.month.year because
   1662       %% ACM prefers the style "Digital Libraries 12, 3, Article 5 (July 2008)"
   1663       %% over "Digital Libraries 12, 3 (July 2008), Article 5"
   1664       %% format.articleno output
   1665       format.page.count
   1666     }
   1667   if$
   1668 }
   1669 
   1670 FUNCTION {calc.format.page.count}
   1671 {
   1672   numpages empty.or.unknown
   1673    {
   1674      pages empty.or.unknown
   1675         {
   1676         "" 'page.count :=
   1677         }
   1678         { reduce.pages.to.page.count }
   1679      if$
   1680    }
   1681    { numpages 'page.count := }
   1682   if$
   1683   format.page.count
   1684 }
   1685 
   1686 
   1687 
   1688 FUNCTION { format.journal.volume.number.day.month.year }
   1689 {
   1690   % By Young (and Spencer)
   1691   % GNP - fixed bugs with missing volume, number, and/or pages
   1692   %
   1693   % Format journal, volume, number, pages for article types.
   1694   %
   1695   journal empty.or.unknown
   1696     { "no journal in " cite$ * warning$
   1697       "" }
   1698 %    { journal emphasize.with.italic.correction }
   1699      {
   1700        "\bibinfo{journal}{"
   1701            journal "Journal of the ACM" =
   1702        { "{\it J. ACM}" }
   1703        {
   1704            journal "American Mathematical Society Translations" =
   1705        { "{\it Amer. Math. Soc. Transl.}" }
   1706        {
   1707            journal "Bulletin of the American Mathematical Society" =
   1708        { "{\it Bull. Amer. Math. Soc.}" }
   1709        {
   1710            journal "Proceedings of the American Mathematical Society" =
   1711        { "{\it Proc. Amer. Math. Soc.}" }
   1712        {
   1713            journal "Transactions of the American Mathematical Society" =
   1714        { "{\it Trans. Amer. Math. Soc.}" }
   1715        {
   1716            journal "Communications of the {ACM}" =
   1717        { "{\it Commun. {ACM}}" }
   1718        {
   1719            journal "{ACM} Computing Surveys" =
   1720        { "{\it Comput. Surveys}" }
   1721        {
   1722            journal "{ACM} Transactions on Mathematical Software" =
   1723        { "{\it {ACM} Trans. Math. Software}" }
   1724        {
   1725            journal "{ACM} {SIGNUM} Newsletter" =
   1726        { "{\it {ACM} {SIGNUM} Newslett.}" }
   1727        {
   1728            journal "American Journal of Sociology" =
   1729        { "{\it Amer. J. Sociology}" }
   1730        {
   1731            journal "Journal of the American Statistical Association" =
   1732        { "{\it J. Amer. Statist. Assoc.}" }
   1733        {
   1734            journal "Applied Mathematics and Computation" =
   1735        { "{\it Appl. Math. Comput.}" }
   1736        {
   1737            journal "American Mathematical Monthly" =
   1738        { "{\it Amer. Math. Monthly}" }
   1739        {
   1740            journal "British Journal of Mathematical and Statistical Psychology" =
   1741        { "{\it Brit. J. Math. Statist. Psych.}" }
   1742        {
   1743            journal "Canadian Mathematical Bulletin" =
   1744        { "{\it Canad. Math. Bull.}" }
   1745        {
   1746            journal "Journal of Computational and Applied Mathematics" =
   1747        { "{\it J. Comput. Appl. Math.}" }
   1748        {
   1749            journal "Journal of Computational Physics" =
   1750        { "{\it J. Comput. Phys.}" }
   1751        {
   1752            journal "Computers and Structures" =
   1753        { "{\it Comput. \& Structures}" }
   1754        {
   1755            journal "The Computer Journal" =
   1756        { "{\it Comput. J.}" }
   1757        {
   1758            journal "Journal of Computer and System Sciences" =
   1759        { "{\it J. Comput. System Sci.}" }
   1760        {
   1761            journal "Contemporary Mathematics" =
   1762        { "{\it Contemp. Math.}" }
   1763        {
   1764            journal "Crelle's Journal" =
   1765        { "{\it Crelle's J.}" }
   1766        {
   1767            journal "Giornale di Mathematiche" =
   1768        { "{\it Giorn. Mat.}" }
   1769        {
   1770            journal "{IEEE} Transactions on Computers" =
   1771        { "{\it {IEEE} Trans. Comput.}" }
   1772        {
   1773            journal "{IEEE} Transactions on Automatic Control" =
   1774        { "{\it {IEEE} Trans. Automat. Control}" }
   1775        {
   1776            journal "Proceedings of the {IEEE}" =
   1777        { "{\it Proc. {IEEE}}" }
   1778        {
   1779            journal "{IEEE} Transactions on Aerospace and Electronic Systems" =
   1780        { "{\it {IEEE} Trans. Aerospace Electron. Systems}" }
   1781        {
   1782            journal "{IMA} Journal of Numerical Analysis" =
   1783        { "{\it {IMA} J. Numer. Anal.}" }
   1784        {
   1785            journal "Information Processing Letters" =
   1786        { "{\it Inform. Process. Lett.}" }
   1787        {
   1788            journal "Journal of the Institute of Mathematics and its Applications" =
   1789        { "{\it J. Inst. Math. Appl.}" }
   1790        {
   1791            journal "International Journal of Control" =
   1792        { "{\it Internat. J. Control}" }
   1793        {
   1794            journal "International Journal for Numerical Methods in Engineering" =
   1795        { "{\it Internat. J. Numer. Methods Engrg.}" }
   1796        {
   1797            journal "International Journal of Supercomputing Applications" =
   1798        { "{\it Internat. J. Supercomputing Applic.}" }
   1799        {
   1800            journal "Journal of Research of the National Bureau of Standards" =
   1801        { "{\it J. Res. Nat. Bur. Standards}" }
   1802        {
   1803            journal "Linear Algebra and its Applications" =
   1804        { "{\it Linear Algebra Appl.}" }
   1805        {
   1806            journal "Journal of Mathematical Analysis and Applications" =
   1807        { "{\it J. Math. Anal. Appl.}" }
   1808        {
   1809            journal "Mathematische Annalen" =
   1810        { "{\it Math. Ann.}" }
   1811        {
   1812            journal "Journal of Mathematical Physics" =
   1813        { "{\it J. Math. Phys.}" }
   1814        {
   1815            journal "Mathematics of Computation" =
   1816        { "{\it Math. Comp.}" }
   1817        {
   1818            journal "Mathematica Scandinavica" =
   1819        { "{\it Math. Scand.}" }
   1820        {
   1821            journal "Mathematical Tables and Other Aids to Computation" =
   1822        { "{\it Math. Tables Aids Comput.}" }
   1823        {
   1824            journal "Numerische Mathematik" =
   1825        { "{\it Numer. Math.}" }
   1826        {
   1827            journal "Pacific Journal of Mathematics" =
   1828        { "{\it Pacific J. Math.}" }
   1829        {
   1830            journal "Journal of Parallel and Distributed Computing" =
   1831        { "{\it J. Parallel and Distrib. Comput.}" }
   1832        {
   1833            journal "Parallel Computing" =
   1834        { "{\it Parallel Comput.}" }
   1835        {
   1836            journal "Philosophical Magazine" =
   1837        { "{\it Philos. Mag.}" }
   1838        {
   1839            journal "Proceedings of the National Academy of Sciences of the USA" =
   1840        { "{\it Proc. Nat. Acad. Sci. U. S. A.}" }
   1841        {
   1842            journal "Quarterly Journal of Mathematics, Oxford, Series (2)" =
   1843        { "{\it Quart. J. Math. Oxford Ser. (2)}" }
   1844        {
   1845            journal "Quarterly of Applied Mathematics" =
   1846        { "{\it Quart. Appl. Math.}" }
   1847        {
   1848            journal "Review of the International Statisical Institute" =
   1849        { "{\it Rev. Inst. Internat. Statist.}" }
   1850        {
   1851            journal "Journal of the Society for Industrial and Applied Mathematics" =
   1852        { "{\it J. Soc. Indust. Appl. Math.}" }
   1853        {
   1854            journal "Journal of the Society for Industrial and Applied Mathematics, Series B, Numerical Analysis" =
   1855        { "{\it J. Soc. Indust. Appl. Math. Ser. B Numer. Anal.}" }
   1856        {
   1857            journal "{SIAM} Journal on Algebraic and Discrete Methods" =
   1858        { "{\it {SIAM} J. Algebraic Discrete Methods}" }
   1859        {
   1860            journal "{SIAM} Journal on Applied Mathematics" =
   1861        { "{\it {SIAM} J. Appl. Math.}" }
   1862        {
   1863            journal "{SIAM} Journal on Computing" =
   1864        { "{\it {SIAM} J. Comput.}" }
   1865        {
   1866            journal "{SIAM} Journal on Matrix Analysis and Applications" =
   1867        { "{\it {SIAM} J. Matrix Anal. Appl.}" }
   1868        {
   1869            journal "{SIAM} Journal on Numerical Analysis" =
   1870        { "{\it {SIAM} J. Numer. Anal.}" }
   1871        {
   1872            journal "{SIAM} Review" =
   1873        { "{\it {SIAM} Rev.}" }
   1874        {
   1875            journal "{SIAM} Journal on Scientific and Statistical Computing" =
   1876        { "{\it {SIAM} J. Sci. Statist. Comput.}" }
   1877        {
   1878            journal "Software Practice and Experience" =
   1879        { "{\it Software Prac. Experience}" }
   1880        {
   1881            journal "Statistical Science" =
   1882        { "{\it Statist. Sci.}" }
   1883        {
   1884            journal "{USSR} Computational Mathematics and Mathematical Physics" =
   1885        { "{\it {U. S. S. R.} Comput. Math. and Math. Phys.}" }
   1886        {
   1887            journal "Journal of {VLSI} and Computer Systems" =
   1888        { "{\it J. {VLSI} Comput. Syst.}" }
   1889        {
   1890            journal "Zeitschrift fur Angewandte Mathematik und Mechanik" =
   1891        { "{\it Z. Angew. Math. Mech.}" }
   1892        {
   1893            journal "Zeitschrift fur Angewandte Mathematik und Physik" =
   1894        { "{\it Z. Angew. Math. Phys.}" }
   1895        {
   1896            journal "ACM Computing Surveys" =
   1897        { "{\it Comput. Surveys}" }
   1898        {
   1899            journal "ACM Transactions on Mathematical Software" =
   1900        { "{\it ACM Trans. Math. Software}" }
   1901        {
   1902            journal "ACM {SIGNUM} Newsletter" =
   1903        { "{\it ACM {SIGNUM} Newslett.}" }
   1904        {
   1905            journal "IEEE Transactions on Computers" =
   1906        { "{\it IEEE Trans. Comput.}" }
   1907        {
   1908            journal "IEEE Transactions on Automatic Control" =
   1909        { "{\it IEEE Trans. Automat. Control}" }
   1910        {
   1911            journal "Proceedings of the IEEE" =
   1912        { "{\it Proc. IEEE}" }
   1913        {
   1914            journal "IEEE Transactions on Aerospace and Electronic Systems" =
   1915        { "{\it IEEE Trans. Aerospace Electron. Systems}" }
   1916        {
   1917            journal "IMA Journal of Numerical Analysis" =
   1918        { "{\it IMA J. Numer. Anal.}" }
   1919        {
   1920            journal "SIAM Journal on Algebraic and Discrete Methods" =
   1921        { "{\it SIAM J. Algebraic Discrete Methods}" }
   1922        {
   1923            journal "SIAM Journal on Applied Mathematics" =
   1924        { "{\it SIAM J. Appl. Math.}" }
   1925        {
   1926            journal "SIAM Journal on Computing" =
   1927        { "{\it SIAM J. Comput.}" }
   1928        {
   1929            journal "SIAM Journal on Matrix Analysis and Applications" =
   1930        { "{\it SIAM J. Matrix Anal. Appl.}" }
   1931        {
   1932            journal "SIAM Journal on Numerical Analysis" =
   1933        { "{\it SIAM J. Numer. Anal.}" }
   1934        {
   1935            journal "SIAM Review" =
   1936        { "{\it SIAM Rev.}" }
   1937        {
   1938            journal "SIAM Journal on Scientific and Statistical Computing" =
   1939        { "{\it SIAM J. Sci. Statist. Comput.}" }
   1940        {
   1941            journal "USSR Computational Mathematics and Mathematical Physics" =
   1942        { "{\it U. S. S. R. Comput. Math. and Math. Phys.}" }
   1943        {
   1944            journal "Journal of VLSI and Computer Systems" =
   1945        { "{\it J. VLSI Comput. Syst.}" }
   1946        {
   1947            journal "Communications of the ACM" =
   1948        { "{\it Commun. ACM}" }
   1949        %% If no match with cases needing special handling, just output journal name
   1950        {  journal emphasize.with.italic.correction  }
   1951      if$
   1952            }
   1953      if$
   1954            }
   1955      if$
   1956            }
   1957      if$
   1958            }
   1959      if$
   1960            }
   1961      if$
   1962            }
   1963      if$
   1964            }
   1965      if$
   1966            }
   1967      if$
   1968            }
   1969      if$
   1970            }
   1971      if$
   1972            }
   1973      if$
   1974            }
   1975      if$
   1976            }
   1977      if$
   1978            }
   1979      if$
   1980            }
   1981      if$
   1982            }
   1983      if$
   1984            }
   1985      if$
   1986            }
   1987      if$
   1988            }
   1989      if$
   1990            }
   1991      if$
   1992            }
   1993      if$
   1994            }
   1995      if$
   1996            }
   1997      if$
   1998            }
   1999      if$
   2000            }
   2001      if$
   2002            }
   2003      if$
   2004            }
   2005      if$
   2006            }
   2007      if$
   2008            }
   2009      if$
   2010            }
   2011      if$
   2012            }
   2013      if$
   2014            }
   2015      if$
   2016            }
   2017      if$
   2018            }
   2019      if$
   2020            }
   2021      if$
   2022            }
   2023      if$
   2024            }
   2025      if$
   2026            }
   2027      if$
   2028            }
   2029      if$
   2030            }
   2031      if$
   2032            }
   2033      if$
   2034            }
   2035      if$
   2036            }
   2037      if$
   2038            }
   2039      if$
   2040            }
   2041      if$
   2042            }
   2043      if$
   2044            }
   2045      if$
   2046            }
   2047      if$
   2048            }
   2049      if$
   2050            }
   2051      if$
   2052            }
   2053      if$
   2054            }
   2055      if$
   2056            }
   2057      if$
   2058            }
   2059      if$
   2060            }
   2061      if$
   2062            }
   2063      if$
   2064            }
   2065      if$
   2066            }
   2067      if$
   2068            }
   2069      if$
   2070            }
   2071      if$
   2072            }
   2073      if$
   2074            }
   2075      if$
   2076            }
   2077      if$
   2078            }
   2079      if$
   2080            }
   2081      if$
   2082            }
   2083      if$
   2084            }
   2085      if$
   2086            }
   2087      if$
   2088            }
   2089      if$
   2090            }
   2091      if$
   2092            }
   2093      if$
   2094            }
   2095      if$
   2096            }
   2097      if$
   2098            }
   2099      if$
   2100            }
   2101      if$
   2102            }
   2103      if$
   2104            }
   2105      if$
   2106            }
   2107      if$
   2108            }
   2109      if$
   2110            }
   2111      if$
   2112            }
   2113      if$
   2114            }
   2115      if$
   2116      * "}" *
   2117          }
   2118     if$
   2119 
   2120   number empty.or.unknown
   2121     {
   2122       volume empty.or.unknown
   2123         { "no number and no volume in " cite$ * warning$ "" * }
   2124         { " " * " \bibinfo{volume}{" * volume * "}" * }
   2125       if$
   2126     }
   2127     {
   2128       volume empty.or.unknown
   2129         {
   2130           "unusual to have number, but no volume, for " cite$ * warning$
   2131           " \bibinfo{number}{" * number * "}" *
   2132         }
   2133         { " \bibinfo{volume}{" * volume  * "}, \bibinfo{number}{" *
   2134           number * "}" *}
   2135       if$
   2136     }
   2137   if$
   2138   after.block 'output.state :=
   2139 
   2140   % Sometimes proceedings are published in journals
   2141   % In this case we do not want to put year, day and month here
   2142 
   2143   type$ "inproceedings" =
   2144     { }
   2145     {format.day.month.year * }
   2146   if$
   2147 }
   2148 
   2149 FUNCTION { format.chapter.pages }
   2150 {
   2151   chapter empty.or.unknown
   2152     'format.pages
   2153     { type empty.or.unknown
   2154         { "Chapter" } % gnp - changed to mixed case
   2155         { type "t" change.case$ }
   2156       if$
   2157       chapter tie.or.space.connect
   2158       pages empty.or.unknown
   2159         {"page numbers missing in " cite$ * warning$} % gnp - added check
   2160         { ", " * format.pages * }
   2161       if$
   2162     }
   2163   if$
   2164 }
   2165 
   2166 FUNCTION { format.in.emphasize.booktitle }
   2167 { % jtb: format for collections or proceedings not appearing in a journal
   2168   booktitle empty.or.unknown
   2169   { "" }
   2170   { "In " format.emphasize.booktitle * }
   2171   if$
   2172 }
   2173 
   2174 FUNCTION { format.in.booktitle }
   2175 { % jtb: format for proceedings appearing in a journal
   2176   booktitle empty.or.unknown
   2177   { "" }
   2178   { "In \bibinfo{booktitle}{" booktitle * "}" * }
   2179   if$
   2180 }
   2181 
   2182 FUNCTION { format.in.ed.booktitle }
   2183 {
   2184   booktitle empty.or.unknown
   2185   { "" }
   2186   { editor empty.or.unknown
   2187     { "In " format.emphasize.booktitle * }
   2188                 % jtb: swapped editor location
   2189     { "In " format.emphasize.booktitle * ", " * format.editors.fml * }
   2190     if$
   2191   }
   2192   if$
   2193 }
   2194 
   2195 FUNCTION { format.thesis.type }
   2196 { % call with default type on stack top
   2197   type empty.or.unknown
   2198     'skip$    % use default type
   2199     {
   2200       pop$    % discard default type
   2201       % NO: it is silly to have to brace protect every degree type!:  type "t" change.case$
   2202       type
   2203     }
   2204   if$
   2205 }
   2206 
   2207 FUNCTION { format.tr.number }
   2208 {
   2209   "\bibinfo{type}{"
   2210   type empty.or.unknown
   2211     { "{T}echnical {R}eport" }
   2212     'type
   2213   if$
   2214   "}" * *
   2215   number empty.or.unknown
   2216     { "t" change.case$ }
   2217     %% LOOKS BAD: { "." * number tie.or.space.connect }
   2218     %% Prefer "Research report RJ687." to "Research report. RJ687."
   2219     { number tie.or.space.connect }
   2220   if$
   2221 }
   2222 
   2223 FUNCTION { format.advisor }
   2224 {
   2225   advisor empty.or.unknown
   2226     { "" }
   2227     { "Advisor(s) " advisor * }
   2228   if$
   2229 }
   2230 
   2231 FUNCTION { format.article.crossref }
   2232 { "See"
   2233   "\citeN{" * crossref * "}" *
   2234 }
   2235 
   2236 FUNCTION { format.crossref.editor }
   2237 {
   2238   editor #1 "{vv~}{ll}" format.name$
   2239   editor num.names$ duplicate$
   2240   #2 >
   2241     { pop$ " et~al\mbox{.}" * }         % jrh: avoid spacing problems
   2242     { #2 <
   2243     'skip$
   2244     { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
   2245         { " et~al\mbox{.}" * }          % jrh: avoid spacing problems
   2246         { " and " * editor #2 "{vv~}{ll}" format.name$ * }
   2247       if$
   2248     }
   2249       if$
   2250     }
   2251   if$
   2252 }
   2253 
   2254 FUNCTION { format.book.crossref }
   2255 {
   2256   volume empty.or.unknown
   2257     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
   2258       "In "
   2259     }
   2260     { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
   2261       " of " *
   2262     }
   2263   if$
   2264   editor empty.or.unknown
   2265   editor field.or.null author field.or.null =
   2266   or
   2267     { key empty.or.unknown
   2268     { series empty.or.unknown
   2269         { "need editor, key, or series for " cite$ * " to crossref " *
   2270           crossref * warning$
   2271           "" *
   2272         }
   2273         { "{\em " * series * "\/}" * }
   2274       if$
   2275     }
   2276     { key * }
   2277       if$
   2278     }
   2279     { format.crossref.editor * }
   2280   if$
   2281   " \citeN{" * crossref * "}" *
   2282 }
   2283 
   2284 FUNCTION { format.incoll.inproc.crossref }
   2285 { "See"
   2286   " \citeN{" * crossref * "}" *
   2287 }
   2288 
   2289 FUNCTION { format.lab.names }
   2290 {
   2291   % format.lab.names:
   2292   %
   2293   % determines "short" names for the abbreviated author information.
   2294   % "Long" labels are created in calc.label, using the routine my.full.label
   2295   % to format author and editor fields.
   2296   %
   2297   % There are 4 cases for labels.   (n=3 in the example)
   2298   % a) one author             Foo
   2299   % b) one to n               Foo, Bar and Baz
   2300   % c) use of "and others"    Foo, Bar et al.
   2301   % d) more than n            Foo et al.
   2302 
   2303   's :=
   2304   s num.names$ 'numnames :=
   2305   numnames #2 >    % change number to number of others allowed before
   2306                    % forcing "et al".
   2307     { s #1 "{vv~}{ll}" format.name$ " et~al\mbox{.}" * } % jrh: \mbox{} added
   2308     {
   2309       numnames #1 - 'namesleft :=
   2310       #2 'nameptr :=
   2311       s #1 "{vv~}{ll}" format.name$
   2312         { namesleft #0 > }
   2313         { nameptr numnames =
   2314             { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
   2315                 { " et~al\mbox{.}" * }          % jrh: avoid spacing problems
   2316                 { " and " * s nameptr "{vv~}{ll}" format.name$ * }
   2317               if$
   2318             }
   2319             { ", " * s nameptr "{vv~}{ll}" format.name$ * }
   2320           if$
   2321           nameptr #1 + 'nameptr :=
   2322           namesleft #1 - 'namesleft :=
   2323         }
   2324       while$
   2325     }
   2326   if$
   2327 }
   2328 
   2329 FUNCTION { author.key.label }
   2330 {
   2331   author empty.or.unknown
   2332     { key empty.or.unknown
   2333           { "no key, author in " cite$ * warning$
   2334             cite$ #1 #3 substring$ }
   2335          'key
   2336       if$
   2337     }
   2338     { author format.lab.names }
   2339   if$
   2340 }
   2341 
   2342 FUNCTION { editor.key.organization.label }
   2343 { % added - gnp. Provide label formatting by organization if editor is null.
   2344   editor empty.or.unknown
   2345     { organization empty.or.unknown
   2346         { key empty.or.unknown
   2347             { "no key, editor or organization in " cite$ * warning$
   2348               cite$ #1 #3 substring$ }
   2349             'key
   2350           if$
   2351         }
   2352         { organization }
   2353       if$
   2354     }
   2355     { editor format.lab.names }
   2356   if$
   2357 }
   2358 
   2359 FUNCTION { author.editor.key.label }
   2360 {
   2361   author empty.or.unknown
   2362     { editor empty.or.unknown
   2363           { key empty.or.unknown
   2364                { "no key, author, or editor in " cite$ * warning$
   2365                  cite$ #1 #3 substring$ }
   2366              'key
   2367            if$
   2368          }
   2369           { editor format.lab.names }
   2370       if$
   2371     }
   2372     { author format.lab.names }
   2373   if$
   2374 }
   2375 
   2376 FUNCTION { author.editor.key.organization.label }
   2377 { % added - gnp. Provide label formatting by organization if author is null.
   2378   author empty.or.unknown
   2379     { editor empty.or.unknown
   2380         { organization empty.or.unknown
   2381             { key empty.or.unknown
   2382                { "no key, author, editor or organization in " cite$ * warning$
   2383                  cite$ #1 #3 substring$ }
   2384                'key
   2385               if$
   2386             }
   2387             { organization }
   2388           if$
   2389         }
   2390         { editor format.lab.names }
   2391       if$
   2392     }
   2393     { author format.lab.names }
   2394   if$
   2395 }
   2396 
   2397 FUNCTION { calc.basic.label }
   2398 {
   2399   type$ "book" =
   2400   type$ "inbook" =
   2401   or
   2402   type$ "article" =
   2403   or
   2404     'author.editor.key.label
   2405     { type$ "proceedings" =
   2406       type$ "periodical" =
   2407       or
   2408         'editor.key.organization.label
   2409         { type$ "manual" =
   2410             'author.editor.key.organization.label
   2411             'author.key.label
   2412           if$
   2413         }
   2414       if$
   2415     }
   2416   if$
   2417 }
   2418 
   2419 FUNCTION { calc.label }
   2420 {
   2421   % Changed - GNP. See also author.editor.organization.sort, editor.organization.sort
   2422   % Form label for BibTeX entry. The classification of which fields are used
   2423   % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
   2424   % The change here from newapa is to also include organization as a
   2425   % citation label if author or editor is missing.
   2426 
   2427   calc.basic.label
   2428 
   2429   author empty.or.unknown  % generate the full label citation information.
   2430     {
   2431       editor empty.or.unknown
   2432         {
   2433           organization empty.or.unknown
   2434             {
   2435               key empty.or.unknown
   2436                 {
   2437                   "no author, editor, organization, or key in " cite$ * warning$
   2438                   "??"
   2439                 }
   2440                 { key }
   2441               if$
   2442             }
   2443             { organization }
   2444           if$
   2445         }
   2446         { editor my.full.label }
   2447       if$
   2448     }
   2449     { author my.full.label }
   2450   if$
   2451 
   2452   % leave label on the stack, to be popped when required.
   2453 
   2454   "}{" * swap$ * "}{" *
   2455   %  year field.or.null purify$ #-1 #4 substring$ *
   2456   %
   2457   % save the year for sort processing afterwards (adding a, b, c, etc.)
   2458   %
   2459   year field.or.null purify$ #-1 #4 substring$
   2460   'label.year :=
   2461 }
   2462 
   2463 
   2464 FUNCTION { output.bibitem }
   2465 {
   2466   newline$
   2467   "\bibitem[\protect\citeauthoryear{" write$
   2468   calc.label write$
   2469   sort.year write$
   2470   "}]%" writeln
   2471   "        {" write$
   2472   cite$ write$
   2473   "}" writeln
   2474   ""
   2475   before.all 'output.state :=
   2476 }
   2477 
   2478 
   2479 FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint }
   2480 { % enter and return with stack empty
   2481   %% We switch now from buffered output to output of complete lines, so
   2482   %% that the Issue .. URL data have their own lines, and are less likely
   2483   %% to be line-wrapped by BibTeX's short-sighted algorithm, which wraps
   2484   %% lines longer than 79 characters, backtracking to what it thinks is
   2485   %% a break point in the string.  Any such wrapping MUST be undone to
   2486   %% prevent percent-newline from appearing in DOIs and URLs.  The
   2487   %% output data are intentionally wrapped in \showxxx{} macros at
   2488   %% beginning of line, and that supply their own punctuation (if they
   2489   %% are not defined to suppress output entirely), to make it easier for
   2490   %% other software to recover them from .bbl files.
   2491   %%
   2492   %% It also makes it possible to later change the macro definitions
   2493   %% to suppress particular output values, or alter their appearance.
   2494   %%
   2495   %% Note that it is possible for theses, technical reports, and
   2496   %% manuals to have ISBNs, and anything that has an ISBN may also
   2497   %% have an ISSN.  When there are no values for these keys, there
   2498   %% is no output generated for them here.
   2499 
   2500   "\newblock" writeln
   2501   after.block 'output.state :=
   2502 
   2503   output.issue
   2504   output.isbn
   2505   output.coden  % CODEN is functionally like ISSN, so output them sequentially
   2506   output.issn
   2507   output.lccn
   2508   output.doi    % DOI is ALWAYS last according to CrossRef DOI documentation
   2509   output.eprint
   2510   output.url    % but ACM wants URL last
   2511 }
   2512 
   2513 FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint.note }
   2514 { % enter with stack empty, return with empty string on stack
   2515   output.issue.doi.coden.isxn.lccn.url.eprint
   2516   note empty.or.unknown
   2517     { }
   2518     {
   2519       "\newblock" writeln
   2520       output.note
   2521     }
   2522   if$
   2523   ""
   2524 }
   2525 
   2526 FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint.note.check }
   2527 { % enter with stack empty, return with empty string on stack
   2528   output.issue.doi.coden.isxn.lccn.url.eprint
   2529   note empty.or.unknown
   2530     { }
   2531     {
   2532       "\newblock" writeln
   2533       output.note.check
   2534     }
   2535   if$
   2536   ""
   2537 }
   2538 
   2539 FUNCTION { article }
   2540 {
   2541   output.bibitem
   2542 
   2543   author empty.or.unknown
   2544     {
   2545       editor empty.or.unknown
   2546         { "neither author and editor supplied for " cite$ * warning$ }
   2547         { format.editors "editor" output.check }
   2548       if$
   2549     }
   2550     { format.authors "author" output.check }
   2551   if$
   2552 
   2553   author format.no.key output       % added
   2554   output.year.check                 % added
   2555   new.block
   2556   format.articletitle "title" output.check
   2557   new.block
   2558   howpublished empty.or.unknown
   2559     { }
   2560     { "\bibinfo{howpublished}{" howpublished "}" * * output }
   2561   if$
   2562 
   2563   crossref missing$
   2564     { format.journal.volume.number.day.month.year output}
   2565     {
   2566       "cross reference in @Article{...} is unusual" warning$
   2567       format.article.crossref output.nonnull
   2568     }
   2569   if$
   2570 
   2571   format.pages.check.without.articleno output
   2572   format.articleno.numpages output
   2573   fin.block
   2574   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2575   fin.entry
   2576 }
   2577 
   2578 FUNCTION { book }
   2579 {
   2580   output.bibitem
   2581   author empty.or.unknown
   2582     { format.editors "author and editor" output.check }
   2583     { format.authors output.nonnull
   2584       crossref missing$
   2585         { "author and editor" editor either.or.check }
   2586         'skip$
   2587       if$
   2588     }
   2589   if$
   2590   output.year.check       % added
   2591   new.block
   2592   format.btitle "title" output.check
   2593   crossref missing$
   2594     { new.sentence              % jtb: start a new sentence for series/volume
   2595       format.bvolume output
   2596       new.block
   2597       format.number.series output
   2598       new.sentence
   2599       publisher "publisher" bibinfo.output.check
   2600       address "address" bibinfo.output.check    % jtb: require address
   2601       fin.sentence
   2602       pages empty.or.unknown
   2603         { format.bookpages }    % use bookpages when pages empty
   2604         { format.pages.check "pages" tie.or.space.connect }
   2605       if$
   2606       output
   2607     }
   2608     { new.block
   2609       format.book.crossref output.nonnull
   2610     }
   2611   if$
   2612   fin.block
   2613   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2614   fin.entry
   2615 }
   2616 
   2617 FUNCTION { booklet }
   2618 {
   2619   output.bibitem
   2620   format.authors output
   2621   author format.key output          % added
   2622   output.year.check                 % added
   2623   new.block
   2624   format.title "title" output.check
   2625   new.block
   2626     howpublished empty.or.unknown
   2627     { }
   2628     { "\bibinfo{howpublished}{" howpublished "}" * * output }
   2629   if$
   2630   address output
   2631   fin.block
   2632   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2633   fin.entry
   2634 }
   2635 
   2636 FUNCTION { inbook }
   2637 {
   2638   output.bibitem
   2639   author empty.or.unknown
   2640     { format.editors
   2641       "author and editor" output.check
   2642     }
   2643     { format.authors output.nonnull
   2644       crossref missing$
   2645     { "author and editor" editor either.or.check }
   2646     'skip$
   2647       if$
   2648     }
   2649   if$
   2650   output.year.check                 % added
   2651   new.block
   2652   format.btitle "title" output.check
   2653   crossref missing$
   2654     { new.sentence              % jtb: start a new sentence for series/volume
   2655       format.bvolume output
   2656       new.block
   2657       format.number.series output
   2658       new.sentence
   2659       publisher "publisher" bibinfo.output.check
   2660       address "address" bibinfo.output.check    % jtb: require address
   2661       format.bookpages output
   2662       format.chapter.pages
   2663       "chapter and pages" output.check  % jtb: moved from before publisher
   2664     }
   2665     {
   2666       format.bookpages output
   2667       format.chapter.pages "chapter and pages" output.check
   2668       new.block
   2669       format.book.crossref output.nonnull
   2670     }
   2671   if$
   2672   fin.block
   2673   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2674   fin.entry
   2675 }
   2676 
   2677 FUNCTION { incollection }
   2678 {
   2679   output.bibitem
   2680   format.authors "author" output.check
   2681   author format.key output       % added
   2682   output.year.check              % added
   2683   new.block
   2684   format.articletitle "title" output.check
   2685   new.block
   2686   crossref missing$
   2687     { format.in.ed.booktitle "booktitle" output.check
   2688       new.sentence                % jtb: start a new sentence for series/volume
   2689       format.bvolume output
   2690       format.number.series output
   2691       new.sentence
   2692       publisher "publisher" bibinfo.output.check
   2693       address "address" bibinfo.output.check      % jtb: require address
   2694       format.bookpages output
   2695       format.chapter.pages output % gnp - was special.output.nonnull
   2696                                   % left out comma before page numbers
   2697                                   % jtb: moved from before publisher
   2698     }
   2699     {
   2700       format.incoll.inproc.crossref output.nonnull
   2701       format.chapter.pages output
   2702     }
   2703   if$
   2704   fin.block
   2705   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2706   fin.entry
   2707 }
   2708 
   2709 FUNCTION { inproceedings }
   2710 {
   2711   output.bibitem
   2712   format.authors "author" output.check
   2713   author format.key output            % added
   2714   output.year.check                   % added
   2715   new.block
   2716   format.articletitle "title" output.check
   2717   howpublished empty.or.unknown
   2718     { }
   2719     { "\bibinfo{howpublished}{" howpublished "}" * * output.dot.space }
   2720   if$
   2721   crossref missing$
   2722     {
   2723       journal missing$          % jtb: proceedings appearing in journals
   2724         { format.in.emphasize.booktitle format.city "booktitle"  output.check.dot.space
   2725           format.series output.removenospace
   2726           format.editors.fml output % BV 2011/09/27 Moved dot to comma
   2727           format.bvolume.noseries output
   2728           new.sentence
   2729           organization output
   2730           publisher "publisher" bibinfo.output.check % jtb: require publisher (?)
   2731           address "address" bibinfo.output.check  % jtb: require address
   2732           format.bookpages output
   2733         }
   2734         {
   2735            format.in.booktitle format.city "booktitle" output.check
   2736            format.editors.fml output
   2737            new.sentence
   2738            format.journal.volume.number.day.month.year output
   2739         }
   2740       if$
   2741       format.articleno output
   2742       format.pages.check.without.articleno output
   2743     }
   2744     {
   2745       format.incoll.inproc.crossref output.nonnull
   2746       format.articleno output
   2747       format.pages.check.without.articleno output
   2748     }
   2749   if$
   2750   format.articleno.numpages output
   2751   fin.block
   2752   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2753   fin.entry
   2754 }
   2755 
   2756 FUNCTION { conference } { inproceedings }
   2757 
   2758 FUNCTION { manual }
   2759 {
   2760   output.bibitem
   2761   author empty.or.unknown
   2762     { editor empty.or.unknown
   2763       { organization "organization" output.check
   2764         organization format.key output }  % if all else fails, use key
   2765       { format.editors "author and editor" output.check }
   2766       if$
   2767     }
   2768     { format.authors output.nonnull }
   2769     if$
   2770   output.year.check                 % added
   2771   new.block
   2772   format.btitle "title" output.check
   2773   organization address new.block.checkb
   2774   % jtb: back to normal style: organization, address
   2775   organization "organization" output.check
   2776   address output
   2777   fin.block
   2778   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2779   fin.entry
   2780 }
   2781 
   2782 FUNCTION { mastersthesis }
   2783 {
   2784   output.bibitem
   2785   format.authors "author" output.check
   2786   author format.key output          % added
   2787   output.year.check                 % added
   2788   new.block
   2789   format.title emphasize "title" output.check  % NB: ACM style requires emphasized thesis title
   2790   new.block
   2791   "\bibinfo{thesistype}{Master's\ thesis}" format.thesis.type output
   2792   new.sentence
   2793   school "school" bibinfo.output.check
   2794   address empty.or.unknown
   2795      { }
   2796      { "\bibinfo{address}{" address * "}" * output }
   2797   if$
   2798   new.block
   2799   format.advisor output
   2800   fin.block
   2801   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2802   fin.entry
   2803 }
   2804 
   2805 FUNCTION { misc }
   2806 {
   2807   output.bibitem
   2808   format.authors output
   2809   author format.key output            % added
   2810   output.year.check                   % added
   2811   title howpublished new.block.checkb
   2812   format.title output
   2813   new.block
   2814   howpublished empty.or.unknown
   2815     { }
   2816     { "\bibinfo{howpublished}{" howpublished "}" * * output }
   2817   if$
   2818   "" output.nonnull.dot.space
   2819   output.day.month.year
   2820   calc.format.page.count output
   2821   fin.block
   2822   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2823   fin.entry
   2824 }
   2825 
   2826 FUNCTION { online } { misc }
   2827 
   2828 FUNCTION { game } { misc }
   2829 
   2830 
   2831 FUNCTION { phdthesis }
   2832 {
   2833   output.bibitem
   2834   format.authors "author" output.check
   2835   author format.key output          % added
   2836   output.year.check                 % added
   2837   new.block
   2838   format.title emphasize "title" output.check  % NB: ACM style requires emphasized thesis title
   2839   new.block
   2840   "\bibinfo{thesistype}{Ph.D. Dissertation}" format.thesis.type output
   2841   new.sentence
   2842   school "school" bibinfo.output.check
   2843   address empty.or.unknown
   2844      { }
   2845      { "\bibinfo{address}{" address * "}" * output }
   2846   if$
   2847   new.block
   2848   format.advisor output
   2849   fin.block
   2850   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2851   fin.entry
   2852 }
   2853 
   2854 FUNCTION {format.date}
   2855 { year empty.or.unknown
   2856     { month empty.or.unknown
   2857         {
   2858           ""                    % output empty date if year/month both empty
   2859           day empty.or.unknown
   2860             {  }
   2861             { "there's a day but no month or year in " cite$ * warning$ }
   2862           if$
   2863         }
   2864         { "there's a month but no year in " cite$ * warning$
   2865           month
   2866           day empty.or.unknown
   2867             { }
   2868             { " " * day * }
   2869           if$
   2870         }
   2871       if$
   2872     }
   2873     { month empty.or.unknown
   2874         {
   2875           year                  % output only year if month empty
   2876           day empty.or.unknown
   2877             {  }
   2878             { "there's a day and year but no month in " cite$ * warning$ }
   2879           if$
   2880         }
   2881         {
   2882           month " " *
   2883           day empty.or.unknown
   2884             { }
   2885             { day * ", " * }
   2886           if$
   2887           year *
   2888         }
   2889       if$
   2890     }
   2891   if$
   2892 }
   2893 
   2894 FUNCTION {new.block.checka}
   2895 {
   2896   empty.or.unknown
   2897     'skip$
   2898     'new.block
   2899   if$
   2900 }
   2901 
   2902 FUNCTION { periodical }
   2903 {
   2904   output.bibitem
   2905   editor empty.or.unknown
   2906     { organization output }
   2907     { format.editors output.nonnull }
   2908   if$
   2909   new.block
   2910   output.year.check
   2911   new.sentence
   2912   format.articletitle "title" output.check
   2913   format.journal.volume.number.day.month.year output
   2914   calc.format.page.count output
   2915   fin.entry
   2916 }
   2917 
   2918 FUNCTION { proceedings }
   2919 {
   2920   output.bibitem
   2921   editor empty.or.unknown
   2922     { organization output
   2923       organization format.key output }  % gnp - changed from author format.key
   2924     { format.editors output.nonnull }
   2925   if$
   2926   % author format.key output             % gnp - removed (should be either
   2927   %                                        editor or organization
   2928   output.year.check                    % added (newapa)
   2929   new.block
   2930   format.btitle format.city "title" output.check        % jtb: added city
   2931   new.sentence
   2932   format.bvolume output
   2933   format.number.series output
   2934   new.sentence
   2935   organization output
   2936   % jtb: normal order: publisher, address
   2937   publisher empty.or.unknown
   2938      { }
   2939      { "\bibinfo{publisher}{" publisher * "}" * output }
   2940   if$
   2941   address empty.or.unknown
   2942      { }
   2943      { "\bibinfo{address}{" address * "}" * output }
   2944   if$
   2945   fin.block
   2946   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2947   fin.entry
   2948 }
   2949 
   2950 FUNCTION { techreport }
   2951 {
   2952   output.bibitem
   2953   format.authors "author" output.check
   2954   author format.key output             % added
   2955   output.year.check                    % added
   2956   new.block
   2957   format.btitle "title" output.check
   2958   new.block
   2959 %   format.tr.number output               % jtb: moved month ...
   2960   format.tr.number output new.sentence    % Gerry  - need dot 2011/09/28
   2961   institution "institution" bibinfo.output.check
   2962   address empty.or.unknown
   2963     { }
   2964     { "\bibinfo{address}{" address "}" * * output }
   2965   if$
   2966   new.sentence
   2967   format.named.pages output
   2968   % ACM omits year at end in transactions style
   2969   % format.day.month.year output.nonnull.dot.space  % jtb: ... to here (no parens)
   2970   fin.block
   2971   output.issue.doi.coden.isxn.lccn.url.eprint.note
   2972   fin.entry
   2973 }
   2974 
   2975 FUNCTION { unpublished }
   2976 {
   2977   output.bibitem
   2978   format.authors
   2979   "author" output.check
   2980   author format.key output              % added
   2981   output.year.check                     % added
   2982   new.block
   2983   format.title "title" output.check
   2984   fin.sentence
   2985   output.day.month.year                 % UTAH
   2986   calc.format.page.count output
   2987   fin.block
   2988   output.issue.doi.coden.isxn.lccn.url.eprint.note.check
   2989   fin.entry
   2990 }
   2991 
   2992 FUNCTION { default.type } { misc }
   2993 
   2994 %%% ACM journal-style month definitions: full name if 1--5 letters, else
   2995 %%% abbreviation of 3 or 4 characters and a dot
   2996 
   2997 MACRO {jan}             {"Jan."}
   2998 
   2999 MACRO {feb}             {"Feb."}
   3000 
   3001 MACRO {mar}             {"March"}
   3002 
   3003 MACRO {apr}             {"April"}
   3004 
   3005 MACRO {may}             {"May"}
   3006 
   3007 MACRO {jun}             {"June"}
   3008 
   3009 MACRO {jul}             {"July"}
   3010 
   3011 MACRO {aug}             {"Aug."}
   3012 
   3013 MACRO {sep}             {"Sept."}
   3014 
   3015 MACRO {oct}             {"Oct."}
   3016 
   3017 MACRO {nov}             {"Nov."}
   3018 
   3019 MACRO {dec}             {"Dec."}
   3020 
   3021 
   3022 %%% ====================================================================
   3023 %%%                 I M P O R T A N T   C H A N G E
   3024 %%%
   3025 %%% For the 2009 release of the official acm-*.bst files, there are to
   3026 %%% be NO predefined journal abbreviations in those style files.
   3027 %%%
   3028 %%% ACM may later develop an official list of mappings of full journal
   3029 %%% names of commonly-cited journals to ACM-preferred abbreviations, but
   3030 %%% authors should consider that use of any of these commented-out
   3031 %%% abbreviations is DEPRECATED unless the BibTeX file itself provides
   3032 %%% its own @String{name = "value"} definitions.
   3033 %%%
   3034 %%% Use of journal (and publisher and address) @String{...}
   3035 %%% abbreviations, as opposed to explicit value assignments such as
   3036 %%% journal = "J. ACM" and publisher = "IEEE", is preferred in
   3037 %%% bibliographic databases, because it makes it easier for journal
   3038 %%% production staff to replace those definitions by publisher-preferred
   3039 %%% abbreviations when articles are typeset for publication.
   3040 %%%
   3041 %%% For historical reasons, and because some of these abbreviations are
   3042 %%% used in other (non-ACM) bibliography style files, they are preserved
   3043 %%% here in comments.  Future releases of the acm*-.bst files are likely
   3044 %%% to remove them entirely.
   3045 %%% ====================================================================
   3046 %%%
   3047 %%% DEPRECATED: MACRO {acmcs}           {"ACM Comput. Surv."}                   % original BibTeX
   3048 %%% DEPRECATED:
   3049 %%% DEPRECATED: MACRO {acmlett}         {"ACM Lett. Program. Lang. Syst."}
   3050 %%% DEPRECATED:
   3051 %%% DEPRECATED: MACRO {acta}            {"Acta Inf."}                           % original BibTeX
   3052 %%% DEPRECATED:
   3053 %%% DEPRECATED: MACRO {ai}              {"Artificial Intelligence"}
   3054 %%% DEPRECATED:
   3055 %%% DEPRECATED: MACRO {al}              {"Ada Lett."}
   3056 %%% DEPRECATED:
   3057 %%% DEPRECATED: MACRO {acr}             {"Adv. Comput. Res."}
   3058 %%% DEPRECATED:
   3059 %%% DEPRECATED: MACRO {bit}             {"Bit"}
   3060 %%% DEPRECATED:
   3061 %%% DEPRECATED: MACRO {cacm}            {"Commun. ACM"}                         % original BibTeX
   3062 %%% DEPRECATED:
   3063 %%% DEPRECATED: MACRO {cj}              {"Comput. J."}
   3064 %%% DEPRECATED:
   3065 %%% DEPRECATED: MACRO {cn}              {"Comput. Netw."}
   3066 %%% DEPRECATED:
   3067 %%% DEPRECATED: MACRO {cl}              {"Comput. Lang."}
   3068 %%% DEPRECATED:
   3069 %%% DEPRECATED: MACRO {ibmjrd}          {"IBM J. Res. and Development"}         % original BibTeX
   3070 %%% DEPRECATED:
   3071 %%% DEPRECATED: MACRO {ibmsj}           {"IBM Systems Journal"}                 % original BibTeX
   3072 %%% DEPRECATED:
   3073 %%% DEPRECATED: MACRO {ict}             {"Inf. Contr."}
   3074 %%% DEPRECATED:
   3075 %%% DEPRECATED: MACRO {ieebcs}          {"IEE/BCS Softw. Eng. J."}
   3076 %%% DEPRECATED:
   3077 %%% DEPRECATED: MACRO {ieees}           {"IEEE Softw."}
   3078 %%% DEPRECATED:
   3079 %%% DEPRECATED: MACRO {ieeese}          {"IEEE Trans. Softw. Eng."}             % original BibTeX
   3080 %%% DEPRECATED:
   3081 %%% DEPRECATED: MACRO {ieeetc}          {"IEEE Trans. Comput."}                 % original BibTeX
   3082 %%% DEPRECATED:
   3083 %%% DEPRECATED: MACRO {ieeetcad}        {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"} % original BibTeX
   3084 %%% DEPRECATED:
   3085 %%% DEPRECATED: MACRO {ieeetpds}        {"IEEE Trans. Parall. Distrib. Syst."}
   3086 %%% DEPRECATED:
   3087 %%% DEPRECATED: MACRO {ieeetit}         {"IEEE Trans. Inf. Theory"}
   3088 %%% DEPRECATED:
   3089 %%% DEPRECATED: MACRO {ipl}             {"Inf. Process. Lett."}                 % original BibTeX
   3090 %%% DEPRECATED:
   3091 %%% DEPRECATED: MACRO {icp}             {"Inf. Comput."}
   3092 %%% DEPRECATED:
   3093 %%% DEPRECATED: MACRO {ist}             {"Inf. Softw. Tech."}
   3094 %%% DEPRECATED:
   3095 %%% DEPRECATED: MACRO {ijsa}            {"Int. J. Supercomput. Appl."}
   3096 %%% DEPRECATED:
   3097 %%% DEPRECATED: MACRO {ijpp}            {"Int. J. Parallel Program."}
   3098 %%% DEPRECATED:
   3099 %%% DEPRECATED: MACRO {jacm}            {"J. ACM"}                              % original BibTeX
   3100 %%% DEPRECATED:
   3101 %%% DEPRECATED: % MACRO {jcss}          {"Journal of Computer and System Sciences"} % original BibTeX
   3102 %%% DEPRECATED: MACRO {jcss}            {"J. Comput. Syst. Sci."}               % original BibTeX
   3103 %%% DEPRECATED:
   3104 %%% DEPRECATED: MACRO {jlp}             {"J. Logic Program."}
   3105 %%% DEPRECATED:
   3106 %%% DEPRECATED: MACRO {jfp}             {"J. Funct. Program."}
   3107 %%% DEPRECATED:
   3108 %%% DEPRECATED: MACRO {jsmrp}           {"J. Softw. Maint. Res. Pract."}
   3109 %%% DEPRECATED:
   3110 %%% DEPRECATED: MACRO {jss}             {"J. Syst. Softw."}
   3111 %%% DEPRECATED:
   3112 %%% DEPRECATED: MACRO {jlc}             {"J. Logic and Comput."}
   3113 %%% DEPRECATED:
   3114 %%% DEPRECATED: MACRO {jlsc}            {"J. Lisp Symb. Comput."}
   3115 %%% DEPRECATED:
   3116 %%% DEPRECATED: MACRO {lpls}            {"Lett. Program. Lang. Syst."}
   3117 %%% DEPRECATED:
   3118 %%% DEPRECATED: MACRO {mor}             {"Math. Oper. Res."}
   3119 %%% DEPRECATED:
   3120 %%% DEPRECATED: MACRO {mscs}            {"Math. Struct. Comput. Sci."}
   3121 %%% DEPRECATED:
   3122 %%% DEPRECATED: MACRO {mst}             {"Math. Syst. Theor."}
   3123 %%% DEPRECATED:
   3124 %%% DEPRECATED: MACRO {ngc}             {"New Gen. Comput."}
   3125 %%% DEPRECATED:
   3126 %%% DEPRECATED: MACRO {scp}             {"Sci. Comput. Program."}               % original BibTeX
   3127 %%% DEPRECATED:
   3128 %%% DEPRECATED: MACRO {sicomp}          {"SIAM J. Comput."}                     % original BibTeX
   3129 %%% DEPRECATED:
   3130 %%% DEPRECATED: MACRO {spe}             {"Softw. Pract. Exper."}
   3131 %%% DEPRECATED:
   3132 %%% DEPRECATED: MACRO {tocs}            {"ACM Trans. Comput. Syst."}            % original BibTeX
   3133 %%% DEPRECATED:
   3134 %%% DEPRECATED: MACRO {tods}            {"ACM Trans. Database Syst."}           % original BibTeX
   3135 %%% DEPRECATED:
   3136 %%% DEPRECATED: MACRO {tog}             {"ACM Trans. Graphics"}                 % original BibTeX
   3137 %%% DEPRECATED:
   3138 %%% DEPRECATED: MACRO {toms}            {"ACM Trans. Math. Softw."}             % original BibTeX
   3139 %%% DEPRECATED:
   3140 %%% DEPRECATED: MACRO {toois}           {"ACM Trans. Office Inf. Syst."}        % original BibTeX
   3141 %%% DEPRECATED:
   3142 %%% DEPRECATED: MACRO {toplas}          {"ACM Trans. Program. Lang. Syst."}     % original BibTeX
   3143 %%% DEPRECATED:
   3144 %%% DEPRECATED: MACRO {tcs}             {"Theor. Comput. Sci."}                 % original BibTeX
   3145 %%% DEPRECATED:
   3146 %%% DEPRECATED: MACRO {tr}              {"Tech. Rep."}
   3147 %%% ====================================================================
   3148 
   3149 READ
   3150 
   3151 FUNCTION { sortify }
   3152 {
   3153   purify$
   3154   "l" change.case$
   3155 }
   3156 
   3157 FUNCTION { chop.word }
   3158 {
   3159   's :=
   3160   'len :=
   3161   s #1 len substring$ =
   3162     { s len #1 + global.max$ substring$ }
   3163     's
   3164   if$
   3165 }
   3166 
   3167 FUNCTION { sort.format.names }
   3168 {
   3169   's :=
   3170   #1 'nameptr :=
   3171   ""
   3172   s num.names$ 'numnames :=
   3173   numnames 'namesleft :=
   3174     { namesleft #0 > }
   3175     { nameptr #1 >
   3176           { "   " * }
   3177          'skip$
   3178       if$
   3179   %      s nameptr "{ff{ } }{ll{ }}{  vv{ }}{  jj{ }}" format.name$ 't :=
   3180       s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't :=
   3181       nameptr numnames = t "others" = and
   3182           { " et~al" * }
   3183           { t sortify * }
   3184       if$
   3185       nameptr #1 + 'nameptr :=
   3186       namesleft #1 - 'namesleft :=
   3187     }
   3188   while$
   3189 }
   3190 
   3191 FUNCTION { sort.format.title }
   3192 {
   3193   't :=
   3194   "A " #2
   3195     "An " #3
   3196       "The " #4 t chop.word
   3197     chop.word
   3198   chop.word
   3199   sortify
   3200   #1 global.max$ substring$
   3201 }
   3202 
   3203 FUNCTION { author.sort }
   3204 {
   3205   author empty.or.unknown
   3206     { key empty.or.unknown
   3207          { "to sort, need author or key in " cite$ * warning$
   3208            "" }
   3209          { key sortify }
   3210       if$
   3211     }
   3212     { author sort.format.names }
   3213   if$
   3214 }
   3215 
   3216 FUNCTION { author.editor.sort }
   3217 {
   3218   author empty.or.unknown
   3219     {
   3220       editor empty.or.unknown
   3221          {
   3222            key empty.or.unknown
   3223              { "to sort, need author, editor, or key in " cite$ * warning$
   3224                ""
   3225              }
   3226              { key sortify }
   3227            if$
   3228          }
   3229          { editor sort.format.names }
   3230       if$
   3231     }
   3232     { author sort.format.names }
   3233   if$
   3234 }
   3235 
   3236 FUNCTION { editor.organization.sort }
   3237 {
   3238   % added - GNP. Stack editor or organization for sorting (from alpha.bst).
   3239   % Unlike alpha.bst, we need entire names, not abbreviations
   3240 
   3241   editor empty.or.unknown
   3242     { organization empty.or.unknown
   3243         { key empty.or.unknown
   3244             { "to sort, need editor, organization, or key in " cite$ * warning$
   3245               ""
   3246             }
   3247             { key sortify }
   3248           if$
   3249         }
   3250         { organization sortify }
   3251       if$
   3252     }
   3253     { editor sort.format.names }
   3254   if$
   3255 }
   3256 
   3257 FUNCTION { author.editor.organization.sort }
   3258 {
   3259   % added - GNP. Stack author or organization for sorting (from alpha.bst).
   3260   % Unlike alpha.bst, we need entire names, not abbreviations
   3261 
   3262   author empty.or.unknown
   3263     {
   3264       editor empty.or.unknown
   3265         { organization empty.or.unknown
   3266             { key empty.or.unknown
   3267                 { "to sort, need author, editor, or key in " cite$ * warning$
   3268                 ""
   3269                 }
   3270                 { key sortify }
   3271               if$
   3272             }
   3273             { organization sortify }
   3274           if$
   3275         }
   3276         { editor sort.format.names }
   3277       if$
   3278     }
   3279     { author sort.format.names }
   3280   if$
   3281 }
   3282 
   3283 FUNCTION { presort }
   3284 {
   3285   % Presort creates the bibentry's label via a call to calc.label, and then
   3286   % sorts the entries based on entry type. Chicago.bst adds support for
   3287   % including organizations as the sort key; the following is stolen from
   3288   % alpha.bst.
   3289 
   3290   calc.label sortify % recalculate bibitem label
   3291   year field.or.null purify$ #-1 #4 substring$ * % add year
   3292   "    "
   3293   *
   3294   type$ "book" =
   3295   type$ "inbook" =
   3296   or
   3297   type$ "article" =
   3298   or
   3299     'author.editor.sort
   3300     { type$ "proceedings" =
   3301       type$ "periodical" =
   3302       or
   3303         'editor.organization.sort
   3304         { type$ "manual" =
   3305             'author.editor.organization.sort
   3306             'author.sort
   3307           if$
   3308         }
   3309       if$
   3310     }
   3311   if$
   3312   #1 entry.max$ substring$        % added for newapa
   3313   'sort.label :=                  % added for newapa
   3314   sort.label                      % added for newapa
   3315   *
   3316   "    "
   3317   *
   3318   title field.or.null
   3319   sort.format.title
   3320   *
   3321   #1 entry.max$ substring$
   3322   'sort.key$ :=
   3323 }
   3324 
   3325 ITERATE { presort }
   3326 
   3327 SORT             % by label, year, author/editor, title
   3328 
   3329 FUNCTION { initialize.extra.label.stuff }
   3330 { #0 int.to.chr$ 'last.label :=
   3331   "" 'next.extra :=
   3332   #0 'last.extra.num :=
   3333 }
   3334 
   3335 FUNCTION { forward.pass }
   3336 {
   3337   % Pass through all entries, comparing current entry to last one.
   3338   % Need to concatenate year to the stack (done by calc.label) to determine
   3339   % if two entries are the same (see presort)
   3340 
   3341   last.label
   3342   % OLD:calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
   3343   % NEW:
   3344   calc.basic.label year field.or.null purify$ #-1 #4 substring$ * % add year
   3345   #1 entry.max$ substring$ =     % are they equal?
   3346      { last.extra.num #1 + 'last.extra.num :=
   3347        last.extra.num int.to.chr$ 'extra.label :=
   3348      }
   3349      { "a" chr.to.int$ 'last.extra.num :=
   3350        "" 'extra.label :=
   3351        % OLD: calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
   3352        % NEW:
   3353        calc.basic.label year field.or.null purify$ #-1 #4 substring$ * % add year
   3354        #1 entry.max$ substring$ 'last.label := % assign to last.label
   3355      }
   3356   if$
   3357 }
   3358 
   3359 FUNCTION { reverse.pass }
   3360 {
   3361   next.extra "b" =
   3362     { "a" 'extra.label := }
   3363      'skip$
   3364   if$
   3365   label.year extra.label * 'sort.year :=
   3366   extra.label 'next.extra :=
   3367 }
   3368 
   3369 EXECUTE {initialize.extra.label.stuff}
   3370 
   3371 ITERATE {forward.pass}
   3372 
   3373 REVERSE {reverse.pass}
   3374 
   3375 FUNCTION { bib.sort.order }
   3376 {
   3377   sort.label
   3378   "    "
   3379   *
   3380   year field.or.null sortify
   3381   *
   3382   "    "
   3383   *
   3384   title field.or.null
   3385   sort.format.title
   3386   *
   3387   #1 entry.max$ substring$
   3388   'sort.key$ :=
   3389 }
   3390 
   3391 ITERATE { bib.sort.order }
   3392 
   3393 SORT             % by sort.label, year, title --- giving final bib. order.
   3394 
   3395 FUNCTION { begin.bib }
   3396 {
   3397   %% Set to #0 show 13-digit ISBN in preference to 10-digit ISBN.
   3398   %% Set to #1 to show both 10-digit and 13-digit ISBNs.
   3399   #1 'show-isbn-10-and-13 :=
   3400 
   3401   "%%% -*-BibTeX-*-" writeln
   3402   "%%% Do NOT edit. File created by BibTeX with style" writeln
   3403   "%%% ACM-Reference-Format-Journals [18-Jan-2012]." writeln
   3404   "" writeln
   3405 
   3406   preamble$ empty.or.unknown
   3407     'skip$
   3408     { preamble$ writeln }
   3409   if$
   3410   "\begin{thebibliography}{00}" writeln
   3411   ""                                                                         writeln
   3412   "%%% ====================================================================" writeln
   3413   "%%% NOTE TO THE USER: you can override these defaults by providing"       writeln
   3414   "%%% customized versions of any of these macros before the \bibliography"  writeln
   3415   "%%% command.  Each of them MUST provide its own final punctuation,"       writeln
   3416   "%%% except for \shownote{}, \showDOI{}, and \showURL{}.  The latter two"  writeln
   3417   "%%% do not use final punctuation, in order to avoid confusing it with"    writeln
   3418   "%%% the Web address."                                                     writeln
   3419   "%%%"                                                                      writeln
   3420   "%%% To suppress output of a particular field, define its macro to expand" writeln
   3421   "%%% to an empty string, or better, \unskip, like this:"                   writeln
   3422   "%%%"                                                                      writeln
   3423   "%%% \newcommand{\showDOI}[1]{\unskip}   % LaTeX syntax"                   writeln
   3424   "%%%"                                                                      writeln
   3425   "%%% \def \showDOI #1{\unskip}           % plain TeX syntax"               writeln
   3426   "%%%"                                                                      writeln
   3427   "%%% ====================================================================" writeln
   3428   ""                                                                         writeln
   3429 
   3430   %% ACM publications do not use CODEN, ISSN, and LCCN data, so their default
   3431   %% macro wrappers expand to \unskip, discarding their values and unwanted
   3432   %% space.
   3433   %%
   3434   %% For other publications, prior definitions like these may be useful:
   3435   %%
   3436   %%     Plain TeX:
   3437   %%         \def \showCODEN     #1{CODEN #1.}
   3438   %%         \def \showISSN      #1{ISSN #1.}
   3439   %%         \def \showLCCN      #1{LCCN #1.}
   3440   %%
   3441   %%     LaTeX:
   3442   %%         \newcommand{\showCODEN}[1]{CODEN #1.}
   3443   %%         \newcommand{\showISSN}[1]#1{ISSN #1.}
   3444   %%         \newcommand{\showLCCN}[1]{LCCN #1.}
   3445 
   3446   "\ifx \showCODEN    \undefined \def \showCODEN     #1{\unskip}     \fi" writeln
   3447   "\ifx \showDOI      \undefined \def \showDOI       #1{#1}\fi" writeln
   3448   % ACM styles omit ISBNs, but they can be included by suitable definitions of
   3449   % \showISBNx and \showISBNxiii before the .bbl file is read
   3450   "\ifx \showISBNx    \undefined \def \showISBNx     #1{\unskip}     \fi" writeln
   3451   "\ifx \showISBNxiii \undefined \def \showISBNxiii  #1{\unskip}     \fi" writeln
   3452   "\ifx \showISSN     \undefined \def \showISSN      #1{\unskip}     \fi" writeln
   3453   "\ifx \showLCCN     \undefined \def \showLCCN      #1{\unskip}     \fi" writeln
   3454   "\ifx \shownote     \undefined \def \shownote      #1{#1}          \fi" writeln % NB: final period supplied by add.period$ above
   3455   "\ifx \showarticletitle \undefined \def \showarticletitle #1{#1}   \fi" writeln
   3456   "\ifx \showURL      \undefined \def \showURL       {\relax}        \fi" writeln
   3457   "% The following commands are used for tagged output and should be " writeln
   3458   "% invisible to TeX" writeln
   3459   "\providecommand\bibfield[2]{#2}" writeln
   3460   "\providecommand\bibinfo[2]{#2}" writeln
   3461   "\providecommand\natexlab[1]{#1}" writeln
   3462   "\providecommand\showeprint[2][]{arXiv:#2}" writeln
   3463 }
   3464 
   3465 EXECUTE {begin.bib}
   3466 
   3467 EXECUTE {init.state.consts}
   3468 
   3469 ITERATE {call.type$}
   3470 
   3471 FUNCTION { end.bib }
   3472 {
   3473   newline$
   3474   "\end{thebibliography}"
   3475   writeln
   3476 }
   3477 
   3478 EXECUTE {end.bib}