You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1134 lines
19 KiB

25 years ago
  1. % ACM Transactions bibliography style (24-Jan-88 version)
  2. % A lot like abbrv.bst, but names come out "Last, initials", and in \sc.
  3. % Some dates are parenthesized.
  4. %
  5. % History
  6. % 2/ 6/86 (HWT) Original version, by Howard Trickey.
  7. % 3/ 5/86 (HWT) Put in pp. everywhere but articles, as per ACM style.
  8. % 1/24/88 (OP&HWT) Updated for BibTeX version 0.99a, Oren Patashnik;
  9. % corrected the abbreviations to "Mar." and "Sept.";
  10. % THIS `acm' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
  11. ENTRY
  12. { address
  13. author
  14. booktitle
  15. chapter
  16. edition
  17. editor
  18. howpublished
  19. institution
  20. journal
  21. key
  22. month
  23. note
  24. number
  25. organization
  26. pages
  27. publisher
  28. school
  29. series
  30. title
  31. type
  32. volume
  33. year
  34. }
  35. {}
  36. { label }
  37. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  38. FUNCTION {init.state.consts}
  39. { #0 'before.all :=
  40. #1 'mid.sentence :=
  41. #2 'after.sentence :=
  42. #3 'after.block :=
  43. }
  44. STRINGS { s t }
  45. FUNCTION {output.nonnull}
  46. { 's :=
  47. output.state mid.sentence =
  48. { ", " * write$ }
  49. { output.state after.block =
  50. { add.period$ write$
  51. newline$
  52. "\newblock " write$
  53. }
  54. { output.state before.all =
  55. 'write$
  56. { add.period$ " " * write$ }
  57. if$
  58. }
  59. if$
  60. mid.sentence 'output.state :=
  61. }
  62. if$
  63. s
  64. }
  65. FUNCTION {output}
  66. { duplicate$ empty$
  67. 'pop$
  68. 'output.nonnull
  69. if$
  70. }
  71. FUNCTION {output.check}
  72. { 't :=
  73. duplicate$ empty$
  74. { pop$ "empty " t * " in " * cite$ * warning$ }
  75. 'output.nonnull
  76. if$
  77. }
  78. FUNCTION {output.bibitem}
  79. { newline$
  80. "\bibitem{" write$
  81. cite$ write$
  82. "}" write$
  83. newline$
  84. ""
  85. before.all 'output.state :=
  86. }
  87. FUNCTION {fin.entry}
  88. { add.period$
  89. write$
  90. newline$
  91. }
  92. FUNCTION {new.block}
  93. { output.state before.all =
  94. 'skip$
  95. { after.block 'output.state := }
  96. if$
  97. }
  98. FUNCTION {new.sentence}
  99. { output.state after.block =
  100. 'skip$
  101. { output.state before.all =
  102. 'skip$
  103. { after.sentence 'output.state := }
  104. if$
  105. }
  106. if$
  107. }
  108. FUNCTION {not}
  109. { { #0 }
  110. { #1 }
  111. if$
  112. }
  113. FUNCTION {and}
  114. { 'skip$
  115. { pop$ #0 }
  116. if$
  117. }
  118. FUNCTION {or}
  119. { { pop$ #1 }
  120. 'skip$
  121. if$
  122. }
  123. FUNCTION {new.block.checka}
  124. { empty$
  125. 'skip$
  126. 'new.block
  127. if$
  128. }
  129. FUNCTION {new.block.checkb}
  130. { empty$
  131. swap$ empty$
  132. and
  133. 'skip$
  134. 'new.block
  135. if$
  136. }
  137. FUNCTION {field.or.null}
  138. { duplicate$ empty$
  139. { pop$ "" }
  140. 'skip$
  141. if$
  142. }
  143. FUNCTION {emphasize}
  144. { duplicate$ empty$
  145. { pop$ "" }
  146. { "{\em " swap$ * "}" * }
  147. if$
  148. }
  149. FUNCTION {emphasizeic}
  150. { duplicate$ empty$
  151. { pop$ "" }
  152. { "{\em " swap$ * "\/}" * }
  153. if$
  154. }
  155. FUNCTION {scapify}
  156. { duplicate$ empty$
  157. { pop$ "" }
  158. { "{\sc " swap$ * "}" * }
  159. if$
  160. }
  161. INTEGERS { nameptr namesleft numnames }
  162. FUNCTION {format.names}
  163. { 's :=
  164. #1 'nameptr :=
  165. s num.names$ 'numnames :=
  166. numnames 'namesleft :=
  167. { namesleft #0 > }
  168. { s nameptr "{vv~}{ff }{ll}{, jj}" format.name$ 't :=
  169. nameptr #1 >
  170. { namesleft #1 >
  171. { ", " * t * }
  172. { t "others" =
  173. { ", et~al." * }
  174. { ", and " * t * }
  175. if$
  176. }
  177. if$
  178. }
  179. 't
  180. if$
  181. nameptr #1 + 'nameptr :=
  182. namesleft #1 - 'namesleft :=
  183. }
  184. while$
  185. }
  186. % For names inside entries (e.g., editors of an "In ...");
  187. % this is exactly ABBRV.BST's `format.names' function.
  188. FUNCTION {format.innames}
  189. { 's :=
  190. #1 'nameptr :=
  191. s num.names$ 'numnames :=
  192. numnames 'namesleft :=
  193. { namesleft #0 > }
  194. { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
  195. nameptr #1 >
  196. { namesleft #1 >
  197. { ", " * t * }
  198. { numnames #2 >
  199. { "," * }
  200. 'skip$
  201. if$
  202. t "others" =
  203. { " et~al." * }
  204. { " and " * t * }
  205. if$
  206. }
  207. if$
  208. }
  209. 't
  210. if$
  211. nameptr #1 + 'nameptr :=
  212. namesleft #1 - 'namesleft :=
  213. }
  214. while$
  215. }
  216. FUNCTION {format.authors}
  217. { author empty$
  218. { "" }
  219. { author format.names scapify }
  220. if$
  221. }
  222. FUNCTION {format.editors}
  223. { editor empty$
  224. { "" }
  225. { editor format.names scapify
  226. editor num.names$ #1 >
  227. { ", Eds." * }
  228. { ", Ed." * }
  229. if$
  230. }
  231. if$
  232. }
  233. FUNCTION {format.ineditors}
  234. { editor empty$
  235. { "" }
  236. { editor format.innames
  237. editor num.names$ #1 >
  238. { ", Eds." * }
  239. { ", Ed." * }
  240. if$
  241. }
  242. if$
  243. }
  244. FUNCTION {format.title}
  245. { title empty$
  246. { "" }
  247. { title }
  248. if$
  249. }
  250. FUNCTION {n.dashify}
  251. { 't :=
  252. ""
  253. { t empty$ not }
  254. { t #1 #1 substring$ "-" =
  255. { t #1 #2 substring$ "--" = not
  256. { "--" *
  257. t #2 global.max$ substring$ 't :=
  258. }
  259. { { t #1 #1 substring$ "-" = }
  260. { "-" *
  261. t #2 global.max$ substring$ 't :=
  262. }
  263. while$
  264. }
  265. if$
  266. }
  267. { t #1 #1 substring$ *
  268. t #2 global.max$ substring$ 't :=
  269. }
  270. if$
  271. }
  272. while$
  273. }
  274. FUNCTION {format.date}
  275. { year empty$
  276. { month empty$
  277. { "" }
  278. { "there's a month but no year in " cite$ * warning$
  279. month
  280. }
  281. if$
  282. }
  283. { month empty$
  284. 'year
  285. { month " " * year * }
  286. if$
  287. }
  288. if$
  289. }
  290. FUNCTION {format.btitle}
  291. { title emphasize
  292. }
  293. FUNCTION {tie.or.space.connect}
  294. { duplicate$ text.length$ #3 <
  295. { "~" }
  296. { " " }
  297. if$
  298. swap$ * *
  299. }
  300. FUNCTION {either.or.check}
  301. { empty$
  302. 'pop$
  303. { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  304. if$
  305. }
  306. FUNCTION {format.bvolume}
  307. { volume empty$
  308. { "" }
  309. { "vol.~" volume *
  310. series empty$
  311. 'skip$
  312. { " of " * series emphasize * }
  313. if$
  314. "volume and number" number either.or.check
  315. }
  316. if$
  317. }
  318. FUNCTION {format.number.series}
  319. { volume empty$
  320. { number empty$
  321. { series field.or.null }
  322. { output.state mid.sentence =
  323. { "no.~" }
  324. { "No.~" }
  325. if$
  326. number *
  327. series empty$
  328. { "there's a number but no series in " cite$ * warning$ }
  329. { " in " * series * }
  330. if$
  331. }
  332. if$
  333. }
  334. { "" }
  335. if$
  336. }
  337. FUNCTION {format.edition}
  338. { edition empty$
  339. { "" }
  340. { output.state mid.sentence =
  341. { edition "l" change.case$ "~ed." * }
  342. { edition "t" change.case$ "~ed." * }
  343. if$
  344. }
  345. if$
  346. }
  347. FUNCTION {format.pages}
  348. { pages empty$
  349. { "" }
  350. { pages n.dashify }
  351. if$
  352. }
  353. INTEGERS { multiresult }
  354. FUNCTION {multi.page.check}
  355. { 't :=
  356. #0 'multiresult :=
  357. { multiresult not
  358. t empty$ not
  359. and
  360. }
  361. { t #1 #1 substring$
  362. duplicate$ "-" =
  363. swap$ duplicate$ "," =
  364. swap$ "+" =
  365. or or
  366. { #1 'multiresult := }
  367. { t #2 global.max$ substring$ 't := }
  368. if$
  369. }
  370. while$
  371. multiresult
  372. }
  373. FUNCTION {format.pp.pages}
  374. { pages empty$
  375. { "" }
  376. { pages multi.page.check
  377. { "pp.~" pages n.dashify * }
  378. { "p.~" pages * }
  379. if$
  380. }
  381. if$
  382. }
  383. FUNCTION {format.journal.vol.num.date}
  384. { journal empty$
  385. { "empty journal in " cite$ * warning$
  386. ""
  387. }
  388. { journal
  389. volume empty$
  390. 'skip$
  391. { " " * volume * }
  392. if$
  393. number empty$
  394. 'emphasizeic
  395. { emphasize ", " * number * }
  396. if$
  397. year empty$
  398. { "empty year in " cite$ * warning$ }
  399. { " (" * format.date * ")" * }
  400. if$
  401. }
  402. if$
  403. }
  404. FUNCTION {format.chapter.pages}
  405. { chapter empty$
  406. 'format.pp.pages
  407. { type empty$
  408. { "ch.~" chapter * }
  409. { type "l" change.case$ chapter tie.or.space.connect }
  410. if$
  411. pages empty$
  412. 'skip$
  413. { ", " * format.pp.pages * }
  414. if$
  415. }
  416. if$
  417. }
  418. FUNCTION {format.in.ed.booktitle}
  419. { booktitle empty$
  420. { "" }
  421. { "In " booktitle emphasize *
  422. editor empty$
  423. 'skip$
  424. { ", " * format.ineditors * }
  425. if$
  426. }
  427. if$
  428. }
  429. % The proceedings title (it's on the stack) gets an (address, date) appended
  430. FUNCTION {format.proc.date}
  431. { duplicate$ empty$
  432. { pop$ "" }
  433. { year empty$
  434. { "empty year in " cite$ * warning$
  435. address empty$
  436. 'emphasize
  437. { emphasizeic
  438. " (" * address * ")" *
  439. }
  440. if$
  441. }
  442. { emphasizeic
  443. " (" *
  444. address empty$
  445. 'skip$
  446. { address * ", " * }
  447. if$
  448. format.date *
  449. ")" *
  450. }
  451. if$
  452. }
  453. if$
  454. }
  455. FUNCTION {format.in.proc.date}
  456. { booktitle empty$
  457. { "" }
  458. { "In " booktitle format.proc.date * }
  459. if$
  460. }
  461. FUNCTION {empty.misc.check}
  462. { author empty$ title empty$ howpublished empty$
  463. month empty$ year empty$ note empty$
  464. and and and and and
  465. key empty$ not and
  466. { "all relevant fields are empty in " cite$ * warning$ }
  467. 'skip$
  468. if$
  469. }
  470. FUNCTION {format.thesis.type}
  471. { type empty$
  472. 'skip$
  473. { pop$
  474. type "t" change.case$
  475. }
  476. if$
  477. }
  478. FUNCTION {format.tr.number}
  479. { type empty$
  480. { "Tech. Rep." }
  481. 'type
  482. if$
  483. number empty$
  484. { "t" change.case$ }
  485. { number tie.or.space.connect }
  486. if$
  487. }
  488. FUNCTION {format.article.crossref}
  489. { key empty$
  490. { journal empty$
  491. { "need key or journal for " cite$ * " to crossref " * crossref *
  492. warning$
  493. ""
  494. }
  495. { "In {\em " journal * "\/}" * }
  496. if$
  497. }
  498. { "In " key * }
  499. if$
  500. " \cite{" * crossref * "}" *
  501. }
  502. FUNCTION {format.crossref.editor}
  503. { editor #1 "{vv~}{ll}" format.name$
  504. editor num.names$ duplicate$
  505. #2 >
  506. { pop$ " et~al." * }
  507. { #2 <
  508. 'skip$
  509. { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  510. { " et~al." * }
  511. { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  512. if$
  513. }
  514. if$
  515. }
  516. if$
  517. }
  518. FUNCTION {format.book.crossref}
  519. { volume empty$
  520. { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  521. "In "
  522. }
  523. { "Vol.~" volume *
  524. " of " *
  525. }
  526. if$
  527. editor empty$
  528. editor field.or.null author field.or.null =
  529. or
  530. { key empty$
  531. { series empty$
  532. { "need editor, key, or series for " cite$ * " to crossref " *
  533. crossref * warning$
  534. "" *
  535. }
  536. { "{\em " * series * "\/}" * }
  537. if$
  538. }
  539. { key * }
  540. if$
  541. }
  542. { format.crossref.editor * }
  543. if$
  544. " \cite{" * crossref * "}" *
  545. }
  546. FUNCTION {format.incoll.inproc.crossref}
  547. { editor empty$
  548. editor field.or.null author field.or.null =
  549. or
  550. { key empty$
  551. { booktitle empty$
  552. { "need editor, key, or booktitle for " cite$ * " to crossref " *
  553. crossref * warning$
  554. ""
  555. }
  556. { "In {\em " booktitle * "\/}" * }
  557. if$
  558. }
  559. { "In " key * }
  560. if$
  561. }
  562. { "In " format.crossref.editor * }
  563. if$
  564. " \cite{" * crossref * "}" *
  565. }
  566. FUNCTION {article}
  567. { output.bibitem
  568. format.authors "author" output.check
  569. new.block
  570. format.title "title" output.check
  571. new.block
  572. crossref missing$
  573. { format.journal.vol.num.date output
  574. format.pages output
  575. }
  576. { format.article.crossref output.nonnull
  577. format.pp.pages output
  578. }
  579. if$
  580. new.block
  581. note output
  582. fin.entry
  583. }
  584. FUNCTION {book}
  585. { output.bibitem
  586. author empty$
  587. { format.editors "author and editor" output.check }
  588. { format.authors output.nonnull
  589. crossref missing$
  590. { "author and editor" editor either.or.check }
  591. 'skip$
  592. if$
  593. }
  594. if$
  595. new.block
  596. format.btitle "title" output.check
  597. format.edition output
  598. crossref missing$
  599. { format.bvolume output
  600. new.block
  601. format.number.series output
  602. new.sentence
  603. publisher "publisher" output.check
  604. address output
  605. }
  606. { new.block
  607. format.book.crossref output.nonnull
  608. }
  609. if$
  610. format.date "year" output.check
  611. new.block
  612. note output
  613. fin.entry
  614. }
  615. FUNCTION {booklet}
  616. { output.bibitem
  617. format.authors output
  618. new.block
  619. format.title "title" output.check
  620. howpublished address new.block.checkb
  621. howpublished output
  622. address output
  623. format.date output
  624. new.block
  625. note output
  626. fin.entry
  627. }
  628. FUNCTION {inbook}
  629. { output.bibitem
  630. author empty$
  631. { format.editors "author and editor" output.check }
  632. { format.authors output.nonnull
  633. crossref missing$
  634. { "author and editor" editor either.or.check }
  635. 'skip$
  636. if$
  637. }
  638. if$
  639. new.block
  640. format.btitle "title" output.check
  641. format.edition output
  642. crossref missing$
  643. { format.bvolume output
  644. new.block
  645. format.number.series output
  646. new.sentence
  647. publisher "publisher" output.check
  648. address output
  649. }
  650. { new.block
  651. format.book.crossref output.nonnull
  652. }
  653. if$
  654. format.date "year" output.check
  655. format.chapter.pages "chapter and pages" output.check
  656. new.block
  657. note output
  658. fin.entry
  659. }
  660. FUNCTION {incollection}
  661. { output.bibitem
  662. format.authors "author" output.check
  663. new.block
  664. format.title "title" output.check
  665. new.block
  666. crossref missing$
  667. { format.in.ed.booktitle "booktitle" output.check
  668. format.edition output
  669. format.bvolume output
  670. format.number.series output
  671. new.sentence
  672. publisher "publisher" output.check
  673. address output
  674. format.date "year" output.check
  675. }
  676. { format.incoll.inproc.crossref output.nonnull }
  677. if$
  678. format.chapter.pages output
  679. new.block
  680. note output
  681. fin.entry
  682. }
  683. FUNCTION {inproceedings}
  684. { output.bibitem
  685. format.authors "author" output.check
  686. new.block
  687. format.title "title" output.check
  688. new.block
  689. crossref missing$
  690. { format.in.proc.date "booktitle" output.check
  691. format.ineditors output
  692. format.bvolume output
  693. format.number.series output
  694. organization output
  695. publisher output
  696. }
  697. { format.incoll.inproc.crossref output.nonnull }
  698. if$
  699. format.pp.pages output
  700. new.block
  701. note output
  702. fin.entry
  703. }
  704. FUNCTION {conference} { inproceedings }
  705. FUNCTION {manual}
  706. { output.bibitem
  707. author empty$
  708. { organization scapify output }
  709. { format.authors output.nonnull }
  710. if$
  711. new.block
  712. format.btitle "title" output.check
  713. format.edition output
  714. author empty$
  715. { address new.block.checka }
  716. { organization address new.block.checkb
  717. organization output
  718. }
  719. if$
  720. address output
  721. format.date output
  722. new.block
  723. note output
  724. fin.entry
  725. }
  726. FUNCTION {mastersthesis}
  727. { output.bibitem
  728. format.authors "author" output.check
  729. new.block
  730. format.title "title" output.check
  731. new.block
  732. "Master's thesis" format.thesis.type output.nonnull
  733. school "school" output.check
  734. address output
  735. format.date "year" output.check
  736. new.block
  737. note output
  738. fin.entry
  739. }
  740. FUNCTION {misc}
  741. { output.bibitem
  742. format.authors output
  743. title howpublished new.block.checkb
  744. format.title output
  745. howpublished new.block.checka
  746. howpublished output
  747. format.date output
  748. new.block
  749. note output
  750. fin.entry
  751. empty.misc.check
  752. }
  753. FUNCTION {phdthesis}
  754. { output.bibitem
  755. format.authors "author" output.check
  756. new.block
  757. format.btitle "title" output.check
  758. new.block
  759. "PhD thesis" format.thesis.type output.nonnull
  760. school "school" output.check
  761. address output
  762. format.date "year" output.check
  763. new.block
  764. note output
  765. fin.entry
  766. }
  767. FUNCTION {proceedings}
  768. { output.bibitem
  769. editor empty$
  770. { organization scapify output }
  771. { format.editors output.nonnull }
  772. if$
  773. new.block
  774. title format.proc.date "title" output.check
  775. format.bvolume output
  776. format.number.series output
  777. editor empty$
  778. 'skip$
  779. { organization output }
  780. if$
  781. publisher output
  782. new.block
  783. note output
  784. fin.entry
  785. }
  786. FUNCTION {techreport}
  787. { output.bibitem
  788. format.authors "author" output.check
  789. new.block
  790. format.title "title" output.check
  791. new.block
  792. format.tr.number output.nonnull
  793. institution "institution" output.check
  794. address output
  795. format.date "year" output.check
  796. new.block
  797. note output
  798. fin.entry
  799. }
  800. FUNCTION {unpublished}
  801. { output.bibitem
  802. format.authors "author" output.check
  803. new.block
  804. format.title "title" output.check
  805. new.block
  806. note "note" output.check
  807. format.date output
  808. fin.entry
  809. }
  810. FUNCTION {default.type} { misc }
  811. MACRO {jan} {"Jan."}
  812. MACRO {feb} {"Feb."}
  813. MACRO {mar} {"Mar."}
  814. MACRO {apr} {"Apr."}
  815. MACRO {may} {"May"}
  816. MACRO {jun} {"June"}
  817. MACRO {jul} {"July"}
  818. MACRO {aug} {"Aug."}
  819. MACRO {sep} {"Sept."}
  820. MACRO {oct} {"Oct."}
  821. MACRO {nov} {"Nov."}
  822. MACRO {dec} {"Dec."}
  823. MACRO {acmcs} {"ACM Comput. Surv."}
  824. MACRO {acta} {"Acta Inf."}
  825. MACRO {cacm} {"Commun. ACM"}
  826. MACRO {ibmjrd} {"IBM J. Res. Dev."}
  827. MACRO {ibmsj} {"IBM Syst.~J."}
  828. MACRO {ieeese} {"IEEE Trans. Softw. Eng."}
  829. MACRO {ieeetc} {"IEEE Trans. Comput."}
  830. MACRO {ieeetcad}
  831. {"IEEE Trans. Comput.-Aided Design Integrated Circuits"}
  832. MACRO {ipl} {"Inf. Process. Lett."}
  833. MACRO {jacm} {"J.~ACM"}
  834. MACRO {jcss} {"J.~Comput. Syst. Sci."}
  835. MACRO {scp} {"Sci. Comput. Programming"}
  836. MACRO {sicomp} {"SIAM J. Comput."}
  837. MACRO {tocs} {"ACM Trans. Comput. Syst."}
  838. MACRO {tods} {"ACM Trans. Database Syst."}
  839. MACRO {tog} {"ACM Trans. Gr."}
  840. MACRO {toms} {"ACM Trans. Math. Softw."}
  841. MACRO {toois} {"ACM Trans. Office Inf. Syst."}
  842. MACRO {toplas} {"ACM Trans. Program. Lang. Syst."}
  843. MACRO {tcs} {"Theoretical Comput. Sci."}
  844. READ
  845. FUNCTION {sortify}
  846. { purify$
  847. "l" change.case$
  848. }
  849. INTEGERS { len }
  850. FUNCTION {chop.word}
  851. { 's :=
  852. 'len :=
  853. s #1 len substring$ =
  854. { s len #1 + global.max$ substring$ }
  855. 's
  856. if$
  857. }
  858. FUNCTION {sort.format.names}
  859. { 's :=
  860. #1 'nameptr :=
  861. ""
  862. s num.names$ 'numnames :=
  863. numnames 'namesleft :=
  864. { namesleft #0 > }
  865. { nameptr #1 >
  866. { " " * }
  867. 'skip$
  868. if$
  869. s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't :=
  870. nameptr numnames = t "others" = and
  871. { "et al" * }
  872. { t sortify * }
  873. if$
  874. nameptr #1 + 'nameptr :=
  875. namesleft #1 - 'namesleft :=
  876. }
  877. while$
  878. }
  879. FUNCTION {sort.format.title}
  880. { 't :=
  881. "A " #2
  882. "An " #3
  883. "The " #4 t chop.word
  884. chop.word
  885. chop.word
  886. sortify
  887. #1 global.max$ substring$
  888. }
  889. FUNCTION {author.sort}
  890. { author empty$
  891. { key empty$
  892. { "to sort, need author or key in " cite$ * warning$
  893. ""
  894. }
  895. { key sortify }
  896. if$
  897. }
  898. { author sort.format.names }
  899. if$
  900. }
  901. FUNCTION {author.editor.sort}
  902. { author empty$
  903. { editor empty$
  904. { key empty$
  905. { "to sort, need author, editor, or key in " cite$ * warning$
  906. ""
  907. }
  908. { key sortify }
  909. if$
  910. }
  911. { editor sort.format.names }
  912. if$
  913. }
  914. { author sort.format.names }
  915. if$
  916. }
  917. FUNCTION {author.organization.sort}
  918. { author empty$
  919. { organization empty$
  920. { key empty$
  921. { "to sort, need author, organization, or key in " cite$ * warning$
  922. ""
  923. }
  924. { key sortify }
  925. if$
  926. }
  927. { "The " #4 organization chop.word sortify }
  928. if$
  929. }
  930. { author sort.format.names }
  931. if$
  932. }
  933. FUNCTION {editor.organization.sort}
  934. { editor empty$
  935. { organization empty$
  936. { key empty$
  937. { "to sort, need editor, organization, or key in " cite$ * warning$
  938. ""
  939. }
  940. { key sortify }
  941. if$
  942. }
  943. { "The " #4 organization chop.word sortify }
  944. if$
  945. }
  946. { editor sort.format.names }
  947. if$
  948. }
  949. FUNCTION {presort}
  950. { type$ "book" =
  951. type$ "inbook" =
  952. or
  953. 'author.editor.sort
  954. { type$ "proceedings" =
  955. 'editor.organization.sort
  956. { type$ "manual" =
  957. 'author.organization.sort
  958. 'author.sort
  959. if$
  960. }
  961. if$
  962. }
  963. if$
  964. " "
  965. *
  966. year field.or.null sortify
  967. *
  968. " "
  969. *
  970. title field.or.null
  971. sort.format.title
  972. *
  973. #1 entry.max$ substring$
  974. 'sort.key$ :=
  975. }
  976. ITERATE {presort}
  977. SORT
  978. STRINGS { longest.label }
  979. INTEGERS { number.label longest.label.width }
  980. FUNCTION {initialize.longest.label}
  981. { "" 'longest.label :=
  982. #1 'number.label :=
  983. #0 'longest.label.width :=
  984. }
  985. FUNCTION {longest.label.pass}
  986. { number.label int.to.str$ 'label :=
  987. number.label #1 + 'number.label :=
  988. label width$ longest.label.width >
  989. { label 'longest.label :=
  990. label width$ 'longest.label.width :=
  991. }
  992. 'skip$
  993. if$
  994. }
  995. EXECUTE {initialize.longest.label}
  996. ITERATE {longest.label.pass}
  997. FUNCTION {begin.bib}
  998. { preamble$ empty$
  999. 'skip$
  1000. { preamble$ write$ newline$ }
  1001. if$
  1002. "\begin{thebibliography}{" longest.label * "}" * write$ newline$
  1003. }
  1004. EXECUTE {begin.bib}
  1005. EXECUTE {init.state.consts}
  1006. ITERATE {call.type$}
  1007. FUNCTION {end.bib}
  1008. { newline$
  1009. "\end{thebibliography}" write$ newline$
  1010. }
  1011. EXECUTE {end.bib}