plainurlyr-rev.bst 33 KB

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