ACM-Reference-Format.bst 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900
  1. %%% -*-BibTeX-*-
  2. %%% ====================================================================
  3. %%% @BibTeX-style-file{
  4. %%% author = "Nelson H. F. Beebe, Boris Veytsman and Gerald Murray",
  5. %%% version = "2.1",
  6. %%% date = "14 June 2017",
  7. %%% filename = "ACM-Reference-Format.bst",
  8. %%% email = "borisv@lk.net, boris@varphi.com",
  9. %%% codetable = "ISO/ASCII",
  10. %%% keywords = "ACM Transactions bibliography style; BibTeX",
  11. %%% license = "public domain",
  12. %%% supported = "yes",
  13. %%% abstract = "",
  14. %%% }
  15. %%% ====================================================================
  16. %%% Revision history: see source in git
  17. ENTRY
  18. { address
  19. advisor
  20. archiveprefix
  21. author
  22. booktitle
  23. chapter
  24. city
  25. date
  26. edition
  27. editor
  28. eprint
  29. eprinttype
  30. eprintclass
  31. howpublished
  32. institution
  33. journal
  34. key
  35. month
  36. note
  37. number
  38. organization
  39. pages
  40. primaryclass
  41. publisher
  42. school
  43. series
  44. title
  45. type
  46. volume
  47. year
  48. % New keys recognized
  49. issue % UTAH: used in, e.g., ACM SIGSAM Bulletin and ACM Communications in Computer Algebra
  50. articleno
  51. eid
  52. day % UTAH: needed for newspapers, weeklies, bi-weeklies
  53. doi % UTAH
  54. url % UTAH
  55. bookpages % UTAH
  56. numpages
  57. lastaccessed % UTAH: used only for @Misc{...}
  58. coden % UTAH
  59. isbn % UTAH
  60. isbn-13 % UTAH
  61. issn % UTAH
  62. lccn % UTAH
  63. }
  64. {}
  65. { label.year extra.label sort.year sort.label basic.label.year}
  66. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  67. INTEGERS { show-isbn-10-and-13 } % initialized below in begin.bib
  68. INTEGERS { nameptr namesleft numnames }
  69. INTEGERS { multiresult }
  70. INTEGERS { len }
  71. INTEGERS { last.extra.num }
  72. STRINGS { s t t.org u }
  73. STRINGS { last.label next.extra }
  74. STRINGS { p1 p2 p3 page.count }
  75. FUNCTION { not }
  76. {
  77. { #0 }
  78. { #1 }
  79. if$
  80. }
  81. FUNCTION { and }
  82. {
  83. 'skip$
  84. { pop$ #0 }
  85. if$
  86. }
  87. FUNCTION { or }
  88. {
  89. { pop$ #1 }
  90. 'skip$
  91. if$
  92. }
  93. FUNCTION { dump.stack.1 }
  94. {
  95. duplicate$ "STACK[top] = [" swap$ * "]" * warning$
  96. }
  97. FUNCTION { dump.stack.2 }
  98. {
  99. duplicate$ "STACK[top ] = [" swap$ * "]" * warning$
  100. swap$
  101. duplicate$ "STACK[top-1] = [" swap$ * "]" * warning$
  102. swap$
  103. }
  104. FUNCTION { empty.or.unknown }
  105. {
  106. %% Examine the top stack entry, and push 1 if it is empty, or
  107. %% consists only of whitespace, or is a string beginning with two
  108. %% queries (??), and otherwise, push 0.
  109. %%
  110. %% This function provides a replacement for empty$, with the
  111. %% convenient feature that unknown values marked by two leading
  112. %% queries are treated the same as missing values, and thus, do not
  113. %% appear in the output .bbl file, and yet, their presence in .bib
  114. %% file(s) serves to mark values which are temporarily missing, but
  115. %% are expected to be filled in eventually once more data is
  116. %% obtained. The TeX User Group and BibNet bibliography archives
  117. %% make extensive use of this practice.
  118. %%
  119. %% An empty string cannot serve the same purpose, because just as in
  120. %% statistics data processing, an unknown value is not the same as an
  121. %% empty value.
  122. %%
  123. %% At entry: stack = ... top:[string]
  124. %% At exit: stack = ... top:[0 or 1]
  125. duplicate$ empty$
  126. { pop$ #1 }
  127. { #1 #2 substring$ "??" = }
  128. if$
  129. }
  130. FUNCTION { writeln }
  131. {
  132. %% In BibTeX style files, the sequences
  133. %%
  134. %% ... "one" "two" output
  135. %% ... "one" "two" output.xxx
  136. %%
  137. %% ship "one" to the output file, possibly following by punctuation,
  138. %% leaving the stack with
  139. %%
  140. %% ... "two"
  141. %%
  142. %% There is thus a one-string lag in output processing that must be
  143. %% carefully handled to avoid duplicating a string in the output
  144. %% file. Unless otherwise noted, all output.xxx functions leave
  145. %% just one new string on the stack, and that model should be born
  146. %% in mind when reading or writing function code.
  147. %%
  148. %% BibTeX's asynchronous buffering of output from strings from the
  149. %% stack is confusing because newline$ bypasses the buffer. It
  150. %% would have been so much easier for newline to be a character
  151. %% rather than a state of the output-in-progress.
  152. %%
  153. %% The documentation in btxhak.dvi is WRONG: it says
  154. %%
  155. %% newline$ Writes onto the bbl file what's accumulated in the
  156. %% output buffer. It writes a blank line if and only
  157. %% if the output buffer is empty. Since write$ does
  158. %% reasonable line breaking, you should use this
  159. %% function only when you want a blank line or an
  160. %% explicit line break.
  161. %%
  162. %% write$ Pops the top (string) literal and writes it on the
  163. %% output buffer (which will result in stuff being
  164. %% written onto the bbl file when the buffer fills
  165. %% up).
  166. %%
  167. %% Examination of the BibTeX source code shows that write$ does
  168. %% indeed behave as claimed, but newline$ sends a newline character
  169. %% directly to the output file, leaving the stack unchanged. The
  170. %% first line "Writes onto ... buffer." is therefore wrong.
  171. %%
  172. %% The original BibTeX style files almost always use "write$ newline$"
  173. %% in that order, so it makes sense to hide that pair in a private
  174. %% function like this one, named after a statement in Pascal,
  175. %% the programming language embedded in the BibTeX Web program.
  176. write$ % output top-of-stack string
  177. newline$ % immediate write of newline (not via stack)
  178. }
  179. FUNCTION { init.state.consts }
  180. {
  181. #0 'before.all :=
  182. #1 'mid.sentence :=
  183. #2 'after.sentence :=
  184. #3 'after.block :=
  185. }
  186. FUNCTION { output.nonnull }
  187. { % Stack in: ... R S T Stack out: ... R T File out: S<comma><space>
  188. 's :=
  189. output.state mid.sentence =
  190. {
  191. ", " * write$
  192. }
  193. {
  194. output.state after.block =
  195. {
  196. add.period$ writeln
  197. "\newblock " write$
  198. }
  199. {
  200. output.state before.all =
  201. {
  202. write$
  203. }
  204. {
  205. add.period$ " " * write$
  206. }
  207. if$
  208. }
  209. if$
  210. mid.sentence 'output.state :=
  211. }
  212. if$
  213. s
  214. }
  215. FUNCTION { output.nonnull.dot.space }
  216. { % Stack in: ... R S T Stack out: ... R T File out: S<dot><space>
  217. 's :=
  218. output.state mid.sentence = % { "<DEBUG output.nonnull.dot.space>. " * write$ }
  219. {
  220. ". " * write$
  221. }
  222. {
  223. output.state after.block =
  224. {
  225. add.period$ writeln "\newblock " write$
  226. }
  227. {
  228. output.state before.all =
  229. {
  230. write$
  231. }
  232. {
  233. add.period$ " " * write$
  234. }
  235. if$
  236. }
  237. if$
  238. mid.sentence 'output.state :=
  239. }
  240. if$
  241. s
  242. }
  243. FUNCTION { output.nonnull.remove }
  244. { % Stack in: ... R S T Stack out: ... R T File out: S<space>
  245. 's :=
  246. output.state mid.sentence =
  247. {
  248. " " * write$
  249. }
  250. {
  251. output.state after.block =
  252. {
  253. add.period$ writeln "\newblock " write$
  254. }
  255. {
  256. output.state before.all =
  257. {
  258. write$
  259. }
  260. {
  261. add.period$ " " * write$
  262. }
  263. if$
  264. }
  265. if$
  266. mid.sentence 'output.state :=
  267. }
  268. if$
  269. s
  270. }
  271. FUNCTION { output.nonnull.removenospace }
  272. { % Stack in: ... R S T Stack out: ... R T File out: S
  273. 's :=
  274. output.state mid.sentence =
  275. {
  276. "" * write$
  277. }
  278. {
  279. output.state after.block =
  280. {
  281. add.period$ writeln "\newblock " write$
  282. }
  283. {
  284. output.state before.all =
  285. {
  286. write$
  287. }
  288. {
  289. add.period$ " " * write$
  290. }
  291. if$
  292. }
  293. if$
  294. mid.sentence 'output.state :=
  295. }
  296. if$
  297. s
  298. }
  299. FUNCTION { output }
  300. { % discard top token if empty, else like output.nonnull
  301. duplicate$ empty.or.unknown
  302. 'pop$
  303. 'output.nonnull
  304. if$
  305. }
  306. FUNCTION { output.dot.space }
  307. { % discard top token if empty, else like output.nonnull.dot.space
  308. duplicate$ empty.or.unknown
  309. 'pop$
  310. 'output.nonnull.dot.space
  311. if$
  312. }
  313. FUNCTION { output.removenospace }
  314. { % discard top token if empty, else like output.nonnull.removenospace
  315. duplicate$ empty.or.unknown
  316. 'pop$
  317. 'output.nonnull.removenospace
  318. if$
  319. }
  320. FUNCTION { output.check }
  321. { % like output, but warn if key name on top-of-stack is not set
  322. 't :=
  323. duplicate$ empty.or.unknown
  324. { pop$ "empty " t * " in " * cite$ * warning$ }
  325. 'output.nonnull
  326. if$
  327. }
  328. FUNCTION { bibinfo.output.check }
  329. { % like output.check, adding bibinfo field
  330. 't :=
  331. duplicate$ empty.or.unknown
  332. { pop$ "empty " t * " in " * cite$ * warning$ }
  333. { "\bibinfo{" t "}{" * * swap$ * "}" *
  334. output.nonnull }
  335. if$
  336. }
  337. FUNCTION { output.check.dot.space }
  338. { % like output.dot.space, but warn if key name on top-of-stack is not set
  339. 't :=
  340. duplicate$ empty.or.unknown
  341. { pop$ "empty " t * " in " * cite$ * warning$ }
  342. 'output.nonnull.dot.space
  343. if$
  344. }
  345. FUNCTION { fin.block }
  346. { % functionally, but not logically, identical to fin.entry
  347. add.period$
  348. writeln
  349. }
  350. FUNCTION { fin.entry }
  351. {
  352. add.period$
  353. writeln
  354. }
  355. FUNCTION { new.sentence }
  356. { % update sentence state, with neither output nor stack change
  357. output.state after.block =
  358. 'skip$
  359. {
  360. output.state before.all =
  361. 'skip$
  362. { after.sentence 'output.state := }
  363. if$
  364. }
  365. if$
  366. }
  367. FUNCTION { fin.sentence }
  368. {
  369. add.period$
  370. write$
  371. new.sentence
  372. ""
  373. }
  374. FUNCTION { new.block }
  375. {
  376. output.state before.all =
  377. 'skip$
  378. { after.block 'output.state := }
  379. if$
  380. }
  381. FUNCTION { output.coden } % UTAH
  382. { % output non-empty CODEN as one-line sentence (stack untouched)
  383. coden empty.or.unknown
  384. { }
  385. { "\showCODEN{" coden * "}" * writeln }
  386. if$
  387. }
  388. FUNCTION { format.articleno }
  389. {
  390. articleno empty.or.unknown not eid empty.or.unknown not and
  391. { "Both articleno and eid are defined for " cite$ * warning$ }
  392. 'skip$
  393. if$
  394. articleno empty.or.unknown eid empty.or.unknown and
  395. { "" }
  396. {
  397. numpages empty.or.unknown
  398. { "articleno or eid field, but no numpages field, in "
  399. cite$ * warning$ }
  400. { }
  401. if$
  402. eid empty.or.unknown
  403. { "Article \bibinfo{articleno}{" articleno * "}" * }
  404. { "Article \bibinfo{articleno}{" eid * "}" * }
  405. if$
  406. }
  407. if$
  408. }
  409. FUNCTION { format.year }
  410. { % push year string or "[n.\,d.]" onto output stack
  411. %% Because year is a mandatory field, we always force SOMETHING
  412. %% to be output
  413. "\bibinfo{year}{"
  414. year empty.or.unknown
  415. { "[n.\,d.]" }
  416. { year }
  417. if$
  418. * "}" *
  419. }
  420. FUNCTION { format.day.month }
  421. { % push "day month " or "month " or "" onto output stack
  422. day empty.or.unknown
  423. {
  424. month empty.or.unknown
  425. { "" }
  426. { "\bibinfo{date}{" month * "} " *}
  427. if$
  428. }
  429. {
  430. month empty.or.unknown
  431. { "" }
  432. { "\bibinfo{date}{" day * " " * month * "} " *}
  433. if$
  434. }
  435. if$
  436. }
  437. FUNCTION { format.day.month.year } % UTAH
  438. { % if month is empty, push "" else push "(MON.)" or "(DD MON.)"
  439. % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
  440. % acm-*.bst addition: prefix parenthesized date string with
  441. % ", Article nnn "
  442. articleno empty.or.unknown eid empty.or.unknown and
  443. { "" }
  444. { output.state after.block =
  445. {", " format.articleno * }
  446. { format.articleno }
  447. if$
  448. }
  449. if$
  450. " (" * format.day.month * format.year * ")" *
  451. }
  452. FUNCTION { output.day.month.year } % UTAH
  453. { % if month is empty value, do nothing; else output stack top and
  454. % leave with new top string "(MON.)" or "(DD MON.)"
  455. % Needed for frequent periodicals: 2008. ... New York Times C-1, C-2, C-17 (23 Oct.)
  456. format.day.month.year
  457. output.nonnull.remove
  458. }
  459. FUNCTION { strip.doi } % UTAH
  460. { % Strip any Web address prefix to recover the bare DOI, leaving the
  461. % result on the output stack, as recommended by CrossRef DOI
  462. % documentation.
  463. % For example, reduce "http://doi.acm.org/10.1145/1534530.1534545" to
  464. % "10.1145/1534530.1534545". A suitable URL is later typeset and
  465. % displayed as the LAST item in the reference list entry. Publisher Web
  466. % sites wrap this with a suitable link to a real URL to resolve the DOI,
  467. % and the master https://doi.org/ address is preferred, since publisher-
  468. % specific URLs can disappear in response to economic events. All
  469. % journals are encouraged by the DOI authorities to use that typeset
  470. % format and link procedures for uniformity across all publications that
  471. % include DOIs in reference lists.
  472. % The numeric prefix is guaranteed to start with "10.", so we use
  473. % that as a test.
  474. % 2017-02-04 Added stripping of https:// (Boris)
  475. doi #1 #3 substring$ "10." =
  476. { doi }
  477. {
  478. doi 't := % get modifiable copy of DOI
  479. % Change https:// to http:// to strip both prefixes (BV)
  480. t #1 #8 substring$ "https://" =
  481. { "http://" t #9 t text.length$ #8 - substring$ * 't := }
  482. { }
  483. if$
  484. t #1 #7 substring$ "http://" =
  485. {
  486. t #8 t text.length$ #7 - substring$ 't :=
  487. "INTERNAL STYLE-FILE ERROR" 's :=
  488. % search for next "/" and assign its suffix to s
  489. { t text.length$ }
  490. {
  491. t #1 #1 substring$ "/" =
  492. {
  493. % save rest of string as true DOI (should be 10.xxxx/yyyy)
  494. t #2 t text.length$ #1 - substring$ 's :=
  495. "" 't := % empty string t terminates the loop
  496. }
  497. {
  498. % discard first character and continue loop: t <= substring(t,2,last)
  499. t #2 t text.length$ #1 - substring$ 't :=
  500. }
  501. if$
  502. }
  503. while$
  504. % check for valid DOI (should be 10.xxxx/yyyy)
  505. s #1 #3 substring$ "10." =
  506. { }
  507. { "unrecognized DOI substring " s * " in DOI value [" * doi * "]" * warning$ }
  508. if$
  509. s % push the stripped DOI on the output stack
  510. }
  511. {
  512. "unrecognized DOI value [" doi * "]" * warning$
  513. doi % push the unrecognized original DOI on the output stack
  514. }
  515. if$
  516. }
  517. if$
  518. }
  519. %
  520. % Change by BV: added standard prefix to URL
  521. %
  522. FUNCTION { output.doi } % UTAH
  523. { % output non-empty DOI as one-line sentence (stack untouched)
  524. doi empty.or.unknown
  525. { }
  526. {
  527. %% Use \urldef here for the same reason it is used in output.url,
  528. %% see output.url for further discussion.
  529. "\urldef\tempurl%" writeln
  530. "\url{https://doi.org/" strip.doi * "}" * writeln
  531. "\showDOI{\tempurl}" writeln
  532. }
  533. if$
  534. }
  535. FUNCTION { output.isbn } % UTAH
  536. { % output non-empty ISBN-10 and/or ISBN-13 as one-line sentences (stack untouched)
  537. show-isbn-10-and-13
  538. {
  539. %% show both 10- and 13-digit ISBNs
  540. isbn empty.or.unknown
  541. { }
  542. {
  543. "\showISBNx{" isbn * "}" * writeln
  544. }
  545. if$
  546. isbn-13 empty.or.unknown
  547. { }
  548. {
  549. "\showISBNxiii{" isbn-13 * "}" * writeln
  550. }
  551. if$
  552. }
  553. {
  554. %% show 10-digit ISBNs only if 13-digit ISBNs not available
  555. isbn-13 empty.or.unknown
  556. {
  557. isbn empty.or.unknown
  558. { }
  559. {
  560. "\showISBNx{" isbn * "}" * writeln
  561. }
  562. if$
  563. }
  564. {
  565. "\showISBNxiii{" isbn-13 * "}" * writeln
  566. }
  567. if$
  568. }
  569. if$
  570. }
  571. FUNCTION { output.issn } % UTAH
  572. { % output non-empty ISSN as one-line sentence (stack untouched)
  573. issn empty.or.unknown
  574. { }
  575. { "\showISSN{" issn * "}" * writeln }
  576. if$
  577. }
  578. FUNCTION { output.issue }
  579. { % output non-empty issue number as a one-line sentence (stack untouched)
  580. issue empty.or.unknown
  581. { }
  582. { "Issue " issue * "." * writeln }
  583. if$
  584. }
  585. FUNCTION { output.lccn } % UTAH
  586. { % return with stack untouched
  587. lccn empty.or.unknown
  588. { }
  589. { "\showLCCN{" lccn * "}" * writeln }
  590. if$
  591. }
  592. FUNCTION { output.note } % UTAH
  593. { % return with stack empty
  594. note empty.or.unknown
  595. { }
  596. { "\shownote{" note add.period$ * "}" * writeln }
  597. if$
  598. }
  599. FUNCTION { output.note.check } % UTAH
  600. { % return with stack empty
  601. note empty.or.unknown
  602. { "empty note in " cite$ * warning$ }
  603. { "\shownote{" note add.period$ * "}" * writeln }
  604. if$
  605. }
  606. FUNCTION { output.eprint } %
  607. { % return with stack empty
  608. eprint empty.or.unknown
  609. { }
  610. { "\showeprint"
  611. archiveprefix empty.or.unknown
  612. { eprinttype empty.or.unknown
  613. { }
  614. { "[" eprinttype "]" * * * }
  615. if$
  616. }
  617. { "[" archiveprefix "l" change.case$ "]" * * * }
  618. if$
  619. "{" *
  620. primaryclass empty.or.unknown
  621. { eprintclass empty.or.unknown
  622. { }
  623. { eprintclass "/" * * }
  624. if$
  625. }
  626. { primaryclass "/" * * }
  627. if$
  628. eprint "}" * *
  629. writeln
  630. }
  631. if$
  632. }
  633. %
  634. % Changes by BV 2011/04/15. Do not output
  635. % url if doi is defined
  636. %
  637. FUNCTION { output.url } % UTAH
  638. { % return with stack untouched
  639. % output URL and associated lastaccessed fields
  640. doi empty.or.unknown
  641. {
  642. url empty.or.unknown
  643. { }
  644. {
  645. %% Use \urldef, outside \showURL, so that %nn, #, etc in URLs work
  646. %% correctly. Put the actual URL on its own line to reduce the
  647. %% likelihood of BibTeX's nasty line wrapping after column 79.
  648. %% \url{} can undo this, but if that doesn't work for some reason
  649. %% the .bbl file would have to be repaired manually.
  650. "\urldef\tempurl%" writeln
  651. "\url{" url * "}" * writeln
  652. "\showURL{%" writeln
  653. lastaccessed empty.or.unknown
  654. { "" }
  655. { "Retrieved " lastaccessed * " from " * }
  656. if$
  657. "\tempurl}" * writeln
  658. }
  659. if$
  660. }
  661. { }
  662. if$
  663. }
  664. FUNCTION { output.year.check }
  665. { % warn if year empty, output top string and leave " YEAR<label>" on stack in mid-sentence
  666. year empty.or.unknown
  667. { "empty year in " cite$ * warning$
  668. write$
  669. " \bibinfo{year}{[n.d.]}"
  670. "\natexlab{" extra.label * "}" * *
  671. mid.sentence 'output.state :=
  672. }
  673. { write$
  674. " \bibinfo{year}{" year * "}" *
  675. "\natexlab{" extra.label * "}" * *
  676. mid.sentence 'output.state :=
  677. }
  678. if$
  679. }
  680. FUNCTION { le }
  681. {
  682. %% test whether first number is less than or equal to second number
  683. %% stack in: n1 n2
  684. %% stack out: if n1 <= n2 then 1 else 0
  685. %% "DEBUG: le " cite$ * warning$
  686. > { #0 } { #1 } if$
  687. }
  688. FUNCTION { ge }
  689. {
  690. %% test whether first number is greater than or equal to second number
  691. %% stack in: n1 n2
  692. %% stack out: if n1 >= n2 then 1 else 0
  693. %% "DEBUG: ge " cite$ * warning$
  694. < { #0 } { #1 } if$
  695. }
  696. FUNCTION { is.leading.digit }
  697. {
  698. %% test whether first character of string is a digit
  699. %% stack in: string
  700. %% stack out: if first-char-is-digit then 1 else 0
  701. #1 #1 substring$ % replace string by string[1:1]
  702. duplicate$ % string[1:1] string[1:1]
  703. chr.to.int$
  704. "0" chr.to.int$ swap$ le % "0" <= string[1:1] --> 0-or-1
  705. swap$ % 0-or-1 string[1:1]
  706. chr.to.int$
  707. "9" chr.to.int$ le % string[1:1} <= "9" --> 0-or-1
  708. and
  709. }
  710. FUNCTION { skip.digits }
  711. {
  712. %% skip over leading digits in string
  713. %% stack in: string
  714. %% stack out: rest-of-string leading-digits
  715. %% "DEBUG: enter skip.digits " cite$ * warning$
  716. %% dump.stack.1
  717. duplicate$
  718. 't :=
  719. 't.org :=
  720. "" 'u :=
  721. { t text.length$ }
  722. {
  723. %% "=================DEBUG: skip.digits t = [" t * "]" * warning$
  724. t is.leading.digit
  725. { t #2 t text.length$ #1 - substring$ }
  726. {
  727. t 'u :=
  728. ""
  729. }
  730. if$
  731. 't :=
  732. }
  733. while$
  734. u % rest of string
  735. t.org #1 t.org text.length$ u text.length$ - substring$ % leading digits
  736. %% "DEBUG: t.org = [" t.org * "]" * warning$
  737. %% "DEBUG: u = [" u * "]" * warning$
  738. %% dump.stack.2
  739. %% "DEBUG: leave skip.digits " cite$ * warning$
  740. }
  741. FUNCTION { skip.nondigits }
  742. {
  743. %% skip over leading nondigits in string
  744. %% stack in: string
  745. %% stack out: rest-of-string
  746. %% "DEBUG: enter skip.nondigits " cite$ * warning$
  747. 't :=
  748. "" 'u :=
  749. { t text.length$ }
  750. {
  751. %% "=================DEBUG: skip.nondigits t = [" t * "]" * warning$
  752. t is.leading.digit
  753. {
  754. t 'u :=
  755. ""
  756. }
  757. { t #2 t text.length$ #1 - substring$ }
  758. if$
  759. 't :=
  760. }
  761. while$
  762. u % rest of string
  763. %% dump.stack.1
  764. %% "DEBUG: leave skip.nondigits " cite$ * warning$
  765. }
  766. FUNCTION { parse.next.number }
  767. {
  768. %% stack in: string
  769. %% stack out: rest-of-string next-numeric-part-of-string
  770. %% Example:
  771. %% stack in: "123:1--123:59"
  772. %% stack out: ":1--123:59" "123"
  773. 's :=
  774. s skip.nondigits 's :=
  775. s skip.digits
  776. }
  777. FUNCTION { reduce.pages.to.page.count }
  778. {
  779. %% Stack in: arbitrary-and-unused
  780. %% Stack out: unchanged
  781. %%
  782. %% For the new-style pagination with article number and numpages or
  783. %% pages, we expect to have BibTeX entries containing something like
  784. %% articleno = "17",
  785. %% pages = "1--23",
  786. %% with output "Article 17, 23 pages",
  787. %% or
  788. %% articleno = "17",
  789. %% numpages = "23",
  790. %% with output "Article 17, 23 pages",
  791. %% or
  792. %% articleno = "17",
  793. %% pages = "17:1--17:23",
  794. %% with output "Article 17, 23 pages",
  795. %%
  796. %% If articleno is missing or empty, then we should output "1--23",
  797. %% "23" (with a warning of a missing articleno), or "17:1--17:23",
  798. %% respectively.
  799. %% "DEBUG: enter reduce.pages.to.page.count " cite$ * warning$
  800. %% "DEBUG: pages = [" pages * "]" * warning$
  801. pages
  802. parse.next.number 'p1 :=
  803. parse.next.number 'p2 :=
  804. parse.next.number 'p3 :=
  805. parse.next.number 'page.count :=
  806. duplicate$
  807. empty.or.unknown
  808. { }
  809. {
  810. duplicate$ "unexpected trailing garbage [" swap$ *
  811. "] after n:p1--n:p2 in pages = [" *
  812. pages *
  813. "] in " *
  814. cite$ *
  815. warning$
  816. }
  817. if$
  818. pop$
  819. %% "DEBUG: reduce.pages.to.page.count: "
  820. %% " p1 = " p1 * *
  821. %% " p2 = " p2 * *
  822. %% " p3 = " p3 * *
  823. %% " p4 = " page.count * *
  824. %% " in " cite$ * * warning$
  825. p1 p3 = p2 "1" = and numpages empty.or.unknown and
  826. { "INFO: reduced pages = [" pages * "] to numpages = [" * page.count * "]" * warning$ }
  827. {
  828. numpages empty.or.unknown
  829. { pages }
  830. { numpages }
  831. if$
  832. 'page.count :=
  833. }
  834. if$
  835. p1 "1" = p3 empty.or.unknown and numpages empty.or.unknown and
  836. {
  837. p2 'page.count :=
  838. "INFO: reduced pages = [" pages * "] to numpages = [" * page.count * "]" * warning$
  839. }
  840. {
  841. numpages empty.or.unknown
  842. { pages }
  843. { numpages }
  844. if$
  845. 'page.count :=
  846. }
  847. if$
  848. %% "DEBUG: leave reduce.pages.to.page.count " cite$ * warning$
  849. }
  850. FUNCTION { new.block.checkb }
  851. { % issue a new.block only if at least one of top two stack strings is not empty
  852. empty.or.unknown
  853. swap$ empty.or.unknown
  854. and
  855. 'skip$
  856. 'new.block
  857. if$
  858. }
  859. FUNCTION { field.or.null }
  860. { % convert empty value to null string, else return value
  861. duplicate$ empty.or.unknown
  862. { pop$ "" }
  863. 'skip$
  864. if$
  865. }
  866. FUNCTION { emphasize }
  867. { % emphasize a non-empty top string on the stack
  868. duplicate$ empty.or.unknown
  869. { pop$ "" }
  870. { "\emph{" swap$ * "}" * }
  871. if$
  872. }
  873. FUNCTION { comma }
  874. { % convert empty string to null string, or brace string and add trailing comma
  875. duplicate$ empty.or.unknown
  876. { pop$ "" }
  877. { "{" swap$ * "}," * }
  878. if$
  879. }
  880. FUNCTION { format.names }
  881. {
  882. % Format bibliographical entries with the first author last name first,
  883. % and subsequent authors with initials followed by last name.
  884. % All names are formatted in this routine.
  885. 's :=
  886. #1 'nameptr := % nameptr = 1;
  887. s num.names$ 'numnames := % numnames = num.name$(s);
  888. numnames 'namesleft :=
  889. { namesleft #0 > }
  890. { nameptr #1 =
  891. %NO: BAD ORDER: {"{" s nameptr "{ff~}{ll}{, jj}{, vv}" format.name$ * "}" * 't := }
  892. %NO: BAD ORDER: {"{" s nameptr "{ff~}{ll}{, jj}{, vv}" format.name$ * "}" * 't := }
  893. {"\bibinfo{person}{" s nameptr "{ff }{vv }{ll}{, jj}" format.name$ * "}" * 't := }
  894. {"\bibinfo{person}{" s nameptr "{ff }{vv }{ll}{, jj}" format.name$ * "}" * 't := }
  895. if$
  896. nameptr #1 >
  897. {
  898. namesleft #1 >
  899. { ", " * t * }
  900. {
  901. numnames #2 >
  902. { "," * }
  903. 'skip$
  904. if$
  905. t "\bibinfo{person}{others}" =
  906. { " {et~al\mbox{.}}" * } % jrh: avoid spacing problems
  907. { " {and} " * t * } % from Chicago Manual of Style
  908. if$
  909. }
  910. if$
  911. }
  912. 't
  913. if$
  914. nameptr #1 + 'nameptr := % nameptr += 1;
  915. namesleft #1 - 'namesleft := % namesleft =- 1;
  916. }
  917. while$
  918. }
  919. FUNCTION { my.full.label }
  920. {
  921. 's :=
  922. #1 'nameptr := % nameptr = 1;
  923. s num.names$ 'numnames := % numnames = num.name$(s);
  924. numnames 'namesleft :=
  925. { namesleft #0 > }
  926. { s nameptr "{vv~}{ll}" format.name$ 't := % get the next name
  927. nameptr #1 >
  928. {
  929. namesleft #1 >
  930. { ", " * t * }
  931. {
  932. numnames #2 >
  933. { "," * }
  934. 'skip$
  935. if$
  936. t "others" =
  937. { " et~al\mbox{.}" * } % jrh: avoid spacing problems
  938. { " and " * t * } % from Chicago Manual of Style
  939. if$
  940. }
  941. if$
  942. }
  943. 't
  944. if$
  945. nameptr #1 + 'nameptr := % nameptr += 1;
  946. namesleft #1 - 'namesleft := % namesleft =- 1;
  947. }
  948. while$
  949. }
  950. FUNCTION { format.names.fml }
  951. {
  952. % Format names in "familiar" format, with first initial followed by
  953. % last name. Like format.names, ALL names are formatted.
  954. % jtb: The names are NOT put in small caps
  955. 's :=
  956. #1 'nameptr := % nameptr = 1;
  957. s num.names$ 'numnames := % numnames = num.name$(s);
  958. numnames 'namesleft :=
  959. { namesleft #0 > }
  960. {
  961. "\bibinfo{person}{" s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ * "}" * 't :=
  962. nameptr #1 >
  963. {
  964. namesleft #1 >
  965. { ", " * t * }
  966. {
  967. numnames #2 >
  968. { "," * }
  969. 'skip$
  970. if$
  971. t "\bibinfo{person}{others}" =
  972. { " {et~al\mbox{.}}" * }
  973. { " {and} " * t * }
  974. if$
  975. }
  976. if$
  977. }
  978. 't
  979. if$
  980. nameptr #1 + 'nameptr := % nameptr += 1;
  981. namesleft #1 - 'namesleft := % namesleft =- 1;
  982. }
  983. while$
  984. }
  985. FUNCTION { format.authors }
  986. {
  987. author empty.or.unknown
  988. { "" }
  989. {
  990. "\bibfield{author}{"
  991. author format.names add.period$ * "}" *} % jtb: add period if none before
  992. if$
  993. }
  994. FUNCTION { format.key }
  995. {
  996. empty.or.unknown
  997. { key field.or.null }
  998. { "" }
  999. if$
  1000. }
  1001. FUNCTION { format.no.key }
  1002. {
  1003. empty.or.unknown
  1004. { "" }
  1005. { "" }
  1006. if$
  1007. }
  1008. FUNCTION { format.editors.fml }
  1009. {
  1010. % Format editor names for use in the "in" types: inbook, incollection,
  1011. % inproceedings: first initial, then last names. When editors are the
  1012. % LABEL for an entry, then format.editor is used which lists editors
  1013. % by last name first.
  1014. editor empty.or.unknown
  1015. { "" }
  1016. {
  1017. "\bibfield{editor}{"
  1018. editor format.names.fml
  1019. * "}" *
  1020. editor num.names$ #1 >
  1021. { " (Eds.)" * }
  1022. { " (Ed.)" * }
  1023. if$
  1024. }
  1025. if$
  1026. }
  1027. FUNCTION { format.editors }
  1028. { % format editor names for use in labels, last names first.
  1029. editor empty.or.unknown
  1030. { "" }
  1031. {
  1032. "\bibfield{editor}{"
  1033. editor format.names
  1034. * "}" *
  1035. editor num.names$ #1 >
  1036. { " (Eds.)." * }
  1037. { " (Ed.)." * }
  1038. if$
  1039. }
  1040. if$
  1041. }
  1042. FUNCTION { format.articletitle }
  1043. {
  1044. title empty.or.unknown
  1045. { "" }
  1046. % Use this to preserve lettercase in titles:
  1047. { "\showarticletitle{" title * "}" * }
  1048. % Use this for downcase title style:
  1049. % { \showarticletitle{" title "t" change.case$ * "}" * }
  1050. if$
  1051. }
  1052. FUNCTION { format.title }
  1053. {
  1054. title empty.or.unknown
  1055. { "" }
  1056. % Use this to preserve lettercase in titles:
  1057. { "\bibinfo{title}{" title * "}" * }
  1058. % Use this for downcase title style:
  1059. % { title "t" change.case$ }
  1060. if$
  1061. }
  1062. FUNCTION { n.dashify }
  1063. {
  1064. 't :=
  1065. ""
  1066. { t empty.or.unknown not }
  1067. {
  1068. t #1 #1 substring$ "-" =
  1069. {
  1070. t #1 #2 substring$ "--" = not
  1071. { "--" *
  1072. t #2 global.max$ substring$ 't :=
  1073. }
  1074. {
  1075. { t #1 #1 substring$ "-" = }
  1076. {
  1077. "-" *
  1078. t #2 global.max$ substring$ 't :=
  1079. }
  1080. while$
  1081. }
  1082. if$
  1083. }
  1084. {
  1085. t #1 #1 substring$ *
  1086. t #2 global.max$ substring$ 't :=
  1087. }
  1088. if$
  1089. }
  1090. while$
  1091. }
  1092. FUNCTION { format.a.title.with.edition }
  1093. {
  1094. "\bibinfo{booktitle}{"
  1095. swap$ emphasize *
  1096. edition empty.or.unknown
  1097. 'skip$
  1098. { " (\bibinfo{edition}{" * edition "l" change.case$ *
  1099. "} ed.)" * } % jtb: no parens for ed.
  1100. if$
  1101. "}" *
  1102. }
  1103. FUNCTION { format.btitle }
  1104. { title format.a.title.with.edition }
  1105. FUNCTION { format.emphasize.booktitle }
  1106. { booktitle format.a.title.with.edition }
  1107. FUNCTION { format.city }
  1108. {
  1109. % jtb: if the preceding string (the title of the conference) is non-empty,
  1110. % jtb: append the location, otherwise leave empty (so as to trigger the
  1111. % jtb: error message in output.check
  1112. duplicate$ empty.or.unknown
  1113. { }
  1114. {
  1115. city empty.or.unknown
  1116. {
  1117. date empty.or.unknown
  1118. { }
  1119. { " (" * date * ")" * }
  1120. if$
  1121. }
  1122. {
  1123. date empty.or.unknown
  1124. { " (" * city * ")" * }
  1125. { " (" * city * ", " * date * ")" * }
  1126. if$
  1127. }
  1128. if$
  1129. }
  1130. if$
  1131. }
  1132. FUNCTION { tie.or.space.connect }
  1133. {
  1134. duplicate$ text.length$ #3 <
  1135. { "~" }
  1136. { " " }
  1137. if$
  1138. swap$ * *
  1139. }
  1140. FUNCTION { either.or.check }
  1141. {
  1142. empty.or.unknown
  1143. 'pop$
  1144. { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  1145. if$
  1146. }
  1147. FUNCTION { format.bvolume }
  1148. {
  1149. % jtb: If there is a series, this is added and the volume trails after it.
  1150. % jtb: Otherwise, "Vol" is Capitalized.
  1151. volume empty.or.unknown
  1152. { "" }
  1153. {
  1154. series empty.or.unknown
  1155. { "Vol.~\bibinfo{volume}{" volume "}" * *}
  1156. { "\bibinfo{series}{" series "}, " * *
  1157. "Vol.~\bibinfo{volume}{" volume "}" * * *}
  1158. if$
  1159. "volume and number" number either.or.check
  1160. }
  1161. if$
  1162. }
  1163. FUNCTION { format.bvolume.noseries }
  1164. {
  1165. volume empty.or.unknown
  1166. { "" }
  1167. { "Vol.~\bibinfo{volume}{" volume "}" * *
  1168. "volume and number" number either.or.check
  1169. }
  1170. if$
  1171. }
  1172. FUNCTION { format.series }
  1173. {
  1174. series empty.or.unknown
  1175. {""}
  1176. {" \emph{(\bibinfo{series}{" * series "})}" *}
  1177. if$
  1178. }
  1179. FUNCTION { format.number.series }
  1180. {
  1181. volume empty.or.unknown
  1182. {
  1183. number empty.or.unknown
  1184. {
  1185. volume empty.or.unknown
  1186. { "" }
  1187. {
  1188. series empty.or.unknown
  1189. { "" }
  1190. { " (\bibinfo{series}{" series * "})" * }
  1191. if$
  1192. }
  1193. if$
  1194. } % { series field.or.null }
  1195. {
  1196. output.state mid.sentence =
  1197. { "Number" } % gnp - changed to mixed case always
  1198. { "Number" }
  1199. if$
  1200. number tie.or.space.connect series empty.or.unknown
  1201. { "there's a number but no series in " cite$ * warning$ }
  1202. { " in \bibinfo{series}{" * series * "}" * }
  1203. if$
  1204. }
  1205. if$
  1206. }
  1207. {
  1208. ""
  1209. }
  1210. if$
  1211. }
  1212. FUNCTION { multi.page.check }
  1213. {
  1214. 't :=
  1215. #0 'multiresult :=
  1216. { multiresult not
  1217. t empty.or.unknown not
  1218. and
  1219. }
  1220. { t #1 #1 substring$
  1221. duplicate$ "-" =
  1222. swap$ duplicate$ "," =
  1223. swap$ "+" =
  1224. or or
  1225. { #1 'multiresult := }
  1226. { t #2 global.max$ substring$ 't := }
  1227. if$
  1228. }
  1229. while$
  1230. multiresult
  1231. }
  1232. FUNCTION { format.pages }
  1233. {
  1234. pages empty.or.unknown
  1235. { "" }
  1236. { "\bibinfo{pages}{"
  1237. pages multi.page.check
  1238. { pages n.dashify } % gnp - removed () % jtb: removed pp.
  1239. { pages }
  1240. if$
  1241. * "}" *
  1242. }
  1243. if$
  1244. }
  1245. FUNCTION { format.pages.check.without.articleno }
  1246. { %% format pages field only if articleno is absent
  1247. %% Stack out: pages-specification
  1248. numpages missing$ pages missing$ and
  1249. { "page numbers missing in both pages and numpages fields in " cite$ * warning$ }
  1250. { }
  1251. if$
  1252. articleno empty.or.unknown eid empty.or.unknown and
  1253. {
  1254. pages missing$
  1255. { numpages }
  1256. { format.pages }
  1257. if$
  1258. }
  1259. { "" }
  1260. if$
  1261. }
  1262. FUNCTION { format.pages.check }
  1263. {
  1264. pages empty.or.unknown
  1265. { "page numbers missing in " cite$ * warning$ "" }
  1266. { pages n.dashify }
  1267. if$
  1268. }
  1269. FUNCTION { format.bookpages }
  1270. {
  1271. bookpages empty.or.unknown
  1272. { "" }
  1273. { bookpages "book pages" tie.or.space.connect }
  1274. if$
  1275. }
  1276. FUNCTION { format.named.pages }
  1277. {
  1278. pages empty.or.unknown
  1279. { "" }
  1280. { format.pages "pages" tie.or.space.connect }
  1281. if$
  1282. }
  1283. %
  1284. % Changed by Boris Veytsman, 2011-03-13
  1285. % Now the word "pages" is printed even if
  1286. % there field pages is not empty.
  1287. %
  1288. FUNCTION { format.page.count }
  1289. {
  1290. page.count empty.or.unknown
  1291. { "" }
  1292. { "\bibinfo{numpages}{" page.count * "}~pages" * }
  1293. if$
  1294. }
  1295. FUNCTION { format.articleno.numpages }
  1296. {
  1297. %% There are seven possible outputs, depending on which fields are set.
  1298. %%
  1299. %% These four are handled here:
  1300. %%
  1301. %% articleno, numpages, pages -> "Article articleno-value, numpages-value pages"
  1302. %% articleno, numpages -> "Article articleno-value, numpages-value pages"
  1303. %% articleno, pages -> "Article articleno-value, reduced-pages-value pages"
  1304. %% articleno -> "Article articleno-value" and warn about missing numpages
  1305. %%
  1306. %% The remaining three have already been handled by
  1307. %% format.pages.check.without.articleno:
  1308. %%
  1309. %% numpages, pages -> "pages-value"
  1310. %% numpages -> "numpages-value"
  1311. %% pages -> "pages-value"
  1312. %%
  1313. %% We no longer issue warninig when missing articleno, but having numpages
  1314. articleno empty.or.unknown eid empty.or.unknown and
  1315. {
  1316. %% numpages empty.or.unknown
  1317. %% { }
  1318. %% { "numpages field, but no articleno or eid field, in "
  1319. %% cite$ * warning$ }
  1320. %% if$
  1321. ""
  1322. }
  1323. {
  1324. numpages empty.or.unknown
  1325. {
  1326. pages empty.or.unknown
  1327. {
  1328. "articleno or eid, but no pages or numpages field in "
  1329. cite$ * warning$
  1330. "" 'page.count :=
  1331. }
  1332. { reduce.pages.to.page.count }
  1333. if$
  1334. }
  1335. { numpages 'page.count := }
  1336. if$
  1337. %% The Article number is now handled in format.day.month.year because
  1338. %% ACM prefers the style "Digital Libraries 12, 3, Article 5 (July 2008)"
  1339. %% over "Digital Libraries 12, 3 (July 2008), Article 5"
  1340. %% format.articleno output
  1341. format.page.count
  1342. }
  1343. if$
  1344. }
  1345. FUNCTION {calc.format.page.count}
  1346. {
  1347. numpages empty.or.unknown
  1348. {
  1349. pages empty.or.unknown
  1350. {
  1351. "" 'page.count :=
  1352. }
  1353. { reduce.pages.to.page.count }
  1354. if$
  1355. }
  1356. { numpages 'page.count := }
  1357. if$
  1358. format.page.count
  1359. }
  1360. FUNCTION { journal.canon.abbrev }
  1361. {
  1362. % Returns a canonical abbreviation for 'journal', or else 'journal'
  1363. % unchanged.
  1364. journal "ACM Computing Surveys" = { "Comput. Surveys" } {
  1365. journal "{ACM} Computing Surveys" = { "Comput. Surveys" } {
  1366. journal "ACM Transactions on Mathematical Software" = { "ACM Trans. Math. Software" } {
  1367. journal "{ACM} Transactions on Mathematical Software" = { "ACM Trans. Math. Software" } {
  1368. journal "ACM SIGNUM Newsletter" = { "ACM SIGNUM Newslett." } {
  1369. journal "ACM {SIGNUM} Newsletter" = { "ACM SIGNUM Newslett." } {
  1370. journal "{ACM} SIGNUM Newsletter" = { "ACM SIGNUM Newslett." } {
  1371. journal "{ACM} {SIGNUM} Newsletter" = { "ACM SIGNUM Newslett." } {
  1372. journal "American Journal of Sociology" = { "Amer. J. Sociology" } {
  1373. journal "American Mathematical Monthly" = { "Amer. Math. Monthly" } {
  1374. journal "American Mathematical Society Translations" = { "Amer. Math. Soc. Transl." } {
  1375. journal "Applied Mathematics and Computation" = { "Appl. Math. Comput." } {
  1376. journal "British Journal of Mathematical and Statistical Psychology" = { "Brit. J. Math. Statist. Psych." } {
  1377. journal "Bulletin of the American Mathematical Society" = { "Bull. Amer. Math. Soc." } {
  1378. journal "Canadian Mathematical Bulletin" = { "Canad. Math. Bull." } {
  1379. journal "Communications of the ACM" = { "Commun. ACM" } {
  1380. journal "Communications of the {ACM}" = { "Commun. ACM" } {
  1381. journal "Computers and Structures" = { "Comput. \& Structures" } {
  1382. journal "Contemporary Mathematics" = { "Contemp. Math." } {
  1383. journal "Crelle's Journal" = { "Crelle's J." } {
  1384. journal "Giornale di Mathematiche" = { "Giorn. Mat." } {
  1385. journal "IEEE Transactions on Aerospace and Electronic Systems" = { "IEEE Trans. Aerospace Electron. Systems" } {
  1386. journal "{IEEE} Transactions on Aerospace and Electronic Systems" = { "IEEE Trans. Aerospace Electron. Systems" } {
  1387. journal "IEEE Transactions on Automatic Control" = { "IEEE Trans. Automat. Control" } {
  1388. journal "{IEEE} Transactions on Automatic Control" = { "IEEE Trans. Automat. Control" } {
  1389. journal "IEEE Transactions on Computers" = { "IEEE Trans. Comput." } {
  1390. journal "{IEEE} Transactions on Computers" = { "IEEE Trans. Comput." } {
  1391. journal "IMA Journal of Numerical Analysis" = { "IMA J. Numer. Anal." } {
  1392. journal "{IMA} Journal of Numerical Analysis" = { "IMA J. Numer. Anal." } {
  1393. journal "Information Processing Letters" = { "Inform. Process. Lett." } {
  1394. journal "International Journal for Numerical Methods in Engineering" = { "Internat. J. Numer. Methods Engrg." } {
  1395. journal "International Journal of Control" = { "Internat. J. Control" } {
  1396. journal "International Journal of Supercomputing Applications" = { "Internat. J. Supercomputing Applic." } {
  1397. journal "Journal of Computational Physics" = { "J. Comput. Phys." } {
  1398. journal "Journal of Computational and Applied Mathematics" = { "J. Comput. Appl. Math." } {
  1399. journal "Journal of Computer and System Sciences" = { "J. Comput. System Sci." } {
  1400. journal "Journal of Mathematical Analysis and Applications" = { "J. Math. Anal. Appl." } {
  1401. journal "Journal of Mathematical Physics" = { "J. Math. Phys." } {
  1402. journal "Journal of Parallel and Distributed Computing" = { "J. Parallel and Distrib. Comput." } {
  1403. journal "Journal of Research of the National Bureau of Standards" = { "J. Res. Nat. Bur. Standards" } {
  1404. journal "Journal of VLSI and Computer Systems" = { "J. VLSI Comput. Syst." } {
  1405. journal "Journal of {VLSI} and Computer Systems" = { "J. VLSI Comput. Syst." } {
  1406. journal "Journal of the ACM" = { "J. ACM" } {
  1407. journal "Journal of the American Statistical Association" = { "J. Amer. Statist. Assoc." } {
  1408. journal "Journal of the Institute of Mathematics and its Applications" = { "J. Inst. Math. Appl." } {
  1409. journal "Journal of the Society for Industrial and Applied Mathematics" = { "J. Soc. Indust. Appl. Math." } {
  1410. journal "Journal of the Society for Industrial and Applied Mathematics, Series B, Numerical Analysis" = { "J. Soc. Indust. Appl. Math. Ser. B Numer. Anal." } {
  1411. journal "Linear Algebra and its Applications" = { "Linear Algebra Appl." } {
  1412. journal "Mathematica Scandinavica" = { "Math. Scand." } {
  1413. journal "Mathematical Tables and Other Aids to Computation" = { "Math. Tables Aids Comput." } {
  1414. journal "Mathematics of Computation" = { "Math. Comp." } {
  1415. journal "Mathematische Annalen" = { "Math. Ann." } {
  1416. journal "Numerische Mathematik" = { "Numer. Math." } {
  1417. journal "Pacific Journal of Mathematics" = { "Pacific J. Math." } {
  1418. journal "Parallel Computing" = { "Parallel Comput." } {
  1419. journal "Philosophical Magazine" = { "Philos. Mag." } {
  1420. journal "Proceedings of the American Mathematical Society" = { "Proc. Amer. Math. Soc." } {
  1421. journal "Proceedings of the IEEE" = { "Proc. IEEE" } {
  1422. journal "Proceedings of the {IEEE}" = { "Proc. IEEE" } {
  1423. journal "Proceedings of the National Academy of Sciences of the USA" = { "Proc. Nat. Acad. Sci. U. S. A." } {
  1424. journal "Quarterly Journal of Mathematics, Oxford, Series (2)" = { "Quart. J. Math. Oxford Ser. (2)" } {
  1425. journal "Quarterly of Applied Mathematics" = { "Quart. Appl. Math." } {
  1426. journal "Review of the International Statisical Institute" = { "Rev. Inst. Internat. Statist." } {
  1427. journal "SIAM Journal on Algebraic and Discrete Methods" = { "SIAM J. Algebraic Discrete Methods" } {
  1428. journal "{SIAM} Journal on Algebraic and Discrete Methods" = { "SIAM J. Algebraic Discrete Methods" } {
  1429. journal "SIAM Journal on Applied Mathematics" = { "SIAM J. Appl. Math." } {
  1430. journal "{SIAM} Journal on Applied Mathematics" = { "SIAM J. Appl. Math." } {
  1431. journal "SIAM Journal on Computing" = { "SIAM J. Comput." } {
  1432. journal "{SIAM} Journal on Computing" = { "SIAM J. Comput." } {
  1433. journal "SIAM Journal on Matrix Analysis and Applications" = { "SIAM J. Matrix Anal. Appl." } {
  1434. journal "{SIAM} Journal on Matrix Analysis and Applications" = { "SIAM J. Matrix Anal. Appl." } {
  1435. journal "SIAM Journal on Numerical Analysis" = { "SIAM J. Numer. Anal." } {
  1436. journal "{SIAM} Journal on Numerical Analysis" = { "SIAM J. Numer. Anal." } {
  1437. journal "SIAM Journal on Scientific and Statistical Computing" = { "SIAM J. Sci. Statist. Comput." } {
  1438. journal "{SIAM} Journal on Scientific and Statistical Computing" = { "SIAM J. Sci. Statist. Comput." } {
  1439. journal "SIAM Review" = { "SIAM Rev." } {
  1440. journal "{SIAM} Review" = { "SIAM Rev." } {
  1441. journal "Software Practice and Experience" = { "Software Prac. Experience" } {
  1442. journal "Statistical Science" = { "Statist. Sci." } {
  1443. journal "The Computer Journal" = { "Comput. J." } {
  1444. journal "Transactions of the American Mathematical Society" = { "Trans. Amer. Math. Soc." } {
  1445. journal "USSR Computational Mathematics and Mathematical Physics" = { "U. S. S. R. Comput. Math. and Math. Phys." } {
  1446. journal "{USSR} Computational Mathematics and Mathematical Physics" = { "U. S. S. R. Comput. Math. and Math. Phys." } {
  1447. journal "Zeitschrift fur Angewandte Mathematik und Mechanik" = { "Z. Angew. Math. Mech." } {
  1448. journal "Zeitschrift fur Angewandte Mathematik und Physik" = { "Z. Angew. Math. Phys." } {
  1449. journal
  1450. } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
  1451. } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
  1452. } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
  1453. } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
  1454. } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
  1455. } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
  1456. } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
  1457. } if$ } if$ } if$ } if$ } if$ } if$ } if$ } if$
  1458. }
  1459. FUNCTION { format.journal.volume.number.day.month.year }
  1460. {
  1461. % By Young (and Spencer)
  1462. % GNP - fixed bugs with missing volume, number, and/or pages
  1463. %
  1464. % Format journal, volume, number, pages for article types.
  1465. %
  1466. journal empty.or.unknown
  1467. { "no journal in " cite$ * warning$ "" }
  1468. { "\bibinfo{journal}{"
  1469. journal.canon.abbrev emphasize *
  1470. "}" * }
  1471. if$
  1472. number empty.or.unknown
  1473. {
  1474. volume empty.or.unknown
  1475. { "no number and no volume in " cite$ * warning$ "" * }
  1476. { " " * " \bibinfo{volume}{" * volume * "}" * }
  1477. if$
  1478. }
  1479. {
  1480. volume empty.or.unknown
  1481. {
  1482. "unusual to have number, but no volume, for " cite$ * warning$
  1483. " \bibinfo{number}{" * number * "}" *
  1484. }
  1485. { " \bibinfo{volume}{" * volume * "}, \bibinfo{number}{" *
  1486. number * "}" *}
  1487. if$
  1488. }
  1489. if$
  1490. after.block 'output.state :=
  1491. % Sometimes proceedings are published in journals
  1492. % In this case we do not want to put year, day and month here
  1493. type$ "inproceedings" =
  1494. { }
  1495. {format.day.month.year * }
  1496. if$
  1497. }
  1498. FUNCTION { format.chapter.pages }
  1499. {
  1500. chapter empty.or.unknown
  1501. 'format.pages
  1502. { type empty.or.unknown
  1503. { "Chapter" } % gnp - changed to mixed case
  1504. { type "t" change.case$ }
  1505. if$
  1506. chapter tie.or.space.connect
  1507. pages empty.or.unknown
  1508. {"page numbers missing in " cite$ * warning$} % gnp - added check
  1509. { ", " * format.pages * }
  1510. if$
  1511. }
  1512. if$
  1513. }
  1514. FUNCTION { format.in.emphasize.booktitle }
  1515. { % jtb: format for collections or proceedings not appearing in a journal
  1516. booktitle empty.or.unknown
  1517. { "" }
  1518. { "In " format.emphasize.booktitle * }
  1519. if$
  1520. }
  1521. FUNCTION { format.in.booktitle }
  1522. { % jtb: format for proceedings appearing in a journal
  1523. booktitle empty.or.unknown
  1524. { "" }
  1525. { "In \bibinfo{booktitle}{" booktitle * "}" * }
  1526. if$
  1527. }
  1528. FUNCTION { format.in.ed.booktitle }
  1529. {
  1530. booktitle empty.or.unknown
  1531. { "" }
  1532. { editor empty.or.unknown
  1533. { "In " format.emphasize.booktitle * }
  1534. % jtb: swapped editor location
  1535. { "In " format.emphasize.booktitle * ", " * format.editors.fml * }
  1536. if$
  1537. }
  1538. if$
  1539. }
  1540. FUNCTION { format.thesis.type }
  1541. { % call with default type on stack top
  1542. type empty.or.unknown
  1543. 'skip$ % use default type
  1544. {
  1545. pop$ % discard default type
  1546. % NO: it is silly to have to brace protect every degree type!: type "t" change.case$
  1547. type
  1548. }
  1549. if$
  1550. }
  1551. FUNCTION { format.tr.number }
  1552. {
  1553. "\bibinfo{type}{"
  1554. type empty.or.unknown
  1555. { "{T}echnical {R}eport" }
  1556. 'type
  1557. if$
  1558. "}" * *
  1559. number empty.or.unknown
  1560. { "t" change.case$ }
  1561. %% LOOKS BAD: { "." * number tie.or.space.connect }
  1562. %% Prefer "Research report RJ687." to "Research report. RJ687."
  1563. { number tie.or.space.connect }
  1564. if$
  1565. }
  1566. FUNCTION { format.advisor }
  1567. {
  1568. advisor empty.or.unknown
  1569. { "" }
  1570. { "Advisor(s) " advisor * }
  1571. if$
  1572. }
  1573. FUNCTION { format.article.crossref }
  1574. { "See"
  1575. "\citeN{" * crossref * "}" *
  1576. }
  1577. FUNCTION { format.crossref.editor }
  1578. {
  1579. editor #1 "{vv~}{ll}" format.name$
  1580. editor num.names$ duplicate$
  1581. #2 >
  1582. { pop$ " et~al\mbox{.}" * } % jrh: avoid spacing problems
  1583. { #2 <
  1584. 'skip$
  1585. { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1586. { " et~al\mbox{.}" * } % jrh: avoid spacing problems
  1587. { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  1588. if$
  1589. }
  1590. if$
  1591. }
  1592. if$
  1593. }
  1594. FUNCTION { format.book.crossref }
  1595. {
  1596. volume empty.or.unknown
  1597. { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  1598. "In "
  1599. }
  1600. { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  1601. " of " *
  1602. }
  1603. if$
  1604. editor empty.or.unknown
  1605. editor field.or.null author field.or.null =
  1606. or
  1607. { key empty.or.unknown
  1608. { series empty.or.unknown
  1609. { "need editor, key, or series for " cite$ * " to crossref " *
  1610. crossref * warning$
  1611. "" *
  1612. }
  1613. { series emphasize * }
  1614. if$
  1615. }
  1616. { key * }
  1617. if$
  1618. }
  1619. { format.crossref.editor * }
  1620. if$
  1621. " \citeN{" * crossref * "}" *
  1622. }
  1623. FUNCTION { format.incoll.inproc.crossref }
  1624. { "See"
  1625. " \citeN{" * crossref * "}" *
  1626. }
  1627. FUNCTION { format.lab.names }
  1628. {
  1629. % format.lab.names:
  1630. %
  1631. % determines "short" names for the abbreviated author information.
  1632. % "Long" labels are created in calc.label, using the routine my.full.label
  1633. % to format author and editor fields.
  1634. %
  1635. % There are 4 cases for labels. (n=3 in the example)
  1636. % a) one author Foo
  1637. % b) one to n Foo, Bar and Baz
  1638. % c) use of "and others" Foo, Bar et al.
  1639. % d) more than n Foo et al.
  1640. 's :=
  1641. s num.names$ 'numnames :=
  1642. numnames #2 > % change number to number of others allowed before
  1643. % forcing "et al".
  1644. { s #1 "{vv~}{ll}" format.name$ " et~al\mbox{.}" * } % jrh: \mbox{} added
  1645. {
  1646. numnames #1 - 'namesleft :=
  1647. #2 'nameptr :=
  1648. s #1 "{vv~}{ll}" format.name$
  1649. { namesleft #0 > }
  1650. { nameptr numnames =
  1651. { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1652. { " et~al\mbox{.}" * } % jrh: avoid spacing problems
  1653. { " and " * s nameptr "{vv~}{ll}" format.name$ * }
  1654. if$
  1655. }
  1656. { ", " * s nameptr "{vv~}{ll}" format.name$ * }
  1657. if$
  1658. nameptr #1 + 'nameptr :=
  1659. namesleft #1 - 'namesleft :=
  1660. }
  1661. while$
  1662. }
  1663. if$
  1664. }
  1665. FUNCTION { author.key.label }
  1666. {
  1667. author empty.or.unknown
  1668. { key empty.or.unknown
  1669. { "no key, author in " cite$ * warning$
  1670. cite$ #1 #3 substring$ }
  1671. 'key
  1672. if$
  1673. }
  1674. { author format.lab.names }
  1675. if$
  1676. }
  1677. FUNCTION { editor.key.organization.label }
  1678. { % added - gnp. Provide label formatting by organization if editor is null.
  1679. editor empty.or.unknown
  1680. { organization empty.or.unknown
  1681. { key empty.or.unknown
  1682. { "no key, editor or organization in " cite$ * warning$
  1683. cite$ #1 #3 substring$ }
  1684. 'key
  1685. if$
  1686. }
  1687. { organization }
  1688. if$
  1689. }
  1690. { editor format.lab.names }
  1691. if$
  1692. }
  1693. FUNCTION { author.editor.key.label }
  1694. {
  1695. author empty.or.unknown
  1696. { editor empty.or.unknown
  1697. { key empty.or.unknown
  1698. { "no key, author, or editor in " cite$ * warning$
  1699. cite$ #1 #3 substring$ }
  1700. 'key
  1701. if$
  1702. }
  1703. { editor format.lab.names }
  1704. if$
  1705. }
  1706. { author format.lab.names }
  1707. if$
  1708. }
  1709. FUNCTION { author.editor.key.organization.label }
  1710. { % added - gnp. Provide label formatting by organization if author is null.
  1711. author empty.or.unknown
  1712. { editor empty.or.unknown
  1713. { organization empty.or.unknown
  1714. { key empty.or.unknown
  1715. { "no key, author, editor or organization in " cite$ * warning$
  1716. cite$ #1 #3 substring$ }
  1717. 'key
  1718. if$
  1719. }
  1720. { organization }
  1721. if$
  1722. }
  1723. { editor format.lab.names }
  1724. if$
  1725. }
  1726. { author format.lab.names }
  1727. if$
  1728. }
  1729. % Calculate label and leave it on stack
  1730. FUNCTION { calc.basic.label }
  1731. {
  1732. type$ "book" =
  1733. type$ "inbook" =
  1734. or
  1735. type$ "article" =
  1736. or
  1737. 'author.editor.key.label
  1738. { type$ "proceedings" =
  1739. type$ "periodical" =
  1740. or
  1741. 'editor.key.organization.label
  1742. { type$ "manual" =
  1743. 'author.editor.key.organization.label
  1744. 'author.key.label
  1745. if$
  1746. }
  1747. if$
  1748. }
  1749. if$
  1750. duplicate$
  1751. year empty.or.unknown
  1752. { "[n.d.]" }
  1753. { year field.or.null purify$ #-1 #4 substring$}
  1754. if$
  1755. *
  1756. 'basic.label.year :=
  1757. }
  1758. FUNCTION { calc.label }
  1759. {
  1760. % Changed - GNP. See also author.editor.organization.sort, editor.organization.sort
  1761. % Form label for BibTeX entry. The classification of which fields are used
  1762. % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
  1763. % The change here from newapa is to also include organization as a
  1764. % citation label if author or editor is missing.
  1765. calc.basic.label
  1766. author empty.or.unknown % generate the full label citation information.
  1767. {
  1768. editor empty.or.unknown
  1769. {
  1770. organization empty.or.unknown
  1771. {
  1772. key empty.or.unknown
  1773. {
  1774. "no author, editor, organization, or key in " cite$ * warning$
  1775. "??"
  1776. }
  1777. { key }
  1778. if$
  1779. }
  1780. { organization }
  1781. if$
  1782. }
  1783. { editor my.full.label }
  1784. if$
  1785. }
  1786. { author my.full.label }
  1787. if$
  1788. % leave label on the stack, to be popped when required.
  1789. "}{" * swap$ * "}{" *
  1790. % year field.or.null purify$ #-1 #4 substring$ *
  1791. %
  1792. % save the year for sort processing afterwards (adding a, b, c, etc.)
  1793. %
  1794. year empty.or.unknown
  1795. { "[n.d.]" }
  1796. { year field.or.null purify$ #-1 #4 substring$}
  1797. if$
  1798. 'label.year :=
  1799. }
  1800. FUNCTION { output.bibitem }
  1801. {
  1802. newline$
  1803. "\bibitem[\protect\citeauthoryear{" write$
  1804. calc.label write$
  1805. sort.year write$
  1806. "}]%" writeln
  1807. " {" write$
  1808. cite$ write$
  1809. "}" writeln
  1810. ""
  1811. before.all 'output.state :=
  1812. }
  1813. FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint }
  1814. { % enter and return with stack empty
  1815. %% We switch now from buffered output to output of complete lines, so
  1816. %% that the Issue .. URL data have their own lines, and are less likely
  1817. %% to be line-wrapped by BibTeX's short-sighted algorithm, which wraps
  1818. %% lines longer than 79 characters, backtracking to what it thinks is
  1819. %% a break point in the string. Any such wrapping MUST be undone to
  1820. %% prevent percent-newline from appearing in DOIs and URLs. The
  1821. %% output data are intentionally wrapped in \showxxx{} macros at
  1822. %% beginning of line, and that supply their own punctuation (if they
  1823. %% are not defined to suppress output entirely), to make it easier for
  1824. %% other software to recover them from .bbl files.
  1825. %%
  1826. %% It also makes it possible to later change the macro definitions
  1827. %% to suppress particular output values, or alter their appearance.
  1828. %%
  1829. %% Note that it is possible for theses, technical reports, and
  1830. %% manuals to have ISBNs, and anything that has an ISBN may also
  1831. %% have an ISSN. When there are no values for these keys, there
  1832. %% is no output generated for them here.
  1833. "\newblock" writeln
  1834. after.block 'output.state :=
  1835. output.issue
  1836. output.isbn
  1837. output.coden % CODEN is functionally like ISSN, so output them sequentially
  1838. output.issn
  1839. output.lccn
  1840. output.doi % DOI is ALWAYS last according to CrossRef DOI documentation
  1841. output.eprint
  1842. output.url % but ACM wants URL last
  1843. }
  1844. FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint.note }
  1845. { % enter with stack empty, return with empty string on stack
  1846. output.issue.doi.coden.isxn.lccn.url.eprint
  1847. note empty.or.unknown
  1848. { }
  1849. {
  1850. "\newblock" writeln
  1851. output.note
  1852. }
  1853. if$
  1854. ""
  1855. }
  1856. FUNCTION { output.issue.doi.coden.isxn.lccn.url.eprint.note.check }
  1857. { % enter with stack empty, return with empty string on stack
  1858. output.issue.doi.coden.isxn.lccn.url.eprint
  1859. note empty.or.unknown
  1860. { }
  1861. {
  1862. "\newblock" writeln
  1863. output.note.check
  1864. }
  1865. if$
  1866. ""
  1867. }
  1868. FUNCTION { article }
  1869. {
  1870. output.bibitem
  1871. author empty.or.unknown
  1872. {
  1873. editor empty.or.unknown
  1874. { "neither author and editor supplied for " cite$ * warning$ }
  1875. { format.editors "editor" output.check }
  1876. if$
  1877. }
  1878. { format.authors "author" output.check }
  1879. if$
  1880. author format.no.key output % added
  1881. output.year.check % added
  1882. new.block
  1883. format.articletitle "title" output.check
  1884. new.block
  1885. howpublished empty.or.unknown
  1886. { }
  1887. { "\bibinfo{howpublished}{" howpublished "}" * * output }
  1888. if$
  1889. crossref missing$
  1890. { format.journal.volume.number.day.month.year output}
  1891. {
  1892. "cross reference in @Article{...} is unusual" warning$
  1893. format.article.crossref output.nonnull
  1894. }
  1895. if$
  1896. format.pages.check.without.articleno output
  1897. format.articleno.numpages output
  1898. fin.block
  1899. output.issue.doi.coden.isxn.lccn.url.eprint.note
  1900. fin.entry
  1901. }
  1902. FUNCTION { book }
  1903. {
  1904. output.bibitem
  1905. author empty.or.unknown
  1906. { format.editors "author and editor" output.check }
  1907. { format.authors output.nonnull
  1908. crossref missing$
  1909. { "author and editor" editor either.or.check }
  1910. 'skip$
  1911. if$
  1912. }
  1913. if$
  1914. output.year.check % added
  1915. new.block
  1916. format.btitle "title" output.check
  1917. crossref missing$
  1918. { new.sentence % jtb: start a new sentence for series/volume
  1919. format.bvolume output
  1920. new.block
  1921. format.number.series output
  1922. new.sentence
  1923. publisher "publisher" bibinfo.output.check
  1924. address "address" bibinfo.output.check % jtb: require address
  1925. fin.sentence
  1926. pages empty.or.unknown
  1927. { format.bookpages } % use bookpages when pages empty
  1928. { format.pages.check "pages" tie.or.space.connect }
  1929. if$
  1930. output
  1931. }
  1932. { new.block
  1933. format.book.crossref output.nonnull
  1934. }
  1935. if$
  1936. fin.block
  1937. output.issue.doi.coden.isxn.lccn.url.eprint.note
  1938. fin.entry
  1939. }
  1940. FUNCTION { booklet }
  1941. {
  1942. output.bibitem
  1943. format.authors output
  1944. author format.key output % added
  1945. output.year.check % added
  1946. new.block
  1947. format.title "title" output.check
  1948. new.block
  1949. howpublished empty.or.unknown
  1950. { }
  1951. { "\bibinfo{howpublished}{" howpublished "}" * * output }
  1952. if$
  1953. address output
  1954. fin.block
  1955. output.issue.doi.coden.isxn.lccn.url.eprint.note
  1956. fin.entry
  1957. }
  1958. FUNCTION { inbook }
  1959. {
  1960. output.bibitem
  1961. author empty.or.unknown
  1962. { format.editors
  1963. "author and editor" output.check
  1964. }
  1965. { format.authors output.nonnull
  1966. crossref missing$
  1967. { "author and editor" editor either.or.check }
  1968. 'skip$
  1969. if$
  1970. }
  1971. if$
  1972. output.year.check % added
  1973. new.block
  1974. format.btitle "title" output.check
  1975. crossref missing$
  1976. { new.sentence % jtb: start a new sentence for series/volume
  1977. format.bvolume output
  1978. new.block
  1979. format.number.series output
  1980. new.sentence
  1981. publisher "publisher" bibinfo.output.check
  1982. address "address" bibinfo.output.check % jtb: require address
  1983. format.bookpages output
  1984. format.chapter.pages
  1985. "chapter and pages" output.check % jtb: moved from before publisher
  1986. }
  1987. {
  1988. format.bookpages output
  1989. format.chapter.pages "chapter and pages" output.check
  1990. new.block
  1991. format.book.crossref output.nonnull
  1992. }
  1993. if$
  1994. fin.block
  1995. output.issue.doi.coden.isxn.lccn.url.eprint.note
  1996. fin.entry
  1997. }
  1998. FUNCTION { incollection }
  1999. {
  2000. output.bibitem
  2001. format.authors "author" output.check
  2002. author format.key output % added
  2003. output.year.check % added
  2004. new.block
  2005. format.articletitle "title" output.check
  2006. new.block
  2007. crossref missing$
  2008. { format.in.ed.booktitle "booktitle" output.check
  2009. new.sentence % jtb: start a new sentence for series/volume
  2010. format.bvolume output
  2011. format.number.series output
  2012. new.sentence
  2013. publisher "publisher" bibinfo.output.check
  2014. address "address" bibinfo.output.check % jtb: require address
  2015. format.bookpages output
  2016. format.chapter.pages output % gnp - was special.output.nonnull
  2017. % left out comma before page numbers
  2018. % jtb: moved from before publisher
  2019. }
  2020. {
  2021. format.incoll.inproc.crossref output.nonnull
  2022. format.chapter.pages output
  2023. }
  2024. if$
  2025. fin.block
  2026. output.issue.doi.coden.isxn.lccn.url.eprint.note
  2027. fin.entry
  2028. }
  2029. FUNCTION { inproceedings }
  2030. {
  2031. output.bibitem
  2032. format.authors "author" output.check
  2033. author format.key output % added
  2034. output.year.check % added
  2035. new.block
  2036. format.articletitle "title" output.check
  2037. howpublished empty.or.unknown
  2038. { }
  2039. { "\bibinfo{howpublished}{" howpublished "}" * * output.dot.space }
  2040. if$
  2041. crossref missing$
  2042. {
  2043. journal missing$ % jtb: proceedings appearing in journals
  2044. { format.in.emphasize.booktitle format.city "booktitle" output.check.dot.space
  2045. format.series output.removenospace
  2046. format.editors.fml output % BV 2011/09/27 Moved dot to comma
  2047. format.bvolume.noseries output
  2048. new.sentence
  2049. organization output
  2050. publisher "publisher" bibinfo.output.check % jtb: require publisher (?)
  2051. address "address" bibinfo.output.check % jtb: require address
  2052. format.bookpages output
  2053. }
  2054. {
  2055. format.in.booktitle format.city "booktitle" output.check
  2056. format.editors.fml output
  2057. new.sentence
  2058. format.journal.volume.number.day.month.year output
  2059. }
  2060. if$
  2061. format.articleno output
  2062. format.pages.check.without.articleno output
  2063. }
  2064. {
  2065. format.incoll.inproc.crossref output.nonnull
  2066. format.articleno output
  2067. format.pages.check.without.articleno output
  2068. }
  2069. if$
  2070. format.articleno.numpages output
  2071. fin.block
  2072. output.issue.doi.coden.isxn.lccn.url.eprint.note
  2073. fin.entry
  2074. }
  2075. FUNCTION { conference } { inproceedings }
  2076. FUNCTION { manual }
  2077. {
  2078. output.bibitem
  2079. author empty.or.unknown
  2080. { editor empty.or.unknown
  2081. { organization "organization" output.check
  2082. organization format.key output } % if all else fails, use key
  2083. { format.editors "author and editor" output.check }
  2084. if$
  2085. }
  2086. { format.authors output.nonnull }
  2087. if$
  2088. output.year.check % added
  2089. new.block
  2090. format.btitle "title" output.check
  2091. organization address new.block.checkb
  2092. % jtb: back to normal style: organization, address
  2093. organization "organization" output.check
  2094. address output
  2095. fin.block
  2096. output.issue.doi.coden.isxn.lccn.url.eprint.note
  2097. fin.entry
  2098. }
  2099. FUNCTION { mastersthesis }
  2100. {
  2101. output.bibitem
  2102. format.authors "author" output.check
  2103. author format.key output % added
  2104. output.year.check % added
  2105. new.block
  2106. format.title emphasize "title" output.check % NB: ACM style requires emphasized thesis title
  2107. new.block
  2108. "\bibinfo{thesistype}{Master's\ thesis}" format.thesis.type output
  2109. new.sentence
  2110. school "school" bibinfo.output.check
  2111. address empty.or.unknown
  2112. { }
  2113. { "\bibinfo{address}{" address * "}" * output }
  2114. if$
  2115. new.block
  2116. format.advisor output
  2117. fin.block
  2118. output.issue.doi.coden.isxn.lccn.url.eprint.note
  2119. fin.entry
  2120. }
  2121. FUNCTION { misc }
  2122. {
  2123. output.bibitem
  2124. format.authors "author" output.check
  2125. author format.key output % added
  2126. output.year.check % added
  2127. title howpublished new.block.checkb
  2128. format.title output
  2129. new.block
  2130. howpublished empty.or.unknown
  2131. { }
  2132. { "\bibinfo{howpublished}{" howpublished "}" * * output }
  2133. if$
  2134. "" output.nonnull.dot.space
  2135. calc.format.page.count output
  2136. fin.block
  2137. output.issue.doi.coden.isxn.lccn.url.eprint.note
  2138. fin.entry
  2139. }
  2140. FUNCTION { online } { manual }
  2141. FUNCTION { game } { manual }
  2142. FUNCTION { artifactsoftware } { manual }
  2143. FUNCTION { artifactdataset } { manual }
  2144. FUNCTION { software } { manual }
  2145. FUNCTION { dataset } { manual }
  2146. FUNCTION { phdthesis }
  2147. {
  2148. output.bibitem
  2149. format.authors "author" output.check
  2150. author format.key output % added
  2151. output.year.check % added
  2152. new.block
  2153. format.title emphasize "title" output.check % NB: ACM style requires emphasized thesis title
  2154. new.block
  2155. "\bibinfo{thesistype}{Ph.D. Dissertation}" format.thesis.type output
  2156. new.sentence
  2157. school "school" bibinfo.output.check
  2158. address empty.or.unknown
  2159. { }
  2160. { "\bibinfo{address}{" address * "}" * output }
  2161. if$
  2162. new.block
  2163. format.advisor output
  2164. fin.block
  2165. output.issue.doi.coden.isxn.lccn.url.eprint.note
  2166. fin.entry
  2167. }
  2168. FUNCTION {format.date}
  2169. { year empty.or.unknown
  2170. { month empty.or.unknown
  2171. {
  2172. "" % output empty date if year/month both empty
  2173. day empty.or.unknown
  2174. { }
  2175. { "there's a day but no month or year in " cite$ * warning$ }
  2176. if$
  2177. }
  2178. { "there's a month but no year in " cite$ * warning$
  2179. month
  2180. day empty.or.unknown
  2181. { }
  2182. { " " * day * }
  2183. if$
  2184. }
  2185. if$
  2186. }
  2187. { month empty.or.unknown
  2188. {
  2189. year % output only year if month empty
  2190. day empty.or.unknown
  2191. { }
  2192. { "there's a day and year but no month in " cite$ * warning$ }
  2193. if$
  2194. }
  2195. {
  2196. month " " *
  2197. day empty.or.unknown
  2198. { }
  2199. { day * ", " * }
  2200. if$
  2201. year *
  2202. }
  2203. if$
  2204. }
  2205. if$
  2206. }
  2207. FUNCTION {new.block.checka}
  2208. {
  2209. empty.or.unknown
  2210. 'skip$
  2211. 'new.block
  2212. if$
  2213. }
  2214. FUNCTION { periodical }
  2215. {
  2216. output.bibitem
  2217. editor empty.or.unknown
  2218. { organization output }
  2219. { format.editors output.nonnull }
  2220. if$
  2221. new.block
  2222. output.year.check
  2223. new.sentence
  2224. format.articletitle "title" output.check
  2225. format.journal.volume.number.day.month.year output
  2226. calc.format.page.count output
  2227. fin.entry
  2228. }
  2229. FUNCTION { proceedings }
  2230. {
  2231. output.bibitem
  2232. editor empty.or.unknown
  2233. { organization output
  2234. organization format.key output } % gnp - changed from author format.key
  2235. { format.editors output.nonnull }
  2236. if$
  2237. % author format.key output % gnp - removed (should be either
  2238. % editor or organization
  2239. output.year.check % added (newapa)
  2240. new.block
  2241. format.btitle format.city "title" output.check % jtb: added city
  2242. new.sentence
  2243. format.bvolume output
  2244. format.number.series output
  2245. new.sentence
  2246. organization output
  2247. % jtb: normal order: publisher, address
  2248. publisher empty.or.unknown
  2249. { }
  2250. { "\bibinfo{publisher}{" publisher * "}" * output }
  2251. if$
  2252. address empty.or.unknown
  2253. { }
  2254. { "\bibinfo{address}{" address * "}" * output }
  2255. if$
  2256. fin.block
  2257. output.issue.doi.coden.isxn.lccn.url.eprint.note
  2258. fin.entry
  2259. }
  2260. FUNCTION { collection } { proceedings }
  2261. FUNCTION { techreport }
  2262. {
  2263. output.bibitem
  2264. format.authors "author" output.check
  2265. author format.key output % added
  2266. output.year.check % added
  2267. new.block
  2268. format.btitle "title" output.check
  2269. new.block
  2270. % format.tr.number output % jtb: moved month ...
  2271. format.tr.number output new.sentence % Gerry - need dot 2011/09/28
  2272. institution "institution" bibinfo.output.check
  2273. address empty.or.unknown
  2274. { }
  2275. { "\bibinfo{address}{" address "}" * * output }
  2276. if$
  2277. new.sentence
  2278. format.named.pages output
  2279. % ACM omits year at end in transactions style
  2280. % format.day.month.year output.nonnull.dot.space % jtb: ... to here (no parens)
  2281. fin.block
  2282. output.issue.doi.coden.isxn.lccn.url.eprint.note
  2283. fin.entry
  2284. }
  2285. FUNCTION { unpublished }
  2286. {
  2287. output.bibitem
  2288. format.authors
  2289. "author" output.check
  2290. author format.key output % added
  2291. output.year.check % added
  2292. new.block
  2293. format.title "title" output.check
  2294. fin.sentence
  2295. output.day.month.year % UTAH
  2296. calc.format.page.count output
  2297. fin.block
  2298. output.issue.doi.coden.isxn.lccn.url.eprint.note.check
  2299. fin.entry
  2300. }
  2301. FUNCTION { default.type } { misc }
  2302. %%% ACM journal-style month definitions: full name if 1--5 letters, else
  2303. %%% abbreviation of 3 or 4 characters and a dot
  2304. MACRO {jan} {"Jan."}
  2305. MACRO {feb} {"Feb."}
  2306. MACRO {mar} {"March"}
  2307. MACRO {apr} {"April"}
  2308. MACRO {may} {"May"}
  2309. MACRO {jun} {"June"}
  2310. MACRO {jul} {"July"}
  2311. MACRO {aug} {"Aug."}
  2312. MACRO {sep} {"Sept."}
  2313. MACRO {oct} {"Oct."}
  2314. MACRO {nov} {"Nov."}
  2315. MACRO {dec} {"Dec."}
  2316. READ
  2317. FUNCTION { sortify }
  2318. {
  2319. purify$
  2320. "l" change.case$
  2321. }
  2322. FUNCTION { chop.word }
  2323. {
  2324. 's :=
  2325. 'len :=
  2326. s #1 len substring$ =
  2327. { s len #1 + global.max$ substring$ }
  2328. 's
  2329. if$
  2330. }
  2331. FUNCTION { sort.format.names }
  2332. {
  2333. 's :=
  2334. #1 'nameptr :=
  2335. ""
  2336. s num.names$ 'numnames :=
  2337. numnames 'namesleft :=
  2338. { namesleft #0 > }
  2339. { nameptr #1 >
  2340. { " " * }
  2341. 'skip$
  2342. if$
  2343. s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't :=
  2344. nameptr numnames = t "others" = and
  2345. { " et~al" * }
  2346. { t sortify * }
  2347. if$
  2348. nameptr #1 + 'nameptr :=
  2349. namesleft #1 - 'namesleft :=
  2350. }
  2351. while$
  2352. }
  2353. FUNCTION { sort.format.title }
  2354. {
  2355. 't :=
  2356. "A " #2
  2357. "An " #3
  2358. "The " #4 t chop.word
  2359. chop.word
  2360. chop.word
  2361. sortify
  2362. #1 global.max$ substring$
  2363. }
  2364. FUNCTION { author.sort }
  2365. {
  2366. author empty.or.unknown
  2367. { key empty.or.unknown
  2368. { "to sort, need author or key in " cite$ * warning$
  2369. "" }
  2370. { key sortify }
  2371. if$
  2372. }
  2373. { author sort.format.names }
  2374. if$
  2375. }
  2376. FUNCTION { author.editor.sort }
  2377. {
  2378. author empty.or.unknown
  2379. {
  2380. editor empty.or.unknown
  2381. {
  2382. key empty.or.unknown
  2383. { "to sort, need author, editor, or key in " cite$ * warning$
  2384. ""
  2385. }
  2386. { key sortify }
  2387. if$
  2388. }
  2389. { editor sort.format.names }
  2390. if$
  2391. }
  2392. { author sort.format.names }
  2393. if$
  2394. }
  2395. FUNCTION { editor.organization.sort }
  2396. {
  2397. % added - GNP. Stack editor or organization for sorting (from alpha.bst).
  2398. % Unlike alpha.bst, we need entire names, not abbreviations
  2399. editor empty.or.unknown
  2400. { organization empty.or.unknown
  2401. { key empty.or.unknown
  2402. { "to sort, need editor, organization, or key in " cite$ * warning$
  2403. ""
  2404. }
  2405. { key sortify }
  2406. if$
  2407. }
  2408. { organization sortify }
  2409. if$
  2410. }
  2411. { editor sort.format.names }
  2412. if$
  2413. }
  2414. FUNCTION { author.editor.organization.sort }
  2415. {
  2416. % added - GNP. Stack author or organization for sorting (from alpha.bst).
  2417. % Unlike alpha.bst, we need entire names, not abbreviations
  2418. author empty.or.unknown
  2419. {
  2420. editor empty.or.unknown
  2421. { organization empty.or.unknown
  2422. { key empty.or.unknown
  2423. { "to sort, need author, editor, or key in " cite$ * warning$
  2424. ""
  2425. }
  2426. { key sortify }
  2427. if$
  2428. }
  2429. { organization sortify }
  2430. if$
  2431. }
  2432. { editor sort.format.names }
  2433. if$
  2434. }
  2435. { author sort.format.names }
  2436. if$
  2437. }
  2438. FUNCTION { presort }
  2439. {
  2440. % Presort creates the bibentry's label via a call to calc.label, and then
  2441. % sorts the entries based on entry type. Chicago.bst adds support for
  2442. % including organizations as the sort key; the following is stolen from
  2443. % alpha.bst.
  2444. calc.label
  2445. basic.label.year
  2446. swap$
  2447. " "
  2448. swap$
  2449. * *
  2450. " "
  2451. *
  2452. sortify
  2453. year field.or.null purify$ #-1 #4 substring$ * % add year
  2454. " "
  2455. *
  2456. type$ "book" =
  2457. type$ "inbook" =
  2458. or
  2459. type$ "article" =
  2460. or
  2461. 'author.editor.sort
  2462. { type$ "proceedings" =
  2463. type$ "periodical" =
  2464. or
  2465. 'editor.organization.sort
  2466. { type$ "manual" =
  2467. 'author.editor.organization.sort
  2468. 'author.sort
  2469. if$
  2470. }
  2471. if$
  2472. }
  2473. if$
  2474. #1 entry.max$ substring$ % added for newapa
  2475. 'sort.label := % added for newapa
  2476. sort.label % added for newapa
  2477. *
  2478. " "
  2479. *
  2480. title field.or.null
  2481. sort.format.title
  2482. *
  2483. #1 entry.max$ substring$
  2484. 'sort.key$ :=
  2485. }
  2486. ITERATE { presort }
  2487. SORT % by label, year, author/editor, title
  2488. % From plainnat.bst
  2489. STRINGS { longest.label }
  2490. INTEGERS { longest.label.width number.label }
  2491. FUNCTION {initialize.longest.label}
  2492. { "" 'longest.label :=
  2493. #0 int.to.chr$ 'last.label :=
  2494. "" 'next.extra :=
  2495. #0 'longest.label.width :=
  2496. #0 'last.extra.num :=
  2497. #0 'number.label :=
  2498. }
  2499. FUNCTION { initialize.extra.label.stuff }
  2500. { #0 int.to.chr$ 'last.label :=
  2501. "" 'next.extra :=
  2502. #0 'last.extra.num :=
  2503. }
  2504. FUNCTION { forward.pass }
  2505. {
  2506. % Pass through all entries, comparing current entry to last one.
  2507. % Need to concatenate year to the stack (done by calc.label) to determine
  2508. % if two entries are the same (see presort)
  2509. last.label
  2510. calc.basic.label year field.or.null purify$ #-1 #4 substring$ * % add year
  2511. #1 entry.max$ substring$ = % are they equal?
  2512. { last.extra.num #1 + 'last.extra.num :=
  2513. last.extra.num int.to.chr$ 'extra.label :=
  2514. }
  2515. { "a" chr.to.int$ 'last.extra.num :=
  2516. "" 'extra.label :=
  2517. calc.basic.label year field.or.null purify$ #-1 #4 substring$ * % add year
  2518. #1 entry.max$ substring$ 'last.label := % assign to last.label
  2519. }
  2520. if$
  2521. number.label #1 + 'number.label :=
  2522. }
  2523. FUNCTION { reverse.pass }
  2524. {
  2525. next.extra "b" =
  2526. { "a" 'extra.label := }
  2527. 'skip$
  2528. if$
  2529. label.year extra.label * 'sort.year :=
  2530. extra.label 'next.extra :=
  2531. }
  2532. EXECUTE {initialize.extra.label.stuff}
  2533. EXECUTE {initialize.longest.label}
  2534. ITERATE {forward.pass}
  2535. REVERSE {reverse.pass}
  2536. FUNCTION { bib.sort.order }
  2537. {
  2538. sort.label
  2539. " "
  2540. *
  2541. year field.or.null sortify
  2542. *
  2543. " "
  2544. *
  2545. title field.or.null
  2546. sort.format.title
  2547. *
  2548. #1 entry.max$ substring$
  2549. 'sort.key$ :=
  2550. }
  2551. ITERATE { bib.sort.order }
  2552. SORT % by sort.label, year, title --- giving final bib. order.
  2553. FUNCTION { begin.bib }
  2554. {
  2555. %% Set to #0 show 13-digit ISBN in preference to 10-digit ISBN.
  2556. %% Set to #1 to show both 10-digit and 13-digit ISBNs.
  2557. #1 'show-isbn-10-and-13 :=
  2558. "%%% -*-BibTeX-*-" writeln
  2559. "%%% Do NOT edit. File created by BibTeX with style" writeln
  2560. "%%% ACM-Reference-Format-Journals [18-Jan-2012]." writeln
  2561. "" writeln
  2562. preamble$ empty.or.unknown
  2563. 'skip$
  2564. { preamble$ writeln }
  2565. if$
  2566. "\begin{thebibliography}{" number.label int.to.str$ * "}" * writeln
  2567. "" writeln
  2568. "%%% ====================================================================" writeln
  2569. "%%% NOTE TO THE USER: you can override these defaults by providing" writeln
  2570. "%%% customized versions of any of these macros before the \bibliography" writeln
  2571. "%%% command. Each of them MUST provide its own final punctuation," writeln
  2572. "%%% except for \shownote{}, \showDOI{}, and \showURL{}. The latter two" writeln
  2573. "%%% do not use final punctuation, in order to avoid confusing it with" writeln
  2574. "%%% the Web address." writeln
  2575. "%%%" writeln
  2576. "%%% To suppress output of a particular field, define its macro to expand" writeln
  2577. "%%% to an empty string, or better, \unskip, like this:" writeln
  2578. "%%%" writeln
  2579. "%%% \newcommand{\showDOI}[1]{\unskip} % LaTeX syntax" writeln
  2580. "%%%" writeln
  2581. "%%% \def \showDOI #1{\unskip} % plain TeX syntax" writeln
  2582. "%%%" writeln
  2583. "%%% ====================================================================" writeln
  2584. "" writeln
  2585. %% ACM publications do not use CODEN, ISSN, and LCCN data, so their default
  2586. %% macro wrappers expand to \unskip, discarding their values and unwanted
  2587. %% space.
  2588. %%
  2589. %% For other publications, prior definitions like these may be useful:
  2590. %%
  2591. %% Plain TeX:
  2592. %% \def \showCODEN #1{CODEN #1.}
  2593. %% \def \showISSN #1{ISSN #1.}
  2594. %% \def \showLCCN #1{LCCN #1.}
  2595. %%
  2596. %% LaTeX:
  2597. %% \newcommand{\showCODEN}[1]{CODEN #1.}
  2598. %% \newcommand{\showISSN}[1]#1{ISSN #1.}
  2599. %% \newcommand{\showLCCN}[1]{LCCN #1.}
  2600. "\ifx \showCODEN \undefined \def \showCODEN #1{\unskip} \fi" writeln
  2601. "\ifx \showDOI \undefined \def \showDOI #1{#1}\fi" writeln
  2602. % ACM styles omit ISBNs, but they can be included by suitable definitions of
  2603. % \showISBNx and \showISBNxiii before the .bbl file is read
  2604. "\ifx \showISBNx \undefined \def \showISBNx #1{\unskip} \fi" writeln
  2605. "\ifx \showISBNxiii \undefined \def \showISBNxiii #1{\unskip} \fi" writeln
  2606. "\ifx \showISSN \undefined \def \showISSN #1{\unskip} \fi" writeln
  2607. "\ifx \showLCCN \undefined \def \showLCCN #1{\unskip} \fi" writeln
  2608. "\ifx \shownote \undefined \def \shownote #1{#1} \fi" writeln % NB: final period supplied by add.period$ above
  2609. "\ifx \showarticletitle \undefined \def \showarticletitle #1{#1} \fi" writeln
  2610. "\ifx \showURL \undefined \def \showURL {\relax} \fi" writeln
  2611. "% The following commands are used for tagged output and should be " writeln
  2612. "% invisible to TeX" writeln
  2613. "\providecommand\bibfield[2]{#2}" writeln
  2614. "\providecommand\bibinfo[2]{#2}" writeln
  2615. "\providecommand\natexlab[1]{#1}" writeln
  2616. "\providecommand\showeprint[2][]{arXiv:#2}" writeln
  2617. }
  2618. EXECUTE {begin.bib}
  2619. EXECUTE {init.state.consts}
  2620. ITERATE {call.type$}
  2621. FUNCTION { end.bib }
  2622. {
  2623. newline$
  2624. "\end{thebibliography}"
  2625. writeln
  2626. }
  2627. EXECUTE {end.bib}