Advertisement
gonmedare

myrefs.bst

Nov 11th, 2011
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.02 KB | None | 0 0
  1. % File myrefs.bst with some modifications to
  2. % "Chicago" BibTeX style, chicago.bst
  3. % ===================================
  4. %
  5.  
  6. ENTRY
  7. { address
  8. author
  9. booktitle
  10. chapter
  11. edition
  12. editor
  13. howpublished
  14. institution
  15. journal
  16. key
  17. month
  18. note
  19. number
  20. organization
  21. pages
  22. publisher
  23. school
  24. series
  25. title
  26. type
  27. volume
  28. year
  29. }
  30. {}
  31. { label.year extra.label sort.year sort.label }
  32.  
  33. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  34.  
  35. FUNCTION {init.state.consts}
  36. { #0 'before.all :=
  37. #1 'mid.sentence :=
  38. #2 'after.sentence :=
  39. #3 'after.block :=
  40. }
  41.  
  42. STRINGS { s t u }
  43.  
  44. FUNCTION {output.nonnull}
  45. { 's :=
  46. output.state mid.sentence =
  47. { ", " * write$ }
  48. { output.state after.block =
  49. { add.period$ write$
  50. newline$
  51. "\newblock " write$
  52. }
  53. { output.state before.all =
  54. 'write$
  55. { add.period$ " " * write$ }
  56. if$
  57. }
  58. if$
  59. mid.sentence 'output.state :=
  60. }
  61. if$
  62. s
  63. }
  64.  
  65. % Use a colon to separate output. Used only for address/publisher
  66. % combination in book/inbook types, address/institution for manuals,
  67. % and organization:publisher for proceedings (inproceedings).
  68. %
  69. FUNCTION {output.nonnull.colon}
  70. { 's :=
  71. output.state mid.sentence =
  72. { ": " * write$ }
  73. { output.state after.block =
  74. { add.period$ write$
  75. newline$
  76. "\newblock " write$
  77. }
  78. { output.state before.all =
  79. 'write$
  80. { add.period$ " " * write$ }
  81. if$
  82. }
  83. if$
  84. mid.sentence 'output.state :=
  85. }
  86. if$
  87. s
  88. }
  89.  
  90. FUNCTION {output}
  91. { duplicate$ empty$
  92. 'pop$
  93. 'output.nonnull
  94. if$
  95. }
  96.  
  97. FUNCTION {output.colon}
  98. { duplicate$ empty$
  99. 'pop$
  100. 'output.nonnull.colon
  101. if$
  102. }
  103.  
  104. FUNCTION {output.check}
  105. { 't :=
  106. duplicate$ empty$
  107. { pop$ "empty " t * " in " * cite$ * warning$ }
  108. 'output.nonnull
  109. if$
  110. }
  111.  
  112. FUNCTION {output.check.colon}
  113. { 't :=
  114. duplicate$ empty$
  115. { pop$ "empty " t * " in " * cite$ * warning$ }
  116. 'output.nonnull.colon
  117. if$
  118. }
  119.  
  120. FUNCTION {output.year.check}
  121. { year empty$
  122. { "empty year in " cite$ * warning$ }
  123. { write$
  124. " (" year * extra.label *
  125. month empty$
  126. { ")" * }
  127. { ", " * month * ")" * }
  128. if$
  129. mid.sentence 'output.state :=
  130. }
  131. if$
  132. }
  133.  
  134.  
  135. FUNCTION {fin.entry}
  136. { add.period$
  137. write$
  138. newline$
  139. }
  140.  
  141. FUNCTION {new.block}
  142. { output.state before.all =
  143. 'skip$
  144. { after.block 'output.state := }
  145. if$
  146. }
  147.  
  148. FUNCTION {new.sentence}
  149. { output.state after.block =
  150. 'skip$
  151. { output.state before.all =
  152. 'skip$
  153. { after.sentence 'output.state := }
  154. if$
  155. }
  156. if$
  157. }
  158.  
  159. FUNCTION {not}
  160. { { #0 }
  161. { #1 }
  162. if$
  163. }
  164.  
  165. FUNCTION {and}
  166. { 'skip$
  167. { pop$ #0 }
  168. if$
  169. }
  170.  
  171. FUNCTION {or}
  172. { { pop$ #1 }
  173. 'skip$
  174. if$
  175. }
  176.  
  177. FUNCTION {new.block.checka}
  178. { empty$
  179. 'skip$
  180. 'new.block
  181. if$
  182. }
  183.  
  184. FUNCTION {new.block.checkb}
  185. { empty$
  186. swap$ empty$
  187. and
  188. 'skip$
  189. 'new.block
  190. if$
  191. }
  192.  
  193. FUNCTION {new.sentence.checka}
  194. { empty$
  195. 'skip$
  196. 'new.sentence
  197. if$
  198. }
  199.  
  200. FUNCTION {new.sentence.checkb}
  201. { empty$
  202. swap$ empty$
  203. and
  204. 'skip$
  205. 'new.sentence
  206. if$
  207. }
  208.  
  209. FUNCTION {field.or.null}
  210. { duplicate$ empty$
  211. { pop$ "" }
  212. 'skip$
  213. if$
  214. }
  215.  
  216. %
  217. % Emphasize the top string on the stack.
  218. %
  219. FUNCTION {emphasize}
  220. { duplicate$ empty$
  221. { pop$ "" }
  222. { "{\em " swap$ * "}" * }
  223. if$
  224. }
  225.  
  226. %
  227. % Emphasize the top string on the stack, but add a trailing space.
  228. %
  229. FUNCTION {emphasize.space}
  230. { duplicate$ empty$
  231. { pop$ "" }
  232. { "{\em " swap$ * "\/}" * }
  233. if$
  234. }
  235.  
  236. INTEGERS { nameptr namesleft numnames }
  237. %
  238. % Format bibliographical entries with the first author last name first,
  239. % and subsequent authors with initials followed by last name.
  240. % All names are formatted in this routine.
  241. %
  242. FUNCTION {format.names}
  243. { 's :=
  244. #1 'nameptr := % nameptr = 1;
  245. s num.names$ 'numnames := % numnames = num.name$(s);
  246. numnames 'namesleft :=
  247. { namesleft #0 > }
  248.  
  249. { nameptr #1 =
  250. {s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := }
  251. {s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
  252. if$
  253. nameptr #1 >
  254. { namesleft #1 >
  255. { ", " * t * }
  256. { numnames #2 >
  257. { "," * }
  258. 'skip$
  259. if$
  260. t "others" =
  261. { " et~al." * }
  262. { " and " * t * } % from Chicago Manual of Style
  263. if$
  264. }
  265. if$
  266. }
  267. 't
  268. if$
  269. nameptr #1 + 'nameptr := % nameptr += 1;
  270. namesleft #1 - 'namesleft := % namesleft =- 1;
  271. }
  272. while$
  273. }
  274.  
  275. FUNCTION {my.full.label}
  276. { 's :=
  277. #1 'nameptr := % nameptr = 1;
  278. s num.names$ 'numnames := % numnames = num.name$(s);
  279. numnames 'namesleft :=
  280. { namesleft #0 > }
  281.  
  282. { s nameptr "{vv~}{ll}" format.name$ 't := % get the next name
  283. nameptr #1 >
  284. { namesleft #1 >
  285. { ", " * t * }
  286. { numnames #2 >
  287. { "," * }
  288. 'skip$
  289. if$
  290. t "others" =
  291. { " et~al." * }
  292. { " and " * t * } % from Chicago Manual of Style
  293. if$
  294. }
  295. if$
  296. }
  297. 't
  298. if$
  299. nameptr #1 + 'nameptr := % nameptr += 1;
  300. namesleft #1 - 'namesleft := % namesleft =- 1;
  301. }
  302. while$
  303.  
  304. }
  305.  
  306. FUNCTION {format.names.fml}
  307. %
  308. % Format names in "familiar" format, with first initial followed by
  309. % last name. Like format.names, ALL names are formatted.
  310. %
  311. { 's :=
  312. #1 'nameptr := % nameptr = 1;
  313. s num.names$ 'numnames := % numnames = num.name$(s);
  314. numnames 'namesleft :=
  315. { namesleft #0 > }
  316.  
  317. { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't :=
  318.  
  319. nameptr #1 >
  320. { namesleft #1 >
  321. { ", " * t * }
  322. { numnames #2 >
  323. { "," * }
  324. 'skip$
  325. if$
  326. t "others" =
  327. { " et~al." * }
  328. { " and " * t * }
  329. % { " \& " * t * }
  330. if$
  331. }
  332. if$
  333. }
  334. 't
  335. if$
  336. nameptr #1 + 'nameptr := % nameptr += 1;
  337. namesleft #1 - 'namesleft := % namesleft =- 1;
  338. }
  339. while$
  340. }
  341.  
  342. FUNCTION {format.authors}
  343. { author empty$
  344. { "" }
  345. { author format.names }
  346. if$
  347. }
  348.  
  349. FUNCTION {format.key}
  350. { empty$
  351. { key field.or.null }
  352. { "" }
  353. if$
  354. }
  355.  
  356. %
  357. % Format editor names for use in the "in" types: inbook, incollection,
  358. % inproceedings: first initial, then last names. When editors are the
  359. % LABEL for an entry, then format.editor is used which lists editors
  360. % by last name first.
  361. %
  362. FUNCTION {format.editors.fml}
  363. { editor empty$
  364. { "" }
  365. {editor num.names$ #1 >
  366. { " eds.~" * }
  367. { " ed.~" * }
  368. if$
  369. editor format.names.fml
  370. }
  371. if$
  372. }
  373.  
  374. %
  375. % Format editor names for use in labels, last names first.
  376. %
  377. FUNCTION {format.editors}
  378. { editor empty$
  379. { "" }
  380. { editor format.names
  381. editor num.names$ #1 >
  382. { " (Eds.)" * }
  383. { " (Ed.)" * }
  384. if$
  385. }
  386. if$
  387. }
  388.  
  389. FUNCTION {format.title}
  390. { title empty$
  391. { "" }
  392. { title "t" change.case$ }
  393. if$
  394. }
  395.  
  396. % Note that the APA style requres case changes
  397. % in article titles. The following does not
  398. % change cases. If you perfer it, uncomment the
  399. % following and comment out the above.
  400.  
  401. %FUNCTION {format.title}
  402. %{ title empty$
  403. % { "" }
  404. % { title }
  405. % if$
  406. %}
  407.  
  408. FUNCTION {n.dashify}
  409. { 't :=
  410. ""
  411. { t empty$ not }
  412. { t #1 #1 substring$ "-" =
  413. { t #1 #2 substring$ "--" = not
  414. { "--" *
  415. t #2 global.max$ substring$ 't :=
  416. }
  417. { { t #1 #1 substring$ "-" = }
  418. { "-" *
  419. t #2 global.max$ substring$ 't :=
  420. }
  421. while$
  422. }
  423. if$
  424. }
  425. { t #1 #1 substring$ *
  426. t #2 global.max$ substring$ 't :=
  427. }
  428. if$
  429. }
  430. while$
  431. }
  432.  
  433. FUNCTION {format.btitle}
  434. { edition empty$
  435. { title emphasize }
  436. { title empty$
  437. { title emphasize }
  438. { volume empty$ % gnp - check for volume, then don't need period
  439. { "{\em " title * "\/} (" * edition * " ed.)" * "." * }
  440. { "{\em " title * "\/} (" * edition * " ed.)" * }
  441. if$
  442. }
  443. if$
  444. }
  445. if$
  446. }
  447.  
  448. FUNCTION {format.emphasize.booktitle}
  449. { edition empty$
  450. { booktitle emphasize }
  451. { booktitle empty$
  452. { booktitle emphasize }
  453. { volume empty$ % gnp - extra period an error if book has a volume
  454. { "{\em " booktitle * "\/} (" * edition * " ed.)" * "." *}
  455. { "{\em " booktitle * "\/} (" * edition * " ed.)" * }
  456. if$
  457. }
  458. if$
  459. }
  460. if$
  461. }
  462.  
  463.  
  464. FUNCTION {tie.or.space.connect}
  465. { duplicate$ text.length$ #3 <
  466. { "~" }
  467. { " " }
  468. if$
  469. swap$ * *
  470. }
  471.  
  472. FUNCTION {either.or.check}
  473. { empty$
  474. 'pop$
  475. { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  476. if$
  477. }
  478.  
  479. FUNCTION {format.bvolume}
  480. { volume empty$
  481. { "" }
  482. { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  483. series empty$
  484. 'skip$
  485. { " of " * series emphasize * }
  486. if$
  487. "volume and number" number either.or.check
  488. }
  489. if$
  490. }
  491.  
  492. FUNCTION {format.number.series}
  493. { volume empty$
  494. { number empty$
  495. { series field.or.null }
  496. { output.state mid.sentence =
  497. { "Number" } % gnp - changed to mixed case always
  498. { "Number" }
  499. if$
  500. number tie.or.space.connect
  501. series empty$
  502. { "there's a number but no series in " cite$ * warning$ }
  503. { " in " * series * }
  504. if$
  505. }
  506. if$
  507. }
  508. { "" }
  509. if$
  510. }
  511.  
  512. INTEGERS { multiresult }
  513.  
  514. FUNCTION {multi.page.check}
  515. { 't :=
  516. #0 'multiresult :=
  517. { multiresult not
  518. t empty$ not
  519. and
  520. }
  521. { t #1 #1 substring$
  522. duplicate$ "-" =
  523. swap$ duplicate$ "," =
  524. swap$ "+" =
  525. or or
  526. { #1 'multiresult := }
  527. { t #2 global.max$ substring$ 't := }
  528. if$
  529. }
  530. while$
  531. multiresult
  532. }
  533.  
  534. FUNCTION {format.pages}
  535. { pages empty$
  536. { "" }
  537. { pages multi.page.check
  538. { "pp.\ " pages n.dashify tie.or.space.connect } % gnp - removed ()
  539. { "pp.\ " pages tie.or.space.connect }
  540. if$
  541. }
  542. if$
  543. }
  544.  
  545. % By Young (and Spencer)
  546. % GNP - fixed bugs with missing volume, number, and/or pages
  547. %
  548. % Format journal, volume, number, pages for article types.
  549. %
  550. FUNCTION {format.jour.vol}
  551. { journal empty$
  552. { "no journal in " cite$ * warning$
  553. "" }
  554. { journal emphasize.space }
  555. if$
  556. number empty$
  557. { volume empty$
  558. { "no number and no volume in " cite$ * warning$
  559. "" * }
  560. { "~{\em " * Volume * "}" * }
  561. if$
  562. }
  563. { volume empty$
  564. {"no volume for " cite$ * warning$
  565. "~(" * number * ")" * }
  566. { "~" *
  567. volume emphasize.space
  568. "(" * number * ")" * * }
  569. if$
  570. }
  571. if$
  572. pages empty$
  573. {"page numbers missing in " cite$ * warning$
  574. "" * } % gnp - place a null string on the stack for output
  575. { duplicate$ empty$
  576. { pop$ format.pages }
  577. { ", " * pages n.dashify * } % gnp - removed pp. for articles
  578. if$
  579. }
  580. if$
  581. }
  582.  
  583. FUNCTION {format.chapter.pages}
  584. { chapter empty$
  585. 'format.pages
  586. { type empty$
  587. { "Chapter" } % gnp - changed to mixed case
  588. { type "t" change.case$ }
  589. if$
  590. chapter tie.or.space.connect
  591. pages empty$
  592. {"page numbers missing in " cite$ * warning$} % gnp - added check
  593. { ", " * format.pages * }
  594. if$
  595. }
  596. if$
  597. }
  598.  
  599. FUNCTION {format.in.ed.booktitle}
  600. { booktitle empty$
  601. { "" }
  602. { editor empty$
  603. { "In " format.emphasize.booktitle * }
  604. { "In " format.emphasize.booktitle * ", " format.editors.fml * * }
  605. if$
  606. }
  607. if$
  608. }
  609.  
  610. FUNCTION {format.thesis.type}
  611. { type empty$
  612. 'skip$
  613. { pop$
  614. type "t" change.case$
  615. }
  616. if$
  617. }
  618.  
  619. FUNCTION {format.tr.number}
  620. { type empty$
  621. { "Technical Report" }
  622. 'type
  623. if$
  624. number empty$
  625. { "t" change.case$ }
  626. { number tie.or.space.connect }
  627. if$
  628. }
  629.  
  630. FUNCTION {format.article.crossref}
  631. { "See"
  632. "\citeN{" * crossref * "}" *
  633. }
  634.  
  635. FUNCTION {format.crossref.editor}
  636. { editor #1 "{vv~}{ll}" format.name$
  637. editor num.names$ duplicate$
  638. #2 >
  639. { pop$ " et~al." * }
  640. { #2 <
  641. 'skip$
  642. { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  643. { " et~al." * }
  644. { " and " * editor #2 "{vv~}{ll}" format.name$ * }
  645. if$
  646. }
  647. if$
  648. }
  649. if$
  650. }
  651.  
  652. FUNCTION {format.book.crossref}
  653. { volume empty$
  654. { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  655. "In "
  656. }
  657. { "Volume" volume tie.or.space.connect % gnp - changed to mixed case
  658. " of " *
  659. }
  660. if$
  661. editor empty$
  662. editor field.or.null author field.or.null =
  663. or
  664. { key empty$
  665. { series empty$
  666. { "need editor, key, or series for " cite$ * " to crossref " *
  667. crossref * warning$
  668. "" *
  669. }
  670. { "{\em " * series * "\/}" * }
  671. if$
  672. }
  673. { key * }
  674. if$
  675. }
  676. { format.crossref.editor * }
  677. if$
  678. " \citeN{" * crossref * "}" *
  679. }
  680.  
  681. FUNCTION {format.incoll.inproc.crossref}
  682. { "See"
  683. " \citeN{" * crossref * "}" *
  684. }
  685.  
  686. % format.lab.names:
  687. %
  688. % determines "short" names for the abbreviated author information.
  689. % "Long" labels are created in calc.label, using the routine my.full.label
  690. % to format author and editor fields.
  691. %
  692. % There are 4 cases for labels. (n=3 in the example)
  693. % a) one author Foo
  694. % b) one to n Foo, Bar and Baz
  695. % c) use of "and others" Foo, Bar et al.
  696. % d) more than n Foo et al.
  697. %
  698. FUNCTION {format.lab.names}
  699. { 's :=
  700. s num.names$ 'numnames :=
  701. numnames #2 > % change number to number of others allowed before
  702. % forcing "et al".
  703. { s #1 "{vv~}{ll}" format.name$ " et~al." * }
  704. {
  705. numnames #1 - 'namesleft :=
  706. #2 'nameptr :=
  707. s #1 "{vv~}{ll}" format.name$
  708. { namesleft #0 > }
  709. { nameptr numnames =
  710. { s nameptr "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  711. { " et~al." * }
  712. { " and " * s nameptr "{vv~}{ll}" format.name$ * }
  713. if$
  714. }
  715. { ", " * s nameptr "{vv~}{ll}" format.name$ * }
  716. if$
  717. nameptr #1 + 'nameptr :=
  718. namesleft #1 - 'namesleft :=
  719. }
  720. while$
  721. }
  722. if$
  723. }
  724.  
  725. FUNCTION {author.key.label}
  726. { author empty$
  727. { key empty$
  728. { "no key, author in " cite$ * warning$
  729. cite$ #1 #3 substring$ }
  730. 'key
  731. if$
  732. }
  733. { author format.lab.names }
  734. if$
  735. }
  736.  
  737. FUNCTION {editor.key.label}
  738. { editor empty$
  739. { key empty$
  740. { "no key, editor in " cite$ * warning$
  741. cite$ #1 #3 substring$ }
  742. 'key
  743. if$
  744. }
  745. { editor format.lab.names }
  746. if$
  747. }
  748.  
  749. FUNCTION {author.key.organization.label}
  750. %
  751. % added - gnp. Provide label formatting by organization if author is null.
  752. %
  753. { author empty$
  754. { organization empty$
  755. { key empty$
  756. { "no key, author or organization in " cite$ * warning$
  757. cite$ #1 #3 substring$ }
  758. 'key
  759. if$
  760. }
  761. { organization }
  762. if$
  763. }
  764. { author format.lab.names }
  765. if$
  766. }
  767.  
  768. FUNCTION {editor.key.organization.label}
  769. %
  770. % added - gnp. Provide label formatting by organization if editor is null.
  771. %
  772. { editor empty$
  773. { organization empty$
  774. { key empty$
  775. { "no key, editor or organization in " cite$ * warning$
  776. cite$ #1 #3 substring$ }
  777. 'key
  778. if$
  779. }
  780. { organization }
  781. if$
  782. }
  783. { editor format.lab.names }
  784. if$
  785. }
  786.  
  787. FUNCTION {author.editor.key.label}
  788. { author empty$
  789. { editor empty$
  790. { key empty$
  791. { "no key, author, or editor in " cite$ * warning$
  792. cite$ #1 #3 substring$ }
  793. 'key
  794. if$
  795. }
  796. { editor format.lab.names }
  797. if$
  798. }
  799. { author format.lab.names }
  800. if$
  801. }
  802.  
  803. FUNCTION {calc.label}
  804. %
  805. % Changed - GNP. See also author.organization.sort, editor.organization.sort
  806. % Form label for BibTeX entry. The classification of which fields are used
  807. % for which type of entry (book, inbook, etc.) are taken from alpha.bst.
  808. % The change here from newapa is to also include organization as a
  809. % citation label if author or editor is missing.
  810. %
  811. { type$ "book" =
  812. type$ "inbook" =
  813. or
  814. 'author.editor.key.label
  815. { type$ "proceedings" =
  816. 'editor.key.organization.label
  817. { type$ "manual" =
  818. 'author.key.organization.label
  819. 'author.key.label
  820. if$
  821. }
  822. if$
  823. }
  824. if$
  825.  
  826. author empty$ % generate the full label citation information.
  827. { editor empty$
  828. { organization empty$
  829. { "no author, editor, or organization in " cite$ * warning$
  830. "??" }
  831. { organization }
  832. if$
  833. }
  834. { editor my.full.label }
  835. if$
  836. }
  837. { author my.full.label }
  838. if$
  839.  
  840. % leave label on the stack, to be popped when required.
  841.  
  842. "}{" * swap$ * "}{" *
  843. % year field.or.null purify$ #-1 #4 substring$ *
  844. %
  845. % save the year for sort processing afterwards (adding a, b, c, etc.)
  846. %
  847. year field.or.null purify$ #-1 #4 substring$
  848. 'label.year :=
  849. }
  850.  
  851. FUNCTION {output.bibitem}
  852. { newline$
  853.  
  854. "\bibitem[\protect\citeauthoryear{" write$
  855. calc.label write$
  856. sort.year write$
  857. "}]{" write$
  858.  
  859. cite$ write$
  860. "}" write$
  861. newline$
  862. ""
  863. before.all 'output.state :=
  864. }
  865.  
  866. FUNCTION {article}
  867. { output.bibitem
  868. format.authors
  869. "author" output.check
  870. author format.key output % added
  871. output.year.check % added
  872. new.block
  873. format.title
  874. "title" output.check
  875. new.block
  876. crossref missing$
  877. { format.jour.vol output
  878. }
  879. { format.article.crossref output.nonnull
  880. format.pages output
  881. }
  882. if$
  883. new.block
  884. note output
  885. fin.entry
  886. }
  887.  
  888. FUNCTION {book}
  889. { output.bibitem
  890. author empty$
  891. { format.editors
  892. "author and editor" output.check }
  893. { format.authors
  894. output.nonnull
  895. crossref missing$
  896. { "author and editor" editor either.or.check }
  897. 'skip$
  898. if$
  899. }
  900. if$
  901. output.year.check % added
  902. new.block
  903. format.btitle
  904. "title" output.check
  905. crossref missing$
  906. { format.bvolume output
  907. new.block
  908. format.number.series output
  909. new.sentence
  910. address output
  911. publisher "publisher" output.check.colon
  912. }
  913. { new.block
  914. format.book.crossref output.nonnull
  915. }
  916. if$
  917. new.block
  918. note output
  919. fin.entry
  920. }
  921.  
  922. FUNCTION {booklet}
  923. { output.bibitem
  924. format.authors output
  925. author format.key output % added
  926. output.year.check % added
  927. new.block
  928. format.title
  929. "title" output.check
  930. new.block
  931. howpublished output
  932. address output
  933. new.block
  934. note output
  935. fin.entry
  936. }
  937.  
  938. FUNCTION {inbook}
  939. { output.bibitem
  940. author empty$
  941. { format.editors
  942. "author and editor" output.check
  943. }
  944. { format.authors output.nonnull
  945. crossref missing$
  946. { "author and editor" editor either.or.check }
  947. 'skip$
  948. if$
  949. }
  950. if$
  951. output.year.check % added
  952. new.block
  953. format.btitle
  954. "title" output.check
  955. crossref missing$
  956. { format.bvolume output
  957. format.chapter.pages
  958. "chapter and pages" output.check
  959. new.block
  960. format.number.series output
  961. new.sentence
  962. address output
  963. publisher
  964. "publisher" output.check.colon
  965. }
  966. { format.chapter.pages "chapter and pages" output.check
  967. new.block
  968. format.book.crossref output.nonnull
  969. }
  970. if$
  971. new.block
  972. note output
  973. fin.entry
  974. }
  975.  
  976. FUNCTION {incollection}
  977. { output.bibitem
  978. format.authors
  979. "author" output.check
  980. author format.key output % added
  981. output.year.check % added
  982. new.block
  983. format.title
  984. "title" output.check
  985. new.block
  986. crossref missing$
  987. { format.in.ed.booktitle
  988. "booktitle" output.check
  989. format.bvolume output
  990. format.number.series output
  991. new.sentence
  992. address output
  993. publisher "publisher" output.check.colon
  994. format.chapter.pages output % gnp - was special.output.nonnull
  995. % left out comma before page numbers
  996. }
  997. { format.incoll.inproc.crossref
  998. output.nonnull
  999. format.chapter.pages output
  1000. }
  1001. if$
  1002. new.block
  1003. note output
  1004. fin.entry
  1005. }
  1006.  
  1007. FUNCTION {inproceedings}
  1008. { output.bibitem
  1009. format.authors
  1010. "author" output.check
  1011. author format.key output % added
  1012. output.year.check % added
  1013. new.block
  1014. format.title
  1015. "title" output.check
  1016. new.block
  1017. crossref missing$
  1018. { format.in.ed.booktitle
  1019. "booktitle" output.check
  1020. format.bvolume output
  1021. format.number.series output
  1022. address output
  1023. format.pages output
  1024. new.sentence
  1025. organization output
  1026. publisher output.colon
  1027. }
  1028. { format.incoll.inproc.crossref output.nonnull
  1029. format.pages output
  1030. }
  1031. if$
  1032. new.block
  1033. note output
  1034. fin.entry
  1035. }
  1036.  
  1037. FUNCTION {conference} { inproceedings }
  1038.  
  1039. FUNCTION {manual}
  1040. { output.bibitem
  1041. author empty$
  1042. { editor empty$
  1043. { organization "organization" output.check
  1044. organization format.key output } % if all else fails, use key
  1045. { format.editors "author and editor" output.check }
  1046. if$
  1047. }
  1048. { format.authors output.nonnull }
  1049. if$
  1050. output.year.check % added
  1051. new.block
  1052. format.btitle
  1053. "title" output.check
  1054. organization address new.block.checkb
  1055. % Reversed the order of "address" and "organization", added the ":".
  1056. address output
  1057. organization "organization" output.check.colon
  1058. % address output
  1059. % ":" output
  1060. % organization output
  1061. new.block
  1062. note output
  1063. fin.entry
  1064. }
  1065.  
  1066. FUNCTION {mastersthesis}
  1067. { output.bibitem
  1068. format.authors
  1069. "author" output.check
  1070. author format.key output % added
  1071. output.year.check % added
  1072. new.block
  1073. format.title
  1074. "title" output.check
  1075. new.block
  1076. "Master's thesis" format.thesis.type output.nonnull
  1077. school "school" output.check
  1078. address output
  1079. new.block
  1080. note output
  1081. fin.entry
  1082. }
  1083.  
  1084. FUNCTION {misc}
  1085. { output.bibitem
  1086. format.authors output
  1087. author format.key output % added
  1088. output.year.check % added
  1089. title howpublished new.block.checkb
  1090. format.title output
  1091. new.block
  1092. howpublished output
  1093. new.block
  1094. note output
  1095. fin.entry
  1096. }
  1097.  
  1098. FUNCTION {phdthesis}
  1099. { output.bibitem
  1100. format.authors
  1101. "author" output.check
  1102. author format.key output % added
  1103. output.year.check % added
  1104. new.block
  1105. format.btitle
  1106. "title" output.check
  1107. new.block
  1108. "Ph.\ D. thesis" format.thesis.type output.nonnull
  1109. school "school" output.check
  1110. address output
  1111. new.block
  1112. note output
  1113. fin.entry
  1114. }
  1115.  
  1116. FUNCTION {proceedings}
  1117. { output.bibitem
  1118. editor empty$
  1119. { organization output
  1120. organization format.key output } % gnp - changed from author format.key
  1121. { format.editors output.nonnull }
  1122. if$
  1123. % author format.key output % gnp - removed (should be either
  1124. % editor or organization
  1125. output.year.check % added (newapa)
  1126. new.block
  1127. format.btitle
  1128. "title" output.check
  1129. format.bvolume output
  1130. format.number.series output
  1131. address output
  1132. new.sentence
  1133. organization output
  1134. publisher output.colon
  1135. new.block
  1136. note output
  1137. fin.entry
  1138. }
  1139.  
  1140. FUNCTION {techreport}
  1141. { output.bibitem
  1142. format.authors
  1143. "author" output.check
  1144. author format.key output % added
  1145. output.year.check % added
  1146. new.block
  1147. format.title
  1148. "title" output.check
  1149. new.block
  1150. format.tr.number output.nonnull
  1151. institution
  1152. "institution" output.check
  1153. address output
  1154. new.block
  1155. note output
  1156. fin.entry
  1157. }
  1158.  
  1159. FUNCTION {unpublished}
  1160. { output.bibitem
  1161. format.authors
  1162. "author" output.check
  1163. author format.key output % added
  1164. output.year.check % added
  1165. new.block
  1166. format.title
  1167. "title" output.check
  1168. new.block
  1169. note "note" output.check
  1170. fin.entry
  1171. }
  1172.  
  1173. FUNCTION {default.type} { misc }
  1174.  
  1175. MACRO {jan} {"January"}
  1176.  
  1177. MACRO {feb} {"February"}
  1178.  
  1179. MACRO {mar} {"March"}
  1180.  
  1181. MACRO {apr} {"April"}
  1182.  
  1183. MACRO {may} {"May"}
  1184.  
  1185. MACRO {jun} {"June"}
  1186.  
  1187. MACRO {jul} {"July"}
  1188.  
  1189. MACRO {aug} {"August"}
  1190.  
  1191. MACRO {sep} {"September"}
  1192.  
  1193. MACRO {oct} {"October"}
  1194.  
  1195. MACRO {nov} {"November"}
  1196.  
  1197. MACRO {dec} {"December"}
  1198.  
  1199. MACRO {acmcs} {"ACM Computing Surveys"}
  1200.  
  1201. MACRO {acta} {"Acta Informatica"}
  1202.  
  1203. MACRO {ai} {"Artificial Intelligence"}
  1204.  
  1205. MACRO {cacm} {"Communications of the ACM"}
  1206.  
  1207. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1208.  
  1209. MACRO {ibmsj} {"IBM Systems Journal"}
  1210.  
  1211. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1212.  
  1213. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1214.  
  1215. MACRO {ieeetcad}
  1216. {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1217.  
  1218. MACRO {ipl} {"Information Processing Letters"}
  1219.  
  1220. MACRO {jacm} {"Journal of the ACM"}
  1221.  
  1222. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1223.  
  1224. MACRO {scp} {"Science of Computer Programming"}
  1225.  
  1226. MACRO {sicomp} {"SIAM Journal on Computing"}
  1227.  
  1228. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1229.  
  1230. MACRO {tods} {"ACM Transactions on Database Systems"}
  1231.  
  1232. MACRO {tog} {"ACM Transactions on Graphics"}
  1233.  
  1234. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1235.  
  1236. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1237.  
  1238. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1239.  
  1240. MACRO {tcs} {"Theoretical Computer Science"}
  1241.  
  1242. READ
  1243.  
  1244. FUNCTION {sortify}
  1245. { purify$
  1246. "l" change.case$
  1247. }
  1248.  
  1249. INTEGERS { len }
  1250.  
  1251. FUNCTION {chop.word}
  1252. { 's :=
  1253. 'len :=
  1254. s #1 len substring$ =
  1255. { s len #1 + global.max$ substring$ }
  1256. 's
  1257. if$
  1258. }
  1259.  
  1260.  
  1261.  
  1262. FUNCTION {sort.format.names}
  1263. { 's :=
  1264. #1 'nameptr :=
  1265. ""
  1266. s num.names$ 'numnames :=
  1267. numnames 'namesleft :=
  1268. { namesleft #0 > }
  1269. { nameptr #1 >
  1270. { " " * }
  1271. 'skip$
  1272. if$
  1273. s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't :=
  1274. nameptr numnames = t "others" = and
  1275. { " et~al" * }
  1276. { t sortify * }
  1277. if$
  1278. nameptr #1 + 'nameptr :=
  1279. namesleft #1 - 'namesleft :=
  1280. }
  1281. while$
  1282. }
  1283.  
  1284. FUNCTION {sort.format.title}
  1285. { 't :=
  1286. "A " #2
  1287. "An " #3
  1288. "The " #4 t chop.word
  1289. chop.word
  1290. chop.word
  1291. sortify
  1292. #1 global.max$ substring$
  1293. }
  1294.  
  1295. FUNCTION {author.sort}
  1296. { author empty$
  1297. { key empty$
  1298. { "to sort, need author or key in " cite$ * warning$
  1299. "" }
  1300. { key sortify }
  1301. if$
  1302. }
  1303. { author sort.format.names }
  1304. if$
  1305. }
  1306.  
  1307. FUNCTION {editor.sort}
  1308. { editor empty$
  1309. { key empty$
  1310. { "to sort, need editor or key in " cite$ * warning$
  1311. ""
  1312. }
  1313. { key sortify }
  1314. if$
  1315. }
  1316. { editor sort.format.names }
  1317. if$
  1318. }
  1319.  
  1320. FUNCTION {author.editor.sort}
  1321. { author empty$
  1322. { "missing author in " cite$ * warning$
  1323. editor empty$
  1324. { key empty$
  1325. { "to sort, need author, editor, or key in " cite$ * warning$
  1326. ""
  1327. }
  1328. { key sortify }
  1329. if$
  1330. }
  1331. { editor sort.format.names }
  1332. if$
  1333. }
  1334. { author sort.format.names }
  1335. if$
  1336. }
  1337.  
  1338. FUNCTION {author.organization.sort}
  1339. %
  1340. % added - GNP. Stack author or organization for sorting (from alpha.bst).
  1341. % Unlike alpha.bst, we need entire names, not abbreviations
  1342. %
  1343. { author empty$
  1344. { organization empty$
  1345. { key empty$
  1346. { "to sort, need author, organization, or key in " cite$ * warning$
  1347. ""
  1348. }
  1349. { key sortify }
  1350. if$
  1351. }
  1352. { organization sortify }
  1353. if$
  1354. }
  1355. { author sort.format.names }
  1356. if$
  1357. }
  1358.  
  1359. FUNCTION {editor.organization.sort}
  1360. %
  1361. % added - GNP. Stack editor or organization for sorting (from alpha.bst).
  1362. % Unlike alpha.bst, we need entire names, not abbreviations
  1363. %
  1364. { editor empty$
  1365. { organization empty$
  1366. { key empty$
  1367. { "to sort, need editor, organization, or key in " cite$ * warning$
  1368. ""
  1369. }
  1370. { key sortify }
  1371. if$
  1372. }
  1373. { organization sortify }
  1374. if$
  1375. }
  1376. { editor sort.format.names }
  1377. if$
  1378. }
  1379.  
  1380. FUNCTION {presort}
  1381. %
  1382. % Presort creates the bibentry's label via a call to calc.label, and then
  1383. % sorts the entries based on entry type. Chicago.bst adds support for
  1384. % including organizations as the sort key; the following is stolen from
  1385. % alpha.bst.
  1386. %
  1387. { calc.label sortify % recalculate bibitem label
  1388. year field.or.null purify$ #-1 #4 substring$ * % add year
  1389. " "
  1390. *
  1391. type$ "book" =
  1392. type$ "inbook" =
  1393. or
  1394. 'author.editor.sort
  1395. { type$ "proceedings" =
  1396. 'editor.organization.sort
  1397. { type$ "manual" =
  1398. 'author.organization.sort
  1399. 'author.sort
  1400. if$
  1401. }
  1402. if$
  1403. }
  1404. if$
  1405. #1 entry.max$ substring$ % added for newapa
  1406. 'sort.label := % added for newapa
  1407. sort.label % added for newapa
  1408. *
  1409. " "
  1410. *
  1411. title field.or.null
  1412. sort.format.title
  1413. *
  1414. #1 entry.max$ substring$
  1415. 'sort.key$ :=
  1416. }
  1417.  
  1418. ITERATE {presort}
  1419.  
  1420. SORT % by label, year, author/editor, title
  1421.  
  1422. STRINGS { last.label next.extra }
  1423.  
  1424. INTEGERS { last.extra.num }
  1425.  
  1426. FUNCTION {initialize.extra.label.stuff}
  1427. { #0 int.to.chr$ 'last.label :=
  1428. "" 'next.extra :=
  1429. #0 'last.extra.num :=
  1430. }
  1431.  
  1432. FUNCTION {forward.pass}
  1433. %
  1434. % Pass through all entries, comparing current entry to last one.
  1435. % Need to concatenate year to the stack (done by calc.label) to determine
  1436. % if two entries are the same (see presort)
  1437. %
  1438. { last.label
  1439. calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
  1440. #1 entry.max$ substring$ = % are they equal?
  1441. { last.extra.num #1 + 'last.extra.num :=
  1442. last.extra.num int.to.chr$ 'extra.label :=
  1443. }
  1444. { "a" chr.to.int$ 'last.extra.num :=
  1445. "" 'extra.label :=
  1446. calc.label year field.or.null purify$ #-1 #4 substring$ * % add year
  1447. #1 entry.max$ substring$ 'last.label := % assign to last.label
  1448. }
  1449. if$
  1450. }
  1451.  
  1452. FUNCTION {reverse.pass}
  1453. { next.extra "b" =
  1454. { "a" 'extra.label := }
  1455. 'skip$
  1456. if$
  1457. label.year extra.label * 'sort.year :=
  1458. extra.label 'next.extra :=
  1459. }
  1460.  
  1461. EXECUTE {initialize.extra.label.stuff}
  1462.  
  1463. ITERATE {forward.pass}
  1464.  
  1465. REVERSE {reverse.pass}
  1466.  
  1467. FUNCTION {bib.sort.order}
  1468. { sort.label
  1469. " "
  1470. *
  1471. year field.or.null sortify
  1472. *
  1473. " "
  1474. *
  1475. title field.or.null
  1476. sort.format.title
  1477. *
  1478. #1 entry.max$ substring$
  1479. 'sort.key$ :=
  1480. }
  1481.  
  1482. ITERATE {bib.sort.order}
  1483.  
  1484. SORT % by sort.label, year, title --- giving final bib. order.
  1485.  
  1486. FUNCTION {begin.bib}
  1487.  
  1488. { preamble$ empty$
  1489. 'skip$
  1490. { preamble$ write$ newline$ }
  1491. if$
  1492. "\begin{thebibliography}{}" write$ newline$
  1493. }
  1494.  
  1495.  
  1496. EXECUTE {begin.bib}
  1497.  
  1498. EXECUTE {init.state.consts}
  1499.  
  1500. ITERATE {call.type$}
  1501.  
  1502. FUNCTION {end.bib}
  1503. { newline$
  1504. "\end{thebibliography}" write$ newline$
  1505. }
  1506.  
  1507. EXECUTE {end.bib}
  1508.  
  1509.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement