Debian Codegraph @

texmf-dist/bibtex/bst/mslapa/mslapa.bst

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