final project for the course ways of thinking in informatics, technical university of vienna.

ACM-Reference-Format.bst 82KB

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