Debian Codegraph @

texmf-dist/bibtex/bst/amscls/amsplain.bst

raw
1 %% filename: amsplain.bst
2 %% version: 2.0
3 %% date: 2000/03/27
4 %%
5 %% American Mathematical Society
6 %% Technical Support
7 %% Publications Technical Group
8 %% 201 Charles Street
9 %% Providence, RI 02904
10 %% USA
11 %% tel: (401) 455-4080
12 %% (800) 321-4267 (USA and Canada only)
13 %% fax: (401) 331-3842
14 %% email: [email protected]
15 %%
16 %% Copyright 1995, 2000, 2010 American Mathematical Society.
17 %%
18 %% This work may be distributed and/or modified under the
19 %% conditions of the LaTeX Project Public License, either version 1.3c
20 %% of this license or (at your option) any later version.
21 %% The latest version of this license is in
22 %% http://www.latex-project.org/lppl.txt
23 %% and version 1.3c or later is part of all distributions of LaTeX
24 %% version 2005/12/01 or later.
25 %%
26 %% This work has the LPPL maintenance status `maintained'.
27 %%
28 %% The Current Maintainer of this work is the American Mathematical
29 %% Society.
30 %%
31 %% ====================================================================
32
33 % See the file btxbst.doc for extra documentation other than
34 % what is included here. And see btxhak.tex for a description
35 % of the BibTeX language and how to use it.
36
37 % This defines the types of fields that can occur in a database entry
38 % for this particular bibliography style. Except for `language',
39 % this is the standard list from plain.bst.
40
41 %% Types of entries currently allowed in a BibTeX file:
42 %%
43 %% ARTICLE -- An article from a journal or magazine.
44 %%
45 %% BOOK -- A book with an explicit publisher.
46 %%
47 %% BOOKLET -- A work that is printed and bound,
48 %% but without a named publisher or sponsoring institution.
49 %%
50 %% CONFERENCE -- The same as INPROCEEDINGS,
51 %% included for Scribe compatibility.
52 %%
53 %% INBOOK -- A part of a book,
54 %% which may be a chapter (or section or whatever) and/or a range of pages.
55 %%
56 %% INCOLLECTION -- A part of a book having its own title.
57 %%
58 %% INPROCEEDINGS -- An article in a conference proceedings.
59 %%
60 %% MANUAL -- Technical documentation.
61 %%
62 %% MASTERSTHESIS -- A Master's thesis.
63 %%
64 %% MISC -- Use this type when nothing else fits.
65 %%
66 %% PHDTHESIS -- A PhD thesis.
67 %%
68 %% PROCEEDINGS -- The proceedings of a conference.
69 %%
70 %% TECHREPORT -- A report published by a school or other institution,
71 %% usually numbered within a series.
72 %%
73 %% UNPUBLISHED -- A document having an author and title, but not formally
74 %% published.
75
76 ENTRY
77 { address
78 author
79 booktitle
80 chapter
81 edition
82 editor
83 howpublished
84 institution
85 journal
86 key
87 language
88 month
89 mrnumber
90 note
91 number
92 organization
93 pages
94 publisher
95 school
96 series
97 title
98 type
99 volume
100 year
101 }
102 {}
103 { label bysame }
104
105 % Removed after.sentence, after.block---not needed.
106
107 INTEGERS { output.state before.all mid.sentence }
108
109 FUNCTION {init.state.consts}
110 { #0 'before.all :=
111 #1 'mid.sentence :=
112 }
113
114 % Scratch variables:
115
116 STRINGS { s t }
117
118 % Utility functions
119
120 FUNCTION {shows}
121 { duplicate$ ":::: `" swap$ * "'" * top$
122 }
123
124 FUNCTION {showstack}
125 {"STACK====================================================================="
126 top$
127 stack$
128 "ENDSTACK=================================================================="
129 top$
130 }
131
132 FUNCTION {not}
133 { { #0 }
134 { #1 }
135 if$
136 }
137
138 FUNCTION {and}
139 { 'skip$
140 { pop$ #0 }
141 if$
142 }
143
144 FUNCTION {or}
145 { { pop$ #1 }
146 'skip$
147 if$
148 }
149
150 FUNCTION {field.or.null}
151 { duplicate$ empty$
152 { pop$ "" }
153 'skip$
154 if$
155 }
156
157 FUNCTION {emphasize}
158 { duplicate$ empty$
159 { pop$ "" }
160 { "\emph{" swap$ * "}" * }
161 if$
162 }
163
164 % n.dashify is used to make sure page ranges get the TeX code
165 % (two hyphens) for en-dashes.
166
167 FUNCTION {n.dashify}
168 { 't :=
169 ""
170 { t empty$ not }
171 { t #1 #1 substring$ "-" =
172 { t #1 #2 substring$ "--" = not
173 { "--" *
174 t #2 global.max$ substring$ 't :=
175 }
176 { { t #1 #1 substring$ "-" = }
177 { "-" *
178 t #2 global.max$ substring$ 't :=
179 }
180 while$
181 }
182 if$
183 }
184 { t #1 #1 substring$ *
185 t #2 global.max$ substring$ 't :=
186 }
187 if$
188 }
189 while$
190 }
191
192 % tie.or.space.connect connects two items with a ~ if the
193 % second item is less than 3 letters long, otherwise it just puts an
194 % ordinary space.
195
196 FUNCTION {tie.or.space.connect}
197 { duplicate$ text.length$ #3 <
198 { "~" }
199 { " " }
200 if$
201 swap$ * *
202 }
203
204 FUNCTION {add.space.if.necessary}
205 { duplicate$ "" =
206 'skip$
207 { " " * }
208 if$
209 }
210
211 % either.or.check gives a warning if two mutually exclusive fields
212 % were used in the database.
213
214 FUNCTION {either.or.check}
215 { empty$
216 'pop$
217 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
218 if$
219 }
220
221 % output.nonnull is called by output.
222
223 FUNCTION {output.nonnull}
224 % remove the top item from the stack because it's in the way.
225 { 's :=
226 output.state mid.sentence =
227 % If we're in mid-sentence, add a comma to the new top item and write it
228 { ", " * write$ }
229 % Otherwise, if we're at the beginning of a bibitem,
230 { output.state before.all =
231 % just write out the top item from the stack;
232 'write$
233 % and the last alternative is that we're at the end of the current
234 % bibitem, so we add a period to the top stack item and write it out.
235 { add.period$ " " * write$ }
236 if$
237 mid.sentence 'output.state :=
238 }
239 if$
240 % Put the top item back on the stack that we removed earlier.
241 s
242 }
243
244 % Output checks to see if the stack top is empty; if not, it
245 % calls output.nonnull to write it out.
246
247 FUNCTION {output}
248 { duplicate$ empty$
249 'pop$
250 'output.nonnull
251 if$
252 }
253
254 % Standard warning message for a missing or empty field. For the user
255 % we call any such field `missing' without respect to the distinction
256 % made by BibTeX between missing and empty.
257
258 FUNCTION {missing.warning}
259 { "missing " swap$ * " in " * cite$ * warning$ }
260
261 % Output.check is like output except that it gives a warning on-screen
262 % if the given field in the database entry is empty. t is the field
263 % name.
264
265 FUNCTION {output.check}
266 { 't :=
267 duplicate$ empty$
268 { pop$ t missing.warning }
269 'output.nonnull
270 if$
271 }
272
273 FUNCTION {output.bibitem}
274 { newline$
275 "\bibitem{" write$
276 cite$ write$
277 "}" write$
278 newline$
279 % This empty string is the first thing that will be written
280 % the next time write$ is called. Done this way because each
281 % item is saved on the stack until we find out what punctuation
282 % should be added after it. Therefore we need an empty first item.
283 ""
284 before.all 'output.state :=
285 }
286
287 FUNCTION {output.nonempty.mrnumber}
288 { duplicate$ missing$
289 { pop$ "" }
290 'skip$
291 if$
292 duplicate$ empty$
293 'pop$
294 { " \MR{" swap$ * "}" * write$ }
295 if$
296 }
297
298 FUNCTION {fin.entry}
299 { add.period$
300 write$
301 mrnumber output.nonempty.mrnumber
302 newline$
303 }
304
305 % Removed new.block, new.block.checka, new.block.checkb, new.sentence,
306 % new.sentence.checka, and new.sentence.checkb functions here, since they
307 % don't seem to be needed in the AMS style. Also moved some real
308 % basic functions like `and' and 'or' earlier in the file.
309
310 INTEGERS { nameptr namesleft numnames }
311
312 % The extra section to write out a language field was added
313 % for AMSPLAIN.BST. Not present in plain.bst.
314
315 FUNCTION {format.language}
316 { language empty$
317 { "" }
318 { " (" language * ")" * }
319 if$
320 }
321
322 % This version of format.names puts names in the format
323 %
324 % First von Last, Jr.
325 %
326 % (i.e., first name first, no abbreviating to initials).
327
328 FUNCTION {format.names}
329 { 's :=
330 #1 'nameptr :=
331 s num.names$ 'numnames :=
332 numnames 'namesleft :=
333 { namesleft #0 > }
334 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't :=
335 nameptr #1 >
336 { namesleft #1 >
337 { ", " * t * }
338 { numnames #2 >
339 { "," * }
340 'skip$
341 if$
342 t "others" =
343 { " et~al." * }
344 { " and " * t * }
345 if$
346 }
347 if$
348 }
349 't
350 if$
351 nameptr #1 + 'nameptr :=
352 namesleft #1 - 'namesleft :=
353 }
354 while$
355 }
356
357 FUNCTION {format.authors}
358 { author empty$
359 { "" }
360 { bysame "\bysame" =
361 {"\bysame"}
362 { author format.names }
363 if$
364 }
365 if$
366 }
367
368 FUNCTION {format.editors}
369 { editor empty$
370 { "" }
371 { editor format.names
372 editor num.names$ #1 >
373 { " (eds.)" * }
374 { " (ed.)" * }
375 if$
376 }
377 if$
378 }
379
380 FUNCTION {format.nonauthor.editors}
381 { editor empty$
382 { "" }
383 { editor format.names
384 editor num.names$ #1 >
385 { ", eds." * }
386 { ", ed." * }
387 if$
388 }
389 if$
390 }
391
392 FUNCTION {format.title}
393 { title empty$
394 { "" }
395 { title "t" change.case$ emphasize }
396 if$
397 }
398
399 FUNCTION {format.journal.vol.year}
400 { journal empty$
401 { "journal name" missing.warning ""}
402 { journal }
403 if$
404 volume empty$
405 'skip$
406 { " \textbf{" * volume * "}" * }
407 if$
408 year empty$
409 { "year" missing.warning }
410 { " (" * year * ")" * }
411 if$
412 }
413
414 % For formatting the issue number for a journal article.
415
416 FUNCTION {format.number}
417 { number empty$
418 { "" }
419 { "no.~" number * }
420 if$
421 }
422
423 % For formatting miscellaneous dates
424
425 FUNCTION {format.date}
426 { year empty$
427 { month empty$
428 { "" }
429 { "there's a month but no year in " cite$ * warning$
430 month
431 }
432 if$
433 }
434 { month empty$
435 'year
436 { month " " * year * }
437 if$
438 }
439 if$
440 }
441
442 %% The volume, series and number information is sort of tricky.
443 %% This code handles it as follows:
444 %% If the series is present, and the volume, but not the number,
445 %% then we do "\emph{Book title}, Series Name, vol. 000"
446 %% If the series is present, and the number, but not the volume,
447 %% then we do "\emph{Book title}, Series Name, no. 000"
448 %% If the series is present, and both number and volume,
449 %% then we do "\emph{Book title}, vol. XX, Series Name, no. 000"
450 %% Finally, if the series is absent,
451 %% then we do "\emph{Book title}, vol. XX"
452 %% or "\emph{Book title}, no. 000"
453 %% and if both volume and number are present, give a warning message.
454
455 FUNCTION {format.bookvolume.series.number}
456 { volume empty$
457 { "" % Push the empty string as a placeholder in case everything else
458 % is empty too.
459 series empty$
460 'skip$
461 { pop$ series } % if series is not empty put in stack
462 if$
463 number empty$
464 'skip$
465 { duplicate$ empty$ % if no preceding material,
466 'skip$ % do nothing, otherwise
467 { ", " * } % add a comma and space to separate.
468 if$
469 "no." number tie.or.space.connect * % add the number information
470 }
471 if$
472 }
473 %% If the volume is NOT EMPTY:
474 { "vol." volume tie.or.space.connect % vol. XX
475 number empty$
476 { series empty$
477 'skip$
478 { series ", " * swap$ *} % Series Name, vol. XX
479 if$
480 }
481 { series empty$
482 { "can't use both volume and number if series info is missing"
483 warning$
484 "in BibTeX entry type `" type$ * "'" * top$
485 }
486 { ", " * series * ", no." * number tie.or.space.connect }
487 if$
488 }
489 if$
490 }
491 if$
492
493 } % end of format.bookvolume.series.number
494
495 %% format.inproc.title.where.editors is used by inproceedings entry types
496
497 %% No case changing or emphasizing for the title. We want initial
498 %% caps, roman.
499 %% We add parentheses around the address (place where conference
500 %% was held).
501 %% Likewise we add parentheses around the editors' names.
502
503 FUNCTION {format.inproc.title.address.editors}
504 { booktitle empty$
505 { "" }
506 { booktitle
507 address empty$
508 'skip$
509 { add.space.if.necessary "(" * address * ")" * }
510 if$
511 editor empty$
512 'skip$
513 { add.space.if.necessary "(" * format.nonauthor.editors * ")" * }
514 if$
515 }
516 if$
517 }
518
519 %% format.incoll.title.editors is similar to format.inproc... but
520 %% omits the address. For collections that are not proceedings volumes.
521
522 FUNCTION {format.incoll.title.editors}
523 { booktitle empty$
524 { "" }
525 { editor empty$
526 { booktitle }
527 { booktitle
528 add.space.if.necessary "(" * format.nonauthor.editors * ")" *
529 }
530 if$
531 }
532 if$
533 }
534
535 FUNCTION {format.edition}
536 { edition empty$
537 { "" }
538 { output.state mid.sentence =
539 { edition "l" change.case$ " ed." * }
540 { edition "t" change.case$ " ed." * }
541 if$
542 }
543 if$
544 }
545
546 INTEGERS { multiresult }
547
548 FUNCTION {multi.page.check}
549 { 't :=
550 #0 'multiresult :=
551 { multiresult not
552 t empty$ not
553 and
554 }
555 { t #1 #1 substring$
556 duplicate$ "-" =
557 swap$ duplicate$ "," =
558 swap$ "+" =
559 or or
560 { #1 'multiresult := }
561 { t #2 global.max$ substring$ 't := }
562 if$
563 }
564 while$
565 multiresult
566 }
567
568 FUNCTION {format.pages}
569 { pages empty$
570 { "" }
571 { pages n.dashify }
572 if$
573 }
574
575 FUNCTION {format.book.pages}
576 { pages empty$
577 { "" }
578 { pages multi.page.check
579 { "pp.~" pages n.dashify * }
580 { "p.~" pages * }
581 if$
582 }
583 if$
584 }
585
586 FUNCTION {format.chapter.pages}
587 { chapter empty$
588 'format.book.pages
589 { type empty$
590 { "ch.~" }
591 { type "l" change.case$ " " * }
592 if$
593 chapter *
594 pages empty$
595 'skip$
596 { ", " * format.book.pages * }
597 if$
598 }
599 if$
600 }
601
602 FUNCTION {empty.misc.check}
603 { author empty$ title empty$ howpublished empty$
604 month empty$ year empty$ note empty$
605 and and and and and
606 key empty$ not and
607 { "all relevant fields are empty in " cite$ * warning$ }
608 'skip$
609 if$
610 }
611
612 FUNCTION {format.thesis.type}
613 { type empty$
614 'skip$
615 { pop$
616 type "t" change.case$
617 }
618 if$
619 }
620
621 FUNCTION {format.tr.number}
622 { type empty$
623 { "Tech. Report" }
624 'type
625 if$
626 number empty$
627 { "t" change.case$ }
628 { number tie.or.space.connect }
629 if$
630 }
631
632 % The format.crossref functions haven't been paid much attention
633 % at the present time (June 1990) and could probably use some
634 % work. MJD
635
636 FUNCTION {format.article.crossref}
637 { key empty$
638 { journal empty$
639 { "need key or journal for " cite$ * " to crossref " * crossref *
640 warning$
641 ""
642 }
643 { "in " journal * }
644 if$
645 }
646 { "in " key * }
647 if$
648 " \cite{" * crossref * "}" *
649 }
650
651 FUNCTION {format.crossref.editor}
652 { editor #1 "{vv~}{ll}" format.name$
653 editor num.names$ duplicate$
654 #2 >
655 { pop$ " et~al." * }
656 { #2 <
657 'skip$
658 { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
659 { " et~al." * }
660 { " and " * editor #2 "{vv~}{ll}" format.name$ * }
661 if$
662 }
663 if$
664 }
665 if$
666 }
667
668 FUNCTION {format.book.crossref}
669 { volume empty$
670 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
671 "in "
672 }
673 { "vol." volume tie.or.space.connect
674 " of " *
675 }
676 if$
677 editor empty$
678 editor field.or.null author field.or.null =
679 or
680 { key empty$
681 { series empty$
682 { "need editor, key, or series for " cite$ * " to crossref " *
683 crossref * warning$
684 "" *
685 }
686 { series * }
687 if$
688 }
689 { key * }
690 if$
691 }
692 { format.crossref.editor * }
693 if$
694 " \cite{" * crossref * "}" *
695 }
696
697 FUNCTION {format.incoll.inproc.crossref}
698 { editor empty$
699 editor field.or.null author field.or.null =
700 or
701 { key empty$
702 { booktitle empty$
703 { "need editor, key, or booktitle for " cite$ * " to crossref " *
704 crossref * warning$
705 ""
706 }
707 { "in \emph{" booktitle * "}" * }
708 if$
709 }
710 { "in " key * }
711 if$
712 }
713 { "in " format.crossref.editor * }
714 if$
715 " \cite{" * crossref * "}" *
716 }
717
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
719
720 % The main functions for each entry type.
721
722 % journal, vol and year are formatted together because they are
723 % not separated by commas.
724
725 FUNCTION {article}
726 { output.bibitem
727 format.authors "author" output.check
728 format.title "title" output.check
729 crossref missing$
730 { format.journal.vol.year output
731 format.number output
732 format.pages "pages" output.check
733 }
734 { format.article.crossref output.nonnull
735 format.pages "pages" output.check
736 }
737 if$
738 format.language *
739 note output
740 fin.entry
741 }
742
743 FUNCTION {book}
744 { output.bibitem
745 author empty$
746 { format.editors "author and editor" output.check }
747 { format.authors output.nonnull
748 crossref missing$
749 { "author and editor" editor either.or.check }
750 'skip$
751 if$
752 }
753 if$
754 format.title "title" output.check
755 format.edition output
756 crossref missing$
757 { format.bookvolume.series.number output
758 publisher "publisher" output.check
759 address output
760 }
761 { format.book.crossref output.nonnull
762 }
763 if$
764 format.date "year" output.check
765 format.language *
766 note output
767 fin.entry
768 }
769
770 FUNCTION {booklet}
771 { output.bibitem
772 format.authors output
773 format.title "title" output.check
774 howpublished output
775 address output
776 format.date output
777 note output
778 fin.entry
779 }
780
781 FUNCTION {inbook}
782 { output.bibitem
783 author empty$
784 { format.editors "author and editor" output.check }
785 { format.authors output.nonnull
786 crossref missing$
787 { "author and editor" editor either.or.check }
788 'skip$
789 if$
790 }
791 if$
792 format.title "title" output.check
793 format.edition output
794 crossref missing$
795 { format.bookvolume.series.number output
796 format.chapter.pages "chapter and pages" output.check
797 publisher "publisher" output.check
798 address output
799 }
800 { format.chapter.pages "chapter and pages" output.check
801 format.book.crossref output.nonnull
802 }
803 if$
804 format.date "year" output.check
805 format.language *
806 note output
807 fin.entry
808 }
809
810 FUNCTION {incollection}
811 { output.bibitem
812 format.authors "author" output.check
813 format.title "title" output.check
814 crossref missing$
815 { format.incoll.title.editors "booktitle" output.check
816 format.bookvolume.series.number output
817 publisher "publisher" output.check
818 address output
819 format.edition output
820 format.date "year" output.check
821 }
822 { format.incoll.inproc.crossref output.nonnull
823 }
824 if$
825 note output
826 format.book.pages output
827 format.language *
828 fin.entry
829 }
830
831 FUNCTION {inproceedings}
832 { output.bibitem
833 format.authors "author" output.check
834 format.title "title" output.check
835 crossref missing$
836 { format.inproc.title.address.editors "booktitle" output.check
837 format.bookvolume.series.number output
838 organization output
839 publisher output
840 format.date "year" output.check
841 }
842 { format.incoll.inproc.crossref output.nonnull
843 }
844 if$
845 note output
846 format.book.pages output
847 format.language *
848 fin.entry
849 }
850
851 FUNCTION {conference} { inproceedings }
852
853 FUNCTION {manual}
854 { output.bibitem
855 author empty$
856 { organization empty$
857 'skip$
858 { organization output.nonnull
859 address output
860 }
861 if$
862 }
863 { format.authors output.nonnull }
864 if$
865 format.title "title" output.check
866 author empty$
867 { organization empty$
868 { address output }
869 'skip$
870 if$
871 }
872 { organization output
873 address output
874 }
875 if$
876 format.edition output
877 format.date output
878 note output
879 fin.entry
880 }
881
882 FUNCTION {mastersthesis}
883 { output.bibitem
884 format.authors "author" output.check
885 format.title "title" output.check
886 "Master's thesis" format.thesis.type output.nonnull
887 school "school" output.check
888 address output
889 format.date "year" output.check
890 note output
891 format.book.pages output
892 fin.entry
893 }
894
895 FUNCTION {misc}
896 { output.bibitem
897 format.authors output
898 format.title output
899 howpublished output
900 format.date output
901 note output
902 format.book.pages output
903 fin.entry
904 empty.misc.check
905 }
906
907 FUNCTION {phdthesis}
908 { output.bibitem
909 format.authors "author" output.check
910 format.title "title" output.check
911 "Ph.D. thesis" format.thesis.type output.nonnull
912 school "school" output.check
913 address output
914 format.date "year" output.check
915 note output
916 format.book.pages output
917 fin.entry
918 }
919
920 FUNCTION {proceedings}
921 { output.bibitem
922 editor empty$
923 { organization output }
924 { format.editors output.nonnull }
925 if$
926 format.title "title" output.check
927 format.bookvolume.series.number output
928 address empty$
929 { editor empty$
930 'skip$
931 { organization output }
932 if$
933 publisher output
934 format.date "year" output.check
935 }
936 { address output.nonnull
937 editor empty$
938 'skip$
939 { organization output }
940 if$
941 publisher output
942 format.date "year" output.check
943 }
944 if$
945 note output
946 fin.entry
947 }
948
949 FUNCTION {techreport}
950 { output.bibitem
951 format.authors "author" output.check
952 format.title "title" output.check
953 format.tr.number output.nonnull
954 institution "institution" output.check
955 address output
956 format.date "year" output.check
957 note output
958 fin.entry
959 }
960
961 FUNCTION {unpublished}
962 { output.bibitem
963 format.authors "author" output.check
964 format.title "title" output.check
965 note "note" output.check
966 format.date output
967 fin.entry
968 }
969
970 FUNCTION {default.type} { misc }
971
972 MACRO {jan} {"January"}
973
974 MACRO {feb} {"February"}
975
976 MACRO {mar} {"March"}
977
978 MACRO {apr} {"April"}
979
980 MACRO {may} {"May"}
981
982 MACRO {jun} {"June"}
983
984 MACRO {jul} {"July"}
985
986 MACRO {aug} {"August"}
987
988 MACRO {sep} {"September"}
989
990 MACRO {oct} {"October"}
991
992 MACRO {nov} {"November"}
993
994 MACRO {dec} {"December"}
995
996 READ
997
998 FUNCTION {sortify}
999 { purify$
1000 "l" change.case$
1001 }
1002
1003 INTEGERS { len }
1004
1005 FUNCTION {chop.word}
1006 { 's :=
1007 'len :=
1008 s #1 len substring$ =
1009 { s len #1 + global.max$ substring$ }
1010 's
1011 if$
1012 }
1013
1014 FUNCTION {sort.format.names}
1015 { 's :=
1016 #1 'nameptr :=
1017 ""
1018 s num.names$ 'numnames :=
1019 numnames 'namesleft :=
1020 { namesleft #0 > }
1021 { nameptr #1 >
1022 { " " * }
1023 'skip$
1024 if$
1025 s nameptr "{vv{ } }{ll{ }}{ ff{ }}{ jj{ }}" format.name$ 't :=
1026 nameptr numnames = t "others" = and
1027 { "et al" * }
1028 { t sortify * }
1029 if$
1030 nameptr #1 + 'nameptr :=
1031 namesleft #1 - 'namesleft :=
1032 }
1033 while$
1034 }
1035
1036 FUNCTION {sort.format.title}
1037 { 't :=
1038 "A " #2
1039 "An " #3
1040 "The " #4 t chop.word
1041 chop.word
1042 chop.word
1043 sortify
1044 #1 global.max$ substring$
1045 }
1046
1047 FUNCTION {author.sort}
1048 { author empty$
1049 { key empty$
1050 { "to sort, need author or key in " cite$ * warning$
1051 ""
1052 }
1053 { key sortify }
1054 if$
1055 }
1056 { author sort.format.names }
1057 if$
1058 }
1059
1060 FUNCTION {author.editor.sort}
1061 { author empty$
1062 { editor empty$
1063 { key empty$
1064 { "to sort, need author, editor, or key in " cite$ * warning$
1065 ""
1066 }
1067 { key sortify }
1068 if$
1069 }
1070 { editor sort.format.names }
1071 if$
1072 }
1073 { author sort.format.names }
1074 if$
1075 }
1076
1077 FUNCTION {author.organization.sort}
1078 { author empty$
1079 { organization empty$
1080 { key empty$
1081 { "to sort, need author, organization, or key in " cite$ * warning$
1082 ""
1083 }
1084 { key sortify }
1085 if$
1086 }
1087 { "The " #4 organization chop.word sortify }
1088 if$
1089 }
1090 { author sort.format.names }
1091 if$
1092 }
1093
1094 FUNCTION {editor.organization.sort}
1095 { editor empty$
1096 { organization empty$
1097 { key empty$
1098 { "to sort, need editor, organization, or key in " cite$ * warning$
1099 ""
1100 }
1101 { key sortify }
1102 if$
1103 }
1104 { "The " #4 organization chop.word sortify }
1105 if$
1106 }
1107 { editor sort.format.names }
1108 if$
1109 }
1110
1111 FUNCTION {presort}
1112 { type$ "book" =
1113 type$ "inbook" =
1114 or
1115 'author.editor.sort
1116 { type$ "proceedings" =
1117 'editor.organization.sort
1118 { type$ "manual" =
1119 'author.organization.sort
1120 'author.sort
1121 if$
1122 }
1123 if$
1124 }
1125 if$
1126 " "
1127 *
1128 year field.or.null sortify
1129 *
1130 " "
1131 *
1132 title field.or.null
1133 sort.format.title
1134 *
1135 #1 entry.max$ substring$
1136 'sort.key$ :=
1137 }
1138
1139 ITERATE {presort}
1140
1141 SORT
1142
1143 STRINGS { longest.label prev.author this.author }
1144
1145 INTEGERS { number.label longest.label.width }
1146
1147 FUNCTION {initialize.longest.label}
1148 { "" 'longest.label :=
1149 #1 'number.label :=
1150 #0 'longest.label.width :=
1151 "abcxyz" 'prev.author :=
1152 "" 'this.author :=
1153 }
1154
1155 FUNCTION {longest.label.pass}
1156 { number.label int.to.str$ 'label :=
1157 number.label #1 + 'number.label :=
1158 label width$ longest.label.width >
1159 { label 'longest.label :=
1160 label width$ 'longest.label.width :=
1161 }
1162 'skip$
1163 if$
1164 author empty$
1165 { editor empty$
1166 { "" }
1167 'editor
1168 if$
1169 }
1170 'author
1171 if$
1172 'this.author :=
1173 this.author prev.author =
1174 { "\bysame" 'bysame := }
1175 { "" 'bysame :=
1176 this.author "" =
1177 { "abcxyz" }
1178 'this.author
1179 if$
1180 'prev.author :=
1181 }
1182 if$
1183 }
1184
1185 EXECUTE {initialize.longest.label}
1186
1187 ITERATE {longest.label.pass}
1188
1189 FUNCTION {write.lines}
1190 { { duplicate$ "." = NOT }
1191 { write$ newline$ }
1192 while$
1193 pop$
1194 }
1195
1196 FUNCTION {begin.bib}
1197 { preamble$ empty$
1198 'skip$
1199 { preamble$ write$ newline$ }
1200 if$
1201 "\providecommand{\bysame}{\leavevmode\hbox to3em{\hrulefill}\thinspace}"
1202 write$ newline$
1203 "\providecommand{\MR}{\relax\ifhmode\unskip\space\fi MR }"
1204 write$ newline$
1205 "% \MRhref is called by the amsart/book/proc definition of \MR."
1206 write$ newline$
1207 "\providecommand{\MRhref}[2]{%"
1208 write$ newline$
1209 " \href{http://www.ams.org/mathscinet-getitem?mr=#1}{#2}"
1210 write$ newline$
1211 "}"
1212 write$ newline$
1213 "\providecommand{\href}[2]{#2}"
1214 write$ newline$
1215 "\begin{thebibliography}{" longest.label * "}" *
1216 write$ newline$
1217 }
1218
1219 EXECUTE {begin.bib}
1220
1221 EXECUTE {init.state.consts}
1222
1223 ITERATE {call.type$}
1224
1225 FUNCTION {end.bib}
1226 { newline$
1227 "\end{thebibliography}" write$ newline$
1228 }
1229
1230 EXECUTE {end.bib}
1231 %% \CharacterTable
1232 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
1233 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
1234 %% Digits \0\1\2\3\4\5\6\7\8\9
1235 %% Exclamation \! Double quote \" Hash (number) \#
1236 %% Dollar \$ Percent \% Ampersand \&
1237 %% Acute accent \' Left paren \( Right paren \)
1238 %% Asterisk \* Plus \+ Comma \,
1239 %% Minus \- Point \. Solidus \/
1240 %% Colon \: Semicolon \; Less than \<
1241 %% Equals \= Greater than \> Question mark \?
1242 %% Commercial at \@ Left bracket \[ Backslash \\
1243 %% Right bracket \] Circumflex \^ Underscore \_
1244 %% Grave accent \` Left brace \{ Vertical bar \|
1245 %% Right brace \} Tilde \~}