Remove trailing whitespace
[csplainnat.git] / csplainnat.bst
blob12737345d40fb0353a844c280763f1450038950d
1 %% $Id$
2 %% File: `csplainnat.bst' for use with natbib package
3 %% This is a modification of `plainnat.bst' for Czech references style
4 %% (According to "CSN ISO 690: Bibliograficke citace. Obsah, forma a struktura").
5 %% Some modifications are commented, look for the keyword 'CHANGE'
6 %% For more detailed info use svn repository svn://kraken.pedf.cuni.cz/csplainnat/
7 %%
8 %% Original plainnat.bst by Patrick W Daly
9 %% Modifications by David Mudr{\'{a}}k mudrd8mz@uxit.pedf.cuni.cz
11 %% MAJOR MODIFICATIONS
12 %% * Added "@ONLINE" item type with added "cited" field.
14 %% This program can be redistributed and/or modified under the terms
15 %% of the LaTeX Project Public License Distributed from CTAN
16 %% archives in directory macros/latex/base/lppl.txt; either
17 %% version 1 of the License, or any later version.
19  % BibTeX `plainnat' family
20  %   version 0.99b for BibTeX versions 0.99a or later,
21  %   for LaTeX versions 2.09 and 2e.
22  %
23  % For use with the `natbib.sty' package; emulates the corresponding
24  %   member of the `plain' family, but with author-year citations.
25  %
26  % With version 6.0 of `natbib.sty', it may also be used for numerical
27  %   citations, while retaining the commands \citeauthor, \citefullauthor,
28  %   and \citeyear to print the corresponding information.
29  %
30  % For version 7.0 of `natbib.sty', the KEY field replaces missing
31  %   authors/editors, and the date is left blank in \bibitem.
32  %
33  % Includes field EID for the sequence/citation number of electronic journals
34  %  which is used instead of page numbers.
35  %
36  % Includes fields ISBN and ISSN.
37  %
38  % Includes field URL for Internet addresses.
39  %
40  % Includes field DOI for Digital Object Idenfifiers.
41  %
42  % Works best with the url.sty package of Donald Arseneau.
43  %
44  % Works with identical authors and year are further sorted by
45  %   citation key, to preserve any natural sequence.
46  %
47 ENTRY
48   { address
49     author
50     booktitle
51     chapter
52     doi
53     eid
54     edition
55     editor
56     howpublished
57     institution
58     isbn
59     issn
60     journal
61     key
62     month
63     note
64     number
65     organization
66     pages
67     publisher
68     school
69     series
70     title
71     type
72     url
73     volume
74     year
75     cited
76   }
77   {}
78   { label extra.label sort.label short.list }
80 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
82 FUNCTION {init.state.consts}
83 { #0 'before.all :=
84   #1 'mid.sentence :=
85   #2 'after.sentence :=
86   #3 'after.block :=
89 STRINGS { s t t1 t2 } %  CHANGE mudrd8mz 2005-10-12 adding t1, t2
91 FUNCTION {output.nonnull}
92 { 's :=
93   output.state mid.sentence =
94     { ", " * write$ }
95     { output.state after.block =
96         { add.period$ write$
97           newline$
98           "\newblock " write$
99         }
100         { output.state before.all =
101             'write$
102             { add.period$ " " * write$ }
103           if$
104         }
105       if$
106       mid.sentence 'output.state :=
107     }
108   if$
109   s
112 FUNCTION {output}
113 { duplicate$ empty$
114     'pop$
115     'output.nonnull
116   if$
119 FUNCTION {output.check}
120 { 't :=
121   duplicate$ empty$
122     { pop$ "empty " t * " in " * cite$ * warning$ }
123     'output.nonnull
124   if$
127 FUNCTION {fin.entry}
128 { add.period$
129   write$
130   newline$
133 FUNCTION {new.block}
134 { output.state before.all =
135     'skip$
136     { after.block 'output.state := }
137   if$
140 FUNCTION {new.sentence}
141 { output.state after.block =
142     'skip$
143     { output.state before.all =
144         'skip$
145         { after.sentence 'output.state := }
146       if$
147     }
148   if$
151 FUNCTION {not}
152 {   { #0 }
153     { #1 }
154   if$
157 FUNCTION {and}
158 {   'skip$
159     { pop$ #0 }
160   if$
163 FUNCTION {or}
164 {   { pop$ #1 }
165     'skip$
166   if$
169 FUNCTION {new.block.checka}
170 { empty$
171     'skip$
172     'new.block
173   if$
176 FUNCTION {new.block.checkb}
177 { empty$
178   swap$ empty$
179   and
180     'skip$
181     'new.block
182   if$
185 FUNCTION {new.sentence.checka}
186 { empty$
187     'skip$
188     'new.sentence
189   if$
192 FUNCTION {new.sentence.checkb}
193 { empty$
194   swap$ empty$
195   and
196     'skip$
197     'new.sentence
198   if$
201 FUNCTION {field.or.null}
202 { duplicate$ empty$
203     { pop$ "" }
204     'skip$
205   if$
208 FUNCTION {emphasize}
209 { duplicate$ empty$
210     { pop$ "" }
211     { "\emph{" swap$ * "}" * }
212   if$
215 FUNCTION {capitalize}  %  CHANGE mudrd8mz 2005-10-12 adding new function
217   duplicate$ empty$
218     { pop$ "" }
219     { "{\sc " swap$ * "}" * } %{ "u" change.case$ }
220   if$
224 INTEGERS { nameptr namesleft numnames }
226 FUNCTION {format.names.full}
227 { 's :=
228   #1 'nameptr :=
229   s num.names$ 'numnames :=
230   numnames 'namesleft :=
231     { namesleft #0 > }
232     { s nameptr "{ll}" format.name$ 't1 :=          % CHANGE mudrd8mz 2005-10-12
233       t1 capitalize 't1 :=                          % CHANGE mudrd8mz 2005-10-12
234       s nameptr "{, f.}{~j.}" format.name$ 't2 :=   % CHANGE mudrd8mz 2005-10-12
235       t1 t2 * 't :=
236       nameptr #1 >
237         { namesleft #1 >
238             { " -- " * t * } % CHANGE mudrd8mz 2005-10-13 : adding "--"
239             { numnames #2 >
240                 { "" * } % CHANGE mudrd8mz 2005-10-12
241                 'skip$
242               if$
243               t "OTHERS" = % CHANGE mudrd8mz 2005-10-12 because of capitalize
244                 { " et~al." * }
245                 { " -- " * t * } % CHANGE mudrd8mz 2005-10-12 : between the last and the one before
246               if$
247             }
248           if$
249         }
250         't
251       if$
252       nameptr #1 + 'nameptr :=
253       namesleft #1 - 'namesleft :=
254     }
255   while$
258 FUNCTION {format.names.short} %  CHANGE mudrd8mz 2005-10-14 adding more authors version
259 { 's :=
260   s #1 "{ll}" format.name$ 't1 :=
261   t1 capitalize 't1 :=
262   s #1 "{, f.}{~j.}" format.name$ 't2 :=
263   t1 t2 * " et~al." *
266 FUNCTION {format.names}
267 {   duplicate$
268     num.names$ #3 >
269         {format.names.short} % pokud ma citace vice nez 3 autory, uvadi se pouze PRVNI et al.
270         {format.names.full}  % pokud ma citace max 3 autory, uvadi se vsichni
271     if$
274 FUNCTION {format.key}
275 { empty$
276     { key field.or.null }
277     { "" }
278   if$
281 FUNCTION {format.authors}
282 { author empty$
283     { "" }
284     { author format.names }
285   if$
288 FUNCTION {format.editors}
289 { editor empty$
290     { "" }
291     { editor format.names
292       editor num.names$ #1 >
293         { " (Ed.)" * } % CHANGE mudrd8mz 2005-10-12
294         { " (Ed.)" * }
295       if$
296     }
297   if$
300 FUNCTION {format.isbn}
301 { isbn empty$
302     { "" }
303     { new.block "ISBN " isbn * }
304   if$
307 FUNCTION {format.issn}
308 { issn empty$
309     { "" }
310     { new.block "ISSN " issn * }
311   if$
314 FUNCTION {format.url}
315 { url empty$
316     { "" }
317     { new.block "Dostupn{\'{e}}~z: $\texttt{<{" url * "}>}$" * }
318   if$
323 FUNCTION {format.doi}
324 { doi empty$
325     { "" }
326     { new.block "\doi{" doi * "}" * }
327   if$
330 FUNCTION {format.title}
331 { title empty$
332     { "" }
333     { title }
334   if$
338 FUNCTION {format.full.names}
339 {'s :=
340   #1 'nameptr :=
341   s num.names$ 'numnames :=
342   numnames 'namesleft :=
343     { namesleft #0 > }
344     { s nameptr
345       "{vv~}{ll}" format.name$ 't :=
346       nameptr #1 >
347         {
348           namesleft #1 >
349             { ", " * t * }
350             {
351               numnames #2 >
352                 { "," * }
353                 'skip$
354               if$
355               t "others" =
356                 { " et~al." * }
357                 { ", " * t * } %  CHANGE mudrd8mz 2005-10-12
358               if$
359             }
360           if$
361         }
362         't
363       if$
364       nameptr #1 + 'nameptr :=
365       namesleft #1 - 'namesleft :=
366     }
367   while$
370 FUNCTION {author.editor.full}
371 { author empty$
372     { editor empty$
373         { "" }
374         { editor format.full.names }
375       if$
376     }
377     { author format.full.names }
378   if$
381 FUNCTION {author.full}
382 { author empty$
383     { "" }
384     { author format.full.names }
385   if$
388 FUNCTION {editor.full}
389 { editor empty$
390     { "" }
391     { editor format.full.names }
392   if$
395 FUNCTION {make.full.names}
396 { type$ "book" =
397   type$ "inbook" =
398   or
399     'author.editor.full
400     { type$ "proceedings" =
401         'editor.full
402         'author.full
403       if$
404     }
405   if$
408 FUNCTION {output.bibitem}
409 { newline$
410   "\bibitem[" write$
411   label write$
412   ")" make.full.names duplicate$ short.list =
413      { pop$ }
414      { * }
415    if$
416   "]{" * write$
417   cite$ write$
418   "}" write$
419   newline$
420   ""
421   before.all 'output.state :=
424 FUNCTION {n.dashify}
425 { 't :=
426   ""
427     { t empty$ not }
428     { t #1 #1 substring$ "-" =
429         { t #1 #2 substring$ "--" = not
430             { "--" *
431               t #2 global.max$ substring$ 't :=
432             }
433             {   { t #1 #1 substring$ "-" = }
434                 { "-" *
435                   t #2 global.max$ substring$ 't :=
436                 }
437               while$
438             }
439           if$
440         }
441         { t #1 #1 substring$ *
442           t #2 global.max$ substring$ 't :=
443         }
444       if$
445     }
446   while$
449 FUNCTION {format.date}
450 { year duplicate$ empty$
451     { "empty year in " cite$ * warning$
452        pop$ "" }
453     'skip$
454   if$
455   month empty$
456     'skip$
457     { month
458       " " * swap$ *
459     }
460   if$
461   extra.label *
464 FUNCTION {format.btitle}
465 { title emphasize
468 FUNCTION {tie.or.space.connect}
469 { duplicate$ text.length$ #3 <
470     { "~" }
471     { " " }
472   if$
473   swap$ * *
476 FUNCTION {either.or.check}
477 { empty$
478     'pop$
479     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
480   if$
483 FUNCTION {format.bvolume}
484 { volume empty$
485     { "" }
486     { "" volume tie.or.space.connect %  CHANGE mudrd8mz 2005-10-12 removing "volume"
487       series empty$
488         'skip$
489         { " / " * series emphasize * } % CHANGE mudrd8mz 2005-10-12  "of" --> "/"
490       if$
491       "volume and number" number either.or.check
492     }
493   if$
496 FUNCTION {format.number.series}
497 { volume empty$
498     { number empty$
499         { series field.or.null }
500         { output.state mid.sentence =
501             { "{\v{c}}." } % CHANGE mudrd8mz 2005-10-12 "{\v{c}}" instead of "number"
502             { "{\v{C}}." }
503           if$
504           number tie.or.space.connect
505           series empty$
506             { "there's a number but no series in " cite$ * warning$ }
507             { " v " * series * } % CHANGE mudrd8mz 2005-10-12 "in" --> "v"
508           if$
509         }
510       if$
511     }
512     { "" }
513   if$
516 FUNCTION {format.edition}
517 { edition empty$
518     { "" }
519     { output.state mid.sentence =
520         { edition "l" change.case$ " edition" * }
521         { edition "t" change.case$ " edition" * }
522       if$
523     }
524   if$
527 INTEGERS { multiresult }
529 FUNCTION {multi.page.check}
530 { 't :=
531   #0 'multiresult :=
532     { multiresult not
533       t empty$ not
534       and
535     }
536     { t #1 #1 substring$
537       duplicate$ "-" =
538       swap$ duplicate$ "," =
539       swap$ "+" =
540       or or
541         { #1 'multiresult := }
542         { t #2 global.max$ substring$ 't := }
543       if$
544     }
545   while$
546   multiresult
549 FUNCTION {format.pages}
550 { pages empty$
551     { "" }
552     { pages multi.page.check
553         { "s." pages n.dashify tie.or.space.connect }  % CHANGE mudrd8mz 2007-03-15: 'pages' -> 's.'
554         { "s." pages tie.or.space.connect }            % CHANGE mudrd8mz 2007-03-15: 'pages' -> 's.'
555       if$
556     }
557   if$
560 FUNCTION {format.eid}
561 { eid empty$
562     { "" }
563     { "art." eid tie.or.space.connect }
564   if$
567 FUNCTION {format.vol.num.pages}
568 { volume field.or.null
569   number empty$
570     'skip$
571     { ", " number * *
572       volume empty$
573         { "there's a number but no volume in " cite$ * warning$ }
574         'skip$
575       if$
576     }
577   if$
578   pages empty$
579     'skip$
580     { duplicate$ empty$
581         { pop$ format.pages }
582         { ", s.~" * pages n.dashify * }
583       if$
584     }
585   if$
588 FUNCTION {format.vol.num.eid}
589 { volume field.or.null
590   number empty$
591     'skip$
592     { "\penalty0, " number * *
593       volume empty$
594         { "there's a number but no volume in " cite$ * warning$ }
595         'skip$
596       if$
597     }
598   if$
599   eid empty$
600     'skip$
601     { duplicate$ empty$
602         { pop$ format.eid }
603         { ":\penalty0 " * eid * }
604       if$
605     }
606   if$
609 FUNCTION {format.chapter.pages}
610 { chapter empty$
611     'format.pages
612     { type empty$
613         { "" }   % CHANGE mudrd8mz 2008-04-08 removing the word "chapter"
614         { type "l" change.case$ }
615       if$
616       chapter tie.or.space.connect
617       pages empty$
618         'skip$
619         { ", " * format.pages * }
620       if$
621     }
622   if$
625 FUNCTION {format.in.ed.booktitle}
626 { booktitle empty$
627     { "" }
628     { editor empty$
629         { "In " booktitle emphasize * }
630         { "In " format.editors * " " * booktitle emphasize * } %  CHANGE mudrd8mz 2005-10-12
631       if$
632     }
633   if$
636 FUNCTION {empty.misc.check}
637 { author empty$ title empty$ howpublished empty$
638   month empty$ year empty$ note empty$
639   and and and and and
640   key empty$ not and
641     { "all relevant fields are empty in " cite$ * warning$ }
642     'skip$
643   if$
646 FUNCTION {format.thesis.type}
647 { type empty$
648     'skip$
649     { pop$ type } % CHANGE mudrd8mz 2007-03-15: Do not lowercase the thesis type
650   if$
653 FUNCTION {format.tr.number}
654 { type empty$
655     { "Technical Report" }
656     'type
657   if$
658   number empty$
659     { "t" change.case$ }
660     { number tie.or.space.connect }
661   if$
664 FUNCTION {format.article.crossref}
665 { key empty$
666     { journal empty$
667         { "need key or journal for " cite$ * " to crossref " * crossref *
668           warning$
669           ""
670         }
671         { "In \emph{" journal * "}" * }
672       if$
673     }
674     { "In " key * }
675   if$
676   " \citep{" * crossref * "}" *
679 FUNCTION {format.book.crossref}
680 { volume empty$
681     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
682       "In "
683     }
684     { "Volume" volume tie.or.space.connect
685       " of " *
686     }
687   if$
688   editor empty$
689   editor field.or.null author field.or.null =
690   or
691     { key empty$
692         { series empty$
693             { "need editor, key, or series for " cite$ * " to crossref " *
694               crossref * warning$
695               "" *
696             }
697             { "\emph{" * series * "}" * }
698           if$
699         }
700         { key * }
701       if$
702     }
703     'skip$
704   if$
705   ", \citet{" * crossref * "}" *
708 FUNCTION {format.incoll.inproc.crossref}
709 { editor empty$
710   editor field.or.null author field.or.null =
711   or
712     { key empty$
713         { booktitle empty$
714             { "need editor, key, or booktitle for " cite$ * " to crossref " *
715               crossref * warning$
716               ""
717             }
718             { "In \emph{" booktitle * "}" * }
719           if$
720         }
721         { "In " key * }
722       if$
723     }
724     { "In " }
725   if$
726   " \citet{" * crossref * "}" *
729 FUNCTION {article}
730 { output.bibitem
731   format.authors "author" output.check
732   author format.key output
733   new.block
734   format.title "title" output.check
735   new.block
736   crossref missing$
737     { journal emphasize "journal" output.check
738       new.sentence
739       format.date "year" output.check
740       eid empty$
741         { format.vol.num.pages output }
742         { format.vol.num.eid output }
743       if$
744     }
745     { format.article.crossref output.nonnull
746       eid empty$
747         { format.pages output }
748         { format.eid output }
749       if$
750     }
751   if$
752   format.issn output
753   format.doi output
754   format.url output
755   new.block
756   note output
757   fin.entry
760 FUNCTION {online} %  CHANGE mudrd8mz 2005-10-12 addign new item type
761 { output.bibitem
762   format.authors output
763   new.block
764   format.btitle " [online]" * output
765   new.sentence
766   publisher missing$
767     'skip$
768     { publisher output }
769   if$
770   year missing$
771     'skip$
772     { format.date "year" output.check }
773   if$
774   new.sentence
775   cited missing$
776     'skip$
777     { "[cit.~" cited * "]" * output }
778   if$
779   new.sentence
780   note output
781   new.sentence
782   format.url output
783   fin.entry
787 FUNCTION {book}
788 { output.bibitem
789   author empty$
790     { format.editors "author and editor" output.check
791       editor format.key output
792     }
793     { format.authors output.nonnull
794       crossref missing$
795         { "author and editor" editor either.or.check }
796         'skip$
797       if$
798     }
799   if$
800   new.block
801   format.btitle "title" output.check
802   crossref missing$
803     { new.block
804       format.bvolume output
805       format.number.series output
806       new.sentence
807       publisher
808       % address "~: " * publisher *   % CHANGE mudrd8mz 2005-10-12
809       "publisher" output.check
810     }
811     { new.block
812       format.book.crossref output.nonnull
813     }
814   if$
815   format.edition output
816   format.date "year" output.check
817   format.doi output
818   format.url output
819   new.block
820   note output
821   format.isbn output
822   fin.entry
825 FUNCTION {booklet}
826 { output.bibitem
827   format.authors output
828   author format.key output
829   new.block
830   format.title "title" output.check
831   howpublished address new.block.checkb
832   howpublished output
833   address output
834   format.date output
835   format.doi output
836   format.url output
837   new.block
838   note output
839   format.isbn output
840   fin.entry
843 FUNCTION {inbook}
844 { output.bibitem
845   author empty$
846     { format.editors "author and editor" output.check
847       editor format.key output
848     }
849     { format.authors output.nonnull
850       crossref missing$
851         { "author and editor" editor either.or.check }
852         'skip$
853       if$
854     }
855   if$
856   new.block
857   format.btitle "title" output.check
858   crossref missing$
859     { format.bvolume output
860       format.chapter.pages "chapter and pages" output.check
861       new.block
862       format.number.series output
863       new.sentence
864       publisher "publisher" output.check
865       address output
866     }
867     { format.chapter.pages "chapter and pages" output.check
868       new.block
869       format.book.crossref output.nonnull
870     }
871   if$
872   format.edition output
873   format.date "year" output.check
874   format.doi output
875   format.url output
876   new.block
877   note output
878   format.isbn output
879   fin.entry
882 FUNCTION {incollection}
883 { output.bibitem
884   format.authors "author" output.check
885   author format.key output
886   new.block
887   format.title "title" output.check
888   new.block
889   crossref missing$
890     { format.in.ed.booktitle "booktitle" output.check
891       format.bvolume output
892       format.number.series output
893       new.sentence
894       address ": " * publisher *   % CHANGE mudrd8mz 2005-10-12
895       "publisher" output.check
896       %publisher "publisher" output.check
897       %address output
898       format.edition output
899       format.date "year" output.check
900       new.sentence
901       format.chapter.pages output
902     }
903     { format.incoll.inproc.crossref output.nonnull
904       format.chapter.pages output
905     }
906   if$
907   format.doi output
908   format.url output
909   new.block
910   format.isbn output
911   note output
912   fin.entry
915 FUNCTION {inproceedings}
916 { output.bibitem
917   format.authors "author" output.check
918   author format.key output
919   new.block
920   format.title "title" output.check
921   new.block
922   crossref missing$
923     { format.in.ed.booktitle "booktitle" output.check
924       format.bvolume output
925       format.number.series output
926       format.pages output
927       address empty$
928         { organization publisher new.sentence.checkb
929           organization output
930           publisher output
931           format.date "year" output.check
932         }
933         { address output.nonnull
934           format.date "year" output.check
935           new.sentence
936           organization output
937           publisher output
938         }
939       if$
940     }
941     { format.incoll.inproc.crossref output.nonnull
942       format.pages output
943     }
944   if$
945   format.doi output
946   format.url output
947   new.block
948   format.isbn output
949   note output
950   fin.entry
953 FUNCTION {conference} { inproceedings }
955 FUNCTION {manual}
956 { output.bibitem
957   format.authors output
958   author format.key output
959   new.block
960   format.btitle "title" output.check
961   organization address new.block.checkb
962   organization output
963   address output
964   format.edition output
965   format.date output
966   format.url output
967   new.block
968   note output
969   fin.entry
972 FUNCTION {mastersthesis}
973 { output.bibitem
974   format.authors "author" output.check
975   author format.key output
976   new.block
977   format.title "title" output.check
978   new.block
979   "Master's thesis" format.thesis.type output.nonnull
980   school "school" output.check
981   address output
982   format.date "year" output.check
983   format.url output
984   new.block
985   note output
986   fin.entry
989 FUNCTION {misc}
990 { output.bibitem
991   format.authors output
992   author format.key output
993   title howpublished new.block.checkb
994   format.title output
995   howpublished new.block.checka
996   howpublished output
997   format.date output
998   format.issn output
999   format.url output
1000   new.block
1001   note output
1002   fin.entry
1003   empty.misc.check
1006 FUNCTION {phdthesis}
1007 { output.bibitem
1008   format.authors "author" output.check
1009   author format.key output
1010   new.block
1011   format.btitle "title" output.check
1012   new.block
1013   "PhD thesis" format.thesis.type output.nonnull
1014   school "school" output.check
1015   address output
1016   format.date "year" output.check
1017   format.url output
1018   new.block
1019   note output
1020   fin.entry
1023 FUNCTION {proceedings}
1024 { output.bibitem
1025   format.editors output
1026   editor format.key output
1027   new.block
1028   format.btitle "title" output.check
1029   format.bvolume output
1030   format.number.series output
1031   address output
1032   format.date "year" output.check
1033   new.sentence
1034   organization output
1035   publisher output
1036   format.doi output
1037   format.url output
1038   new.block
1039   format.isbn output
1040   note output
1041   fin.entry
1044 FUNCTION {techreport}
1045 { output.bibitem
1046   format.authors "author" output.check
1047   author format.key output
1048   new.block
1049   format.title "title" output.check
1050   new.block
1051   format.tr.number output.nonnull
1052   institution "institution" output.check
1053   address output
1054   format.date "year" output.check
1055   format.url output
1056   new.block
1057   note output
1058   fin.entry
1061 FUNCTION {unpublished}
1062 { output.bibitem
1063   format.authors "author" output.check
1064   author format.key output
1065   new.block
1066   format.title "title" output.check
1067   format.url output
1068   new.block
1069   note "note" output.check
1070   format.date output
1071   fin.entry
1074 FUNCTION {default.type} { misc }
1077 MACRO {jan} {"January"}
1079 MACRO {feb} {"February"}
1081 MACRO {mar} {"March"}
1083 MACRO {apr} {"April"}
1085 MACRO {may} {"May"}
1087 MACRO {jun} {"June"}
1089 MACRO {jul} {"July"}
1091 MACRO {aug} {"August"}
1093 MACRO {sep} {"September"}
1095 MACRO {oct} {"October"}
1097 MACRO {nov} {"November"}
1099 MACRO {dec} {"December"}
1103 MACRO {acmcs} {"ACM Computing Surveys"}
1105 MACRO {acta} {"Acta Informatica"}
1107 MACRO {cacm} {"Communications of the ACM"}
1109 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1111 MACRO {ibmsj} {"IBM Systems Journal"}
1113 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1115 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1117 MACRO {ieeetcad}
1118  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1120 MACRO {ipl} {"Information Processing Letters"}
1122 MACRO {jacm} {"Journal of the ACM"}
1124 MACRO {jcss} {"Journal of Computer and System Sciences"}
1126 MACRO {scp} {"Science of Computer Programming"}
1128 MACRO {sicomp} {"SIAM Journal on Computing"}
1130 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1132 MACRO {tods} {"ACM Transactions on Database Systems"}
1134 MACRO {tog} {"ACM Transactions on Graphics"}
1136 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1138 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1140 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1142 MACRO {tcs} {"Theoretical Computer Science"}
1145 READ
1147 FUNCTION {sortify}
1148 { purify$
1149   "l" change.case$
1152 INTEGERS { len }
1154 FUNCTION {chop.word}
1155 { 's :=
1156   'len :=
1157   s #1 len substring$ =
1158     { s len #1 + global.max$ substring$ }
1159     's
1160   if$
1163 FUNCTION {format.lab.names}
1164 { 's :=
1165   s #1 "{vv~}{ll}" format.name$
1166   s num.names$ duplicate$
1167   #2 >
1168     { pop$ " et~al." * }
1169     { #2 <
1170         'skip$
1171         { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1172             { " et~al." * }
1173             { " -- " * s #2 "{vv~}{ll}" format.name$ * } % CHANGE mudrd8mz 2005-10-12: changed "and"
1174           if$
1175         }
1176       if$
1177     }
1178   if$
1181 FUNCTION {author.key.label}
1182 { author empty$
1183     { key empty$
1184         { cite$ #1 #3 substring$ }
1185         'key
1186       if$
1187     }
1188     { author format.lab.names }
1189   if$
1192 FUNCTION {author.editor.key.label}
1193 { author empty$
1194     { editor empty$
1195         { key empty$
1196             { cite$ #1 #3 substring$ }
1197             'key
1198           if$
1199         }
1200         { editor format.lab.names }
1201       if$
1202     }
1203     { author format.lab.names }
1204   if$
1207 FUNCTION {author.key.organization.label}
1208 { author empty$
1209     { key empty$
1210         { organization empty$
1211             { cite$ #1 #3 substring$ }
1212             { "The " #4 organization chop.word #3 text.prefix$ }
1213           if$
1214         }
1215         'key
1216       if$
1217     }
1218     { author format.lab.names }
1219   if$
1222 FUNCTION {editor.key.organization.label}
1223 { editor empty$
1224     { key empty$
1225         { organization empty$
1226             { cite$ #1 #3 substring$ }
1227             { "The " #4 organization chop.word #3 text.prefix$ }
1228           if$
1229         }
1230         'key
1231       if$
1232     }
1233     { editor format.lab.names }
1234   if$
1237 FUNCTION {calc.short.authors}
1238 { type$ "book" =
1239   type$ "inbook" =
1240   or
1241     'author.editor.key.label
1242     { type$ "proceedings" =
1243         'editor.key.organization.label
1244         { type$ "manual" =
1245             'author.key.organization.label
1246             'author.key.label
1247           if$
1248         }
1249       if$
1250     }
1251   if$
1252   'short.list :=
1255 FUNCTION {calc.label}
1256 { calc.short.authors
1257   short.list
1258   "("
1259   *
1260   year duplicate$ empty$
1261   short.list key field.or.null = or
1262      { pop$ "" }
1263      'skip$
1264   if$
1265   *
1266   'label :=
1269 FUNCTION {sort.format.names}
1270 { 's :=
1271   #1 'nameptr :=
1272   ""
1273   s num.names$ 'numnames :=
1274   numnames 'namesleft :=
1275     { namesleft #0 > }
1276     {
1277       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
1278       nameptr #1 >
1279         {
1280           "   "  *
1281           namesleft #1 = t "others" = and
1282             { "zzzzz" * }
1283             { numnames #2 > nameptr #2 = and
1284                 { "zz" * year field.or.null * "   " * }
1285                 'skip$
1286               if$
1287               t sortify *
1288             }
1289           if$
1290         }
1291         { t sortify * }
1292       if$
1293       nameptr #1 + 'nameptr :=
1294       namesleft #1 - 'namesleft :=
1295     }
1296   while$
1299 FUNCTION {sort.format.title}
1300 { 't :=
1301   "A " #2
1302     "An " #3
1303       "The " #4 t chop.word
1304     chop.word
1305   chop.word
1306   sortify
1307   #1 global.max$ substring$
1310 FUNCTION {author.sort}
1311 { author empty$
1312     { key empty$
1313         { "to sort, need author or key in " cite$ * warning$
1314           ""
1315         }
1316         { key sortify }
1317       if$
1318     }
1319     { author sort.format.names }
1320   if$
1323 FUNCTION {author.editor.sort}
1324 { author empty$
1325     { editor empty$
1326         { key empty$
1327             { "to sort, need author, editor, or key in " cite$ * warning$
1328               ""
1329             }
1330             { key sortify }
1331           if$
1332         }
1333         { editor sort.format.names }
1334       if$
1335     }
1336     { author sort.format.names }
1337   if$
1340 FUNCTION {author.organization.sort}
1341 { author empty$
1342     { organization empty$
1343         { key empty$
1344             { "to sort, need author, organization, or key in " cite$ * warning$
1345               ""
1346             }
1347             { key sortify }
1348           if$
1349         }
1350         { "The " #4 organization chop.word sortify }
1351       if$
1352     }
1353     { author sort.format.names }
1354   if$
1357 FUNCTION {editor.organization.sort}
1358 { editor empty$
1359     { organization empty$
1360         { key empty$
1361             { "to sort, need editor, organization, or key in " cite$ * warning$
1362               ""
1363             }
1364             { key sortify }
1365           if$
1366         }
1367         { "The " #4 organization chop.word sortify }
1368       if$
1369     }
1370     { editor sort.format.names }
1371   if$
1375 FUNCTION {presort}
1376 { calc.label
1377   label sortify
1378   "    "
1379   *
1380   type$ "book" =
1381   type$ "inbook" =
1382   or
1383     'author.editor.sort
1384     { type$ "proceedings" =
1385         'editor.organization.sort
1386         { type$ "manual" =
1387             'author.organization.sort
1388             'author.sort
1389           if$
1390         }
1391       if$
1392     }
1393   if$
1394   "    "
1395   *
1396   cite$
1397   *
1398   #1 entry.max$ substring$
1399   'sort.label :=
1400   sort.label *
1401   #1 entry.max$ substring$
1402   'sort.key$ :=
1405 ITERATE {presort}
1407 SORT
1409 STRINGS { longest.label last.label next.extra }
1411 INTEGERS { longest.label.width last.extra.num number.label }
1413 FUNCTION {initialize.longest.label}
1414 { "" 'longest.label :=
1415   #0 int.to.chr$ 'last.label :=
1416   "" 'next.extra :=
1417   #0 'longest.label.width :=
1418   #0 'last.extra.num :=
1419   #0 'number.label :=
1422 FUNCTION {forward.pass}
1423 { last.label label =
1424     { last.extra.num #1 + 'last.extra.num :=
1425       last.extra.num int.to.chr$ 'extra.label :=
1426     }
1427     { "a" chr.to.int$ 'last.extra.num :=
1428       "" 'extra.label :=
1429       label 'last.label :=
1430     }
1431   if$
1432   number.label #1 + 'number.label :=
1435 FUNCTION {reverse.pass}
1436 { next.extra "b" =
1437     { "a" 'extra.label := }
1438     'skip$
1439   if$
1440   extra.label 'next.extra :=
1441   extra.label
1442   duplicate$ empty$
1443     'skip$
1444     { "{\natexlab{" swap$ * "}}" * }
1445   if$
1446   'extra.label :=
1447   label extra.label * 'label :=
1450 EXECUTE {initialize.longest.label}
1452 ITERATE {forward.pass}
1454 REVERSE {reverse.pass}
1456 FUNCTION {bib.sort.order}
1457 { sort.label  'sort.key$ :=
1460 ITERATE {bib.sort.order}
1462 SORT
1464 FUNCTION {begin.bib}
1465 {   preamble$ empty$
1466     'skip$
1467     { preamble$ write$ newline$ }
1468   if$
1469   "\begin{thebibliography}{" number.label int.to.str$ * "}" *
1470   write$ newline$
1471   "\providecommand{\natexlab}[1]{#1}"
1472   write$ newline$
1473   "\providecommand{\url}[1]{\texttt{#1}}"
1474   write$ newline$
1475   "\expandafter\ifx\csname urlstyle\endcsname\relax"
1476   write$ newline$
1477   "  \providecommand{\doi}[1]{doi: #1}\else"
1478   write$ newline$
1479   "  \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
1480   write$ newline$
1483 EXECUTE {begin.bib}
1485 EXECUTE {init.state.consts}
1487 ITERATE {call.type$}
1489 FUNCTION {end.bib}
1490 { newline$
1491   "\end{thebibliography}" write$ newline$
1494 EXECUTE {end.bib}