ACM 2017 vs SIGCHI 2012 reference format bst

%%% -*-BibTeX-*-
%%% -*-BibTeX-*-
%%% ====================================================================
%%% ====================================================================
%%% @BibTeX-style-file{
%%% @BibTeX-style-file{
%%% author = "Nelson H. F. Beebe, Boris Veytsman and Gerald Murray",
%%% author = "Nelson H. F. Beebe, Boris Veytsman and Gerald Murray",
%%% version = "2.1",
%%% version = "1.00",
%%% acmart-version = "1.79",
%%% date = "18 January 2012",
%%% date = "14 June 2017",
%%% time = "11:48 EST",
%%% filename = "ACM-Reference-Format.bst",
%%% filename = "ACM-Reference-Format-Journals.bst",
%%% email = "borisv@lk.net, boris@varphi.com",
%%% address = "University of Utah
%%% Department of Mathematics, 110 LCB
%%% 155 S 1400 E RM 233
%%% Salt Lake City, UT 84112-0090
%%% USA",
%%% telephone = "+1 801 581 5254",
%%% FAX = "+1 801 581 4148",
%%% URL = "http://www.math.utah.edu/~beebe",
%%% checksum = "available here: http://www.acm.org/publications/latex_style/CRC-journals.txt"
%%% email = "beebe@math.utah.edu, beebe@acm.org,
%%% beebe@computer.org, borisv@lk.net, murray@hq.acm.org",
%%% codetable = "ISO/ASCII",
%%% codetable = "ISO/ASCII",
%%% keywords = "ACM Transactions bibliography style; BibTeX",
%%% keywords = "ACM Transactions bibliography style; BibTeX",
%%% license = "public domain",
%%% license = "public domain",
%%% supported = "yes",
%%% supported = "yes",
%%% abstract = "",
%%% abstract = "",
%%% docstring = "The checksum field, above, is produced by WinMD5Free (v1.20)
%%% available from http://www.winmd5.com/?rid=winmd5,"
%%% }
%%% }
%%% ====================================================================
%%% ====================================================================
%%% Revision history: see source in git
% "SIGCHI Format" BibTeX style, Forked from ACM-Reference-Format-Journals.bst
% Modifications 13-FEBURARY-2015 (David Ayman Shamma)
% "ACM Transactions" BibTeX style, ACM-Reference-Format-Journals.bst
% for BibTeX version 0.99c, LaTeX version 3.141
% ACM extensions with code cleaned up, extended, and debugged 10--15-Nov-2008
% Revised 17-APRIL-2008 (Nelson)
% Revised 13-MARCH-2011 (Boris/Gerry)
% Revised 23-MARCH-2011 (Boris/Gerry)
% Revised 27-MARCH-2011 (Boris/Gerry)
% Revised 15-APRIL-2011 (Boris/Gerry)
% Revised 27-SEPTEMBER-2011 (Boris)
%
%
% History (by Nelson)
%
% Based on 'acmtrans' (for ACM Journals)
% Date: 28th April 2008
%
% 1. Avoid 'repeating' the 'month' values.
% 2. Avoid incorrectly italicizing the volume number.
% 3. Avoid non italicizing certain titles (book, inproceedings etc).
% 4. NO series if there is NO volume.
% 5. Sorting of reference with first surname.
% 6. Article no added for Inproceedings.
%
% Date: 07th May 2008
%
% 1. Abbreviation list added
%
% Citation format: [author-last-name year]
% [author-last-name and author-last-name year]
% [author-last-name, author-last-name, and author-last-name year]
% [author-last-name et al. year]
% [author-last-name]
% author-last-name [year]
% [author-last-name and author-last-name]
% [author-last-name et al.]
% [year] or [year,year]
% year or year,year
%
% Reference list ordering: alphabetical by author or whatever passes
% for author in the absence of one.
%
% Features of the old acmtrans.bst:
% =================================
%
% - all authors appear last name first.
% - all pages are listed xx-xx, (no pp.) and are at the end of the reference
% - publishers are identified as publisher, address
% - conferences papers (inproceedings) may give city of conference,
% date of conference, and journal that the proceedings appear in.
% - months abbreviated to max four letters (eg. Mar.)
% - volume of a series indicated after the title of the series
% - editors appear after edited title and are identified by a trailing "Eds."
% not in parentheses. Editor names are not given in small caps.
% (unless there is no author line)
% - names terminated with a period even if there is no first name.
% - editions are indicated trailing after the work, not in parentheses.
% - "et al." citations have a protected period to avoid bad spacing (jrh)
% - "address" required when publisher given
% - series (roman) and volume are in a sentence separate from (book-)title
%
%
% Features of chicago.bst:
% =======================
%
% - full names used in citations, but abbreviated citations are available
% (see above)
% - if an entry has a "month", then the month and year are also printed
% as part of that bibitem.
% - all conjunctions use "and" instead of "\&"
% - major modification from Chicago Manual of Style (13th ed.) is that
% only the first author in a reference appears last name first-
% additional authors appear as J. Q. Public.
% - pages are listed as "pp. xx-xx" in all entry types except
% article entries.
% - book, inbook, and manual use "location: publisher" (or organization)
% for address and publisher. All other types list publishers separately.
% - "pp." are used to identify page numbers for all entry types except
% articles.
% - organization is used as a citation label if neither author nor editor
% is present (for manuals).
% - "et al." is used for long author and editor lists, or when "others"
% is used.
%
% Modifications and bug fixes from newapa.bst:
% ===========================================
%
% - added month, year to bib entries if month is present
% - fixed bug with In proceedings, added necessary comma after title
% - all conjunctions changed to "and" from "\&"
% - fixed bug with author labels in my.full.label: "et al." now is
% generated when "others" is an author name
% - major modification from Chicago Manual of Style (13th ed.) is that
% only the first author in a reference appears last name first-
% additional authors appear as J. Q. Public.
% - pages are listed as "pp. xx-xx" in all entry types except
% article entries. Unnecessary (IMHO) "()" around page numbers
% were removed, and page numbers now don't end with a period.
% - created chicago.sty for use with this bibstyle (required).
% - fixed bugs in FUNCTION {format.vol.num.pages} for missing volume,
% number, and /or pages. Renamed to format.journal.volume.number.
% - fixed bug in formatting booktitles: additional period an error if
% book has a volume.
% - fixed bug: editors usually given redundant period before next clause
% (format.editors.dot) removed.
% - added label support for organizations, if both author and editor
% are missing (from alpha.bst). If organization is too long, then
% the key field is used for abbreviated citations.
% - In proceedings or books of several volumes, no comma was written
% between the "Volume x" and the page numbers (this was intentional
% in newapa.bst). Fixed.
% - Some journals may not have volumes/numbers, only month/year (eg.
% IEEE Computer). Fixed bug in article style that assumed volume/number
% was always present.
%
% Original documentation for newapa.sty:
% =====================================
%
% This version was made by modifying the master file made by
% Oren Patashnik (PATASHNIK@SCORE.STANFORD.EDU), and the 'named' BibTeX
% style of Peter F. Patel-Schneider.
%
% Copyright (C) 1985, all rights reserved.
% Copying of this file is authorized only if either
% (1) you make absolutely no changes to your copy, including name, or
% (2) if you do make changes, you name it something other than 'newapa.bst'.
% There are undoubtably bugs in this style. If you make bug fixes,
% improvements, etc. please let me know. My e-mail address is:
% spencer@cgrg.ohio.state.edu or 71160.3141@compuserve.com
%
% This style was made from 'plain.bst', 'named.bst', and 'apalike.bst',
% with lots of tweaking to make it look like APA style, along with tips
% from Young Ryu and Brian Reiser's modifications of 'apalike.bst'.
%
%
% Start of ACM-Reference-Format-Journals.bst
%
% Note: Many of the new bibentry 'fields' will only work with the
% 'ACM-Reference-Format-Journals.bst' file. Legacy .bib files (which will, in all probability,
% NOT contain these new fields) will _still_ work with the ACM-Reference-Format-Journals.bst.
%
%
ENTRY
ENTRY
{ address
{ address
advisor
advisor
archiveprefix
author
author
booktitle
booktitle
chapter
chapter
city
city % jtb: added
date
date % jtb: added
edition
edition
editor
editor
eprint
eprinttype
eprintclass
howpublished
howpublished
institution
institution
journal
journal
key
key
location
month
month
note
note
number
number
organization
organization
pages
pages
primaryclass
publisher
publisher
school
school
series
series
title
title
type
type
volume
volume
year
year
% New keys recognized
% New keys recognized
issue % UTAH: used in, e.g., ACM SIGSAM Bulletin and ACM Communications in Computer Algebra
issue % UTAH: used in, e.g., ACM SIGSAM Bulletin and ACM Communications in Computer Algebra
articleno
articleno
eid
day % UTAH: needed for newspapers, weeklies, bi-weeklies
day % UTAH: needed for newspapers, weeklies, bi-weeklies
doi % UTAH
doi % UTAH
url % UTAH
url % UTAH
bookpages % UTAH
bookpages % UTAH
numpages
numpages
lastaccessed % UTAH: used only for @Misc{...}
lastaccessed % UTAH: used only for @Misc{...}
coden % UTAH
coden % UTAH
isbn % UTAH
isbn % UTAH
isbn-13 % UTAH
isbn-13 % UTAH
issn % UTAH
issn % UTAH
lccn % UTAH
lccn % UTAH
distinctURL % whether to print url if doi is present
}
}
{}
{}
{ label.year extra.label sort.year sort.label basic.label.year}
{ label.year extra.label sort.year sort.label }
INTEGERS { output.state before.all mid.sentence after.sentence after.block }
INTEGERS { output.state before.all mid.sentence after.sentence after.block }
INTEGERS { show-isbn-10-and-13 } % initialized below in begin.bib
INTEGERS { show-isbn-10-and-13 } % initialized below in begin.bib
INTEGERS { nameptr namesleft numnames }
INTEGERS { nameptr namesleft numnames }
INTEGERS { multiresult }
INTEGERS { multiresult }
INTEGERS { len }
INTEGERS { len }
INTEGERS { last.extra.num }
INTEGERS { last.extra.num }
STRINGS { s t t.org u }
STRINGS { s t t.org u }
STRINGS { last.label next.extra }
STRINGS { last.label next.extra }
STRINGS { p1 p2 p3 page.count }
STRINGS { p1 p2 p3 page.count }
FUNCTION { not }
{
{ #0 }
{ #1 }
if$
}
FUNCTION { and }
{
'skip$
{ pop$ #0 }
if$
}
FUNCTION { or }
{
{ pop$ #1 }
'skip$
if$
}
FUNCTION { dump.stack.1 }
FUNCTION { dump.stack.1 }
{
{
duplicate$ "STACK[top] = [" swap$ * "]" * warning$
duplicate$ "STACK[top] = [" swap$ * "]" * warning$
}
}
FUNCTION { dump.stack.2 }
FUNCTION { dump.stack.2 }
{
{
duplicate$ "STACK[top ] = [" swap$ * "]" * warning$
duplicate$ "STACK[top ] = [" swap$ * "]" * warning$
swap$
swap$
duplicate$ "STACK[top-1] = [" swap$ * "]" * warning$
duplicate$ "STACK[top-1] = [" swap$ * "]" * warning$
swap$
swap$
}
}
FUNCTION { empty.or.unknown }
FUNCTION { empty.or.unknown }
{
{
%% Examine the top stack entry, and push 1 if it is empty, or
%% Examine the top stack entry, and push 1 if it is empty, or
%% consists only of whitespace, or is a string beginning with two
%% consists only of whitespace, or is a string beginning with two
%% queries (??), and otherwise, push 0.
%% queries (??), and otherwise, push 0.
%%
%%
%% This function provides a replacement for empty$, with the
%% This function provides a replacement for empty$, with the
%% convenient feature that unknown values marked by two leading
%% convenient feature that unknown values marked by two leading
%% queries are treated the same as missing values, and thus, do not
%% queries are treated the same as missing values, and thus, do not
%% appear in the output .bbl file, and yet, their presence in .bib
%% appear in the output .bbl file, and yet, their presence in .bib
%% file(s) serves to mark values which are temporarily missing, but
%% file(s) serves to mark values which are temporarily missing, but
%% are expected to be filled in eventually once more data is
%% are expected to be filled in eventually once more data is
%% obtained. The TeX User Group and BibNet bibliography archives
%% obtained. The TeX User Group and BibNet bibliography archives
%% make extensive use of this practice.
%% make extensive use of this practice.
%%
%%
%% An empty string cannot serve the same purpose, because just as in
%% An empty string cannot serve the same purpose, because just as in
%% statistics data processing, an unknown value is not the same as an
%% statistics data processing, an unknown value is not the same as an
%% empty value.
%% empty value.
%%
%%
%% At entry: stack = ... top:[string]
%% At entry: stack = ... top:[string]
%% At exit: stack = ... top:[0 or 1]
%% At exit: stack = ... top:[0 or 1]
duplicate$ empty$
duplicate$ empty$
{ pop$ #1 }
{ pop$ #1 }
{ #1 #2 substring$ "??" = }
{ #1 #2 substring$ "??" = }
if$
if$
}
}
FUNCTION { empty.or.zero }
{
%% Examine the top entry and push 1 if it is empty, or is zero
duplicate$ empty$
{ pop$ #1 }
{ "0" = }
if$
}
FUNCTION { writeln }
FUNCTION { writeln }
{
{
%% In BibTeX style files, the sequences
%% In BibTeX style files, the sequences
%%
%%
%% ... "one" "two" output
%% ... "one" "two" output
%% ... "one" "two" output.xxx
%% ... "one" "two" output.xxx
%%
%%
%% ship "one" to the output file, possibly following by punctuation,
%% ship "one" to the output file, possibly following by punctuation,
%% leaving the stack with
%% leaving the stack with
%%
%%
%% ... "two"
%% ... "two"
%%
%%
%% There is thus a one-string lag in output processing that must be
%% There is thus a one-string lag in output processing that must be
%% carefully handled to avoid duplicating a string in the output
%% carefully handled to avoid duplicating a string in the output
%% file. Unless otherwise noted, all output.xxx functions leave
%% file. Unless otherwise noted, all output.xxx functions leave
%% just one new string on the stack, and that model should be born
%% just one new string on the stack, and that model should be born
%% in mind when reading or writing function code.
%% in mind when reading or writing function code.
%%
%%
%% BibTeX's asynchronous buffering of output from strings from the
%% BibTeX's asynchronous buffering of output from strings from the
%% stack is confusing because newline$ bypasses the buffer. It
%% stack is confusing because newline$ bypasses the buffer. It
%% would have been so much easier for newline to be a character
%% would have been so much easier for newline to be a character
%% rather than a state of the output-in-progress.
%% rather than a state of the output-in-progress.
%%
%%
%% The documentation in btxhak.dvi is WRONG: it says
%% The documentation in btxhak.dvi is WRONG: it says
%%
%%
%% newline$ Writes onto the bbl file what's accumulated in the
%% newline$ Writes onto the bbl file what's accumulated in the
%% output buffer. It writes a blank line if and only
%% output buffer. It writes a blank line if and only
%% if the output buffer is empty. Since write$ does
%% if the output buffer is empty. Since write$ does
%% reasonable line breaking, you should use this
%% reasonable line breaking, you should use this
%% function only when you want a blank line or an
%% function only when you want a blank line or an
%% explicit line break.
%% explicit line break.
%%
%%
%% write$ Pops the top (string) literal and writes it on the
%% write$ Pops the top (string) literal and writes it on the
%% output buffer (which will result in stuff being
%% output buffer (which will result in stuff being
%% written onto the bbl file when the buffer fills
%% written onto the bbl file when the buffer fills
%% up).
%% up).
%%
%%
%% Examination of the BibTeX source code shows that write$ does
%% Examination of the BibTeX source code shows that write$ does
%% indeed behave as claimed, but newline$ sends a newline character
%% indeed behave as claimed, but newline$ sends a newline character
%% directly to the output file, leaving the stack unchanged. The
%% directly to the output file, leaving the stack unchanged. The
%% first line "Writes onto ... buffer." is therefore wrong.
%% first line "Writes onto ... buffer." is therefore wrong.
%%
%%
%% The original BibTeX style files almost always use "write$ newline$"
%% The original BibTeX style files almost always use "write$ newline$"
%% in that order, so it makes sense to hide that pair in a private
%% in that order, so it makes sense to hide that pair in a private
%% function like this one, named after a statement in Pascal,
%% function like this one, named after a statement in Pascal,
%% the programming language embedded in the BibTeX Web program.
%% the programming language embedded in the BibTeX Web program.
write$ % output top-of-stack string
write$ % output top-of-stack string
newline$ % immediate write of newline (not via stack)
newline$ % immediate write of newline (not via stack)
}
}
FUNCTION { init.state.consts }
FUNCTION { init.state.consts }
{
{
#0 'before.all :=
#0 'before.all :=
#1 'mid.sentence :=
#1 'mid.sentence :=
#2 'after.sentence :=
#2 'after.sentence :=
#3 'after.block :=
#3 'after.block :=
}
}
FUNCTION { output.nonnull }
FUNCTION { output.nonnull }
{ % Stack in: ... R S T Stack out: ... R T File out: S<comma><space>
{ % Stack in: ... R S T Stack out: ... R T File out: S<comma><space>
's :=
's :=
output.state mid.sentence =
output.state mid.sentence =
{
{
", " * write$
", " * write$
}
}
{
{
output.state after.block =
output.state after.block =
{
{
add.period$ writeln
add.period$ writeln
"\newblock " write$
"\newblock " write$
}
}
{
{
output.state before.all =
output.state before.all =
{
{
write$
write$
}
}
{
{
add.period$ " " * write$
add.period$ " " * write$
}
}
if$
if$
}
}
if$
if$
mid.sentence 'output.state :=
mid.sentence 'output.state :=
}
}
if$
if$
s
s
}
}
FUNCTION { output.nonnull.dot.space }
FUNCTION { output.nonnull.dot.space }
{ % Stack in: ... R S T Stack out: ... R T File out: S<dot><space>
{ % Stack in: ... R S T Stack out: ... R T File out: S<dot><space>
's :=
's :=
output.state mid.sentence = % { "<DEBUG output.nonnull.dot.space>. " * write$ }
output.state mid.sentence = % { "<DEBUG output.nonnull.dot.space>. " * write$ }
{
{
". " * write$
". " * write$
}
}
{
{
output.state after.block =
output.state after.block =
{
{
add.period$ writeln "\newblock " write$
add.period$ writeln "\newblock " write$
}
}
{
{
output.state before.all =
output.state before.all =
{
{
write$
write$
}
}
{
{
add.period$ " " * write$
add.period$ " " * write$
}
}
if$
if$
}
}
if$
if$
mid.sentence 'output.state :=
mid.sentence 'output.state :=
}
}
if$
if$
s
s
}
}
FUNCTION { output.nonnull.remove }
FUNCTION { output.nonnull.remove }
{ % Stack in: ... R S T Stack out: ... R T File out: S<space>
{ % Stack in: ... R S T Stack out: ... R T File out: S<space>
's :=
's :=
output.state mid.sentence =
output.state mid.sentence =
{
{
" " * write$
" " * write$
}
}
{
{
output.state after.block =
output.state after.block =
{
{
add.period$ writeln "\newblock " write$
add.period$ writeln "\newblock " write$
}
}
{
{
output.state before.all =
output.state before.all =
{
{
write$
write$
}
}
{
{
add.period$ " " * write$
add.period$ " " * write$
}
}
if$
if$
}
}
if$
if$
mid.sentence 'output.state :=
mid.sentence 'output.state :=
}
}
if$
if$
s
s
}
}
FUNCTION { output.nonnull.removenospace }
FUNCTION { output.nonnull.removenospace }
{ % Stack in: ... R S T Stack out: ... R T File out: S
{ % Stack in: ... R S T Stack out: ... R T File out: S
's :=
's :=
output.state mid.sentence =
output.state mid.sentence =
{
{
"" * write$
"" * write$
}
}
{
{
output.state after.block =
output.state after.block =
{
{
add.period$ writeln "\newblock " write$
add.period$ writeln "\newblock " write$
}
}
{
{
output.state before.all =
output.state before.all =
{
{
write$
write$
}
}
{
{
add.period$ " " * write$
add.period$ " " * write$
}
}
if$
if$
}
}
if$
if$
mid.sentence 'output.state :=
mid.sentence 'output.state :=
}
}
if$
if$
s
s
}
}
FUNCTION { output }
FUNCTION { output }
{ % discard top token if empty, else like output.nonnull
{ % discard top token if empty, else like output.nonnull
duplicate$ empty.or.unknown
duplicate$ empty.or.unknown
'pop$
'pop$
'output.nonnull
'output.nonnull
if$
if$
}
}
FUNCTION { output.dot.space }
FUNCTION { output.dot.space }
{ % discard top token if empty, else like output.nonnull.dot.space
{ % discard top token if empty, else like output.nonnull.dot.space
duplicate$ empty.or.unknown
duplicate$ empty.or.unknown
'pop$
'pop$
'output.nonnull.dot.space
'output.nonnull.dot.space
if$
if$
}
}
FUNCTION { output.removenospace }
FUNCTION { output.removenospace }
{ % discard top token if empty, else like output.nonnull.removenospace
{ % discard top token if empty, else like output.nonnull.removenospace
duplicate$ empty.or.unknown
duplicate$ empty.or.unknown
'pop$
'pop$
'output.nonnull.removenospace
'output.nonnull.removenospace
if$
if$
}
}
FUNCTION { output.check }
FUNCTION { output.check }
{ % like output, but warn if key name on top-of-stack is not set
{ % like output, but warn if key name on top-of-stack is not set
't :=
't :=
duplicate$ empty.or.unknown
duplicate$ empty.or.unknown
{ pop$ "empty " t * " in " * cite$ * warning$ }
{ pop$ "empty " t * " in " * cite$ * warning$ }
'output.nonnull
'output.nonnull
if$
if$
}
}
FUNCTION { bibinfo.output.check }
{ % like output.check, adding bibinfo field
't :=
duplicate$ empty.or.unknown
{ pop$ "empty " t * " in " * cite$ * warning$ }
{ "\bibinfo{" t "}{" * * swap$ * "}" *
output.nonnull }
if$
}
FUNCTION { output.check.dot.space }
FUNCTION { output.check.dot.space }
{ % like output.dot.space, but warn if key name on top-of-stack is not set
{ % like output.dot.space, but warn if key name on top-of-stack is not set
't :=
't :=
duplicate$ empty.or.unknown
duplicate$ empty.or.unknown
{ pop$ "empty " t * " in " * cite$ * warning$ }
{ pop$ "empty " t * " in " * cite$ * warning$ }
'output.nonnull.dot.space
'output.nonnull.dot.space
if$
if$
}
}
FUNCTION { fin.block }
FUNCTION { fin.block }
{ % functionally, but not logically, identical to fin.entry
{ % functionally, but not logically, identical to fin.entry
add.period$
add.period$
writeln
writeln
}
}
FUNCTION { fin.entry }
FUNCTION { fin.entry }
{
{
add.period$
add.period$
writeln
writeln
}
}
FUNCTION { new.sentence }
FUNCTION { new.sentence }
{ % update sentence state, with neither output nor stack change
{ % update sentence state, with neither output nor stack change
output.state after.block =
output.state after.block =
'skip$
'skip$
{
{
output.state before.all =
output.state before.all =
'skip$
'skip$
{ after.sentence 'output.state := }
{ after.sentence 'output.state := }
if$
if$
}
}
if$
if$
}
}
FUNCTION { fin.sentence }
FUNCTION { fin.sentence }
{
{
add.period$
add.period$
write$
write$
new.sentence
new.sentence
""
""
}
}
FUNCTION { new.block }
FUNCTION { new.block }
{
{
output.state before.all =
output.state before.all =
'skip$
'skip$
{ after.block 'output.state := }
{ after.block 'output.state := }
if$
if$
}
}
FUNCTION { output.coden } % UTAH
FUNCTION { output.coden } % UTAH
{ % output non-empty CODEN as one-line sentence (stack untouched)
{ % output non-empty CODEN as one-line sentence (stack untouched)
coden empty.or.unknown
coden empty.or.unknown
{ }
{ }
{ "\showCODEN{" coden * "}" * writeln }
{ "\showCODEN{" coden * "}" * writeln }
if$
if$
}
}
%
% Sometimes articleno starts with the word 'Article' or 'Paper.
% (this is a bug of acmdl, sigh)
% We strip them. We assume eid or articleno is already on stack
%
FUNCTION { strip.articleno.or.eid }
{
't :=
t #1 #7 substring$ "Article" =
{t #8 t text.length$ substring$ 't :=}
{ }
if$
t #1 #7 substring$ "article" =
{t #8 t text.length$ substring$ 't :=}
{ }
if$
t #1 #5 substring$ "Paper" =
{t #6 t text.length$ substring$ 't :=}
{ }
if$
t #1 #5 substring$ "paper" =
{t #6 t text.length$ substring$ 't :=}
{ }
if$
% Strip any left trailing space or ~
t #1 #1 substring$ " " =
{t #2 t text.length$ substring$ 't :=}
{ }
if$
t #1 #1 substring$ "~" =
{t #2 t text.length$ substring$ 't :=}
{ }
if$
t
}
FUNCTION { format.articleno }
FUNCTION { format.articleno }
{
{
articleno empty.or.unknown not eid empty.or.unknown not and
articleno empty.or.unknown
{ "Both articleno and eid are defined for " cite$ * warning$ }
'skip$
if$
articleno empty.or.unknown eid empty.or.unknown and
{ "" }
{ "" }
{
{
numpages empty.or.unknown
numpages empty.or.unknown
{ "articleno or eid field, but no numpages field, in "
{ "articleno field, but no numpages field, in " cite$ * warning$ }
cite$ * warning$ }
{ }
{ }
if$
if$
eid empty.or.unknown
"Article " articleno *
{ "Article \bibinfo{articleno}{" articleno strip.articleno.or.eid * "}" * }
{ "Article \bibinfo{articleno}{" eid strip.articleno.or.eid * "}" * }
if$
}
}
if$
if$
}
}
FUNCTION { format.year }
FUNCTION { format.year }
{ % push year string or "[n.\,d.]" onto output stack
{ % push year string or "????" onto output stack
%% Because year is a mandatory field, we always force SOMETHING
%% Because year is a mandatory field, we always force SOMETHING
%% to be output
%% to be output
"\bibinfo{year}{"
year empty.or.unknown
year empty.or.unknown
{ "[n.\,d.]" }
{ "????" }
{ year }
{ year }
if$
if$
* "}" *
}
}
FUNCTION { format.day.month }
FUNCTION { format.day.month }
{ % push "day month " or "month " or "" onto output stack
{ % push "day month " or "month " or "" onto output stack
day empty.or.unknown
day empty.or.unknown
{
{
month empty.or.unknown
month empty.or.unknown
{ "" }
{ "" }
{ "\bibinfo{date}{" month * "} " *}
{ month " " *}
if$
if$
}
}
{
{
month empty.or.unknown
month empty.or.unknown
{ "" }
{ "" }
{ "\bibinfo{date}{" day * " " * month * "} " *}
{ day " " * month * " " *}
if$
if$
}
}
if$
if$
}
}
FUNCTION { format.day.month.year } % UTAH
FUNCTION { format.day.month.year } % UTAH
{ % if month is empty, push "" else push "(MON.)" or "(DD MON.)"
{ % if month is empty, push "" else push "(MON.)" or "(DD MON.)"
% Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
% Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
% acm-*.bst addition: prefix parenthesized date string with
% acm-*.bst addition: prefix parenthesized date string with
% ", Article nnn "
% ", Article nnn "
articleno empty.or.unknown eid empty.or.unknown and
articleno empty.or.unknown
{ "" }
{ "" }
{ output.state after.block =
{ ", " format.articleno * }
{", " format.articleno * }
{ format.articleno }
if$
}
if$
if$
" (" * format.day.month * format.year * ")" *
" (" * format.day.month * format.year * ")" *
}
}
FUNCTION { output.day.month.year } % UTAH
FUNCTION { output.day.month.year } % UTAH
{ % if month is empty value, do nothing; else output stack top and
{ % if month is empty value, do nothing; else output stack top and
% leave with new top string "(MON.)" or "(DD MON.)"
% leave with new top string "(MON.)" or "(DD MON.)"
% Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
% Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
format.day.month.year
format.day.month.year
output.nonnull.remove
output.nonnull.remove
}
}
FUNCTION { strip.doi } % UTAH
FUNCTION { strip.doi } % UTAH
{ % Strip any Web address prefix to recover the bare DOI, leaving the
{ % Strip any Web address prefix to recover the bare DOI, leaving the
% result on the output stack, as recommended by CrossRef DOI
% result on the output stack, as recommended by CrossRef DOI
% documentation.
% documentation.
% For example, reduce "http://doi.acm.org/10.1145/1534530.1534545" to
% For example, reduce "http://doi.acm.org/10.1145/1534530.1534545" to
% "10.1145/1534530.1534545". A suitable URL is later typeset and
% "10.1145/1534530.1534545". That is later typeset and displayed as
% displayed as the LAST item in the reference list entry. Publisher Web
% doi:10.1145/1534530.1534545 as the LAST item in the reference list
% sites wrap this with a suitable link to a real URL to resolve the DOI,
% entry. Publisher Web sites wrap this with a suitable link to a real
% and the master https://doi.org/ address is preferred, since publisher-
% URL to resolve the DOI, and the master http://dx.doi.org/ address is
% specific URLs can disappear in response to economic events. All
% preferred, since publisher-specific URLs can disappear in response
% journals are encouraged by the DOI authorities to use that typeset
% to economic events. All journals are encouraged by the DOI
% format and link procedures for uniformity across all publications that
% authorities to use that typeset format and link procedures for
% include DOIs in reference lists.
% uniformity across all publications that include DOIs in reference
% lists.
% The numeric prefix is guaranteed to start with "10.", so we use
% The numeric prefix is guaranteed to start with "10.", so we use
% that as a test.
% that as a test.
% 2017-02-04 Added stripping of https:// (Boris)
doi #1 #3 substring$ "10." =
doi #1 #3 substring$ "10." =
{ doi }
{ doi }
{
{
doi 't := % get modifiable copy of DOI
doi #1 #7 substring$ "http://" =
% Change https:// to http:// to strip both prefixes (BV)
t #1 #8 substring$ "https://" =
{ "http://" t #9 t text.length$ #8 - substring$ * 't := }
{ }
if$
t #1 #7 substring$ "http://" =
{
{
t #8 t text.length$ #7 - substring$ 't :=
doi #8 doi text.length$ #7 - substring$ 't := % get modifiable copy of rest of DOI
"INTERNAL STYLE-FILE ERROR" 's :=
"INTERNAL STYLE-FILE ERROR" 's :=
% search for next "/" and assign its suffix to s
% search for next "/" and assign its suffix to s
{ t text.length$ }
{ t text.length$ }
{
{
t #1 #1 substring$ "/" =
t #1 #1 substring$ "/" =
{
{
% save rest of string as true DOI (should be 10.xxxx/yyyy)
% save rest of string as true DOI (should be 10.xxxx/yyyy)
t #2 t text.length$ #1 - substring$ 's :=
t #2 t text.length$ #1 - substring$ 's :=
"" 't := % empty string t terminates the loop
"" 't := % empty string t terminates the loop
}
}
{
{
% discard first character and continue loop: t <= substring(t,2,last)
% discard first character and continue loop: t <= substring(t,2,last)
t #2 t text.length$ #1 - substring$ 't :=
t #2 t text.length$ #1 - substring$ 't :=
}
}
if$
if$
}
}
while$
while$
% check for valid DOI (should be 10.xxxx/yyyy)
% check for valid DOI (should be 10.xxxx/yyyy)
s #1 #3 substring$ "10." =
s #1 #3 substring$ "10." =
{ }
{ }
{ "unrecognized DOI substring " s * " in DOI value [" * doi * "]" * warning$ }
{ "unrecognized DOI substring " s * " in DOI value [" * doi * "]" * warning$ }
if$
if$
s % push the stripped DOI on the output stack
s % push the stripped DOI on the output stack
}
}
{
{
"unrecognized DOI value [" doi * "]" * warning$
"unrecognized DOI value [" doi * "]" * warning$
doi % push the unrecognized original DOI on the output stack
doi % push the unrecognized original DOI on the output stack
}
}
if$
if$
}
}
if$
if$
}
}
%
%
% Change by BV: added standard prefix to URL
% Change by BV: added standard prefix to URL
%
%
FUNCTION { output.doi } % UTAH
FUNCTION { output.doi } % UTAH
{ % output non-empty DOI as one-line sentence (stack untouched)
{ % output non-empty DOI as one-line sentence (stack untouched)
doi empty.or.unknown
doi empty.or.unknown
{ }
{ }
{
{
%% Use \urldef here for the same reason it is used in output.url,
%% NB: We want URLs at beginning of line to reduce likelihood of
%% see output.url for further discussion.
%% BibTeX's nasty line wrapping after column 79, which then requires
"\urldef\tempurl%" writeln
%% manual (or automated) editing of the .bbl file to repair.
"\url{https://doi.org/" strip.doi * "}" * writeln
%% The \url{} macro strips percent-newlines, and is thus safe in
"\showDOI{\tempurl}" writeln
%% the presence of the line wrapping, but \path|...| and
%% \verb|...| do not.
%% "\url{http://dx.doi.org/" strip.doi * "}}" * writeln
%% "\href{http://dx.doi.org/" strip.doi * "}{" * strip.doi * "}}" * writeln
"\showDOI{%" writeln
"\href{http://dx.doi.org/" strip.doi * "}{\texttt{" * strip.doi * "}}}" * writeln
}
}
if$
if$
}
}
FUNCTION { output.isbn } % UTAH
FUNCTION { output.isbn } % UTAH
{ % output non-empty ISBN-10 and/or ISBN-13 as one-line sentences (stack untouched)
{ % output non-empty ISBN-10 and/or ISBN-13 as one-line sentences (stack untouched)
doi empty.or.unknown
{
show-isbn-10-and-13
show-isbn-10-and-13
{
{
%% show both 10- and 13-digit ISBNs
%% show both 10- and 13-digit ISBNs
isbn empty.or.unknown
isbn empty.or.unknown
{ }
{ }
{
{
"\showISBNx{" isbn * "}" * writeln
"\showISBNx{" isbn * "}" * writeln
}
}
if$
if$
isbn-13 empty.or.unknown
isbn-13 empty.or.unknown
{ }
{ }
{
{
"\showISBNxiii{" isbn-13 * "}" * writeln
"\showISBNxiii{" isbn-13 * "}" * writeln
}
}
if$
if$
}
}
{
{
%% show 10-digit ISBNs only if 13-digit ISBNs not available
%% show 10-digit ISBNs only if 13-digit ISBNs not available
isbn-13 empty.or.unknown
isbn-13 empty.or.unknown
{
{
isbn empty.or.unknown
isbn empty.or.unknown
{ }
{ }
{
{
"\showISBNx{" isbn * "}" * writeln
"\showISBNx{" isbn * "}" * writeln
}
}
if$
if$
}
}
{
{
"\showISBNxiii{" isbn-13 * "}" * writeln
"\showISBNxiii{" isbn-13 * "}" * writeln
}
}
if$
if$
}
}
if$
if$
}
{ }
if$
}
}
FUNCTION { output.issn } % UTAH
FUNCTION { output.issn } % UTAH
{ % output non-empty ISSN as one-line sentence (stack untouched)
{ % output non-empty ISSN as one-line sentence (stack untouched)
issn empty.or.unknown
issn empty.or.unknown
{ }
{ }
{ "\showISSN{" issn * "}" * writeln }
{ "\showISSN{" issn * "}" * writeln }
if$
if$
}
}
FUNCTION { output.issue }
FUNCTION { output.issue }
{ % output non-empty issue number as a one-line sentence (stack untouched)
{ % output non-empty issue number as a one-line sentence (stack untouched)
issue empty.or.unknown
issue empty.or.unknown
{ }
{ }
{ "Issue " issue * "." * writeln }
{ "Issue " issue * "." * writeln }
if$
if$
}
}
FUNCTION { output.lccn } % UTAH
FUNCTION { output.lccn } % UTAH
{ % return with stack untouched
{ % return with stack untouched
lccn empty.or.unknown
lccn empty.or.unknown
{ }
{ }
{ "\showLCCN{" lccn * "}" * writeln }
{ "\showLCCN{" lccn * "}" * writeln }
if$
if$
}
}
FUNCTION { output.note } % UTAH
FUNCTION { output.note } % UTAH
{ % return with stack empty
{ % return with stack empty
note empty.or.unknown
note empty.or.unknown
{ }
{ }
{ "\shownote{" note * "}" add.period$ * writeln }
{ "\shownote{" note add.period$ * "}" * writeln }
if$
if$
}
}
FUNCTION { output.note.check } % UTAH
FUNCTION { output.note.check } % UTAH
{ % return with stack empty
{ % return with stack empty
note empty.or.unknown
note empty.or.unknown
{ "empty note in " cite$ * warning$ }
{ "empty note in " cite$ * warning$ }
{ "\shownote{" note * "}" add.period$ * writeln }
{ "\shownote{" note add.period$ * "}" * writeln }
if$
}
FUNCTION { output.eprint } %
{ % return with stack empty
eprint empty.or.unknown
{ }
{ "\showeprint"
archiveprefix empty.or.unknown
{ eprinttype empty.or.unknown
{ }
{ "[" eprinttype "]" * * * }
if$
}
{ "[" archiveprefix "l" change.case$ "]" * * * }
if$
"{" eprint "}" * * *
primaryclass empty.or.unknown
{ eprintclass empty.or.unknown
{ }
{ "~[" eprintclass "]" * * * }
if$
}
{ "~[" primaryclass "]" * * * }
if$
writeln
}
if$
if$
}
}
%
%
% Changes by BV 2011/04/15. Do not output
% Changes by BV 2011/04/15. Do not output
% url if doi is defined
% url if doi is defined
%
%
%
% Changes by BV 2021/11/26. Output url even if doi is defined
% if distinctURL is not zero.
%
FUNCTION { output.url } % UTAH
FUNCTION { output.url } % UTAH
{ % return with stack untouched
{ % return with stack untouched
% output URL and associated lastaccessed fields
% output URL and associated lastaccessed fields
doi empty.or.unknown distinctURL empty.or.zero not or
doi empty.or.unknown
{
{
url empty.or.unknown
url empty.or.unknown
{ }
{ }
{
{
%% Use \urldef, outside \showURL, so that %nn, #, etc in URLs work
%% NB: We want URLs at beginning of line to reduce likelihood of
%% correctly. Put the actual URL on its own line to reduce the
%% BibTeX's nasty line wrapping after column 79, which would require
%% likelihood of BibTeX's nasty line wrapping after column 79.
%% manual (or automated) editing of the .bbl file to repair. However,
%% \url{} can undo this, but if that doesn't work for some reason
%% the \url{} macro handles the unwrapping job automatically.
%% the .bbl file would have to be repaired manually.
"\urldef\tempurl%" writeln
"\url{" url * "}" * writeln
"\showURL{%" writeln
"\showURL{%" writeln
lastaccessed empty.or.unknown
lastaccessed empty.or.unknown
{ "" }
{ "" }
{ "Retrieved " lastaccessed * " from " * }
{ "Retrieved " lastaccessed * " from " * }
if$
if$
"\tempurl}" * writeln
}
if$
}
{ }
if$
}
FUNCTION { output.year.check }
%% The URL field may contain a semicolon-separated list of Web
{ % warn if year empty, output top string and leave " YEAR<label>" on stack in mid-sentence
%% addresses, and we locate and wrap each of them in \url{...}.
year empty.or.unknown
%% The simplistic approach of putting the entire list into the
{ "empty year in " cite$ * warning$
%% macro argument is that the semicolons are typeset in a
write$
%% typewriter font, and no space follows them.
" \bibinfo{year}{[n.\,d.]}"
%%
"\natexlab{" extra.label * "}" * *
%% We therefore replace the original code
mid.sentence 'output.state :=
%% "\url{" * url * "}}" * writeln
}
%% with this character-at-a-time loop:
{ write$
" \bibinfo{year}{" year * "}" *
"\natexlab{" extra.label * "}" * *
mid.sentence 'output.state :=
}
if$
}
"\url{" *
FUNCTION { le }
{
%% test whether first number is less than or equal to second number
%% stack in: n1 n2
%% stack out: if n1 <= n2 then 1 else 0
%% "DEBUG: le " cite$ * warning$
> { #0 } { #1 } if$
}
FUNCTION { ge }
{
%% test whether first number is greater than or equal to second number
%% stack in: n1 n2
%% stack out: if n1 >= n2 then 1 else 0
%% "DEBUG: ge " cite$ * warning$
< { #0 } { #1 } if$
}
FUNCTION { is.leading.digit }
{
%% test whether first character of string is a digit
%% stack in: string
%% stack out: if first-char-is-digit then 1 else 0
#1 #1 substring$ % replace string by string[1:1]
duplicate$ % string[1:1] string[1:1]
chr.to.int$
"0" chr.to.int$ swap$ le % "0" <= string[1:1] --> 0-or-1