acmurl.bst 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486
  1. %%% Modification of BibTeX style file ../acm.bst
  2. %%% ... by urlbst, version 0.6-4 (marked with "% urlbst")
  3. %%% See <http://purl.org/nxg/dist/urlbst>
  4. %%% Added webpage entry type, and url and lastchecked fields.
  5. %%% Original headers follow...
  6. % ACM Transactions bibliography style (24-Jan-88 version)
  7. % A lot like abbrv.bst, but names come out "Last, initials", and in \sc.
  8. % Some dates are parenthesized.
  9. %
  10. % History
  11. % 2/ 6/86 (HWT) Original version, by Howard Trickey.
  12. % 3/ 5/86 (HWT) Put in pp. everywhere but articles, as per ACM style.
  13. % 1/24/88 (OP&HWT) Updated for BibTeX version 0.99a, Oren Patashnik;
  14. % corrected the abbreviations to "Mar." and "Sept.";
  15. % THIS `acm' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
  16. ENTRY
  17. { address
  18. author
  19. booktitle
  20. chapter
  21. edition
  22. editor
  23. howpublished
  24. institution
  25. journal
  26. key
  27. month
  28. note
  29. number
  30. organization
  31. pages
  32. publisher
  33. school
  34. series
  35. title
  36. type
  37. volume
  38. year
  39. eprint % urlbst
  40. doi % urlbst
  41. pubmed % urlbst
  42. url % urlbst
  43. lastchecked % urlbst
  44. }
  45. {}
  46. { label }
  47. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  48. STRINGS { urlintro eprinturl eprintprefix doiprefix doiurl pubmedprefix pubmedurl openinlinelink closeinlinelink } % urlbst...
  49. INTEGERS { hrefform inlinelinks makeinlinelink addeprints adddoiresolver addpubmedresolver }
  50. % Following constants may be adjusted by hand, if desired
  51. FUNCTION {init.urlbst.variables}
  52. {
  53. "" 'urlintro := % prefix before URL
  54. "http://arxiv.org/abs/" 'eprinturl := % prefix to make URL from eprint ref
  55. "arXiv:" 'eprintprefix := % text prefix printed before eprint ref
  56. "http://dx.doi.org/" 'doiurl := % prefix to make URL from DOI
  57. "doi:" 'doiprefix := % text prefix printed before DOI ref
  58. "http://www.ncbi.nlm.nih.gov/pubmed/" 'pubmedurl := % prefix to make URL from PUBMED
  59. "PMID:" 'pubmedprefix := % text prefix printed before PUBMED ref
  60. #0 'addeprints := % 0=no eprints; 1=include eprints
  61. #0 'adddoiresolver := % 0=no DOI resolver; 1=include it
  62. #0 'addpubmedresolver := % 0=no PUBMED resolver; 1=include it
  63. #0 'hrefform := % 0=no crossrefs; 1=hypertex xrefs; 2=hyperref refs
  64. #0 'inlinelinks := % 0=URLs explicit; 1=URLs attached to titles
  65. % the following are internal state variables, not config constants
  66. #0 'makeinlinelink := % state variable managed by possibly.setup.inlinelink
  67. "" 'openinlinelink := % ditto
  68. "" 'closeinlinelink := % ditto
  69. }
  70. INTEGERS {
  71. bracket.state
  72. outside.brackets
  73. open.brackets
  74. within.brackets
  75. close.brackets
  76. }
  77. % ...urlbst to here
  78. FUNCTION {init.state.consts}
  79. { #0 'outside.brackets := % urlbst
  80. #1 'open.brackets :=
  81. #2 'within.brackets :=
  82. #3 'close.brackets :=
  83. #0 'before.all :=
  84. #1 'mid.sentence :=
  85. #2 'after.sentence :=
  86. #3 'after.block :=
  87. }
  88. STRINGS { s t }
  89. % urlbst
  90. FUNCTION {output.nonnull.original}
  91. { 's :=
  92. output.state mid.sentence =
  93. { ", " * write$ }
  94. { output.state after.block =
  95. { add.period$ write$
  96. newline$
  97. "\newblock " write$
  98. }
  99. { output.state before.all =
  100. 'write$
  101. { add.period$ " " * write$ }
  102. if$
  103. }
  104. if$
  105. mid.sentence 'output.state :=
  106. }
  107. if$
  108. s
  109. }
  110. % urlbst...
  111. % The following three functions are for handling inlinelink. They wrap
  112. % a block of text which is potentially output with write$ by multiple
  113. % other functions, so we don't know the content a priori.
  114. % They communicate between each other using the variables makeinlinelink
  115. % (which is true if a link should be made), and closeinlinelink (which holds
  116. % the string which should close any current link. They can be called
  117. % at any time, but start.inlinelink will be a no-op unless something has
  118. % previously set makeinlinelink true, and the two ...end.inlinelink functions
  119. % will only do their stuff if start.inlinelink has previously set
  120. % closeinlinelink to be non-empty.
  121. FUNCTION {possibly.setup.inlinelink}
  122. { makeinlinelink
  123. { hrefform #1 = % hypertex
  124. { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink :=
  125. "\special {html:</a>}" 'closeinlinelink :=
  126. }
  127. { hrefform #2 = % hyperref
  128. % the space between "} {" matters: a URL of just the right length can cause "\% newline em"
  129. { "\href{" url * "} {" * 'openinlinelink :=
  130. "}" 'closeinlinelink :=
  131. }
  132. 'skip$
  133. if$ % hrefform #2 =
  134. }
  135. if$ % hrefform #1 =
  136. #0 'makeinlinelink :=
  137. }
  138. 'skip$
  139. if$ % makeinlinelink
  140. }
  141. FUNCTION {add.inlinelink}
  142. { openinlinelink empty$
  143. 'skip$
  144. { openinlinelink swap$ * closeinlinelink *
  145. "" 'openinlinelink :=
  146. }
  147. if$
  148. }
  149. FUNCTION {output.nonnull}
  150. { % Save the thing we've been asked to output
  151. 's :=
  152. % If the bracket-state is close.brackets, then add a close-bracket to
  153. % what is currently at the top of the stack, and set bracket.state
  154. % to outside.brackets
  155. bracket.state close.brackets =
  156. { "]" *
  157. outside.brackets 'bracket.state :=
  158. }
  159. 'skip$
  160. if$
  161. bracket.state outside.brackets =
  162. { % We're outside all brackets -- this is the normal situation.
  163. % Write out what's currently at the top of the stack, using the
  164. % original output.nonnull function.
  165. s
  166. add.inlinelink
  167. output.nonnull.original % invoke the original output.nonnull
  168. }
  169. { % Still in brackets. Add open-bracket or (continuation) comma, add the
  170. % new text (in s) to the top of the stack, and move to the close-brackets
  171. % state, ready for next time (unless inbrackets resets it). If we come
  172. % into this branch, then output.state is carefully undisturbed.
  173. bracket.state open.brackets =
  174. { " [" * }
  175. { ", " * } % bracket.state will be within.brackets
  176. if$
  177. s *
  178. close.brackets 'bracket.state :=
  179. }
  180. if$
  181. }
  182. % Call this function just before adding something which should be presented in
  183. % brackets. bracket.state is handled specially within output.nonnull.
  184. FUNCTION {inbrackets}
  185. { bracket.state close.brackets =
  186. { within.brackets 'bracket.state := } % reset the state: not open nor closed
  187. { open.brackets 'bracket.state := }
  188. if$
  189. }
  190. FUNCTION {format.lastchecked}
  191. { lastchecked empty$
  192. { "" }
  193. { "accessed " lastchecked * }
  194. if$
  195. }
  196. % ...urlbst to here
  197. FUNCTION {output}
  198. { duplicate$ empty$
  199. 'pop$
  200. 'output.nonnull
  201. if$
  202. }
  203. FUNCTION {output.check}
  204. { 't :=
  205. duplicate$ empty$
  206. { pop$ "empty " t * " in " * cite$ * warning$ }
  207. 'output.nonnull
  208. if$
  209. }
  210. FUNCTION {output.bibitem.original}
  211. { newline$
  212. "\bibitem{" write$
  213. cite$ write$
  214. "}" write$
  215. newline$
  216. ""
  217. before.all 'output.state :=
  218. }
  219. FUNCTION {fin.entry.original}
  220. { add.period$
  221. write$
  222. newline$
  223. }
  224. FUNCTION {new.block}
  225. { output.state before.all =
  226. 'skip$
  227. { after.block 'output.state := }
  228. if$
  229. }
  230. FUNCTION {new.sentence}
  231. { output.state after.block =
  232. 'skip$
  233. { output.state before.all =
  234. 'skip$
  235. { after.sentence 'output.state := }
  236. if$
  237. }
  238. if$
  239. }
  240. FUNCTION {not}
  241. { { #0 }
  242. { #1 }
  243. if$
  244. }
  245. FUNCTION {and}
  246. { 'skip$
  247. { pop$ #0 }
  248. if$
  249. }
  250. FUNCTION {or}
  251. { { pop$ #1 }
  252. 'skip$
  253. if$
  254. }
  255. FUNCTION {new.block.checka}
  256. { empty$
  257. 'skip$
  258. 'new.block
  259. if$
  260. }
  261. FUNCTION {new.block.checkb}
  262. { empty$
  263. swap$ empty$
  264. and
  265. 'skip$
  266. 'new.block
  267. if$
  268. }
  269. FUNCTION {field.or.null}
  270. { duplicate$ empty$
  271. { pop$ "" }
  272. 'skip$
  273. if$
  274. }
  275. FUNCTION {emphasize}
  276. { duplicate$ empty$
  277. { pop$ "" }
  278. { "{\em " swap$ * "}" * }
  279. if$
  280. }
  281. FUNCTION {emphasizeic}
  282. { duplicate$ empty$
  283. { pop$ "" }
  284. { "{\em " swap$ * "\/}" * }
  285. if$
  286. }
  287. FUNCTION {scapify}
  288. { duplicate$ empty$
  289. { pop$ "" }
  290. { "{\sc " swap$ * "}" * }
  291. if$
  292. }
  293. INTEGERS { nameptr namesleft numnames }
  294. FUNCTION {format.names}
  295. { 's :=
  296. #1 'nameptr :=
  297. s num.names$ 'numnames :=
  298. numnames 'namesleft :=
  299. { namesleft #0 > }
  300. { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=
  301. nameptr #1 >
  302. { namesleft #1 >
  303. { ", " * t * }
  304. { t "others" =
  305. { ", et~al." * }
  306. { ", and " * t * }
  307. if$
  308. }
  309. if$
  310. }
  311. 't
  312. if$
  313. nameptr #1 + 'nameptr :=
  314. namesleft #1 - 'namesleft :=
  315. }
  316. while$
  317. }
  318. % For names inside entries (e.g., editors of an "In ...");
  319. % this is exactly ABBRV.BST's `format.names' function.
  320. FUNCTION {format.innames}
  321. { 's :=
  322. #1 'nameptr :=
  323. s num.names$ 'numnames :=
  324. numnames 'namesleft :=
  325. { namesleft #0 > }
  326. { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
  327. nameptr #1 >
  328. { namesleft #1 >
  329. { ", " * t * }
  330. { numnames #2 >
  331. { "," * }
  332. 'skip$
  333. if$
  334. t "others" =
  335. { " et~al." * }
  336. { " and " * t * }
  337. if$
  338. }
  339. if$
  340. }
  341. 't
  342. if$
  343. nameptr #1 + 'nameptr :=
  344. namesleft #1 - 'namesleft :=
  345. }
  346. while$
  347. }
  348. FUNCTION {format.authors}
  349. { author empty$
  350. { "" }
  351. { author format.names scapify }
  352. if$
  353. }
  354. FUNCTION {format.editors}
  355. { editor empty$
  356. { "" }
  357. { editor format.names scapify
  358. editor num.names$ #1 >
  359. { ", Eds." * }
  360. { ", Ed." * }
  361. if$
  362. }
  363. if$
  364. }
  365. FUNCTION {format.ineditors}
  366. { editor empty$
  367. { "" }
  368. { editor format.innames
  369. editor num.names$ #1 >
  370. { ", Eds." * }
  371. { ", Ed." * }
  372. if$
  373. }
  374. if$
  375. }
  376. FUNCTION {format.title}
  377. { title empty$
  378. { "" }
  379. { title "t" change.case$ }
  380. if$
  381. }
  382. FUNCTION {n.dashify}
  383. { 't :=
  384. ""
  385. { t empty$ not }
  386. { t #1 #1 substring$ "-" =
  387. { t #1 #2 substring$ "--" = not
  388. { "--" *
  389. t #2 global.max$ substring$ 't :=
  390. }
  391. { { t #1 #1 substring$ "-" = }
  392. { "-" *
  393. t #2 global.max$ substring$ 't :=
  394. }
  395. while$
  396. }
  397. if$
  398. }
  399. { t #1 #1 substring$ *
  400. t #2 global.max$ substring$ 't :=
  401. }
  402. if$
  403. }
  404. while$
  405. }
  406. FUNCTION {format.date}
  407. { year empty$
  408. { month empty$
  409. { "" }
  410. { "there's a month but no year in " cite$ * warning$
  411. month
  412. }
  413. if$
  414. }
  415. { month empty$
  416. 'year
  417. { month " " * year * }
  418. if$
  419. }
  420. if$
  421. }
  422. FUNCTION {format.btitle}
  423. { title emphasize
  424. }
  425. FUNCTION {tie.or.space.connect}
  426. { duplicate$ text.length$ #3 <
  427. { "~" }
  428. { " " }
  429. if$
  430. swap$ * *
  431. }
  432. FUNCTION {either.or.check}
  433. { empty$
  434. 'pop$
  435. { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  436. if$
  437. }
  438. FUNCTION {format.bvolume}
  439. { volume empty$
  440. { "" }
  441. { "vol.~" volume *
  442. series empty$
  443. 'skip$
  444. { " of " * series emphasize * }
  445. if$
  446. "volume and number" number either.or.check
  447. }
  448. if$
  449. }
  450. FUNCTION {format.number.series}
  451. { volume empty$
  452. { number empty$
  453. { series field.or.null }
  454. { output.state mid.sentence =
  455. { "no.~" }
  456. { "No.~" }
  457. if$
  458. number *
  459. series empty$
  460. { "there's a number but no series in " cite$ * warning$ }
  461. { " in " * series * }
  462. if$
  463. }
  464. if$
  465. }
  466. { "" }
  467. if$
  468. }
  469. FUNCTION {format.edition}
  470. { edition empty$
  471. { "" }
  472. { output.state mid.sentence =
  473. { edition "l" change.case$ "~ed." * }
  474. { edition "t" change.case$ "~ed." * }
  475. if$
  476. }
  477. if$
  478. }
  479. FUNCTION {format.pages}
  480. { pages empty$
  481. { "" }
  482. { pages n.dashify }
  483. if$
  484. }
  485. INTEGERS { multiresult }
  486. FUNCTION {multi.page.check}
  487. { 't :=
  488. #0 'multiresult :=
  489. { multiresult not
  490. t empty$ not
  491. and
  492. }
  493. { t #1 #1 substring$
  494. duplicate$ "-" =
  495. swap$ duplicate$ "," =
  496. swap$ "+" =
  497. or or
  498. { #1 'multiresult := }
  499. { t #2 global.max$ substring$ 't := }
  500. if$
  501. }
  502. while$
  503. multiresult
  504. }
  505. FUNCTION {format.pp.pages}
  506. { pages empty$
  507. { "" }
  508. { pages multi.page.check
  509. { "pp.~" pages n.dashify * }
  510. { "p.~" pages * }
  511. if$
  512. }
  513. if$
  514. }
  515. FUNCTION {format.journal.vol.num.date}
  516. { journal empty$
  517. { "empty journal in " cite$ * warning$
  518. ""
  519. }
  520. { journal
  521. volume empty$
  522. 'skip$
  523. { " " * volume * }
  524. if$
  525. number empty$
  526. 'emphasizeic
  527. { emphasize ", " * number * }
  528. if$
  529. year empty$
  530. { "empty year in " cite$ * warning$ }
  531. { " (" * format.date * ")" * }
  532. if$
  533. }
  534. if$
  535. }
  536. FUNCTION {format.chapter.pages}
  537. { chapter empty$
  538. 'format.pp.pages
  539. { type empty$
  540. { "ch.~" chapter * }
  541. { type "l" change.case$ chapter tie.or.space.connect }
  542. if$
  543. pages empty$
  544. 'skip$
  545. { ", " * format.pp.pages * }
  546. if$
  547. }
  548. if$
  549. }
  550. FUNCTION {format.in.ed.booktitle}
  551. { booktitle empty$
  552. { "" }
  553. { "In " booktitle emphasize *
  554. editor empty$
  555. 'skip$
  556. { ", " * format.ineditors * }
  557. if$
  558. }
  559. if$
  560. }
  561. % The proceedings title (it's on the stack) gets an (address, date) appended
  562. FUNCTION {format.proc.date}
  563. { duplicate$ empty$
  564. { pop$ "" }
  565. { year empty$
  566. { "empty year in " cite$ * warning$
  567. address empty$
  568. 'emphasize
  569. { emphasizeic
  570. " (" * address * ")" *
  571. }
  572. if$
  573. }
  574. { emphasizeic
  575. " (" *
  576. address empty$
  577. 'skip$
  578. { address * ", " * }
  579. if$
  580. format.date *
  581. ")" *
  582. }
  583. if$
  584. }
  585. if$
  586. }
  587. FUNCTION {format.in.proc.date}
  588. { booktitle empty$
  589. { "" }
  590. { "In " booktitle format.proc.date * }
  591. if$
  592. }
  593. FUNCTION {empty.misc.check}
  594. { author empty$ title empty$ howpublished empty$
  595. month empty$ year empty$ note empty$
  596. and and and and and
  597. key empty$ not and
  598. { "all relevant fields are empty in " cite$ * warning$ }
  599. 'skip$
  600. if$
  601. }
  602. FUNCTION {format.thesis.type}
  603. { type empty$
  604. 'skip$
  605. { pop$
  606. type "t" change.case$
  607. }
  608. if$
  609. }
  610. FUNCTION {format.tr.number}
  611. { type empty$
  612. { "Tech. Rep." }
  613. 'type
  614. if$
  615. number empty$
  616. { "t" change.case$ }
  617. { number tie.or.space.connect }
  618. if$
  619. }
  620. FUNCTION {format.article.crossref}
  621. { key empty$
  622. { journal empty$
  623. { "need key or journal for " cite$ * " to crossref " * crossref *
  624. warning$
  625. ""
  626. }
  627. { "In {\em " journal * "\/}" * }
  628. if$
  629. }
  630. { "In " key * }
  631. if$
  632. " \cite{" * crossref * "}" *
  633. }
  634. FUNCTION {format.crossref.editor}
  635. { editor #1 "{vv~}{ll}" format.name$
  636. editor num.names$ duplicate$
  637. #2 >
  638. { pop$ " et~al." * }
  639. { #2 <
  640. 'skip$
  641. { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  642. { " et~al." * }
  643. { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  644. if$
  645. }
  646. if$
  647. }
  648. if$
  649. }
  650. FUNCTION {format.book.crossref}
  651. { volume empty$
  652. { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  653. "In "
  654. }
  655. { "Vol.~" volume *
  656. " of " *
  657. }
  658. if$
  659. editor empty$
  660. editor field.or.null author field.or.null =
  661. or
  662. { key empty$
  663. { series empty$
  664. { "need editor, key, or series for " cite$ * " to crossref " *
  665. crossref * warning$
  666. "" *
  667. }
  668. { "{\em " * series * "\/}" * }
  669. if$
  670. }
  671. { key * }
  672. if$
  673. }
  674. { format.crossref.editor * }
  675. if$
  676. " \cite{" * crossref * "}" *
  677. }
  678. FUNCTION {format.incoll.inproc.crossref}
  679. { editor empty$
  680. editor field.or.null author field.or.null =
  681. or
  682. { key empty$
  683. { booktitle empty$
  684. { "need editor, key, or booktitle for " cite$ * " to crossref " *
  685. crossref * warning$
  686. ""
  687. }
  688. { "In {\em " booktitle * "\/}" * }
  689. if$
  690. }
  691. { "In " key * }
  692. if$
  693. }
  694. { "In " format.crossref.editor * }
  695. if$
  696. " \cite{" * crossref * "}" *
  697. }
  698. % urlbst...
  699. % Functions for making hypertext links.
  700. % In all cases, the stack has (link-text href-url)
  701. %
  702. % make 'null' specials
  703. FUNCTION {make.href.null}
  704. {
  705. pop$
  706. }
  707. % make hypertex specials
  708. FUNCTION {make.href.hypertex}
  709. {
  710. "\special {html:<a href=" quote$ *
  711. swap$ * quote$ * "> }" * swap$ *
  712. "\special {html:</a>}" *
  713. }
  714. % make hyperref specials
  715. FUNCTION {make.href.hyperref}
  716. {
  717. "\href {" swap$ * "} {\path{" * swap$ * "}}" *
  718. }
  719. FUNCTION {make.href}
  720. { hrefform #2 =
  721. 'make.href.hyperref % hrefform = 2
  722. { hrefform #1 =
  723. 'make.href.hypertex % hrefform = 1
  724. 'make.href.null % hrefform = 0 (or anything else)
  725. if$
  726. }
  727. if$
  728. }
  729. % If inlinelinks is true, then format.url should be a no-op, since it's
  730. % (a) redundant, and (b) could end up as a link-within-a-link.
  731. FUNCTION {format.url}
  732. { inlinelinks #1 = url empty$ or
  733. { "" }
  734. { hrefform #1 =
  735. { % special case -- add HyperTeX specials
  736. urlintro "\url{" url * "}" * url make.href.hypertex * }
  737. { urlintro "\url{" * url * "}" * }
  738. if$
  739. }
  740. if$
  741. }
  742. FUNCTION {format.eprint}
  743. { eprint empty$
  744. { "" }
  745. { eprintprefix eprint * eprinturl eprint * make.href }
  746. if$
  747. }
  748. FUNCTION {format.doi}
  749. { doi empty$
  750. { "" }
  751. { doiprefix doi * doiurl doi * make.href }
  752. if$
  753. }
  754. FUNCTION {format.pubmed}
  755. { pubmed empty$
  756. { "" }
  757. { pubmedprefix pubmed * pubmedurl pubmed * make.href }
  758. if$
  759. }
  760. % Output a URL. We can't use the more normal idiom (something like
  761. % `format.url output'), because the `inbrackets' within
  762. % format.lastchecked applies to everything between calls to `output',
  763. % so that `format.url format.lastchecked * output' ends up with both
  764. % the URL and the lastchecked in brackets.
  765. FUNCTION {output.url}
  766. { url empty$
  767. 'skip$
  768. { new.block
  769. format.url output
  770. format.lastchecked output
  771. }
  772. if$
  773. }
  774. FUNCTION {output.web.refs}
  775. {
  776. new.block
  777. output.url
  778. addeprints eprint empty$ not and
  779. { format.eprint output.nonnull }
  780. 'skip$
  781. if$
  782. adddoiresolver doi empty$ not and
  783. { format.doi output.nonnull }
  784. 'skip$
  785. if$
  786. addpubmedresolver pubmed empty$ not and
  787. { format.pubmed output.nonnull }
  788. 'skip$
  789. if$
  790. }
  791. % Wrapper for output.bibitem.original.
  792. % If the URL field is not empty, set makeinlinelink to be true,
  793. % so that an inline link will be started at the next opportunity
  794. FUNCTION {output.bibitem}
  795. { outside.brackets 'bracket.state :=
  796. output.bibitem.original
  797. inlinelinks url empty$ not and
  798. { #1 'makeinlinelink := }
  799. { #0 'makeinlinelink := }
  800. if$
  801. }
  802. % Wrapper for fin.entry.original
  803. FUNCTION {fin.entry}
  804. { output.web.refs % urlbst
  805. makeinlinelink % ooops, it appears we didn't have a title for inlinelink
  806. { possibly.setup.inlinelink % add some artificial link text here, as a fallback
  807. "[link]" output.nonnull }
  808. 'skip$
  809. if$
  810. bracket.state close.brackets = % urlbst
  811. { "]" * }
  812. 'skip$
  813. if$
  814. fin.entry.original
  815. }
  816. % Webpage entry type.
  817. % Title and url fields required;
  818. % author, note, year, month, and lastchecked fields optional
  819. % See references
  820. % ISO 690-2 http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm
  821. % http://www.classroom.net/classroom/CitingNetResources.html
  822. % http://neal.ctstateu.edu/history/cite.html
  823. % http://www.cas.usf.edu/english/walker/mla.html
  824. % for citation formats for web pages.
  825. FUNCTION {webpage}
  826. { output.bibitem
  827. author empty$
  828. { editor empty$
  829. 'skip$ % author and editor both optional
  830. { format.editors output.nonnull }
  831. if$
  832. }
  833. { editor empty$
  834. { format.authors output.nonnull }
  835. { "can't use both author and editor fields in " cite$ * warning$ }
  836. if$
  837. }
  838. if$
  839. new.block
  840. title empty$ 'skip$ 'possibly.setup.inlinelink if$
  841. format.title "title" output.check
  842. new.block
  843. "Online Resource" output
  844. year empty$
  845. 'skip$
  846. { format.date "year" output.check }
  847. if$
  848. % We don't need to output the URL details ('lastchecked' and 'url'),
  849. % because fin.entry does that for us, using output.web.refs. The only
  850. % reason we would want to put them here is if we were to decide that
  851. % they should go in front of the rather miscellaneous information in 'note'.
  852. new.block
  853. note output
  854. fin.entry
  855. }
  856. % ...urlbst to here
  857. FUNCTION {article}
  858. { output.bibitem
  859. format.authors "author" output.check
  860. new.block
  861. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  862. format.title "title" output.check
  863. new.block
  864. crossref missing$
  865. { format.journal.vol.num.date output
  866. format.pages output
  867. }
  868. { format.article.crossref output.nonnull
  869. format.pp.pages output
  870. }
  871. if$
  872. new.block
  873. note output
  874. fin.entry
  875. }
  876. FUNCTION {bachelorsthesis}
  877. { output.bibitem
  878. format.authors "author" output.check
  879. new.block
  880. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  881. format.title "title" output.check
  882. new.block
  883. "Bachelor's thesis" format.thesis.type output.nonnull
  884. school "school" output.check
  885. address output
  886. format.date "year" output.check
  887. new.block
  888. note output
  889. fin.entry
  890. }
  891. FUNCTION {book}
  892. { output.bibitem
  893. author empty$
  894. { format.editors "author and editor" output.check }
  895. { format.authors output.nonnull
  896. crossref missing$
  897. { "author and editor" editor either.or.check }
  898. 'skip$
  899. if$
  900. }
  901. if$
  902. new.block
  903. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  904. format.btitle "title" output.check
  905. format.edition output
  906. crossref missing$
  907. { format.bvolume output
  908. new.block
  909. format.number.series output
  910. new.sentence
  911. publisher "publisher" output.check
  912. address output
  913. }
  914. { new.block
  915. format.book.crossref output.nonnull
  916. }
  917. if$
  918. format.date "year" output.check
  919. new.block
  920. note output
  921. fin.entry
  922. }
  923. FUNCTION {booklet}
  924. { output.bibitem
  925. format.authors output
  926. new.block
  927. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  928. format.title "title" output.check
  929. howpublished address new.block.checkb
  930. howpublished output
  931. address output
  932. format.date output
  933. new.block
  934. note output
  935. fin.entry
  936. }
  937. FUNCTION {diplomathesis}
  938. { output.bibitem
  939. format.authors "author" output.check
  940. new.block
  941. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  942. format.title "title" output.check
  943. new.block
  944. "Diploma thesis" format.thesis.type output.nonnull
  945. school "school" output.check
  946. address output
  947. format.date "year" output.check
  948. new.block
  949. note output
  950. fin.entry
  951. }
  952. FUNCTION {inbook}
  953. { output.bibitem
  954. author empty$
  955. { format.editors "author and editor" output.check }
  956. { format.authors output.nonnull
  957. crossref missing$
  958. { "author and editor" editor either.or.check }
  959. 'skip$
  960. if$
  961. }
  962. if$
  963. new.block
  964. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  965. format.btitle "title" output.check
  966. format.edition output
  967. crossref missing$
  968. { format.bvolume output
  969. new.block
  970. format.number.series output
  971. new.sentence
  972. publisher "publisher" output.check
  973. address output
  974. }
  975. { new.block
  976. format.book.crossref output.nonnull
  977. }
  978. if$
  979. format.date "year" output.check
  980. format.chapter.pages "chapter and pages" output.check
  981. new.block
  982. note output
  983. fin.entry
  984. }
  985. FUNCTION {incollection}
  986. { output.bibitem
  987. format.authors "author" output.check
  988. new.block
  989. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  990. format.title "title" output.check
  991. new.block
  992. crossref missing$
  993. { format.in.ed.booktitle "booktitle" output.check
  994. format.edition output
  995. format.bvolume output
  996. format.number.series output
  997. new.sentence
  998. publisher "publisher" output.check
  999. address output
  1000. format.date "year" output.check
  1001. }
  1002. { format.incoll.inproc.crossref output.nonnull }
  1003. if$
  1004. format.chapter.pages output
  1005. new.block
  1006. note output
  1007. fin.entry
  1008. }
  1009. FUNCTION {inproceedings}
  1010. { output.bibitem
  1011. format.authors "author" output.check
  1012. new.block
  1013. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  1014. format.title "title" output.check
  1015. new.block
  1016. crossref missing$
  1017. { format.in.proc.date "booktitle" output.check
  1018. format.ineditors output
  1019. format.bvolume output
  1020. format.number.series output
  1021. organization output
  1022. publisher output
  1023. }
  1024. { format.incoll.inproc.crossref output.nonnull }
  1025. if$
  1026. format.pp.pages output
  1027. new.block
  1028. note output
  1029. fin.entry
  1030. }
  1031. FUNCTION {conference} { inproceedings }
  1032. FUNCTION {manual}
  1033. { output.bibitem
  1034. author empty$
  1035. { organization scapify output }
  1036. { format.authors output.nonnull }
  1037. if$
  1038. new.block
  1039. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  1040. format.btitle "title" output.check
  1041. format.edition output
  1042. author empty$
  1043. { address new.block.checka }
  1044. { organization address new.block.checkb
  1045. organization output
  1046. }
  1047. if$
  1048. address output
  1049. format.date output
  1050. new.block
  1051. note output
  1052. fin.entry
  1053. }
  1054. FUNCTION {mastersthesis}
  1055. { output.bibitem
  1056. format.authors "author" output.check
  1057. new.block
  1058. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  1059. format.title "title" output.check
  1060. new.block
  1061. "Master's thesis" format.thesis.type output.nonnull
  1062. school "school" output.check
  1063. address output
  1064. format.date "year" output.check
  1065. new.block
  1066. note output
  1067. fin.entry
  1068. }
  1069. FUNCTION {misc}
  1070. { output.bibitem
  1071. format.authors output
  1072. title howpublished new.block.checkb
  1073. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  1074. format.title output
  1075. howpublished new.block.checka
  1076. howpublished output
  1077. format.date output
  1078. new.block
  1079. note output
  1080. fin.entry
  1081. empty.misc.check
  1082. }
  1083. FUNCTION {phdthesis}
  1084. { output.bibitem
  1085. format.authors "author" output.check
  1086. new.block
  1087. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  1088. format.btitle "title" output.check
  1089. new.block
  1090. "PhD thesis" format.thesis.type output.nonnull
  1091. school "school" output.check
  1092. address output
  1093. format.date "year" output.check
  1094. new.block
  1095. note output
  1096. fin.entry
  1097. }
  1098. FUNCTION {proceedings}
  1099. { output.bibitem
  1100. editor empty$
  1101. { organization scapify output }
  1102. { format.editors output.nonnull }
  1103. if$
  1104. new.block
  1105. title format.proc.date "title" output.check
  1106. format.bvolume output
  1107. format.number.series output
  1108. editor empty$
  1109. 'skip$
  1110. { organization output }
  1111. if$
  1112. publisher output
  1113. new.block
  1114. note output
  1115. fin.entry
  1116. }
  1117. FUNCTION {techreport}
  1118. { output.bibitem
  1119. format.authors "author" output.check
  1120. new.block
  1121. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  1122. format.title "title" output.check
  1123. new.block
  1124. format.tr.number output.nonnull
  1125. institution "institution" output.check
  1126. address output
  1127. format.date "year" output.check
  1128. new.block
  1129. note output
  1130. fin.entry
  1131. }
  1132. FUNCTION {unpublished}
  1133. { output.bibitem
  1134. format.authors "author" output.check
  1135. new.block
  1136. title empty$ 'skip$ 'possibly.setup.inlinelink if$ % urlbst
  1137. format.title "title" output.check
  1138. new.block
  1139. note "note" output.check
  1140. format.date output
  1141. fin.entry
  1142. }
  1143. FUNCTION {default.type} { misc }
  1144. MACRO {jan} {"Jan."}
  1145. MACRO {feb} {"Feb."}
  1146. MACRO {mar} {"Mar."}
  1147. MACRO {apr} {"Apr."}
  1148. MACRO {may} {"May"}
  1149. MACRO {jun} {"June"}
  1150. MACRO {jul} {"July"}
  1151. MACRO {aug} {"Aug."}
  1152. MACRO {sep} {"Sept."}
  1153. MACRO {oct} {"Oct."}
  1154. MACRO {nov} {"Nov."}
  1155. MACRO {dec} {"Dec."}
  1156. MACRO {acmcs} {"ACM Comput. Surv."}
  1157. MACRO {acta} {"Acta Inf."}
  1158. MACRO {cacm} {"Commun. ACM"}
  1159. MACRO {ibmjrd} {"IBM J. Res. Dev."}
  1160. MACRO {ibmsj} {"IBM Syst.~J."}
  1161. MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
  1162. MACRO {ieeetc} {"IEEE Trans. Comput."}
  1163. MACRO {ieeetcad}
  1164. {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
  1165. MACRO {ipl} {"Inf. Process. Lett."}
  1166. MACRO {jacm} {"J.~ACM"}
  1167. MACRO {jcss} {"J.~Comput. Syst. Sci."}
  1168. MACRO {scp} {"Sci. Comput. Programming"}
  1169. MACRO {sicomp} {"SIAM J. Comput."}
  1170. MACRO {tocs} {"ACM Trans. Comput. Syst."}
  1171. MACRO {tods} {"ACM Trans. Database Syst."}
  1172. MACRO {tog} {"ACM Trans. Gr."}
  1173. MACRO {toms} {"ACM Trans. Math. Softw."}
  1174. MACRO {toois} {"ACM Trans. Office Inf. Syst."}
  1175. MACRO {toplas} {"ACM Trans. Program. Lang. Syst."}
  1176. MACRO {tcs} {"Theoretical Comput. Sci."}
  1177. READ
  1178. FUNCTION {sortify}
  1179. { purify$
  1180. "l" change.case$
  1181. }
  1182. INTEGERS { len }
  1183. FUNCTION {chop.word}
  1184. { 's :=
  1185. 'len :=
  1186. s #1 len substring$ =
  1187. { s len #1 + global.max$ substring$ }
  1188. 's
  1189. if$
  1190. }
  1191. FUNCTION {sort.format.names}
  1192. { 's :=
  1193. #1 'nameptr :=
  1194. ""
  1195. s num.names$ 'numnames :=
  1196. numnames 'namesleft :=
  1197. { namesleft #0 > }
  1198. { nameptr #1 >
  1199. { " " * }
  1200. 'skip$
  1201. if$
  1202. s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't :=
  1203. nameptr numnames = t "others" = and
  1204. { "et al" * }
  1205. { t sortify * }
  1206. if$
  1207. nameptr #1 + 'nameptr :=
  1208. namesleft #1 - 'namesleft :=
  1209. }
  1210. while$
  1211. }
  1212. FUNCTION {sort.format.title}
  1213. { 't :=
  1214. "A " #2
  1215. "An " #3
  1216. "The " #4 t chop.word
  1217. chop.word
  1218. chop.word
  1219. sortify
  1220. #1 global.max$ substring$
  1221. }
  1222. FUNCTION {author.sort}
  1223. { author empty$
  1224. { key empty$
  1225. { "to sort, need author or key in " cite$ * warning$
  1226. ""
  1227. }
  1228. { key sortify }
  1229. if$
  1230. }
  1231. { author sort.format.names }
  1232. if$
  1233. }
  1234. FUNCTION {author.editor.sort}
  1235. { author empty$
  1236. { editor empty$
  1237. { key empty$
  1238. { "to sort, need author, editor, or key in " cite$ * warning$
  1239. ""
  1240. }
  1241. { key sortify }
  1242. if$
  1243. }
  1244. { editor sort.format.names }
  1245. if$
  1246. }
  1247. { author sort.format.names }
  1248. if$
  1249. }
  1250. FUNCTION {author.organization.sort}
  1251. { author empty$
  1252. { organization empty$
  1253. { key empty$
  1254. { "to sort, need author, organization, or key in " cite$ * warning$
  1255. ""
  1256. }
  1257. { key sortify }
  1258. if$
  1259. }
  1260. { "The " #4 organization chop.word sortify }
  1261. if$
  1262. }
  1263. { author sort.format.names }
  1264. if$
  1265. }
  1266. FUNCTION {editor.organization.sort}
  1267. { editor empty$
  1268. { organization empty$
  1269. { key empty$
  1270. { "to sort, need editor, organization, or key in " cite$ * warning$
  1271. ""
  1272. }
  1273. { key sortify }
  1274. if$
  1275. }
  1276. { "The " #4 organization chop.word sortify }
  1277. if$
  1278. }
  1279. { editor sort.format.names }
  1280. if$
  1281. }
  1282. FUNCTION {presort}
  1283. { type$ "book" =
  1284. type$ "inbook" =
  1285. or
  1286. 'author.editor.sort
  1287. { type$ "proceedings" =
  1288. 'editor.organization.sort
  1289. { type$ "manual" =
  1290. 'author.organization.sort
  1291. 'author.sort
  1292. if$
  1293. }
  1294. if$
  1295. }
  1296. if$
  1297. " "
  1298. *
  1299. year field.or.null sortify
  1300. *
  1301. " "
  1302. *
  1303. title field.or.null
  1304. sort.format.title
  1305. *
  1306. #1 entry.max$ substring$
  1307. 'sort.key$ :=
  1308. }
  1309. ITERATE {presort}
  1310. SORT
  1311. STRINGS { longest.label }
  1312. INTEGERS { number.label longest.label.width }
  1313. FUNCTION {initialize.longest.label}
  1314. { "" 'longest.label :=
  1315. #1 'number.label :=
  1316. #0 'longest.label.width :=
  1317. }
  1318. FUNCTION {longest.label.pass}
  1319. { number.label int.to.str$ 'label :=
  1320. number.label #1 + 'number.label :=
  1321. label width$ longest.label.width >
  1322. { label 'longest.label :=
  1323. label width$ 'longest.label.width :=
  1324. }
  1325. 'skip$
  1326. if$
  1327. }
  1328. EXECUTE {initialize.longest.label}
  1329. ITERATE {longest.label.pass}
  1330. FUNCTION {begin.bib}
  1331. { preamble$ empty$
  1332. 'skip$
  1333. { preamble$ write$ newline$ }
  1334. if$
  1335. "\begin{thebibliography}{" longest.label * "}" * write$ newline$
  1336. }
  1337. EXECUTE {begin.bib}
  1338. EXECUTE {init.urlbst.variables}
  1339. EXECUTE {init.state.consts}
  1340. ITERATE {call.type$}
  1341. FUNCTION {end.bib}
  1342. { newline$
  1343. "\end{thebibliography}" write$ newline$
  1344. }
  1345. EXECUTE {end.bib}