Debian Codegraph @

texmf-dist/bibtex/bst/cell/cell.bst

raw
1 % (changes from apalike to cell by Tom Schneider are public domain.)
2 %
3 % BibTex `cell' bibliography style
4 % version = 1.28 of cell.bst 2009 Jul 21
5 % 2009 Jul 21, 1.28 upgrade documentation
6 % 2009 Jul 13, 1.27 suppress notes in article
7 % 2009 Jul 11, 1.26 upgrade to modern cell: &->and, give titles, \emph{vol}
8 % 1994 Oct 15, 1.25 from version = 1.27 of jmb.bst 1992 October 22
9
10 % This bibliography style is for the journal Cell.
11 % http://www.cell.com/
12
13 % Dr. Thomas D. Schneider
14 % National Institutes of Health
15 % [email protected]
16 % [email protected] (permanent)
17 % http://alum.mit.edu/www/toms
18
19 % previous history:
20 %
21 % conversion from JMB to Cell by:
22 % changing emphasis to roman (\em to \rm)
23 % bold face to roman (\bf to \rm) (on volume)
24 % making the volume be italics
25 % removing the comma after the journal name
26 %
27 % Thomas Schneider
28 % National Cancer Institute
29 % Laboratory of Mathematical Biology
30 % Frederick, Maryland 21702-1013
31 % [email protected]
32 %
33 % This file is available by anonymous ftp from ncifcrf.gov in pub/delila.
34 %
35 % TITLES can be turned on and off!
36 % Just nocite the reference TitlesOn in the paper (i.e. \nocite{TitlesOn})
37 % and have a bibliography article in your database with that cite key!
38 %
39 % WARNING: Since I use mostly article, book and inproceedings, these
40 % are formatted pretty closely to the Journal of Theoretical Biology style
41 % while other things are neglected. Also, I can't guarantee that the style
42 % is exactly right.
43 %
44 % The following documentation is identical from the source of jmb.bst,
45 % which was the apalike.bst taken from the Clarkson archive on 1989 June 19.
46 %
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 % BibTeX `apalike' bibliography style (24-Jan-88 version)
49 % Adapted from the `alpha' style, version 0.99a; for BibTeX version 0.99a.
50 %
51 % Copyright (C) 1988, 2010 Oren Patashnik.
52 % Unlimited copying and redistribution of this file are permitted as long as
53 % it is unmodified. Modifications (and redistribution of modified versions)
54 % are also permitted, but only if the resulting file is renamed.
55 %
56 % Differences between this style and `alpha' are generally heralded by a `%'.
57 % The file btxbst.doc has the documentation for alpha.bst.
58 %
59 % This style should be used with the `apalike' LaTeX style (apalike.sty).
60 % \cite's come out like "(Jones, 1986)" in the text but there are no labels
61 % in the bibliography, and something like "(1986)" comes out immediately
62 % after the author. Author (and editor) names appear as last name, comma,
63 % initials. A `year' field is required for every entry, and so is either
64 % an author (or in some cases, an editor) field or a key field.
65 %
66 % Editorial note:
67 % Many journals require a style like `apalike', but I strongly, strongly,
68 % strongly recommend that you not use it if you have a choice---use something
69 % like `plain' instead. Mary-Claire van Leunen (A Handbook for Scholars,
70 % Knopf, 1979) argues convincingly that a style like `plain' encourages better
71 % writing than one like `apalike'. Furthermore the strongest arguments for
72 % using an author-date style like `apalike'---that it's "the most practical"
73 % (The Chicago Manual of Style, University of Chicago Press, thirteenth
74 % edition, 1982, pages 400--401)---fall flat on their face with the new
75 % computer-typesetting technology. For instance page 401 anachronistically
76 % states "The chief disadvantage of [a style like `plain'] is that additions
77 % or deletions cannot be made after the manuscript is typed without changing
78 % numbers in both text references and list." LaTeX sidesteps the disadvantage.
79 %
80 % History:
81 % 15-sep-86 (SK,OP) Original version, by Susan King and Oren Patashnik.
82 % 10-nov-86 (OP) Truncated the sort.key$ string to the correct length
83 % in bib.sort.order to eliminate error message.
84 % 24-jan-88 (OP) Updated for BibTeX version 0.99a, from alpha.bst 0.99a;
85 % apalike now sorts by author, then year, then title;
86 % THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 %
89 % The program was further modified by Tom Schneider:
90 %
91 % 1989 June 19 (TDS) Renamed jmb.bst. Items that do not have years were
92 % listed in the bibliography without identifiers. However, they
93 % have identifiers in the text. The identifier was added.
94 % Titles were removed :-(.
95 %
96 % 1989 October 2 (TDS) Made labels in the paper use the & symbol rather
97 % than `and', as required by JMB.
98 % 1989 October 3 (TDS) Made et~al. be in italics.
99 % Removed comma after journal name. (actually, all
100 % mid sentence commas go!)
101 % Made volume number be bold faced.
102 % Converted colon (:) after volume number to a comma (,).
103 % If a journal name does NOT end in a period, add
104 % a comma after the name.
105 % 1989 October 14 (TDS) Without a year the program used to sort on the
106 % title. I made it sort on the cite$ if there is no year.
107 % 1989 October 18 (TDS) If there is one reference without a year, put
108 % an "a" at the end of its label, so that it comes out
109 % as (Smith, a) in the text. in FUNCTION {forward.pass}
110 % 1989 November 2 (TDS) Unpublished papers now give the title.
111 % 1989 November 18 (TDS) TITLES can be turned on and off!
112 % Just nocite the reference TitlesOn in the paper
113 % and have a bibliography article in your database
114 % with that cite key!
115 % 1989 December 5 (TDS) I can't stand sorting to fall back on the
116 % titles of the article - no control! So in function
117 % bib.sort.order the default is now cite$.
118 % 1990 November 14 (TDS) Changes to match JTB better:
119 % Names in the bibliography are now connected
120 % with "\&" instead of "and", since this fits JTB better.
121 % "In" is now "In:".
122 % "editors" and "editor" are now "eds" and "ed".
123 % booktitle follows editors. editors in parenthesis.
124 % pp. and p. instead of pages and page.
125 % location followed by colon (:) and then publisher.
126 % 1992 October 22 (TDS) Publisher address is at the end of books.
127 % with no colon after address.
128 % no comma before & in name list in bibliography.
129 % The extra.label (as the a of 1991a) is emphasized.
130 % "In:" goes back to "In"!
131 % publisher address is at the end of inproceedings.
132 % volume is "vol.", with comma after number.
133 % ed.", and comma after ) closing editors.
134 % as a colon (:), JMB does NOT want the next
135 % ed, but the format.title function uses
136 % which leaves it capitalized. To fix this, a
137 % place change.case$ must be written.
138 %
139 % When a title has a colon (:), JMB does NOT want the next
140 % word capitalized, but the format.title function uses
141 % change.case$, which leaves it capitalized. To fix this, a
142 % function to replace change.case$ was written:
143 % special.change.case
144 %
145 % edition should follow TITLE for books!
146
147 % possible bug: sorting order probably should be first author followed
148 % by year; but this is not absolutely clear. Sorting here is (I think)
149 % by all authors (or perhaps the key) then year.
150
151
152 ENTRY % declare variables that have a value for each entry on the list
153 { address
154 author
155 booktitle
156 chapter
157 edition
158 editor
159 howpublished
160 institution
161 journal
162 key
163 % month not used in apalike
164 note
165 number
166 organization
167 pages
168 publisher
169 school
170 series
171 title
172 type
173 volume
174 year
175 }
176 {}
177 { label extra.label sort.label }
178
179 INTEGERS { output.state before.all mid.sentence after.sentence after.block
180 docomma givetitles }
181
182 FUNCTION {init.state.consts}
183 { #0 'before.all :=
184 #1 'mid.sentence :=
185 #2 'after.sentence :=
186 #3 'after.block :=
187
188 #0 'docomma := % if it is 0 then don't do commas, otherwise do them.
189 }
190
191 FUNCTION {init.toggle.switches}
192 {% set switches for controlling the output!
193 #0 'givetitles := % if it is 0 then don't give titles, otherwise do them.
194 }
195
196 STRINGS { s t }
197
198 FUNCTION {output.nonnull}
199 { 's :=
200 output.state mid.sentence =
201 % "in of output.nonnull" warning$
202
203 % % { ", " * write$ } % the comma here is responsible for every comma!
204 % % % But JMB doesn't want commas, so away it goes!
205 % { " " * write$ } % That does it!
206
207 { % doing a comma is controlled specifically in JMB using docomma
208 docomma #0 =
209 { " " * write$ }
210 { ", " * write$ }
211 if$
212 }
213 { output.state after.block =
214 { add.period$ write$
215 newline$
216 "\newblock " write$
217 }
218 { output.state before.all =
219 'write$
220 { add.period$ " " * write$ }
221 if$
222 }
223 if$
224 mid.sentence 'output.state :=
225 }
226 if$
227 s
228 % "out of output.nonnull" warning$
229 }
230
231 FUNCTION {output}
232 { duplicate$ empty$
233 'pop$
234 'output.nonnull
235 if$
236 }
237
238 FUNCTION {output.check}
239 { 't :=
240 % "in output.check" warning$
241 duplicate$ empty$
242 { t "title" =
243 { pop$ } % jmb ignores titles and does not object if missing
244 { pop$ "empty " t * " in " * cite$ * warning$ }
245 if$
246 }
247 'output.nonnull % block periods
248 % { pop$ } % don't do anything
249 if$
250 % "ouT of output.check" warning$
251 }
252
253 % t "title" =
254 % { "zowie" warning$ }
255 % { duplicate$ empty$
256 % { pop$ "EmPtY " t * " in " * cite$ * warning$ }
257 % 'output.nonnull
258 % }
259 % if$
260 % if$
261 %}
262
263 % apalike needs this function because
264 % the year has special punctuation;
265 % apalike ignores the month
266 FUNCTION {output.year.check}
267 { year empty$
268 {
269 "empty year in " cite$ ", using label: " extra.label * * * warning$
270 write$
271 % " (" extra.label * ")" * % TDS UNemphasized label
272
273 % zzz here is the problem:
274 % extra.label "BLURB" * warning$
275 " ({\rm{" extra.label * "}})" * % TDS emphasized label
276 % "BLORB" warning$
277
278 { label "{\rm{" extra.label "}}" * * * 'label :=}
279 % "BLUBEL" warning$
280
281 mid.sentence 'output.state :=
282 % "BLIP" warning$
283 }
284 { write$
285
286 % " (" year * extra.label * ")" * % TDS UNemphasized label
287 " (" year * "{\rm{" extra.label "}}" * * * ")" * % TDS emphasized label
288
289 mid.sentence 'output.state :=
290 }
291 if$
292 % "POW" warning$
293 }
294
295 FUNCTION {output.bibitem}
296 { newline$
297 "\bibitem[" write$
298 label write$
299 "]{" write$
300 cite$ write$
301 "}" write$
302 newline$
303 ""
304 before.all 'output.state :=
305 }
306
307 FUNCTION {fin.entry}
308 { add.period$
309 write$
310 newline$
311 }
312
313 FUNCTION {new.block}
314 { output.state before.all =
315 'skip$
316 { after.block 'output.state := }
317 if$
318 }
319
320 FUNCTION {new.sentence}
321 { output.state after.block =
322 'skip$
323 { output.state before.all =
324 'skip$
325 { after.sentence 'output.state := }
326 if$
327 }
328 if$
329 }
330
331 FUNCTION {not}
332 { { #0 }
333 { #1 }
334 if$
335 }
336
337 FUNCTION {and}
338 { 'skip$
339 { pop$ #0 }
340 if$
341 }
342
343 FUNCTION {or}
344 { { pop$ #1 }
345 'skip$
346 if$
347 }
348
349 FUNCTION {new.block.checkb}
350 { empty$
351 swap$ empty$
352 and
353 'skip$
354 'new.block
355 if$
356 }
357
358 FUNCTION {field.or.null}
359 { duplicate$ empty$
360 { pop$ "" }
361 'skip$
362 if$
363 }
364
365 FUNCTION {emphasize}
366 { duplicate$ empty$
367 { pop$ "" }
368 { "{\rm " swap$ * "}" * }
369 if$
370 }
371
372 INTEGERS { nameptr namesleft numnames }
373
374 FUNCTION {format.names}
375 { 's :=
376 #1 'nameptr :=
377 s num.names$ 'numnames :=
378 numnames 'namesleft :=
379 { namesleft #0 > }
380 { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := % last name first
381 nameptr #1 >
382 { namesleft #1 >
383 { ", " * t * }
384 { numnames #2 >
385 % { "," * } % remove this comma TDS
386 { " " * }
387 'skip$
388 if$
389 t "others" =
390 { " {\rm et~al.}" * }
391 %{ " \& " * t * }
392 % 2009 Jul 11: return to 'and'
393 { " and " * t * }
394 if$
395 }
396 if$
397 }
398 't
399 if$
400 nameptr #1 + 'nameptr :=
401 namesleft #1 - 'namesleft :=
402 }
403 while$
404 }
405
406 FUNCTION {format.authors}
407 { author empty$
408 { "" }
409 { author format.names }
410 if$
411 }
412
413 FUNCTION {format.key} % this function is just for apalike
414 { empty$
415 { key field.or.null }
416 { "" }
417 if$
418 }
419
420 FUNCTION {format.editors}
421 { editor empty$
422 { "" }
423 { editor format.names
424 editor num.names$ #1 >
425 { ", eds" * } % TDS
426 { ", ed." * } % TDS
427 if$
428 }
429 if$
430 }
431
432 FUNCTION {special.change.case}
433 % change the entire string to lower case except
434 % for the first letter and things inside {}
435 % That is, force the first letter after a colon (:) to be lower case
436 % but otherwise use the change.case$ rules.
437 {
438 % title "t" change.case$ % TDS this line was the original method
439
440 % start with the first letter of the title, hang on stack
441 title #1 #1 substring$
442
443 % unearth this to see the breakpoint
444 %"|---|" *
445
446 % take the title, change to entire lower case.
447 title "l" change.case$
448
449 % take from second position of lowered title to end of title
450 #2
451 global.max$
452 substring$
453
454 % concatenate first letter to rest of title
455 *
456 }
457
458 FUNCTION {format.title}
459 { title empty$
460 { "" }
461 { % decide whether to give the title or not
462 % givetitles #1 =
463 %% { title "t" change.case$ } % produce the title % TDS original function
464 % { special.change.case } % produce the title
465 % { title pop$ "" } % don't produce the title
466 % if$
467 % 2009 Jul 11: give the title for Cell now
468 title
469 }
470 if$
471 }
472
473 FUNCTION {n.dashify}
474 { 't :=
475 ""
476 { t empty$ not }
477 { t #1 #1 substring$ "-" =
478 { t #1 #2 substring$ "--" = not
479 { "--" *
480 t #2 global.max$ substring$ 't :=
481 }
482 { { t #1 #1 substring$ "-" = }
483 { "-" *
484 t #2 global.max$ substring$ 't :=
485 }
486 while$
487 }
488 if$
489 }
490 { t #1 #1 substring$ *
491 t #2 global.max$ substring$ 't :=
492 }
493 if$
494 }
495 while$
496 }
497
498 FUNCTION {format.btitle}
499 { title emphasize
500 }
501
502 FUNCTION {tie.or.space.connect}
503 { duplicate$ text.length$ #3 <
504 { "~" }
505 { " " }
506 if$
507 swap$ * *
508 }
509
510 FUNCTION {either.or.check}
511 { empty$
512 'pop$
513 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
514 if$
515 }
516
517 FUNCTION {format.bvolume}
518 { volume empty$
519 { "" }
520 % { "volume" volume tie.or.space.connect % TDS
521 { "vol." volume "," * tie.or.space.connect % made vol.
522 series empty$
523 'skip$
524 { " of " * series emphasize * }
525 if$
526 % "volume and number" number either.or.check % TDS
527 "vol. and num." number either.or.check % made vol.
528 }
529 if$
530 }
531
532 FUNCTION {format.number.series}
533 { volume empty$
534 { number empty$
535 { series field.or.null }
536 { output.state mid.sentence =
537 { "number" }
538 { "Number" }
539 if$
540 number tie.or.space.connect
541 series empty$
542 { "there's a number but no series in " cite$ * warning$ }
543 { " in " * series * }
544 if$
545 }
546 if$
547 }
548 { "" }
549 if$
550 }
551
552 FUNCTION {format.edition}
553 { edition empty$
554 { "" }
555 { output.state mid.sentence =
556 { edition "l" change.case$ " edition" * }
557 { edition "t" change.case$ " edition" * }
558 if$
559 }
560 if$
561 }
562
563 INTEGERS { multiresult }
564
565 FUNCTION {multi.page.check}
566 { 't :=
567 #0 'multiresult :=
568 { multiresult not
569 t empty$ not
570 and
571 }
572 { t #1 #1 substring$
573 duplicate$ "-" =
574 swap$ duplicate$ "," =
575 swap$ "+" =
576 or or
577 { #1 'multiresult := }
578 { t #2 global.max$ substring$ 't := }
579 if$
580 }
581 while$
582 multiresult
583 }
584
585 FUNCTION {format.pages}
586 { pages empty$
587 { "" }
588 { pages multi.page.check
589 { "pp." pages n.dashify tie.or.space.connect } % TDS
590 { "p." pages tie.or.space.connect } % TDS
591 if$
592 }
593 if$
594 }
595
596 FUNCTION {format.vol.num.pages}
597 % { "{\rm " volume "}" * * field.or.null % make volume bold face
598 { "\emph{" volume "}" * * field.or.null % make volume italics 2009 jul 11
599
600 % cell does not take numbers
601 % number empty$
602 % 'skip$
603 %% { " (" number * ")" * *
604 % { " ({\em " number "\/}" * * ")" * * % CELL IS ITALICS
605 %% zzz
606 % volume empty$
607 % { "there's a number but no volume in " cite$ * warning$ }
608 % 'skip$
609 % if$
610 % }
611 % if$
612
613 pages empty$
614 'skip$
615 { duplicate$ empty$
616 { pop$ format.pages }
617 % { ":" * pages n.dashify * } % no more colons after the volume
618 { ", " * pages n.dashify * } % comma's instead
619 if$
620 }
621 if$
622 }
623
624 FUNCTION {format.chapter.pages}
625 { chapter empty$
626 'format.pages
627 { type empty$
628 { "chapter" }
629 { type "l" change.case$ }
630 if$
631 chapter tie.or.space.connect
632 pages empty$
633 'skip$
634 { ", " * format.pages * }
635 if$
636 }
637 if$
638 }
639
640 FUNCTION {format.in.ed.booktitle}
641 { booktitle empty$
642 { "" }
643 { editor empty$
644 { "In " booktitle emphasize * } % TDS
645 { "In " booktitle emphasize * ", " * % That's the comma after the title
646 "(" format.editors ")," * * * } % TDS
647 if$
648 }
649 if$
650 }
651
652 FUNCTION {format.thesis.type}
653 { type empty$
654 'skip$
655 { pop$
656 type "t" change.case$
657 }
658 if$
659 }
660
661 FUNCTION {format.tr.number}
662 { type empty$
663 { "Technical Report" }
664 'type
665 if$
666 number empty$
667 { "t" change.case$ }
668 { number tie.or.space.connect }
669 if$
670 }
671
672 FUNCTION {format.article.crossref}
673 { "In" % this is for apalike % TDS
674 " \cite{" * crossref * "}" *
675 }
676
677 FUNCTION {format.book.crossref}
678 { volume empty$
679 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
680 "In " % TDS
681 }
682 { "Volume" volume tie.or.space.connect
683 " of " *
684 }
685 if$
686 "\cite{" * crossref * "}" * % this is for apalike
687 }
688
689 FUNCTION {format.incoll.inproc.crossref}
690 { "In" % this is for apalike % TDS
691 " \cite{" * crossref * "}" *
692 }
693
694 FUNCTION {article}
695 {
696 cite$ "TitlesOn" =
697 'skip$ % Don't write out an article of this kind, it's a toggle switch!
698 {
699 output.bibitem
700 format.authors "author" output.check
701 author format.key output % special for
702 % "===> about to" warning$
703 output.year.check % apalike
704 % "===> after it" warning$
705 new.block
706 % yyy
707 format.title "title" output.check
708 new.block
709 crossref missing$
710 { % figure out the last character of the journal name.
711 % "<<" journal #-1 #1 substring$ ">>" * * % for testing
712 % "<" journal ">" * * % this works ok % for testing
713
714 journal #-1 #1 substring$ "." =
715 { journal } % journal ended in period so don't do anything
716 % { journal ", " *} % journal ended without period, so add comma
717 { journal " " *} % journal ended without period, so add comma NONE FOR CELL
718 if$
719 emphasize "journal" output.check
720
721 % journal * emphasize "journal" output.check % the original method
722
723 format.vol.num.pages output
724 }
725 { format.article.crossref output.nonnull
726 format.pages output
727 }
728 if$
729 % new.block % 2009 jul 13: suppress notes
730 % note output % 2009 jul 13: suppress notes
731 fin.entry
732 }
733 if$
734 }
735
736 FUNCTION {book}
737 { output.bibitem
738 author empty$
739 { format.editors "author and editor" output.check
740 editor format.key output
741 }
742 { format.authors output.nonnull
743 crossref missing$
744 { "author and editor" editor either.or.check }
745 'skip$
746 if$
747 }
748 if$
749 output.year.check % special for apalike
750 new.block
751 format.btitle "title" output.check
752 #1 'docomma := % TURN COMMAS ON FOR JMB
753 crossref missing$
754 {
755 format.bvolume output
756 new.block
757 format.number.series output
758 format.edition output % TDS JMB position for edition
759 % new.sentence
760 % #0 'docomma := % no comma after address
761 % address ":" * output % TDS
762 publisher "publisher" output.check % TDS
763 % #1 'docomma := % comma back on
764 % publisher "publisher" output.check
765 % address output
766 address output % TDS - no colon!
767 }
768 { new.block
769 format.book.crossref output.nonnull
770 }
771 if$
772 % format.edition output % TDS original position of edition
773 new.block
774 note output
775 fin.entry
776 #0 'docomma := % TURN COMMAS OFF
777 }
778
779 FUNCTION {booklet}
780 { output.bibitem
781 format.authors output
782 author format.key output % special for
783 output.year.check % apalike
784 new.block
785 format.title "title" output.check
786 new.block
787 howpublished output
788 address output
789 new.block
790 note output
791 fin.entry
792 }
793
794 FUNCTION {inbook}
795 { output.bibitem
796 author empty$
797 { format.editors "author and editor" output.check
798 editor format.key output
799 }
800 { format.authors output.nonnull
801 crossref missing$
802 { "author and editor" editor either.or.check }
803 'skip$
804 if$
805 }
806 if$
807 output.year.check % special for apalike
808 new.block
809 format.btitle "title" output.check
810 crossref missing$
811 { format.bvolume output
812 format.chapter.pages "chapter and pages" output.check
813 new.block
814 format.number.series output
815 new.sentence
816 #0 'docomma := % no comma after address
817 address ":" * output % TDS
818 publisher "publisher" output.check % TDS
819 #1 'docomma := % comma back on
820 % publisher "publisher" output.check
821 % address output
822 }
823 { format.chapter.pages "chapter and pages" output.check
824 new.block
825 format.book.crossref output.nonnull
826 }
827 if$
828 format.edition output
829 new.block
830 note output
831 fin.entry
832 }
833
834 FUNCTION {incollection}
835 { output.bibitem
836 format.authors "author" output.check
837 author format.key output % special for
838 output.year.check % apalike
839 new.block
840 format.title "title" output.check
841 new.block
842 crossref missing$
843 { format.in.ed.booktitle "booktitle" output.check
844 format.bvolume output
845 format.number.series output
846 format.chapter.pages output
847 new.sentence
848 publisher "publisher" output.check
849 address output
850 format.edition output
851 }
852 { format.incoll.inproc.crossref output.nonnull
853 format.chapter.pages output
854 }
855 if$
856 new.block
857 note output
858 fin.entry
859 }
860
861 FUNCTION {inproceedings}
862 { output.bibitem
863 format.authors "author" output.check
864 author format.key output % special for
865 output.year.check % apalike
866 new.block
867 format.title "title" output.check
868 new.block
869 crossref missing$
870 {
871 % #1 'docomma := % TURN COMMAS ON FOR JMB, BUT NOT FOR JTB: inconsistent. TDS NOW
872 format.in.ed.booktitle "booktitle" output.check
873 format.bvolume output
874 format.number.series output
875 format.pages
876 pages empty$
877 { output }
878 { "," * output } % TDS toss in comma instead of period
879 if$
880
881 % address output % TDS address is below for JTB
882 % new.sentence % TDS remove period
883 organization output
884 #0 'docomma := % NO COMMA AFTER ADDRESS
885 publisher "publisher" output.check % TDS
886 #1 'docomma := % comma back on
887
888 % publisher output % are simpler
889 address output % TDS
890 #0 'docomma := % TURN COMMAS OFF
891 }
892 { format.incoll.inproc.crossref output.nonnull
893 format.pages output
894 }
895 if$
896 new.block
897 note output
898 fin.entry
899 }
900
901 FUNCTION {conference} { inproceedings }
902
903 FUNCTION {manual}
904 { output.bibitem
905 format.authors output
906 author format.key output % special for
907 output.year.check % apalike
908 new.block
909 format.btitle "title" output.check
910 organization address new.block.checkb
911 organization output
912 address output
913 format.edition output
914 new.block
915 note output
916 fin.entry
917 }
918
919 FUNCTION {mastersthesis}
920 { output.bibitem
921 format.authors "author" output.check
922 author format.key output % special for
923 output.year.check % apalike
924 new.block
925 format.title "title" output.check
926 new.block
927 "Master's thesis" format.thesis.type output.nonnull
928 school "school" output.check
929 address output
930 new.block
931 note output
932 fin.entry
933 }
934
935 FUNCTION {misc}
936 { output.bibitem
937 format.authors output
938 author format.key output % special for
939 output.year.check % apalike
940 new.block
941 format.title output
942 new.block
943 howpublished output
944 new.block
945 note output
946 fin.entry
947 }
948
949 FUNCTION {phdthesis}
950 { output.bibitem
951 format.authors "author" output.check
952 author format.key output % special for
953 output.year.check % apalike
954 new.block
955 format.btitle "title" output.check
956 new.block
957 "PhD thesis," format.thesis.type output.nonnull
958 school "school" output.check
959 address output
960 new.block
961 note output
962 fin.entry
963 }
964
965 FUNCTION {proceedings}
966 { output.bibitem
967 format.editors output
968 editor format.key output % special for
969 output.year.check % apalike
970 new.block
971 format.btitle "title" output.check
972 format.bvolume output
973 format.number.series output
974 address output % for apalike
975 new.sentence % we always output
976 organization output % a nonempty organization
977 publisher output % here
978 new.block
979 note output
980 fin.entry
981 }
982
983 FUNCTION {techreport}
984 { output.bibitem
985 format.authors "author" output.check
986 author format.key output % special for
987 output.year.check % apalike
988 new.block
989 format.title "title" output.check
990 new.block
991 format.tr.number output.nonnull
992 institution "institution" output.check
993 address output
994 new.block
995 note output
996 fin.entry
997 }
998
999 FUNCTION {unpublished}
1000 { output.bibitem
1001 format.authors "author" output.check
1002 author format.key output % special for
1003 % "===> about to unpuBLISH" warning$
1004 output.year.check % apalike
1005 % "===> out of to unpuBLISH" warning$
1006 new.block
1007 % "===> PLEASE PLEASE BE HERE" warning$
1008
1009 % Since format.title is out of commission, the original method won't work:
1010 % format.title "title" output.check
1011 % so do the equivalent of the format.title procedure: (TDS)
1012 title empty$
1013 { "" }
1014 { title "t" change.case$ } % produce the title
1015 if$
1016 % "===> perfidity 1" warning$
1017 "title" output.check
1018 % "===> perfidity" warning$
1019
1020 new.block
1021 note "note" output.check
1022 fin.entry
1023
1024 % "===> GOlly done" warning$
1025 }
1026
1027 FUNCTION {default.type} { misc }
1028
1029 MACRO {jan} {"January"}
1030
1031 MACRO {feb} {"February"}
1032
1033 MACRO {mar} {"March"}
1034
1035 MACRO {apr} {"April"}
1036
1037 MACRO {may} {"May"}
1038
1039 MACRO {jun} {"June"}
1040
1041 MACRO {jul} {"July"}
1042
1043 MACRO {aug} {"August"}
1044
1045 MACRO {sep} {"September"}
1046
1047 MACRO {oct} {"October"}
1048
1049 MACRO {nov} {"November"}
1050
1051 MACRO {dec} {"December"}
1052
1053 MACRO {acmcs} {"ACM Computing Surveys"}
1054
1055 MACRO {acta} {"Acta Informatica"}
1056
1057 MACRO {cacm} {"Communications of the ACM"}
1058
1059 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1060
1061 MACRO {ibmsj} {"IBM Systems Journal"}
1062
1063 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1064
1065 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1066
1067 MACRO {ieeetcad}
1068 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1069
1070 MACRO {ipl} {"Information Processing Letters"}
1071
1072 MACRO {jacm} {"Journal of the ACM"}
1073
1074 MACRO {jcss} {"Journal of Computer and System Sciences"}
1075
1076 MACRO {scp} {"Science of Computer Programming"}
1077
1078 MACRO {sicomp} {"SIAM Journal on Computing"}
1079
1080 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1081
1082 MACRO {tods} {"ACM Transactions on Database Systems"}
1083
1084 MACRO {tog} {"ACM Transactions on Graphics"}
1085
1086 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1087
1088 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1089
1090 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1091
1092 MACRO {tcs} {"Theoretical Computer Science"}
1093
1094 READ
1095
1096 % ***********************************************************
1097
1098 FUNCTION {check.for.titlecommand}
1099 % go through each entry and see if one of them has the key
1100 % 'TitlesOn'. If this is found, then do titles!
1101 % 1989 November 18 TDS
1102 {
1103 % "|" label "|" * * write$ newline$ % |Arrhenius {\rm et~al.}, 1986|
1104 % "|" cite$ "|" * * write$ newline$ % |Arrhenius1986|
1105 % so cite$ is the thing I want to detect...
1106
1107 cite$ "TitlesOn" =
1108 { % got it!
1109 % "FOUND TitlesOn" write$ newline$
1110 "Titles Will Be Printed" warning$
1111 #1 'givetitles := % give titles!
1112 }
1113 'skip$
1114 if$
1115 }
1116 EXECUTE {init.toggle.switches}
1117 ITERATE {check.for.titlecommand}
1118 % ***********************************************************
1119
1120 FUNCTION {sortify}
1121 { purify$
1122 "l" change.case$
1123 }
1124
1125 INTEGERS { len }
1126
1127 FUNCTION {chop.word}
1128 { 's :=
1129 'len :=
1130 s #1 len substring$ =
1131 { s len #1 + global.max$ substring$ }
1132 's
1133 if$
1134 }
1135
1136 % There are three apalike cases: one person (Jones),
1137 % two (Jones and de~Bruijn), and more (Jones et~al.).
1138 % This function is much like format.crossref.editors.
1139 %
1140 FUNCTION {format.lab.names}
1141 { 's :=
1142 s #1 "{vv~}{ll}" format.name$
1143 s num.names$ duplicate$
1144 #2 >
1145 { pop$ " {\rm et~al.}" * }
1146 { #2 <
1147 'skip$
1148 { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1149 { " {\rm et~al.}" * }
1150 % { " \& " * s #2 "{vv~}{ll}" format.name$ * }
1151 % note new use of & rather than `and'. TDS
1152 % 2009 jul 11: return to 'and'
1153 { " and " * s #2 "{vv~}{ll}" format.name$ * }
1154 if$
1155 }
1156 if$
1157 }
1158 if$
1159 }
1160
1161 FUNCTION {author.key.label}
1162 { author empty$
1163 { key empty$
1164 { cite$ #1 #3 substring$ }
1165 'key % apalike uses the whole key
1166 if$
1167 }
1168 { author format.lab.names }
1169 if$
1170 }
1171
1172 FUNCTION {author.editor.key.label}
1173 { author empty$
1174 { editor empty$
1175 { key empty$
1176 { cite$ #1 #3 substring$ }
1177 'key % apalike uses the whole key
1178 if$
1179 }
1180 { editor format.lab.names }
1181 if$
1182 }
1183 { author format.lab.names }
1184 if$
1185 }
1186
1187 FUNCTION {editor.key.label}
1188 { editor empty$
1189 { key empty$
1190 { cite$ #1 #3 substring$ }
1191 'key % apalike uses the whole key, no organization
1192 if$
1193 }
1194 { editor format.lab.names }
1195 if$
1196 }
1197
1198 FUNCTION {calc.label}
1199 { type$ "book" =
1200 type$ "inbook" =
1201 or
1202 'author.editor.key.label
1203 { type$ "proceedings" =
1204 'editor.key.label % apalike ignores organization
1205 'author.key.label % for labeling and sorting
1206 if$
1207 }
1208 if$
1209 ", " % these three lines are
1210 * % for apalike, which
1211 year field.or.null purify$ #-1 #4 substring$ % uses all four digits
1212 *
1213 'label :=
1214 }
1215
1216 FUNCTION {sort.format.names}
1217 { 's :=
1218 #1 'nameptr :=
1219 ""
1220 s num.names$ 'numnames :=
1221 numnames 'namesleft :=
1222 { namesleft #0 > }
1223 { nameptr #1 >
1224 { " " * }
1225 'skip$
1226 if$ % apalike uses initials
1227 s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := % <= here
1228 nameptr numnames = t "others" = and
1229 { "{\rm et al}" * }
1230 { t sortify * }
1231 if$
1232 nameptr #1 + 'nameptr :=
1233 namesleft #1 - 'namesleft :=
1234 }
1235 while$
1236 }
1237
1238 FUNCTION {sort.format.title}
1239 { 't :=
1240 "A " #2
1241 "An " #3
1242 "The " #4 t chop.word
1243 chop.word
1244 chop.word
1245 sortify
1246 #1 global.max$ substring$
1247 }
1248
1249 FUNCTION {author.sort}
1250 { author empty$
1251 { key empty$
1252 { "to sort, need author or key in " cite$ * warning$
1253 ""
1254 }
1255 { key sortify }
1256 if$
1257 }
1258 { author sort.format.names }
1259 if$
1260 }
1261
1262 FUNCTION {author.editor.sort}
1263 { author empty$
1264 { editor empty$
1265 { key empty$
1266 { "to sort, need author, editor, or key in " cite$ * warning$
1267 ""
1268 }
1269 { key sortify }
1270 if$
1271 }
1272 { editor sort.format.names }
1273 if$
1274 }
1275 { author sort.format.names }
1276 if$
1277 }
1278
1279 FUNCTION {editor.sort}
1280 { editor empty$
1281 { key empty$
1282 { "to sort, need editor or key in " cite$ * warning$
1283 ""
1284 }
1285 { key sortify }
1286 if$
1287 }
1288 { editor sort.format.names }
1289 if$
1290 }
1291
1292 % apalike uses two sorting passes; the first one sets the
1293 % labels so that the `a's, `b's, etc. can be computed;
1294 % the second pass puts the references in "correct" order.
1295 % The presort function is for the first pass. It computes
1296 % label, sort.label, and title, and then concatenates.
1297 FUNCTION {presort}
1298 { calc.label
1299 label sortify
1300 " "
1301 *
1302 type$ "book" =
1303 type$ "inbook" =
1304 or
1305 'author.editor.sort
1306 { type$ "proceedings" =
1307 'editor.sort
1308 'author.sort
1309 if$
1310 }
1311 if$
1312 #1 entry.max$ substring$ % for
1313 'sort.label := % apalike
1314 sort.label % style
1315 *
1316 " "
1317 *
1318 title field.or.null
1319 sort.format.title
1320 *
1321 #1 entry.max$ substring$
1322 'sort.key$ :=
1323 }
1324
1325 ITERATE {presort}
1326
1327 SORT % by label, sort.label, title---for final label calculation
1328
1329 STRINGS { last.label next.extra } % apalike labels are only for the text;
1330
1331 INTEGERS { last.extra.num } % there are none in the bibliography
1332
1333 FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label'
1334 { #0 int.to.chr$ 'last.label :=
1335 "" 'next.extra :=
1336 #0 'last.extra.num :=
1337 }
1338
1339 FUNCTION {forward.pass}
1340 % pass through the references forward
1341 {
1342 %"\\ label=" label "//" * * write$ newline$ % display the label
1343 %"\\last.label=" last.label "//" * * write$ newline$ % display the label
1344
1345 last.label label = % if the label repeats the previous label...
1346 { % then increment the extra number
1347 last.extra.num #1 + 'last.extra.num :=
1348 % and convert it to a label
1349 last.extra.num int.to.chr$ 'extra.label :=
1350 }
1351 { % else set things up for the next entry
1352 "a" chr.to.int$ 'last.extra.num :=
1353
1354 % However, if the year was missing, tack on an extra "a". TDS
1355 year empty$
1356 {"a" 'extra.label :=}
1357 {"" 'extra.label :=}
1358 if$
1359
1360 % "" 'extra.label := % the original method was not to do anything TDS
1361
1362 label 'last.label := % capture this label for next time
1363 }
1364 if$
1365 %"\\extra.label = " extra.label "//" * * write$ newline$ % display the label
1366 }
1367
1368 FUNCTION {reverse.pass}
1369 % pass through the references backwards
1370 % add extra characters to the end of the label string
1371 {
1372 %"{{" label "}}" * * write$ newline$ % display the label
1373 next.extra "b" =
1374 % original logic:
1375 { "a" 'extra.label := }
1376 'skip$
1377 if$
1378
1379 % next.extra "b" = { "next.extra was = b" write$ newline$} 'skip$ if$
1380
1381 % new as of 1989 Oct 18
1382 % { "a" 'extra.label := }
1383 % { % Put on an "a" at the end of the label if the year is missing. TDS
1384 % year empty$
1385 % { "a" 'extra.label := }
1386 % %{ label "a" * 'label := }
1387 % 'skip$ % otherwise leave it alone (orignial method)
1388 % if$ }
1389 % if$
1390
1391 % label extra.label * 'label := % TDS ORIGINAL LABEL METHOD
1392
1393 % stick {\rm } around extra.label if it's not empty TDS
1394 extra.label "" =
1395 'skip$
1396 { label "{\rm{" extra.label "}}" * * * 'label :=}
1397 if$
1398
1399 extra.label 'next.extra :=
1400 %"{{" label "}}" * * write$ newline$ % display the label
1401 }
1402
1403 FUNCTION {bib.sort.order}
1404 % Generate the sort.key$ variables for sorting.
1405 % The sorting is first on the sort.label (ie, author's name), followed
1406 % by the year then the title. If there is no year, the cite$ is used.
1407 {
1408 sort.label % this is based on the author name
1409 " " * % tack on some space
1410 % original apa command was to use the year or an empty string:
1411 % year field.or.null sortify
1412 %
1413 % Replace that with the use of the cite$, when there is no year:
1414 year duplicate$ empty$
1415 {pop$ cite$}
1416 'skip$
1417 if$
1418
1419 * " " * % tack on some space
1420
1421 % I CAN'T STAND SORTING ON TITLE!!! TDS 1989 Dec 5
1422 % title field.or.null
1423 % sort.format.title
1424 % * % attach them together
1425 cite$
1426 * % use cite$ instead!!
1427
1428 % note: if there is no year, then the cite$ will override the sorting
1429 % on the title. Oh well. Title sorting is sorta (ha ha) awful.
1430
1431 #1 entry.max$ substring$
1432 'sort.key$ :=
1433
1434 % The following line helps debug the program. It shows what the sort.key$ is.
1435 % "%" sort.key$ * write$ newline$
1436 }
1437
1438 % Here is the place that the actual executions of the labeling and sorting
1439 % functions are done.
1440
1441
1442 EXECUTE {initialize.extra.label.stuff} % initialize variables
1443 ITERATE {bib.sort.order} % set up the sorting keys
1444 SORT % by sort.label, year, title---giving final bibliography order
1445 % Having sorted NOW we apply the extra letters at the end!
1446 ITERATE {forward.pass}
1447 REVERSE {reverse.pass}
1448
1449 FUNCTION {begin.bib}
1450 { preamble$ empty$ % no \etalchar in apalike
1451 'skip$
1452 { preamble$ write$ newline$ }
1453 if$
1454 "\begin{thebibliography}{}" write$ newline$ % no labels in apalike
1455 }
1456
1457 EXECUTE {begin.bib}
1458
1459 EXECUTE {init.state.consts}
1460
1461 ITERATE {call.type$}
1462
1463 FUNCTION {end.bib}
1464 { newline$
1465 "\end{thebibliography}" write$ newline$
1466 }
1467
1468 EXECUTE {end.bib}