plainyr-rev.bst 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302
  1. %% plainyr-rev BibTeX style
  2. %% Author: Christian Plessl <christian@plesslweb.ch>
  3. %%
  4. %% This BibTeX style formats bibliographic entries like the plain style
  5. %% but sorts them in reverse chronological order, i.e., the newest
  6. %% references are listed first.
  7. %%
  8. %% The style is almost identical to plainyr.bst, but changes only the sorting
  9. %% order.
  10. %% Changelog
  11. %% ---------------------------------------------------------------------------------
  12. %% 2009-04-29
  13. %% Modified BibTeX style to correctly sorting authors within a particular year, when
  14. %% no month is given or the month is the same
  15. %% Contributed by Hans Ekkehard Plesser, http://arken.umb.no/~plesser
  16. %% ---------------------------------------------------------------------------------
  17. %% 2009-02-21
  18. %% Modified BibTeX style to consider also the month field when sorting BibTeX entries.
  19. %%
  20. %% contributed by João Gomes, jvpgomes at gmail com, http://penhas.di.ubi.pt/~jgomes
  21. %% ---------------------------------------------------------------------------------
  22. %% /usr/local/lib/tex/bibtex/plainyr.bst, Mon Jun 29 08:06:48 1992
  23. %% Edit by Nelson H. F. Beebe <beebe@plot79.math.utah.edu>
  24. %% I've called this posting plainyr instead of the author's datasort
  25. %% because the latter is uninformative.
  26. % Newsgroups: comp.text.tex
  27. % Path: math.utah.edu!hellgate.utah.edu!cs.utexas.edu!uunet!brunix!cs.brown.edu!mpp
  28. % From: mpp@cns.brown.edu (Michael P. Perrone)
  29. % Subject: Re: bibtex sorting by year
  30. % Message-ID: <1992Jun26.075302.21206@cs.brown.edu>
  31. % Sender: mpp@cs.brown.edu (Michael P. Perrone)
  32. % Organization: Center for Neural Science, Brown University
  33. % References: <1992Jun26.065942.20721@cs.brown.edu>
  34. % Date: Fri, 26 Jun 1992 07:53:02 GMT
  35. % Lines: 1128
  36. %
  37. % i figured out the bibtex problem.
  38. % the following bibstyle file will sort by year, author, title (in that order)
  39. % with the usual editor, organization (etc.) substitutions
  40. %
  41. % % ----- cut here -------------------------------
  42. %
  43. %-------------------------------------------------------------------------
  44. % DATASORT.BST --- created: 92.6.26 (Michael P. Perrone, Brown University)
  45. %
  46. % this is a simple hack of the plain.bst bibtex style file
  47. % which processes bibliography entries in chronological order
  48. % by year. within a year things are sort by author, title, etc.
  49. %
  50. % DISCLAIMER: if this doesn't work - sorry!
  51. %-------------------------------------------------------------------------
  52. %
  53. %
  54. % [MODIFIED] BibTeX standard bibliography style `plain'
  55. % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
  56. % Copyright (C) 1985, all rights reserved.
  57. % Copying of this file is authorized only if either
  58. % (1) you make absolutely no changes to your copy, including name, or
  59. % (2) if you do make changes, you name it something other than
  60. % btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
  61. % This restriction helps ensure that all standard styles are identical.
  62. % The file btxbst.doc has the documentation for this style.
  63. ENTRY
  64. { address
  65. author
  66. booktitle
  67. chapter
  68. edition
  69. editor
  70. howpublished
  71. institution
  72. journal
  73. key
  74. month
  75. note
  76. number
  77. organization
  78. pages
  79. publisher
  80. school
  81. series
  82. title
  83. type
  84. volume
  85. year
  86. }
  87. {}
  88. { label }
  89. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  90. FUNCTION {init.state.consts}
  91. { #0 'before.all :=
  92. #1 'mid.sentence :=
  93. #2 'after.sentence :=
  94. #3 'after.block :=
  95. }
  96. STRINGS { s t }
  97. FUNCTION {output.nonnull}
  98. { 's :=
  99. output.state mid.sentence =
  100. { ", " * write$ }
  101. { output.state after.block =
  102. { add.period$ write$
  103. newline$
  104. "\newblock " write$
  105. }
  106. { output.state before.all =
  107. 'write$
  108. { add.period$ " " * write$ }
  109. if$
  110. }
  111. if$
  112. mid.sentence 'output.state :=
  113. }
  114. if$
  115. s
  116. }
  117. FUNCTION {output}
  118. { duplicate$ empty$
  119. 'pop$
  120. 'output.nonnull
  121. if$
  122. }
  123. FUNCTION {output.check}
  124. { 't :=
  125. duplicate$ empty$
  126. { pop$ "empty " t * " in " * cite$ * warning$ }
  127. 'output.nonnull
  128. if$
  129. }
  130. FUNCTION {output.bibitem}
  131. { newline$
  132. "\bibitem{" write$
  133. cite$ write$
  134. "}" write$
  135. newline$
  136. ""
  137. before.all 'output.state :=
  138. }
  139. FUNCTION {fin.entry}
  140. { add.period$
  141. write$
  142. newline$
  143. }
  144. FUNCTION {new.block}
  145. { output.state before.all =
  146. 'skip$
  147. { after.block 'output.state := }
  148. if$
  149. }
  150. FUNCTION {new.sentence}
  151. { output.state after.block =
  152. 'skip$
  153. { output.state before.all =
  154. 'skip$
  155. { after.sentence 'output.state := }
  156. if$
  157. }
  158. if$
  159. }
  160. FUNCTION {not}
  161. { { #0 }
  162. { #1 }
  163. if$
  164. }
  165. FUNCTION {and}
  166. { 'skip$
  167. { pop$ #0 }
  168. if$
  169. }
  170. FUNCTION {or}
  171. { { pop$ #1 }
  172. 'skip$
  173. if$
  174. }
  175. FUNCTION {new.block.checka}
  176. { empty$
  177. 'skip$
  178. 'new.block
  179. if$
  180. }
  181. FUNCTION {new.block.checkb}
  182. { empty$
  183. swap$ empty$
  184. and
  185. 'skip$
  186. 'new.block
  187. if$
  188. }
  189. FUNCTION {new.sentence.checka}
  190. { empty$
  191. 'skip$
  192. 'new.sentence
  193. if$
  194. }
  195. FUNCTION {new.sentence.checkb}
  196. { empty$
  197. swap$ empty$
  198. and
  199. 'skip$
  200. 'new.sentence
  201. if$
  202. }
  203. FUNCTION {field.or.null}
  204. { duplicate$ empty$
  205. { pop$ "" }
  206. 'skip$
  207. if$
  208. }
  209. FUNCTION {emphasize}
  210. { duplicate$ empty$
  211. { pop$ "" }
  212. { "{\em " swap$ * "}" * }
  213. if$
  214. }
  215. INTEGERS { nameptr namesleft numnames }
  216. FUNCTION {format.names}
  217. { 's :=
  218. #1 'nameptr :=
  219. s num.names$ 'numnames :=
  220. numnames 'namesleft :=
  221. { namesleft #0 > }
  222. { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
  223. nameptr #1 >
  224. { namesleft #1 >
  225. { ", " * t * }
  226. { numnames #2 >
  227. { "," * }
  228. 'skip$
  229. if$
  230. t "others" =
  231. { " et~al." * }
  232. { " and " * t * }
  233. if$
  234. }
  235. if$
  236. }
  237. 't
  238. if$
  239. nameptr #1 + 'nameptr :=
  240. namesleft #1 - 'namesleft :=
  241. }
  242. while$
  243. }
  244. FUNCTION {format.authors}
  245. { author empty$
  246. { "" }
  247. { author format.names }
  248. if$
  249. }
  250. FUNCTION {format.editors}
  251. { editor empty$
  252. { "" }
  253. { editor format.names
  254. editor num.names$ #1 >
  255. { ", editors" * }
  256. { ", editor" * }
  257. if$
  258. }
  259. if$
  260. }
  261. FUNCTION {format.title}
  262. { title empty$
  263. { "" }
  264. { title "t" change.case$ }
  265. if$
  266. }
  267. FUNCTION {n.dashify}
  268. { 't :=
  269. ""
  270. { t empty$ not }
  271. { t #1 #1 substring$ "-" =
  272. { t #1 #2 substring$ "--" = not
  273. { "--" *
  274. t #2 global.max$ substring$ 't :=
  275. }
  276. { { t #1 #1 substring$ "-" = }
  277. { "-" *
  278. t #2 global.max$ substring$ 't :=
  279. }
  280. while$
  281. }
  282. if$
  283. }
  284. { t #1 #1 substring$ *
  285. t #2 global.max$ substring$ 't :=
  286. }
  287. if$
  288. }
  289. while$
  290. }
  291. FUNCTION {format.date}
  292. { year empty$
  293. { month empty$
  294. { "" }
  295. { "there's a month but no year in " cite$ * warning$
  296. month
  297. }
  298. if$
  299. }
  300. { month empty$
  301. 'year
  302. { month " " * year * }
  303. if$
  304. }
  305. if$
  306. }
  307. FUNCTION {format.btitle}
  308. { title emphasize
  309. }
  310. FUNCTION {tie.or.space.connect}
  311. { duplicate$ text.length$ #3 <
  312. { "~" }
  313. { " " }
  314. if$
  315. swap$ * *
  316. }
  317. FUNCTION {either.or.check}
  318. { empty$
  319. 'pop$
  320. { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  321. if$
  322. }
  323. FUNCTION {format.bvolume}
  324. { volume empty$
  325. { "" }
  326. { "volume" volume tie.or.space.connect
  327. series empty$
  328. 'skip$
  329. { " of " * series emphasize * }
  330. if$
  331. "volume and number" number either.or.check
  332. }
  333. if$
  334. }
  335. FUNCTION {format.number.series}
  336. { volume empty$
  337. { number empty$
  338. { series field.or.null }
  339. { output.state mid.sentence =
  340. { "number" }
  341. { "Number" }
  342. if$
  343. number tie.or.space.connect
  344. series empty$
  345. { "there's a number but no series in " cite$ * warning$ }
  346. { " in " * series * }
  347. if$
  348. }
  349. if$
  350. }
  351. { "" }
  352. if$
  353. }
  354. FUNCTION {format.edition}
  355. { edition empty$
  356. { "" }
  357. { output.state mid.sentence =
  358. { edition "l" change.case$ " edition" * }
  359. { edition "t" change.case$ " edition" * }
  360. if$
  361. }
  362. if$
  363. }
  364. INTEGERS { multiresult }
  365. FUNCTION {multi.page.check}
  366. { 't :=
  367. #0 'multiresult :=
  368. { multiresult not
  369. t empty$ not
  370. and
  371. }
  372. { t #1 #1 substring$
  373. duplicate$ "-" =
  374. swap$ duplicate$ "," =
  375. swap$ "+" =
  376. or or
  377. { #1 'multiresult := }
  378. { t #2 global.max$ substring$ 't := }
  379. if$
  380. }
  381. while$
  382. multiresult
  383. }
  384. FUNCTION {format.pages}
  385. { pages empty$
  386. { "" }
  387. { pages multi.page.check
  388. { "pages" pages n.dashify tie.or.space.connect }
  389. { "page" pages tie.or.space.connect }
  390. if$
  391. }
  392. if$
  393. }
  394. FUNCTION {format.vol.num.pages}
  395. { volume field.or.null
  396. number empty$
  397. 'skip$
  398. { "(" number * ")" * *
  399. volume empty$
  400. { "there's a number but no volume in " cite$ * warning$ }
  401. 'skip$
  402. if$
  403. }
  404. if$
  405. pages empty$
  406. 'skip$
  407. { duplicate$ empty$
  408. { pop$ format.pages }
  409. { ":" * pages n.dashify * }
  410. if$
  411. }
  412. if$
  413. }
  414. FUNCTION {format.chapter.pages}
  415. { chapter empty$
  416. 'format.pages
  417. { type empty$
  418. { "chapter" }
  419. { type "l" change.case$ }
  420. if$
  421. chapter tie.or.space.connect
  422. pages empty$
  423. 'skip$
  424. { ", " * format.pages * }
  425. if$
  426. }
  427. if$
  428. }
  429. FUNCTION {format.in.ed.booktitle}
  430. { booktitle empty$
  431. { "" }
  432. { editor empty$
  433. { "In " booktitle emphasize * }
  434. { "In " format.editors * ", " * booktitle emphasize * }
  435. if$
  436. }
  437. if$
  438. }
  439. FUNCTION {empty.misc.check}
  440. { author empty$ title empty$ howpublished empty$
  441. month empty$ year empty$ note empty$
  442. and and and and and
  443. key empty$ not and
  444. { "all relevant fields are empty in " cite$ * warning$ }
  445. 'skip$
  446. if$
  447. }
  448. FUNCTION {format.thesis.type}
  449. { type empty$
  450. 'skip$
  451. { pop$
  452. type "t" change.case$
  453. }
  454. if$
  455. }
  456. FUNCTION {format.tr.number}
  457. { type empty$
  458. { "Technical Report" }
  459. 'type
  460. if$
  461. number empty$
  462. { "t" change.case$ }
  463. { number tie.or.space.connect }
  464. if$
  465. }
  466. FUNCTION {format.article.crossref}
  467. { key empty$
  468. { journal empty$
  469. { "need key or journal for " cite$ * " to crossref " * crossref *
  470. warning$
  471. ""
  472. }
  473. { "In {\em " journal * "\/}" * }
  474. if$
  475. }
  476. { "In " key * }
  477. if$
  478. " \cite{" * crossref * "}" *
  479. }
  480. FUNCTION {format.crossref.editor}
  481. { editor #1 "{vv~}{ll}" format.name$
  482. editor num.names$ duplicate$
  483. #2 >
  484. { pop$ " et~al." * }
  485. { #2 <
  486. 'skip$
  487. { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  488. { " et~al." * }
  489. { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  490. if$
  491. }
  492. if$
  493. }
  494. if$
  495. }
  496. FUNCTION {format.book.crossref}
  497. { volume empty$
  498. { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  499. "In "
  500. }
  501. { "Volume" volume tie.or.space.connect
  502. " of " *
  503. }
  504. if$
  505. editor empty$
  506. editor field.or.null author field.or.null =
  507. or
  508. { key empty$
  509. { series empty$
  510. { "need editor, key, or series for " cite$ * " to crossref " *
  511. crossref * warning$
  512. "" *
  513. }
  514. { "{\em " * series * "\/}" * }
  515. if$
  516. }
  517. { key * }
  518. if$
  519. }
  520. { format.crossref.editor * }
  521. if$
  522. " \cite{" * crossref * "}" *
  523. }
  524. FUNCTION {format.incoll.inproc.crossref}
  525. { editor empty$
  526. editor field.or.null author field.or.null =
  527. or
  528. { key empty$
  529. { booktitle empty$
  530. { "need editor, key, or booktitle for " cite$ * " to crossref " *
  531. crossref * warning$
  532. ""
  533. }
  534. { "In {\em " booktitle * "\/}" * }
  535. if$
  536. }
  537. { "In " key * }
  538. if$
  539. }
  540. { "In " format.crossref.editor * }
  541. if$
  542. " \cite{" * crossref * "}" *
  543. }
  544. FUNCTION {article}
  545. { output.bibitem
  546. format.authors "author" output.check
  547. new.block
  548. format.title "title" output.check
  549. new.block
  550. crossref missing$
  551. { journal emphasize "journal" output.check
  552. format.vol.num.pages output
  553. format.date "year" output.check
  554. }
  555. { format.article.crossref output.nonnull
  556. format.pages output
  557. }
  558. if$
  559. new.block
  560. note output
  561. fin.entry
  562. }
  563. FUNCTION {book}
  564. { output.bibitem
  565. author empty$
  566. { format.editors "author and editor" output.check }
  567. { format.authors output.nonnull
  568. crossref missing$
  569. { "author and editor" editor either.or.check }
  570. 'skip$
  571. if$
  572. }
  573. if$
  574. new.block
  575. format.btitle "title" output.check
  576. crossref missing$
  577. { format.bvolume output
  578. new.block
  579. format.number.series output
  580. new.sentence
  581. publisher "publisher" output.check
  582. address output
  583. }
  584. { new.block
  585. format.book.crossref output.nonnull
  586. }
  587. if$
  588. format.edition output
  589. format.date "year" output.check
  590. new.block
  591. note output
  592. fin.entry
  593. }
  594. FUNCTION {booklet}
  595. { output.bibitem
  596. format.authors output
  597. new.block
  598. format.title "title" output.check
  599. howpublished address new.block.checkb
  600. howpublished output
  601. address output
  602. format.date output
  603. new.block
  604. note output
  605. fin.entry
  606. }
  607. FUNCTION {inbook}
  608. { output.bibitem
  609. author empty$
  610. { format.editors "author and editor" output.check }
  611. { format.authors output.nonnull
  612. crossref missing$
  613. { "author and editor" editor either.or.check }
  614. 'skip$
  615. if$
  616. }
  617. if$
  618. new.block
  619. format.btitle "title" output.check
  620. crossref missing$
  621. { format.bvolume output
  622. format.chapter.pages "chapter and pages" output.check
  623. new.block
  624. format.number.series output
  625. new.sentence
  626. publisher "publisher" output.check
  627. address output
  628. }
  629. { format.chapter.pages "chapter and pages" output.check
  630. new.block
  631. format.book.crossref output.nonnull
  632. }
  633. if$
  634. format.edition output
  635. format.date "year" output.check
  636. new.block
  637. note output
  638. fin.entry
  639. }
  640. FUNCTION {incollection}
  641. { output.bibitem
  642. format.authors "author" output.check
  643. new.block
  644. format.title "title" output.check
  645. new.block
  646. crossref missing$
  647. { format.in.ed.booktitle "booktitle" output.check
  648. format.bvolume output
  649. format.number.series output
  650. format.chapter.pages output
  651. new.sentence
  652. publisher "publisher" output.check
  653. address output
  654. format.edition output
  655. format.date "year" output.check
  656. }
  657. { format.incoll.inproc.crossref output.nonnull
  658. format.chapter.pages output
  659. }
  660. if$
  661. new.block
  662. note output
  663. fin.entry
  664. }
  665. FUNCTION {inproceedings}
  666. { output.bibitem
  667. format.authors "author" output.check
  668. new.block
  669. format.title "title" output.check
  670. new.block
  671. crossref missing$
  672. { format.in.ed.booktitle "booktitle" output.check
  673. format.bvolume output
  674. format.number.series output
  675. format.pages output
  676. address empty$
  677. { organization publisher new.sentence.checkb
  678. organization output
  679. publisher output
  680. format.date "year" output.check
  681. }
  682. { address output.nonnull
  683. format.date "year" output.check
  684. new.sentence
  685. organization output
  686. publisher output
  687. }
  688. if$
  689. }
  690. { format.incoll.inproc.crossref output.nonnull
  691. format.pages output
  692. }
  693. if$
  694. new.block
  695. note output
  696. fin.entry
  697. }
  698. FUNCTION {conference} { inproceedings }
  699. FUNCTION {manual}
  700. { output.bibitem
  701. author empty$
  702. { organization empty$
  703. 'skip$
  704. { organization output.nonnull
  705. address output
  706. }
  707. if$
  708. }
  709. { format.authors output.nonnull }
  710. if$
  711. new.block
  712. format.btitle "title" output.check
  713. author empty$
  714. { organization empty$
  715. { address new.block.checka
  716. address output
  717. }
  718. 'skip$
  719. if$
  720. }
  721. { organization address new.block.checkb
  722. organization output
  723. address output
  724. }
  725. if$
  726. format.edition output
  727. format.date output
  728. new.block
  729. note output
  730. fin.entry
  731. }
  732. FUNCTION {mastersthesis}
  733. { output.bibitem
  734. format.authors "author" output.check
  735. new.block
  736. format.title "title" output.check
  737. new.block
  738. "Master's thesis" format.thesis.type output.nonnull
  739. school "school" output.check
  740. address output
  741. format.date "year" output.check
  742. new.block
  743. note output
  744. fin.entry
  745. }
  746. FUNCTION {misc}
  747. { output.bibitem
  748. format.authors output
  749. title howpublished new.block.checkb
  750. format.title output
  751. howpublished new.block.checka
  752. howpublished output
  753. format.date output
  754. new.block
  755. note output
  756. fin.entry
  757. empty.misc.check
  758. }
  759. FUNCTION {phdthesis}
  760. { output.bibitem
  761. format.authors "author" output.check
  762. new.block
  763. format.btitle "title" output.check
  764. new.block
  765. "PhD thesis" format.thesis.type output.nonnull
  766. school "school" output.check
  767. address output
  768. format.date "year" output.check
  769. new.block
  770. note output
  771. fin.entry
  772. }
  773. FUNCTION {proceedings}
  774. { output.bibitem
  775. editor empty$
  776. { organization output }
  777. { format.editors output.nonnull }
  778. if$
  779. new.block
  780. format.btitle "title" output.check
  781. format.bvolume output
  782. format.number.series output
  783. address empty$
  784. { editor empty$
  785. { publisher new.sentence.checka }
  786. { organization publisher new.sentence.checkb
  787. organization output
  788. }
  789. if$
  790. publisher output
  791. format.date "year" output.check
  792. }
  793. { address output.nonnull
  794. format.date "year" output.check
  795. new.sentence
  796. editor empty$
  797. 'skip$
  798. { organization output }
  799. if$
  800. publisher output
  801. }
  802. if$
  803. new.block
  804. note output
  805. fin.entry
  806. }
  807. FUNCTION {techreport}
  808. { output.bibitem
  809. format.authors "author" output.check
  810. new.block
  811. format.title "title" output.check
  812. new.block
  813. format.tr.number output.nonnull
  814. institution "institution" output.check
  815. address output
  816. format.date "year" output.check
  817. new.block
  818. note output
  819. fin.entry
  820. }
  821. FUNCTION {unpublished}
  822. { output.bibitem
  823. format.authors "author" output.check
  824. new.block
  825. format.title "title" output.check
  826. new.block
  827. note "note" output.check
  828. format.date output
  829. fin.entry
  830. }
  831. FUNCTION {default.type} { misc }
  832. MACRO {jan} {"January"}
  833. MACRO {feb} {"February"}
  834. MACRO {mar} {"March"}
  835. MACRO {apr} {"April"}
  836. MACRO {may} {"May"}
  837. MACRO {jun} {"June"}
  838. MACRO {jul} {"July"}
  839. MACRO {aug} {"August"}
  840. MACRO {sep} {"September"}
  841. MACRO {oct} {"October"}
  842. MACRO {nov} {"November"}
  843. MACRO {dec} {"December"}
  844. MACRO {acmcs} {"ACM Computing Surveys"}
  845. MACRO {acta} {"Acta Informatica"}
  846. MACRO {cacm} {"Communications of the ACM"}
  847. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  848. MACRO {ibmsj} {"IBM Systems Journal"}
  849. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  850. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  851. MACRO {ieeetcad}
  852. {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  853. MACRO {ipl} {"Information Processing Letters"}
  854. MACRO {jacm} {"Journal of the ACM"}
  855. MACRO {jcss} {"Journal of Computer and System Sciences"}
  856. MACRO {scp} {"Science of Computer Programming"}
  857. MACRO {sicomp} {"SIAM Journal on Computing"}
  858. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  859. MACRO {tods} {"ACM Transactions on Database Systems"}
  860. MACRO {tog} {"ACM Transactions on Graphics"}
  861. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  862. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  863. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  864. MACRO {tcs} {"Theoretical Computer Science"}
  865. READ
  866. FUNCTION {sortify}
  867. { purify$
  868. "l" change.case$
  869. }
  870. INTEGERS { len }
  871. FUNCTION {chop.word}
  872. { 's :=
  873. 'len :=
  874. s #1 len substring$ =
  875. { s len #1 + global.max$ substring$ }
  876. 's
  877. if$
  878. }
  879. FUNCTION {sort.format.names}
  880. { 's :=
  881. #1 'nameptr :=
  882. ""
  883. s num.names$ 'numnames :=
  884. numnames 'namesleft :=
  885. { namesleft #0 > }
  886. { nameptr #1 >
  887. { " " * }
  888. 'skip$
  889. if$
  890. s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
  891. nameptr numnames = t "others" = and
  892. { "et al" * }
  893. { t sortify * }
  894. if$
  895. nameptr #1 + 'nameptr :=
  896. namesleft #1 - 'namesleft :=
  897. }
  898. while$
  899. }
  900. FUNCTION {sort.format.month}
  901. { 't :=
  902. t #1 #3 substring$ "Jan" =
  903. t #1 #3 substring$ "jan" =
  904. or
  905. { "12" }
  906. { t #1 #3 substring$ "Feb" =
  907. t #1 #3 substring$ "feb" =
  908. or
  909. { "11" }
  910. { t #1 #3 substring$ "Mar" =
  911. t #1 #3 substring$ "mar" =
  912. or
  913. { "10" }
  914. { t #1 #3 substring$ "Apr" =
  915. t #1 #3 substring$ "apr" =
  916. or
  917. { "09" }
  918. { t #1 #3 substring$ "May" =
  919. t #1 #3 substring$ "may" =
  920. or
  921. { "08" }
  922. { t #1 #3 substring$ "Jun" =
  923. t #1 #3 substring$ "jun" =
  924. or
  925. { "07" }
  926. { t #1 #3 substring$ "Jul" =
  927. t #1 #3 substring$ "jul" =
  928. or
  929. { "06" }
  930. { t #1 #3 substring$ "Aug" =
  931. t #1 #3 substring$ "aug" =
  932. or
  933. { "05" }
  934. { t #1 #3 substring$ "Sep" =
  935. t #1 #3 substring$ "sep" =
  936. or
  937. { "04" }
  938. { t #1 #3 substring$ "Oct" =
  939. t #1 #3 substring$ "oct" =
  940. or
  941. { "03" }
  942. { t #1 #3 substring$ "Nov" =
  943. t #1 #3 substring$ "nov" =
  944. or
  945. { "02" }
  946. { t #1 #3 substring$ "Dec" =
  947. t #1 #3 substring$ "dec" =
  948. or
  949. { "01" }
  950. { "13" } % No month specified
  951. if$
  952. }
  953. if$
  954. }
  955. if$
  956. }
  957. if$
  958. }
  959. if$
  960. }
  961. if$
  962. }
  963. if$
  964. }
  965. if$
  966. }
  967. if$
  968. }
  969. if$
  970. }
  971. if$
  972. }
  973. if$
  974. }
  975. FUNCTION {sort.format.title}
  976. { 't :=
  977. "A " #2
  978. "An " #3
  979. "The " #4 t chop.word
  980. chop.word
  981. chop.word
  982. sortify
  983. #1 global.max$ substring$
  984. }
  985. FUNCTION {year.sort}
  986. { year empty$
  987. { key empty$
  988. { "to sort, need year or key in " cite$ * warning$
  989. ""
  990. }
  991. { key sortify }
  992. if$
  993. }
  994. { year sort.format.names }
  995. if$
  996. }
  997. FUNCTION {author.sort}
  998. { author empty$
  999. { key empty$
  1000. { "to sort, need author or key in " cite$ * warning$
  1001. ""
  1002. }
  1003. { key sortify }
  1004. if$
  1005. }
  1006. { author sort.format.names }
  1007. if$
  1008. }
  1009. FUNCTION {author.editor.sort}
  1010. { author empty$
  1011. { editor empty$
  1012. { key empty$
  1013. { "to sort, need author, editor, or key in " cite$ * warning$
  1014. ""
  1015. }
  1016. { key sortify }
  1017. if$
  1018. }
  1019. { editor sort.format.names }
  1020. if$
  1021. }
  1022. { author sort.format.names }
  1023. if$
  1024. }
  1025. FUNCTION {author.organization.sort}
  1026. { author empty$
  1027. { organization empty$
  1028. { key empty$
  1029. { "to sort, need author, organization, or key in " cite$ * warning$
  1030. ""
  1031. }
  1032. { key sortify }
  1033. if$
  1034. }
  1035. { "The " #4 organization chop.word sortify }
  1036. if$
  1037. }
  1038. { author sort.format.names }
  1039. if$
  1040. }
  1041. FUNCTION {editor.organization.sort}
  1042. { editor empty$
  1043. { organization empty$
  1044. { key empty$
  1045. { "to sort, need editor, organization, or key in " cite$ * warning$
  1046. ""
  1047. }
  1048. { key sortify }
  1049. if$
  1050. }
  1051. { "The " #4 organization chop.word sortify }
  1052. if$
  1053. }
  1054. { editor sort.format.names }
  1055. if$
  1056. }
  1057. %% Code for reverse sorting
  1058. %% Contributed by Hans Ekkehard Plesser, http://arken.umb.no/~plesser
  1059. % Take year, assuming it is four-digit, convert to int, subtract from 9999
  1060. % and return as string on stack. For reverse chronological sorting.
  1061. INTEGERS { pos k res }
  1062. STRINGS { tmpyear }
  1063. FUNCTION {reverse.year}
  1064. {
  1065. % ensure four digit year
  1066. year empty$
  1067. { "9999" "missing year in " cite$ * ", using 9999 for sorting" * warning$ }
  1068. { year text.length$ #4 =
  1069. { year }
  1070. { "9999" "year not 4-digit in " cite$ * ", using 9999 for sorting" * warning$ }
  1071. if$
  1072. }
  1073. if$
  1074. 'tmpyear :=
  1075. #0 'res := % will contain year as integer
  1076. #5 'pos := % index into year, we pre-decrement, will enter body with 4..1
  1077. { pos #1 - 'pos := pos }
  1078. {
  1079. % extract digit at pos, convert to ASCII, subtract 48 -> 0..9, store in k
  1080. tmpyear pos #1 substring$ chr.to.int$ #48 - 'k :=
  1081. { k duplicate$ #1 - 'k := }
  1082. {
  1083. pos #1 =
  1084. { res #1000 + 'res := }
  1085. {
  1086. pos #2 =
  1087. { res #100 + 'res := }
  1088. {
  1089. pos #3 =
  1090. { res #10 + 'res := }
  1091. { res #1 + 'res := }
  1092. if$
  1093. }
  1094. if$
  1095. }
  1096. if$
  1097. }
  1098. while$
  1099. }
  1100. while$
  1101. #9999 res -
  1102. int.to.str$
  1103. }
  1104. FUNCTION {presort}
  1105. {
  1106. % sort by reverse year
  1107. reverse.year
  1108. " "
  1109. *
  1110. month field.or.null
  1111. sort.format.month
  1112. *
  1113. " "
  1114. *
  1115. author field.or.null
  1116. sort.format.names
  1117. *
  1118. " "
  1119. *
  1120. title field.or.null
  1121. sort.format.title
  1122. *
  1123. % cite key for definitive disambiguation
  1124. cite$
  1125. *
  1126. % limit to maximum sort key length
  1127. #1 entry.max$ substring$
  1128. 'sort.key$ :=
  1129. }
  1130. ITERATE {presort}
  1131. SORT
  1132. STRINGS { longest.label }
  1133. INTEGERS { number.label longest.label.width }
  1134. FUNCTION {initialize.longest.label}
  1135. { "" 'longest.label :=
  1136. #1 'number.label :=
  1137. #0 'longest.label.width :=
  1138. }
  1139. FUNCTION {longest.label.pass}
  1140. { number.label int.to.str$ 'label :=
  1141. number.label #1 + 'number.label :=
  1142. label width$ longest.label.width >
  1143. { label 'longest.label :=
  1144. label width$ 'longest.label.width :=
  1145. }
  1146. 'skip$
  1147. if$
  1148. }
  1149. EXECUTE {initialize.longest.label}
  1150. ITERATE {longest.label.pass}
  1151. FUNCTION {begin.bib}
  1152. { preamble$ empty$
  1153. 'skip$
  1154. { preamble$ write$ newline$ }
  1155. if$
  1156. "\begin{thebibliography}{" longest.label * "}" * write$ newline$
  1157. }
  1158. EXECUTE {begin.bib}
  1159. EXECUTE {init.state.consts}
  1160. ITERATE {call.type$}
  1161. %REVERSE {call.type$}
  1162. FUNCTION {end.bib}
  1163. { newline$
  1164. "\end{thebibliography}" write$ newline$
  1165. }
  1166. EXECUTE {end.bib}