Advertisement
Guest User

modified_apalike

a guest
Sep 18th, 2018
485
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BibTeX 29.98 KB | None | 0 0
  1. % BibTeX `apalike' bibliography style (24-Jan-88 version)
  2. % Adapted from the `alpha' style, version 0.99a; for BibTeX version 0.99a.
  3. % Copyright (C) 1988, all rights reserved.
  4. % Copying of this file is allowed, provided that if you make any changes at all
  5. % you name it something other than `apalike.bst'.
  6. % This restriction helps ensure that all copies are identical.
  7. % Differences between this style and `alpha' are generally heralded by a `%'.
  8. % The file btxbst.doc has the documentation for alpha.bst.
  9. %
  10. % This style should be used with the `apalike' LaTeX style (apalike.sty).
  11. % \cite's come out like "(Jones, 1986)" in the text but there are no labels
  12. % in the bibliography, and something like "(1986)" comes out immediately
  13. % after the author.  Author (and editor) names appear as last name, comma,
  14. % initials.  A `year' field is required for every entry, and so is either
  15. % an author (or in some cases, an editor) field or a key field.
  16. %
  17. % Editorial note:
  18. % Many journals require a style like `apalike', but I strongly, strongly,
  19. % strongly recommend that you not use it if you have a choice---use something
  20. % like `plain' instead.  Mary-Claire van Leunen (A Handbook for Scholars,
  21. % Knopf, 1979) argues convincingly that a style like `plain' encourages better
  22. % writing than one like `apalike'.  Furthermore the strongest arguments for
  23. % using an author-date style like `apalike'---that it's "the most practical"
  24. % (The Chicago Manual of Style, University of Chicago Press, thirteenth
  25. % edition, 1982, pages 400--401)---fall flat on their face with the new
  26. % computer-typesetting technology.  For instance page 401 anachronistically
  27. % states "The chief disadvantage of [a style like `plain'] is that additions
  28. % or deletions cannot be made after the manuscript is typed without changing
  29. % numbers in both text references and list."  LaTeX sidesteps the disadvantage.
  30. %
  31. % History:
  32. %   15-sep-86   (SK,OP) Original version, by Susan King and Oren Patashnik.
  33. %   10-nov-86   (OP)    Truncated the sort.key$ string to the correct length
  34. %           in bib.sort.order to eliminate error message.
  35. %   24-jan-88   (OP)    Updated for BibTeX version 0.99a, from alpha.bst 0.99a;
  36. %           apalike now sorts by author, then year, then title;
  37. %           THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
  38. % Local modifications 10/89 -- Brian Reiser
  39.  
  40. ENTRY
  41.   { address
  42.    author
  43.    booktitle
  44.    chapter
  45.    edition
  46.    editor
  47.    howpublished
  48.    institution
  49.    journal
  50.    key
  51. %    month      not used in apalike
  52.    note
  53.    number
  54.    organization
  55.    pages
  56.    publisher
  57.    school
  58.    series
  59.    title
  60.    type
  61.    volume
  62.    year
  63.  }
  64.   {}
  65.   { label extra.label sort.label }
  66.  
  67. INTEGERS { output.state before.all mid.sentence after.sentence after.block }
  68.  
  69. FUNCTION {init.state.consts}
  70. { #0 'before.all :=
  71.  #1 'mid.sentence :=
  72.  #2 'after.sentence :=
  73.  #3 'after.block :=
  74. }
  75.  
  76. STRINGS { s t }
  77.  
  78. FUNCTION {output.nonnull}
  79. { 's :=
  80.  output.state mid.sentence =
  81.    { ", " * write$ }
  82.    { output.state after.block =
  83.     { add.period$ write$
  84.       newline$
  85.       "\newblock " write$
  86.     }
  87.     { output.state before.all =
  88.         'write$
  89.         { add.period$ " " * write$ }
  90.       if$
  91.     }
  92.      if$
  93.      mid.sentence 'output.state :=
  94.    }
  95.  if$
  96.  s
  97. }
  98.  
  99. FUNCTION {eho.special.output.nonnull}
  100. { 's :=
  101.  output.state mid.sentence =
  102.    { "  " * write$ }
  103.    { output.state after.block =
  104.     { % add.period$ write$
  105.       ": " write$
  106.       newline$
  107.       "\newblock " write$
  108.     }
  109.     { output.state before.all =
  110.         'write$
  111.         { % add.period$ " " * write$
  112.           ": " * write$
  113.            }
  114.       if$
  115.     }
  116.      if$
  117.      mid.sentence 'output.state :=
  118.    }
  119.  if$
  120.  s
  121. }
  122.  
  123. FUNCTION {eho.special2.output.nonnull}
  124. { 's :=
  125.  output.state mid.sentence =
  126.    { "" * write$ }
  127.    { output.state after.block =
  128.     { % add.period$ write$
  129.       ": " write$
  130.       newline$
  131.       "\newblock " write$
  132.     }
  133.     { output.state before.all =
  134.         'write$
  135.         { % add.period$ " " * write$
  136.           ": " * write$
  137.            }
  138.       if$
  139.     }
  140.      if$
  141.      mid.sentence 'output.state :=
  142.    }
  143.  if$
  144.  s
  145. }
  146.  
  147. FUNCTION {eho.special.output}
  148. { duplicate$ empty$
  149.    'pop$
  150.    'eho.special.output.nonnull
  151.  if$
  152. }
  153.  
  154. %% Added by Eric Ho <eho@word> on Wed Jan 10 20:13:56 1990
  155. %% A special patch for output.nonnull in book environment.
  156.  
  157. FUNCTION {eho.output.nonnull}
  158. { 's :=
  159.  output.state mid.sentence =
  160.    { ": " * write$ }
  161.    { output.state after.block =
  162.     { add.period$ write$
  163.       newline$
  164.       "\newblock " write$
  165.     }
  166.     { output.state before.all =
  167.         'write$
  168.         { add.period$ " " * write$ }
  169.       if$
  170.     }
  171.      if$
  172.      mid.sentence 'output.state :=
  173.    }
  174.  if$
  175.  s
  176. }
  177.  
  178. FUNCTION {output}
  179. { duplicate$ empty$
  180.    'pop$
  181.    'output.nonnull
  182.  if$
  183. }
  184.  
  185. %% Added by Eric Ho <eho@word> on Wed Jan 10 20:13:56 1990
  186. %% A special patch for output in book environment.
  187.  
  188. FUNCTION {eho.output}
  189. { duplicate$ empty$
  190.    'pop$
  191.    'eho.output.nonnull
  192.  if$
  193. }
  194.  
  195. FUNCTION {output.check}
  196. { 't :=
  197.  duplicate$ empty$
  198.    { pop$ "empty " t * " in " * cite$ * warning$ }
  199.    'output.nonnull
  200.  if$
  201. }
  202.  
  203. %% Added by Eric Ho <eho@word> on Wed Jan 10 20:13:56 1990
  204. %% A special patch for output.check in book environment.
  205.  
  206. FUNCTION {eho.output.check}
  207. { 't :=
  208.  duplicate$ empty$
  209.    { pop$ "empty " t * " in " * cite$ * warning$ }
  210.    'eho.output.nonnull
  211.  if$
  212. }
  213.  
  214. %                   apalike needs this function because
  215. %                   the year has special punctuation;
  216. %                   apalike ignores the month
  217. %FUNCTION {output.year.check}
  218. %{ year empty$
  219. %    { "empty year in " cite$ * warning$ }
  220. %    { write$
  221. %      " (" year * extra.label * ")" *
  222. %      mid.sentence 'output.state :=
  223. %    }
  224. %  if$
  225. %}
  226. FUNCTION {output.year.check}
  227. { year empty$
  228.    { "empty year in " cite$ * warning$ }
  229.    { write$
  230.      " (" year * extra.label * ") " *
  231.      before.all 'output.state :=
  232.    }
  233.  if$
  234. }
  235.  
  236.  
  237. FUNCTION {output.bibitem}
  238. { newline$
  239.  "\bibitem[" write$
  240.  label write$
  241.  "]{" write$
  242.  cite$ write$
  243.  "}" write$
  244.  newline$
  245.  ""
  246.  before.all 'output.state :=
  247. }
  248.  
  249. FUNCTION {fin.entry}
  250. { add.period$
  251.  write$
  252.  newline$
  253. }
  254.  
  255. FUNCTION {new.block}
  256. { output.state before.all =
  257.    'skip$
  258.    { after.block 'output.state := }
  259.  if$
  260. }
  261.  
  262. FUNCTION {new.sentence}
  263. { output.state after.block =
  264.    'skip$
  265.    { output.state before.all =
  266.     'skip$
  267.     { after.sentence 'output.state := }
  268.      if$
  269.    }
  270.  if$
  271. }
  272.  
  273. FUNCTION {not}
  274. {   { #0 }
  275.    { #1 }
  276.  if$
  277. }
  278.  
  279. FUNCTION {and}
  280. {   'skip$
  281.    { pop$ #0 }
  282.  if$
  283. }
  284.  
  285. FUNCTION {or}
  286. {   { pop$ #1 }
  287.    'skip$
  288.  if$
  289. }
  290.  
  291. FUNCTION {new.block.checkb}
  292. { empty$
  293.  swap$ empty$
  294.  and
  295.    'skip$
  296.    'new.block
  297.  if$
  298. }
  299.  
  300. FUNCTION {field.or.null}
  301. { duplicate$ empty$
  302.    { pop$ "" }
  303.    'skip$
  304.  if$
  305. }
  306.  
  307. FUNCTION {emphasize}
  308. { duplicate$ empty$
  309.    { pop$ "" }
  310.    { "{\em " swap$ * "}" * }
  311.  if$
  312. }
  313.  
  314. INTEGERS { nameptr namesleft numnames }
  315.  
  316. FUNCTION {format.names}
  317. { 's :=
  318.   #1 'nameptr :=
  319.   s num.names$ 'numnames :=
  320.   numnames 'namesleft :=
  321.     { namesleft #0 > }
  322.  %%   { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=   % last name first
  323.       { s nameptr "{vv~}{ll}{, jj}{ f{}}" format.name$ 't :=   % last name first
  324.       nameptr #1 >
  325.     { namesleft #1 >
  326.         { ", " * t * }
  327.         { numnames #2 >
  328.     %%  { "," * }
  329.         { "" * }
  330.         'skip$
  331.           if$
  332.           t "others" =
  333.         { " et~al." * }
  334.     %%  { " \& " * t * }    % changed from " and " for names -- BJR 10/5/89
  335.         { ", " * t * }    % changed from " and " for names -- BJR 10/5/89
  336.           if$
  337.         }
  338.       if$
  339.     }
  340.     't
  341.       if$
  342.       nameptr #1 + 'nameptr :=
  343.       namesleft #1 - 'namesleft :=
  344.     }
  345.   while$
  346. }
  347.  
  348. %% Added by Fri Jan 12 19:03:22 1990 on Fri Jan 12 19:03:27 1990
  349. %% Mainly to make sure that editors have initials before last names.
  350.  
  351. FUNCTION {eho.format.names}
  352. { 's :=
  353.   #1 'nameptr :=
  354.   s num.names$ 'numnames :=
  355.   numnames 'namesleft :=
  356.     { namesleft #0 > }
  357.  %% { s nameptr "{f.} {vv~}{ll}{, jj}" format.name$ 't :=  %% initials first.
  358.     { s nameptr "{vv~}{ll}{, jj}{ f{}}" format.name$ 't :=   % last name first
  359.       nameptr #1 >
  360.     { namesleft #1 >
  361.         { ", " * t * }
  362.         { numnames #2 >
  363.     %%  { "," * }
  364.         { "" * }
  365.         'skip$
  366.           if$
  367.           t "others" =
  368.         { " et~al." * }
  369.     %%  { " \& " * t * }    % changed from " and " for names -- BJR 10/5/89
  370.         { ", " * t * }    % changed from " and " for names -- BJR 10/5/89
  371.           if$
  372.         }
  373.       if$
  374.     }
  375.     't
  376.       if$
  377.       nameptr #1 + 'nameptr :=
  378.       namesleft #1 - 'namesleft :=
  379.     }
  380.   while$
  381. }
  382.  
  383. FUNCTION {format.authors}
  384. { author empty$
  385.    { "" }
  386.    { author format.names }
  387.  if$
  388. }
  389.  
  390. FUNCTION {format.key}           % this function is just for apalike
  391. { empty$
  392.    { key field.or.null }
  393.    { "" }
  394.  if$
  395. }
  396.  
  397. FUNCTION {format.editors}
  398. { editor empty$
  399.    { "" }
  400.    { editor format.names
  401.      editor num.names$ #1 >
  402.     { ", eds" * }    % changed from ", editors" -- BJR 10/5/89
  403.     { ", ed" * }     % changed from ", editor" -- BJR 10/5/89
  404.      if$
  405.    }
  406.  if$
  407. }
  408.  
  409. %% Added by Eric Ho <eho@word> Fri Jan 12 19:11:12 1990
  410. %% Mainly to call eho.format.names instead of format.names and
  411. %% to make Eds or Ed to be surrounded by pararentheses instead of preceeded by
  412. %% a comma.
  413.  
  414. FUNCTION {eho.format.editors}
  415. { editor empty$
  416.    { "" }
  417.    { editor eho.format.names
  418.      editor num.names$ #1 >
  419.     { " (eds)" * }    % changed from ", editors" -- BJR 10/5/89
  420.     { " (ed)" * }     % changed from ", editor" -- BJR 10/5/89
  421.      if$
  422.    }
  423.  if$
  424. }
  425.  
  426. FUNCTION {format.title}
  427. { title empty$
  428.    { "" }
  429.    { title "t" change.case$ }
  430. %    { title }
  431.  if$
  432. }
  433.  
  434. FUNCTION {n.dashify}
  435. { 't :=
  436.  ""
  437.    { t empty$ not }
  438.    { t #1 #1 substring$ "-" =
  439.     { t #1 #2 substring$ "--" = not
  440.         { "--" *
  441.           t #2 global.max$ substring$ 't :=
  442.         }
  443.         {   { t #1 #1 substring$ "-" = }
  444.         { "-" *
  445.           t #2 global.max$ substring$ 't :=
  446.         }
  447.           while$
  448.         }
  449.       if$
  450.     }
  451.     { t #1 #1 substring$ *
  452.       t #2 global.max$ substring$ 't :=
  453.     }
  454.      if$
  455.    }
  456.  while$
  457. }
  458.  
  459. FUNCTION {format.btitle}
  460. { title emphasize
  461. }
  462.  
  463. FUNCTION {tie.or.space.connect}
  464. { duplicate$ text.length$ #3 <
  465.    { "~" }
  466.    { " " }
  467.  if$
  468.  swap$ * *
  469. }
  470.  
  471. FUNCTION {either.or.check}
  472. { empty$
  473.    'pop$
  474.    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
  475.  if$
  476. }
  477.  
  478. FUNCTION {format.bvolume}
  479. { volume empty$
  480.    { "" }
  481.    { "volume" volume tie.or.space.connect
  482.      series empty$
  483.     'skip$
  484.     { " of " * series emphasize * }
  485.      if$
  486.      "volume and number" number either.or.check
  487.    }
  488.  if$
  489. }
  490.  
  491. FUNCTION {format.number.series}
  492. { volume empty$
  493.    { number empty$
  494.     { series field.or.null }
  495.     { output.state mid.sentence =
  496.         { "number" }
  497.         { "Number" }
  498.       if$
  499.       number tie.or.space.connect
  500.       series empty$
  501.         { "there's a number but no series in " cite$ * warning$ }
  502.         { " in " * series * }
  503.       if$
  504.     }
  505.      if$
  506.    }
  507.    { "" }
  508.  if$
  509. }
  510.  
  511. FUNCTION {format.edition}
  512. { edition empty$
  513.    { "" }
  514.    { output.state mid.sentence =
  515.     { edition "l" change.case$ " edition" * }
  516.     { edition "t" change.case$ " edition" * }
  517.      if$
  518.    }
  519.  if$
  520. }
  521.  
  522. INTEGERS { multiresult }
  523.  
  524. FUNCTION {multi.page.check}
  525. { 't :=
  526.  #0 'multiresult :=
  527.    { multiresult not
  528.      t empty$ not
  529.      and
  530.    }
  531.    { t #1 #1 substring$
  532.      duplicate$ "-" =
  533.      swap$ duplicate$ "," =
  534.      swap$ "+" =
  535.      or or
  536.     { #1 'multiresult := }
  537.     { t #2 global.max$ substring$ 't := }
  538.      if$
  539.    }
  540.  while$
  541.  multiresult
  542. }
  543.  
  544. FUNCTION {format.pages}
  545. { pages empty$
  546.    { "" }
  547.    { pages multi.page.check
  548. %   { "pages" pages n.dashify tie.or.space.connect }
  549. %   { "page" pages tie.or.space.connect }
  550.     { "(pp.\" pages n.dashify tie.or.space.connect }
  551.     { "(pp.\" pages tie.or.space.connect }
  552.      if$
  553.      ")." *
  554.    }
  555.  if$
  556. }
  557.  
  558. FUNCTION {format.vol.num.pages}
  559. { volume field.or.null
  560.  number empty$
  561.    'skip$
  562.    { " (" number * ")" * *
  563.      volume empty$
  564.     { "there's a number but no volume in " cite$ * warning$ }
  565.     'skip$
  566.      if$
  567.    }
  568.  if$
  569.  pages empty$
  570.    'skip$
  571.    { duplicate$ empty$
  572. %   { pop$ format.pages }
  573.     { ": " * pages n.dashify * }
  574. %   { ", " * pages n.dashify * }    % changed from ":" for vol,pgs -- BJR 10/5/89
  575.     { ": " * pages n.dashify * }    % changed from ":" for vol,pgs -- BJR 10/5/89
  576.      if$
  577.    }
  578.  if$
  579. }
  580.  
  581. FUNCTION {format.chapter.pages}
  582. { chapter empty$
  583.    'format.pages
  584.    { type empty$
  585.     { "chapter" }
  586.     { type "l" change.case$ }
  587.      if$
  588.      chapter tie.or.space.connect
  589.      pages empty$
  590.     'skip$
  591.     { ", " * format.pages * }
  592.      if$
  593.    }
  594.  if$
  595. }
  596.  
  597. FUNCTION {format.in.ed.booktitle}
  598. { booktitle empty$
  599.    { "" }
  600.    { editor empty$
  601.     { "In: " booktitle emphasize * }
  602.     { "In: " format.editors * " " * booktitle emphasize * }
  603.      if$
  604.    }
  605.  if$
  606. }
  607.  
  608. %% Added by Eric Ho <eho@word> Fri Jan 12 19:17:37 1990
  609. %% Primarily to call eho.format.editors instead of format.editors.
  610.  
  611. FUNCTION {eho.format.in.ed.booktitle}
  612. { booktitle empty$
  613.    { "" }
  614.    { editor empty$
  615.     { "In: " booktitle emphasize * }
  616.     { "In: " eho.format.editors * " " * booktitle emphasize *}
  617.      if$
  618.    }
  619.  if$
  620. }
  621.  
  622. FUNCTION {format.thesis.type}
  623. { type empty$
  624.    'skip$
  625.    { pop$
  626.      type "t" change.case$
  627.    }
  628.  if$
  629. }
  630.  
  631. FUNCTION {format.tr.number}
  632. { type empty$
  633.    { "Technical Report" }
  634.    'type
  635.  if$
  636.  number empty$
  637.    { "t" change.case$ }
  638.    { number tie.or.space.connect }
  639.  if$
  640. }
  641.  
  642. FUNCTION {format.article.crossref}
  643. { "In:"                         % this is for apalike
  644.  " \cite{" * crossref * "}" *
  645. }
  646.  
  647. FUNCTION {format.book.crossref}
  648. { volume empty$
  649.    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
  650.      "In: "
  651.    }
  652.    { "Volume" volume tie.or.space.connect
  653.      " of " *
  654.    }
  655.  if$
  656.   "\cite{" * crossref * "}" *               % this is for apalike
  657. }
  658.  
  659. FUNCTION {format.incoll.inproc.crossref}
  660. { "In:"                         % this is for apalike
  661.  " \cite{" * crossref * "}" *
  662. }
  663.  
  664. FUNCTION {article}
  665. { output.bibitem
  666.  format.authors "author" output.check
  667.   author format.key output              % special for
  668.   output.year.check                 % apalike
  669.  new.block
  670.  format.title "title" output.check
  671.  new.block
  672.  crossref missing$
  673.    { journal emphasize "journal" output.check
  674.      format.vol.num.pages output
  675.    }
  676.    { format.article.crossref output.nonnull
  677.      format.pages output
  678.    }
  679.  if$
  680.  new.block
  681.  note output
  682.  fin.entry
  683. }
  684.  
  685. %% Modified by Eric Ho <eho@word> on Wed Jan 10 20:30:11 1990
  686. %% Making it to call eho.output.check instead of output.check and eho.output
  687. %% instead of output.
  688.  
  689. FUNCTION {book}
  690. { output.bibitem
  691.  author empty$
  692.    { format.editors "author and editor" output.check
  693.      editor format.key output
  694.    }
  695.    { format.authors output.nonnull
  696.      crossref missing$
  697.     { "author and editor" editor either.or.check }
  698.     'skip$
  699.      if$
  700.    }
  701.  if$
  702.   output.year.check             % special for apalike
  703.  new.block
  704.  format.btitle "title" output.check
  705.  crossref missing$
  706.    { format.bvolume output
  707.      new.block
  708.      format.number.series output
  709.      new.sentence
  710. %      publisher "publisher" output.check
  711. %      address output
  712. % switched order of publisher and address for book -- BJR 10/5/89
  713.       address eho.output    % Using eho.output instead of output.
  714.       publisher "publisher" eho.output.check    % Using eho.output.check
  715.                             % instead of output.check.
  716.    }
  717.    { new.block
  718.      format.book.crossref output.nonnull
  719.    }
  720.  if$
  721.  format.edition output
  722.  new.block
  723.  note output
  724.  fin.entry
  725. }
  726.  
  727. FUNCTION {booklet}
  728. { output.bibitem
  729.  format.authors output
  730.   author format.key output              % special for
  731.   output.year.check                 % apalike
  732.  new.block
  733.  format.title "title" output.check
  734.  new.block
  735.  howpublished output
  736.  address output
  737.  new.block
  738.  note output
  739.  fin.entry
  740. }
  741.  
  742. %% Modified by Eric Ho <eho@word> on Wed Jan 10 20:27:26 1990
  743. %% Making it to call eho.output.check instead of output.check and eho.output
  744. %% instead of output.
  745.  
  746. FUNCTION {inbook}
  747. { output.bibitem
  748.  author empty$
  749.    { format.editors "author and editor" output.check
  750.      editor format.key output
  751.    }
  752.    { format.authors output.nonnull
  753.      crossref missing$
  754.     { "author and editor" editor either.or.check }
  755.     'skip$
  756.      if$
  757.    }
  758.  if$
  759.   output.year.check             % special for apalike
  760.  new.block
  761.  format.btitle "title" output.check
  762.  crossref missing$
  763.    { format.bvolume output
  764.      format.chapter.pages "chapter and pages" output.check
  765.      new.block
  766.      format.number.series output
  767.      new.sentence
  768.       publisher "publisher" eho.output.check    % Using eho.output.check instead
  769.                         % of output.check.
  770.       address eho.output    % Using eho.output instead of output.
  771.    }
  772.    { format.chapter.pages "chapter and pages" output.check
  773.      new.block
  774.      format.book.crossref output.nonnull
  775.    }
  776.  if$
  777.  format.edition output
  778.  new.block
  779.  note output
  780.  fin.entry
  781. }
  782.  
  783. %% Modified by Eric Ho <eho@word> on Wed Jan 10 20:27:26 1990
  784. %% Making it to call eho.output.check instead of output.check and eho.output
  785. %% instead of output.  Also modified by Eric Ho <eho@word> on Fri Jan 12
  786. %% 19:21:59 1990 so as to call eho.format.in.ed.booktitle instead of the old
  787. %% format.in.ed.booktitle.
  788.  
  789. FUNCTION {incollection}
  790. { output.bibitem
  791.  format.authors "author" output.check
  792.   author format.key output              % special for
  793.   output.year.check                 % apalike
  794.  new.block
  795.  format.title "title" output.check
  796.  new.block
  797.  crossref missing$
  798.    { eho.format.in.ed.booktitle "booktitle" output.check
  799.     % The above line is changed by Eric Ho <eho@word> on Fri Jan 12
  800.     % 19:20:28 1990 so that it'll call eho.format.in.ed.booktitle instead
  801.     % of format.in.ed.booktitle.
  802.  
  803.      format.bvolume output
  804.      format.number.series output
  805.      format.chapter.pages eho.special.output
  806.      new.sentence
  807. %      publisher "publisher" output.check
  808. %      address output
  809. % switched order of publisher and address for incollection -- BJR 1/3/90
  810.       address eho.output    % Use eho.output instead of output.
  811.       publisher "publisher" eho.output.check    % Use eho.output.check instead
  812.                         % of output.check.
  813.      format.edition output
  814.    }
  815.    { format.incoll.inproc.crossref output.nonnull
  816.      format.chapter.pages output
  817.    }
  818.  if$
  819.  new.block
  820.  note output
  821.  fin.entry
  822. }
  823.  
  824. %FUNCTION {inproceedings}
  825. %{ output.bibitem
  826. %  format.authors "author" output.check
  827. %  author format.key output             % special for
  828. %  output.year.check                    % apalike
  829. %  new.block
  830. %  format.title "title" output.check
  831. %  new.block
  832. %  crossref missing$
  833. %    { % format.in.ed.booktitle "booktitle" output.check
  834. %      eho.format.in.ed.booktitle "booktitle" output.check
  835. %      format.bvolume output
  836. %      format.number.series output
  837. %      format.pages eho.special.output
  838. %      address eho.special.output           % for apalike
  839. %      new.sentence                 % there's no year
  840. %      organization eho.special.output          % here so things
  841. %      publisher eho.special.output         % are simpler
  842. %    }
  843. %    { format.incoll.inproc.crossref output.nonnull
  844. %      format.pages output
  845. %    }
  846. %  if$
  847. %  new.block
  848. %  note output
  849. %  fin.entry
  850. %}
  851.  
  852. FUNCTION {inproceedings}
  853. { output.bibitem
  854.  format.authors "author" output.check
  855.   author format.key output              % special for
  856.   output.year.check                 % apalike
  857.  new.block
  858.  format.title "title" output.check
  859.  new.block
  860.  crossref missing$
  861.    {
  862.      volume empty$
  863.        {
  864.              eho.format.in.ed.booktitle "booktitle" output.check
  865.              format.vol.num.pages eho.special2.output.nonnull        
  866.     }
  867.         {
  868.           eho.format.in.ed.booktitle "booktitle" output.check
  869. %         new.sentence
  870.           address eho.output   
  871. %         publisher "publisher" eho.output.check   
  872. %         new.sentence                 
  873.           format.vol.num.pages output
  874.     }
  875.       if$  
  876.    }
  877.    { format.incoll.inproc.crossref output.nonnull
  878.      format.pages output
  879.    }
  880.  if$
  881.  new.block
  882.  note output
  883.  fin.entry
  884. }
  885.  
  886. FUNCTION {conference} { inproceedings }
  887.  
  888. FUNCTION {manual}
  889. { output.bibitem
  890.  format.authors output
  891.   author format.key output              % special for
  892.   output.year.check                 % apalike
  893.  new.block
  894.  format.btitle "title" output.check
  895.  organization address new.block.checkb
  896.  organization output
  897.  address output
  898.  format.edition output
  899.  new.block
  900.  note output
  901.  fin.entry
  902. }
  903.  
  904. FUNCTION {mastersthesis}
  905. { output.bibitem
  906.  format.authors "author" output.check
  907.   author format.key output              % special for
  908.   output.year.check                 % apalike
  909.  new.block
  910.  format.title "title" output.check
  911.  new.block
  912.  "Master's thesis" format.thesis.type output.nonnull
  913.  school "school" output.check
  914.  address output
  915.  new.block
  916.  note output
  917.  fin.entry
  918. }
  919.  
  920. FUNCTION {misc}
  921. { output.bibitem
  922.  format.authors output
  923.   author format.key output              % special for
  924.   output.year.check                 % apalike
  925.  new.block
  926.  format.title output
  927.  new.block
  928.  howpublished output
  929.  new.block
  930.  note output
  931.  fin.entry
  932. }
  933.  
  934. FUNCTION {phdthesis}
  935. { output.bibitem
  936.  format.authors "author" output.check
  937.   author format.key output              % special for
  938.   output.year.check                 % apalike
  939.  new.block
  940.  format.btitle "title" output.check
  941.  new.block
  942.  "PhD thesis" format.thesis.type output.nonnull
  943.  school "school" output.check
  944.  address output
  945.  new.block
  946.  note output
  947.  fin.entry
  948. }
  949.  
  950. FUNCTION {dissertation}
  951. { output.bibitem
  952.  format.authors "author" output.check
  953.   author format.key output              % special for
  954.   output.year.check                 % apalike
  955.  new.block
  956.  format.btitle "title" output.check
  957.  new.block
  958.  "Dissertation" format.thesis.type output.nonnull
  959.  school "school" output.check
  960.  address output
  961.  new.block
  962.  note output
  963.  fin.entry
  964. }
  965.  
  966. FUNCTION {proceedings}
  967. { output.bibitem
  968.  format.editors output
  969.   editor format.key output              % special for
  970.   output.year.check                 % apalike
  971.  new.block
  972.  format.btitle "title" output.check
  973.  format.bvolume output
  974.  format.number.series output
  975.   address output                % for apalike
  976.   new.sentence                  % we always output
  977.   organization output               % a nonempty organization
  978.   publisher output              % here
  979.  new.block
  980.  note output
  981.  fin.entry
  982. }
  983.  
  984. %FUNCTION {techreport}
  985. %{ output.bibitem
  986. %  format.authors "author" output.check
  987. %  author format.key output             % special for
  988. %  output.year.check                    % apalike
  989. %  new.block
  990. %%  format.title "title" output.check
  991. %  format.btitle "title" output.check            % change to ital title -- BJR
  992. %  new.block
  993. %  format.tr.number output.nonnull
  994. %  institution "institution" output.check
  995. %  address output
  996. %  new.block
  997. %  note output
  998. %  fin.entry
  999. %}
  1000.  
  1001. FUNCTION {techreport}
  1002. { output.bibitem
  1003.  format.authors "author" output.check
  1004.   author format.key output              % special for
  1005.   output.year.check                 % apalike
  1006.  new.block
  1007. %  format.title "title" output.check
  1008.  format.btitle "title" output.check            % change to ital title -- BJR
  1009.  new.block
  1010.  address output
  1011.  institution "institution" eho.output.check
  1012.  format.tr.number output.nonnull
  1013.  new.block
  1014.  note output
  1015.  fin.entry
  1016. }
  1017.  
  1018. FUNCTION {unpublished}
  1019. { output.bibitem
  1020.  format.authors "author" output.check
  1021.   author format.key output              % special for
  1022.   output.year.check                 % apalike
  1023.  new.block
  1024.  format.title "title" output.check
  1025.  new.block
  1026.  note "note" output.check
  1027.  fin.entry
  1028. }
  1029.  
  1030. FUNCTION {default.type} { misc }
  1031.  
  1032. MACRO {jan} {"January"}
  1033.  
  1034. MACRO {feb} {"February"}
  1035.  
  1036. MACRO {mar} {"March"}
  1037.  
  1038. MACRO {apr} {"April"}
  1039.  
  1040. MACRO {may} {"May"}
  1041.  
  1042. MACRO {jun} {"June"}
  1043.  
  1044. MACRO {jul} {"July"}
  1045.  
  1046. MACRO {aug} {"August"}
  1047.  
  1048. MACRO {sep} {"September"}
  1049.  
  1050. MACRO {oct} {"October"}
  1051.  
  1052. MACRO {nov} {"November"}
  1053.  
  1054. MACRO {dec} {"December"}
  1055.  
  1056. MACRO {acmcs} {"ACM Computing Surveys"}
  1057.  
  1058. MACRO {acta} {"Acta Informatica"}
  1059.  
  1060. MACRO {cacm} {"Communications of the ACM"}
  1061.  
  1062. MACRO {ibmjrd} {"IBM Journal of Research and Development"}
  1063.  
  1064. MACRO {ibmsj} {"IBM Systems Journal"}
  1065.  
  1066. MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
  1067.  
  1068. MACRO {ieeetc} {"IEEE Transactions on Computers"}
  1069.  
  1070. MACRO {ieeetcad}
  1071.  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
  1072.  
  1073. MACRO {ipl} {"Information Processing Letters"}
  1074.  
  1075. MACRO {jacm} {"Journal of the ACM"}
  1076.  
  1077. MACRO {jcss} {"Journal of Computer and System Sciences"}
  1078.  
  1079. MACRO {scp} {"Science of Computer Programming"}
  1080.  
  1081. MACRO {sicomp} {"SIAM Journal on Computing"}
  1082.  
  1083. MACRO {tocs} {"ACM Transactions on Computer Systems"}
  1084.  
  1085. MACRO {tods} {"ACM Transactions on Database Systems"}
  1086.  
  1087. MACRO {tog} {"ACM Transactions on Graphics"}
  1088.  
  1089. MACRO {toms} {"ACM Transactions on Mathematical Software"}
  1090.  
  1091. MACRO {toois} {"ACM Transactions on Office Information Systems"}
  1092.  
  1093. MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
  1094.  
  1095. MACRO {tcs} {"Theoretical Computer Science"}
  1096.  
  1097. READ
  1098.  
  1099. FUNCTION {sortify}
  1100. { purify$
  1101.  "l" change.case$
  1102. }
  1103.  
  1104. INTEGERS { len }
  1105.  
  1106. FUNCTION {chop.word}
  1107. { 's :=
  1108.  'len :=
  1109.  s #1 len substring$ =
  1110.    { s len #1 + global.max$ substring$ }
  1111.    's
  1112.  if$
  1113. }
  1114.  
  1115. %           There are three apalike cases: one person (Jones),
  1116. %           two (Jones and de~Bruijn), and more (Jones et~al.).
  1117. %           This function is much like format.crossref.editors.
  1118. %
  1119. FUNCTION {format.lab.names}
  1120. { 's :=
  1121.  s #1 "{vv~}{ll}" format.name$
  1122.  s num.names$ duplicate$
  1123.  #2 >
  1124.    { pop$ " et~al." * }
  1125.    { #2 <
  1126.     'skip$
  1127.     { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
  1128.         { " et~al." * }
  1129.         { " \& " * s #2 "{vv~}{ll}" format.name$ * } % " and " --  BJR 10/5/89
  1130.       if$
  1131.     }
  1132.      if$
  1133.    }
  1134.  if$
  1135. }
  1136.  
  1137. FUNCTION {author.key.label}
  1138. { author empty$
  1139.    { key empty$
  1140.     { cite$ #1 #3 substring$ }
  1141.     'key                    % apalike uses the whole key
  1142.      if$
  1143.    }
  1144.    { author format.lab.names }
  1145.  if$
  1146. }
  1147.  
  1148. FUNCTION {author.editor.key.label}
  1149. { author empty$
  1150.    { editor empty$
  1151.     { key empty$
  1152.         { cite$ #1 #3 substring$ }
  1153.         'key                % apalike uses the whole key
  1154.       if$
  1155.     }
  1156.     { editor format.lab.names }
  1157.      if$
  1158.    }
  1159.    { author format.lab.names }
  1160.  if$
  1161. }
  1162.  
  1163. FUNCTION {editor.key.label}
  1164. { editor empty$
  1165.    { key empty$
  1166.     { cite$ #1 #3 substring$ }
  1167.     'key            % apalike uses the whole key, no organization
  1168.      if$
  1169.    }
  1170.    { editor format.lab.names }
  1171.  if$
  1172. }
  1173.  
  1174. FUNCTION {calc.label}
  1175. { type$ "book" =
  1176.  type$ "inbook" =
  1177.  or
  1178.    'author.editor.key.label
  1179.    { type$ "proceedings" =
  1180.     'editor.key.label           % apalike ignores organization
  1181.     'author.key.label           % for labeling and sorting
  1182.      if$
  1183.    }
  1184.  if$
  1185.   ", "                          % these three lines are
  1186.   *                         % for apalike, which
  1187.   year field.or.null purify$ #-1 #4 substring$      % uses all four digits
  1188.  *
  1189.  'label :=
  1190. }
  1191.  
  1192. FUNCTION {sort.format.names}
  1193. { 's :=
  1194.  #1 'nameptr :=
  1195.  ""
  1196.  s num.names$ 'numnames :=
  1197.  numnames 'namesleft :=
  1198.    { namesleft #0 > }
  1199.    { nameptr #1 >
  1200.     { "   " * }
  1201.     'skip$
  1202.       if$                       % apalike uses initials
  1203.      s nameptr "{vv{ } }{ll{ }}{  f{ }}{  jj{ }}" format.name$ 't := % <= here
  1204.      nameptr numnames = t "others" = and
  1205.     { "et al" * }
  1206.     { t sortify * }
  1207.      if$
  1208.      nameptr #1 + 'nameptr :=
  1209.      namesleft #1 - 'namesleft :=
  1210.    }
  1211.  while$
  1212. }
  1213.  
  1214. FUNCTION {sort.format.title}
  1215. { 't :=
  1216.  "A " #2
  1217.    "An " #3
  1218.      "The " #4 t chop.word
  1219.    chop.word
  1220.  chop.word
  1221.  sortify
  1222.  #1 global.max$ substring$
  1223. }
  1224.  
  1225. FUNCTION {author.sort}
  1226. { author empty$
  1227.    { key empty$
  1228.     { "to sort, need author or key in " cite$ * warning$
  1229.       ""
  1230.     }
  1231.     { key sortify }
  1232.      if$
  1233.    }
  1234.    { author sort.format.names }
  1235.  if$
  1236. }
  1237.  
  1238. FUNCTION {author.editor.sort}
  1239. { author empty$
  1240.    { editor empty$
  1241.     { key empty$
  1242.         { "to sort, need author, editor, or key in " cite$ * warning$
  1243.           ""
  1244.         }
  1245.         { key sortify }
  1246.       if$
  1247.     }
  1248.     { editor sort.format.names }
  1249.      if$
  1250.    }
  1251.    { author sort.format.names }
  1252.  if$
  1253. }
  1254.  
  1255. FUNCTION {editor.sort}
  1256. { editor empty$
  1257.    { key empty$
  1258.     { "to sort, need editor or key in " cite$ * warning$
  1259.       ""
  1260.     }
  1261.     { key sortify }
  1262.      if$
  1263.    }
  1264.    { editor sort.format.names }
  1265.  if$
  1266. }
  1267.  
  1268. %           apalike uses two sorting passes; the first one sets the
  1269. %           labels so that the `a's, `b's, etc. can be computed;
  1270. %           the second pass puts the references in "correct" order.
  1271. %           The presort function is for the first pass. It computes
  1272. %           label, sort.label, and title, and then concatenates.
  1273. FUNCTION {presort}
  1274. { calc.label
  1275.  label sortify
  1276.  "    "
  1277.  *
  1278.  type$ "book" =
  1279.  type$ "inbook" =
  1280.  or
  1281.    'author.editor.sort
  1282.    { type$ "proceedings" =
  1283.     'editor.sort
  1284.     'author.sort
  1285.      if$
  1286.    }
  1287.  if$
  1288.   #1 entry.max$ substring$  % for
  1289.   'sort.label :=        % apalike
  1290.   sort.label            % style
  1291.  *
  1292.  "    "
  1293.  *
  1294.  title field.or.null
  1295.  sort.format.title
  1296.  *
  1297.  #1 entry.max$ substring$
  1298.  'sort.key$ :=
  1299. }
  1300.  
  1301. ITERATE {presort}
  1302.  
  1303. SORT        % by label, sort.label, title---for final label calculation
  1304.  
  1305. STRINGS { last.label next.extra }   % apalike labels are only for the text;
  1306.  
  1307. INTEGERS { last.extra.num }     % there are none in the bibliography
  1308.  
  1309. FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label'
  1310. { #0 int.to.chr$ 'last.label :=
  1311.  "" 'next.extra :=
  1312.  #0 'last.extra.num :=
  1313. }
  1314.  
  1315. FUNCTION {forward.pass}
  1316. { last.label label =
  1317.    { last.extra.num #1 + 'last.extra.num :=
  1318.      last.extra.num int.to.chr$ 'extra.label :=
  1319.    }
  1320.    { "a" chr.to.int$ 'last.extra.num :=
  1321.      "" 'extra.label :=
  1322.      label 'last.label :=
  1323.    }
  1324.  if$
  1325. }
  1326.  
  1327. FUNCTION {reverse.pass}
  1328. { next.extra "b" =
  1329.    { "a" 'extra.label := }
  1330.    'skip$
  1331.  if$
  1332.  label extra.label * 'label :=
  1333.  extra.label 'next.extra :=
  1334. }
  1335.  
  1336. EXECUTE {initialize.extra.label.stuff}
  1337.  
  1338. ITERATE {forward.pass}
  1339.  
  1340. REVERSE {reverse.pass}
  1341.  
  1342. %               Now that the label is right we sort for real,
  1343. %               on sort.label then year then title.  This is
  1344. %               for the second sorting pass.
  1345. FUNCTION {bib.sort.order}
  1346. { sort.label
  1347.  "    "
  1348.  *
  1349.  year field.or.null sortify
  1350.  *
  1351.  "    "
  1352.  *
  1353.  title field.or.null
  1354.  sort.format.title
  1355.  *
  1356.  #1 entry.max$ substring$
  1357.  'sort.key$ :=
  1358. }
  1359.  
  1360. ITERATE {bib.sort.order}
  1361.  
  1362. SORT        % by sort.label, year, title---giving final bibliography order
  1363.  
  1364. FUNCTION {begin.bib}
  1365. { preamble$ empty$              % no \etalchar in apalike
  1366.    'skip$
  1367.    { preamble$ write$ newline$ }
  1368.  if$
  1369.   "\begin{thebibliography}{}" write$ newline$       % no labels in apalike
  1370. }
  1371.  
  1372. EXECUTE {begin.bib}
  1373.  
  1374. EXECUTE {init.state.consts}
  1375.  
  1376. ITERATE {call.type$}
  1377.  
  1378. FUNCTION {end.bib}
  1379. { newline$
  1380.  "\end{thebibliography}" write$ newline$
  1381. }
  1382.  
  1383. EXECUTE {end.bib}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement