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

UCC git Repository :: git.ucc.asn.au