Debian Codegraph @

texmf-dist/bibtex/bst/chicago-annote/chicago-annote.bst

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