The space after "s.~" (which means page number in Czech) removed because it is typed...
[csplainnat.git] / csplainnat.bst
blob6b16eb770b62c7751e12b8dd8f170cf05fddd805
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
10 %% 
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     { "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: \url{" url * "}" * }
318   if$
321 FUNCTION {format.doi}
322 { doi empty$
323     { "" }
324     { new.block "\doi{" doi * "}" * }
325   if$
328 FUNCTION {format.title}
329 { title empty$
330     { "" }
331     { title }
332   if$
336 FUNCTION {format.full.names}
337 {'s :=
338   #1 'nameptr :=
339   s num.names$ 'numnames :=
340   numnames 'namesleft :=
341     { namesleft #0 > }
342     { s nameptr
343       "{vv~}{ll}" format.name$ 't :=
344       nameptr #1 >
345         {
346           namesleft #1 >
347             { ", " * t * }
348             {
349               numnames #2 >
350                 { "," * }
351                 'skip$
352               if$
353               t "others" =
354                 { " et~al." * }
355                 { ", " * t * } %  CHANGE mudrd8mz 2005-10-12 
356               if$
357             }
358           if$
359         }
360         't
361       if$
362       nameptr #1 + 'nameptr :=
363       namesleft #1 - 'namesleft :=
364     }
365   while$
368 FUNCTION {author.editor.full}
369 { author empty$
370     { editor empty$
371         { "" }
372         { editor format.full.names }
373       if$
374     }
375     { author format.full.names }
376   if$
379 FUNCTION {author.full}
380 { author empty$
381     { "" }
382     { author format.full.names }
383   if$
386 FUNCTION {editor.full}
387 { editor empty$
388     { "" }
389     { editor format.full.names }
390   if$
393 FUNCTION {make.full.names}
394 { type$ "book" =
395   type$ "inbook" =
396   or
397     'author.editor.full
398     { type$ "proceedings" =
399         'editor.full
400         'author.full
401       if$
402     }
403   if$
406 FUNCTION {output.bibitem}
407 { newline$
408   "\bibitem[" write$
409   label write$
410   ")" make.full.names duplicate$ short.list =
411      { pop$ }
412      { * }
413    if$
414   "]{" * write$
415   cite$ write$
416   "}" write$
417   newline$
418   ""
419   before.all 'output.state :=
422 FUNCTION {n.dashify}
423 { 't :=
424   ""
425     { t empty$ not }
426     { t #1 #1 substring$ "-" =
427         { t #1 #2 substring$ "--" = not
428             { "--" *
429               t #2 global.max$ substring$ 't :=
430             }
431             {   { t #1 #1 substring$ "-" = }
432                 { "-" *
433                   t #2 global.max$ substring$ 't :=
434                 }
435               while$
436             }
437           if$
438         }
439         { t #1 #1 substring$ *
440           t #2 global.max$ substring$ 't :=
441         }
442       if$
443     }
444   while$
447 FUNCTION {format.date}
448 { year duplicate$ empty$
449     { "empty year in " cite$ * warning$
450        pop$ "" }
451     'skip$
452   if$
453   month empty$
454     'skip$
455     { month
456       " " * swap$ *
457     }
458   if$
459   extra.label *
462 FUNCTION {format.btitle}
463 { title emphasize
466 FUNCTION {tie.or.space.connect}
467 { duplicate$ text.length$ #3 <
468     { "~" }
469     { " " }
470   if$
471   swap$ * *
474 FUNCTION {either.or.check}
475 { empty$
476     'pop$
477     { "can't use both " swap$ * " fields in " * cite$ * warning$ }
478   if$
481 FUNCTION {format.bvolume}
482 { volume empty$
483     { "" }
484     { "" volume tie.or.space.connect %  CHANGE mudrd8mz 2005-10-12 removing "volume"
485       series empty$
486         'skip$
487         { " / " * series emphasize * } % CHANGE mudrd8mz 2005-10-12  "of" --> "/"
488       if$
489       "volume and number" number either.or.check
490     }
491   if$
494 FUNCTION {format.number.series}
495 { volume empty$
496     { number empty$
497         { series field.or.null }
498         { output.state mid.sentence =
499             { "{\v{c}}." } % CHANGE mudrd8mz 2005-10-12 "{\v{c}}" instead of "number"
500             { "{\v{C}}." }
501           if$
502           number tie.or.space.connect
503           series empty$
504             { "there's a number but no series in " cite$ * warning$ }
505             { " v " * series * } % CHANGE mudrd8mz 2005-10-12 "in" --> "v"
506           if$
507         }
508       if$
509     }
510     { "" }
511   if$
514 FUNCTION {format.edition}
515 { edition empty$
516     { "" }
517     { output.state mid.sentence =
518         { edition "l" change.case$ " edition" * }
519         { edition "t" change.case$ " edition" * }
520       if$
521     }
522   if$
525 INTEGERS { multiresult }
527 FUNCTION {multi.page.check}
528 { 't :=
529   #0 'multiresult :=
530     { multiresult not
531       t empty$ not
532       and
533     }
534     { t #1 #1 substring$
535       duplicate$ "-" =
536       swap$ duplicate$ "," =
537       swap$ "+" =
538       or or
539         { #1 'multiresult := }
540         { t #2 global.max$ substring$ 't := }
541       if$
542     }
543   while$
544   multiresult
547 FUNCTION {format.pages}
548 { pages empty$
549     { "" }
550     { pages multi.page.check
551         { "s." pages n.dashify tie.or.space.connect }  % CHANGE mudrd8mz 2007-03-15: 'pages' -> 's.'
552         { "s." pages tie.or.space.connect }            % CHANGE mudrd8mz 2007-03-15: 'pages' -> 's.'
553       if$
554     }
555   if$
558 FUNCTION {format.eid}
559 { eid empty$
560     { "" }
561     { "art." eid tie.or.space.connect }
562   if$
565 FUNCTION {format.vol.num.pages}
566 { volume field.or.null
567   number empty$
568     'skip$
569     { ", " number * *
570       volume empty$
571         { "there's a number but no volume in " cite$ * warning$ }
572         'skip$
573       if$
574     }
575   if$
576   pages empty$
577     'skip$
578     { duplicate$ empty$
579         { pop$ format.pages }
580         { ", s.~" * pages n.dashify * }
581       if$
582     }
583   if$
586 FUNCTION {format.vol.num.eid}
587 { volume field.or.null
588   number empty$
589     'skip$
590     { "\penalty0, " number * *
591       volume empty$
592         { "there's a number but no volume in " cite$ * warning$ }
593         'skip$
594       if$
595     }
596   if$
597   eid empty$
598     'skip$
599     { duplicate$ empty$
600         { pop$ format.eid }
601         { ":\penalty0 " * eid * }
602       if$
603     }
604   if$
607 FUNCTION {format.chapter.pages}
608 { chapter empty$
609     'format.pages
610     { type empty$
611         { "chapter" }
612         { type "l" change.case$ }
613       if$
614       chapter tie.or.space.connect
615       pages empty$
616         'skip$
617         { ", " * format.pages * }
618       if$
619     }
620   if$
623 FUNCTION {format.in.ed.booktitle}
624 { booktitle empty$
625     { "" }
626     { editor empty$
627         { "In " booktitle emphasize * }
628         { "In " format.editors * " " * booktitle emphasize * } %  CHANGE mudrd8mz 2005-10-12 
629       if$
630     }
631   if$
634 FUNCTION {empty.misc.check}
635 { author empty$ title empty$ howpublished empty$
636   month empty$ year empty$ note empty$
637   and and and and and
638   key empty$ not and
639     { "all relevant fields are empty in " cite$ * warning$ }
640     'skip$
641   if$
644 FUNCTION {format.thesis.type}
645 { type empty$
646     'skip$
647     { pop$ type } % CHANGE mudrd8mz 2007-03-15: Do not lowercase the thesis type
648   if$
651 FUNCTION {format.tr.number}
652 { type empty$
653     { "Technical Report" }
654     'type
655   if$
656   number empty$
657     { "t" change.case$ }
658     { number tie.or.space.connect }
659   if$
662 FUNCTION {format.article.crossref}
663 { key empty$
664     { journal empty$
665         { "need key or journal for " cite$ * " to crossref " * crossref *
666           warning$
667           ""
668         }
669         { "In \emph{" journal * "}" * }
670       if$
671     }
672     { "In " key * }
673   if$
674   " \citep{" * crossref * "}" *
677 FUNCTION {format.book.crossref}
678 { volume empty$
679     { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
680       "In "
681     }
682     { "Volume" volume tie.or.space.connect
683       " of " *
684     }
685   if$
686   editor empty$
687   editor field.or.null author field.or.null =
688   or
689     { key empty$
690         { series empty$
691             { "need editor, key, or series for " cite$ * " to crossref " *
692               crossref * warning$
693               "" *
694             }
695             { "\emph{" * series * "}" * }
696           if$
697         }
698         { key * }
699       if$
700     }
701     'skip$
702   if$
703   ", \citet{" * crossref * "}" *
706 FUNCTION {format.incoll.inproc.crossref}
707 { editor empty$
708   editor field.or.null author field.or.null =
709   or
710     { key empty$
711         { booktitle empty$
712             { "need editor, key, or booktitle for " cite$ * " to crossref " *
713               crossref * warning$
714               ""
715             }
716             { "In \emph{" booktitle * "}" * }
717           if$
718         }
719         { "In " key * }
720       if$
721     }
722     { "In " }
723   if$
724   " \citet{" * crossref * "}" *
727 FUNCTION {article}
728 { output.bibitem
729   format.authors "author" output.check
730   author format.key output
731   new.block
732   format.title "title" output.check
733   new.block
734   crossref missing$
735     { journal emphasize "journal" output.check
736       new.sentence
737       format.date "year" output.check
738       eid empty$
739         { format.vol.num.pages output }
740         { format.vol.num.eid output }
741       if$
742     }
743     { format.article.crossref output.nonnull
744       eid empty$
745         { format.pages output }
746         { format.eid output }
747       if$
748     }
749   if$
750   format.issn output
751   format.doi output
752   format.url output
753   new.block
754   note output
755   fin.entry
758 FUNCTION {online} %  CHANGE mudrd8mz 2005-10-12 addign new item type
759 { output.bibitem
760   format.authors output
761   new.block
762   format.btitle " [online]" * output
763   new.sentence
764   publisher missing$
765     'skip$
766     { publisher output }
767   if$
768   year missing$
769     'skip$
770     { format.date "year" output.check }
771   if$
772   new.sentence
773   cited missing$
774     'skip$
775     { "[cit.~" cited * "]" * output }
776   if$
777   new.sentence
778   note output
779   new.sentence
780   format.url output
781   fin.entry
785 FUNCTION {book}
786 { output.bibitem
787   author empty$
788     { format.editors "author and editor" output.check
789       editor format.key output
790     }
791     { format.authors output.nonnull
792       crossref missing$
793         { "author and editor" editor either.or.check }
794         'skip$
795       if$
796     }
797   if$
798   new.block
799   format.btitle "title" output.check
800   crossref missing$
801     { new.block
802       format.bvolume output
803       format.number.series output
804       new.sentence
805       address "~: " * publisher *   % CHANGE mudrd8mz 2005-10-12 
806       "publisher" output.check      
807     }
808     { new.block
809       format.book.crossref output.nonnull
810     }
811   if$
812   format.edition output
813   format.date "year" output.check
814   format.doi output
815   format.url output
816   new.block
817   note output
818   format.isbn output
819   fin.entry
822 FUNCTION {booklet}
823 { output.bibitem
824   format.authors output
825   author format.key output
826   new.block
827   format.title "title" output.check
828   howpublished address new.block.checkb
829   howpublished output
830   address output
831   format.date output
832   format.doi output
833   format.url output
834   new.block
835   note output
836   format.isbn output
837   fin.entry
840 FUNCTION {inbook}
841 { output.bibitem
842   author empty$
843     { format.editors "author and editor" output.check
844       editor format.key output
845     }
846     { format.authors output.nonnull
847       crossref missing$
848         { "author and editor" editor either.or.check }
849         'skip$
850       if$
851     }
852   if$
853   new.block
854   format.btitle "title" output.check
855   crossref missing$
856     { format.bvolume output
857       format.chapter.pages "chapter and pages" output.check
858       new.block
859       format.number.series output
860       new.sentence
861       publisher "publisher" output.check
862       address output
863     }
864     { format.chapter.pages "chapter and pages" output.check
865       new.block
866       format.book.crossref output.nonnull
867     }
868   if$
869   format.edition output
870   format.date "year" output.check
871   format.doi output
872   format.url output
873   new.block
874   note output
875   format.isbn output
876   fin.entry
879 FUNCTION {incollection}
880 { output.bibitem
881   format.authors "author" output.check
882   author format.key output
883   new.block
884   format.title "title" output.check
885   new.block
886   crossref missing$
887     { format.in.ed.booktitle "booktitle" output.check
888       format.bvolume output
889       format.number.series output
890       format.chapter.pages output
891       new.sentence
892       address ": " * publisher *   % CHANGE mudrd8mz 2005-10-12
893       "publisher" output.check      
894       %publisher "publisher" output.check
895       %address output
896       format.edition output
897       format.date "year" output.check
898     }
899     { format.incoll.inproc.crossref output.nonnull
900       format.chapter.pages output
901     }
902   if$
903   format.doi output
904   format.url output
905   new.block
906   format.isbn output
907   note output
908   fin.entry
911 FUNCTION {inproceedings}
912 { output.bibitem
913   format.authors "author" output.check
914   author format.key output
915   new.block
916   format.title "title" output.check
917   new.block
918   crossref missing$
919     { format.in.ed.booktitle "booktitle" output.check
920       format.bvolume output
921       format.number.series output
922       format.pages output
923       address empty$
924         { organization publisher new.sentence.checkb
925           organization output
926           publisher output
927           format.date "year" output.check
928         }
929         { address output.nonnull
930           format.date "year" output.check
931           new.sentence
932           organization output
933           publisher output
934         }
935       if$
936     }
937     { format.incoll.inproc.crossref output.nonnull
938       format.pages output
939     }
940   if$
941   format.doi output
942   format.url output
943   new.block
944   format.isbn output
945   note output
946   fin.entry
949 FUNCTION {conference} { inproceedings }
951 FUNCTION {manual}
952 { output.bibitem
953   format.authors output
954   author format.key output
955   new.block
956   format.btitle "title" output.check
957   organization address new.block.checkb
958   organization output
959   address output
960   format.edition output
961   format.date output
962   format.url output
963   new.block
964   note output
965   fin.entry
968 FUNCTION {mastersthesis}
969 { output.bibitem
970   format.authors "author" output.check
971   author format.key output
972   new.block
973   format.title "title" output.check
974   new.block
975   "Master's thesis" format.thesis.type output.nonnull
976   school "school" output.check
977   address output
978   format.date "year" output.check
979   format.url output
980   new.block
981   note output
982   fin.entry
985 FUNCTION {misc}
986 { output.bibitem
987   format.authors output
988   author format.key output
989   title howpublished new.block.checkb
990   format.title output
991   howpublished new.block.checka
992   howpublished output
993   format.date output
994   format.issn output
995   format.url output
996   new.block
997   note output
998   fin.entry
999   empty.misc.check
1002 FUNCTION {phdthesis}
1003 { output.bibitem
1004   format.authors "author" output.check
1005   author format.key output
1006   new.block
1007   format.btitle "title" output.check
1008   new.block
1009   "PhD thesis" format.thesis.type output.nonnull
1010   school "school" output.check
1011   address output
1012   format.date "year" output.check
1013   format.url output
1014   new.block
1015   note output
1016   fin.entry
1019 FUNCTION {proceedings}
1020 { output.bibitem
1021   format.editors output
1022   editor format.key output
1023   new.block
1024   format.btitle "title" output.check
1025   format.bvolume output
1026   format.number.series output
1027   address output
1028   format.date "year" output.check
1029   new.sentence
1030   organization output
1031   publisher output
1032   format.doi output
1033   format.url output
1034   new.block
1035   format.isbn output
1036   note output
1037   fin.entry
1040 FUNCTION {techreport}
1041 { output.bibitem
1042   format.authors "author" output.check
1043   author format.key output
1044   new.block
1045   format.title "title" output.check
1046   new.block
1047   format.tr.number output.nonnull
1048   institution "institution" output.check
1049   address output
1050   format.date "year" output.check
1051   format.url output
1052   new.block
1053   note output
1054   fin.entry
1057 FUNCTION {unpublished}
1058 { output.bibitem
1059   format.authors "author" output.check
1060   author format.key output
1061   new.block
1062   format.title "title" output.check
1063   format.url output
1064   new.block
1065   note "note" output.check
1066   format.date output
1067   fin.entry
1070 FUNCTION {default.type} { misc }
1073 MACRO {jan} {"January"}
1075 MACRO {feb} {"February"}
1077 MACRO {mar} {"March"}
1079 MACRO {apr} {"April"}
1081 MACRO {may} {"May"}
1083 MACRO {jun} {"June"}
1085 MACRO {jul} {"July"}
1087 MACRO {aug} {"August"}
1089 MACRO {sep} {"September"}
1091 MACRO {oct} {"October"}
1093 MACRO {nov} {"November"}
1095 MACRO {dec} {"December"}
1099 MACRO {acmcs} {"ACM Computing Surveys"}
1101 MACRO {acta} {"Acta Informatica"}
1103 MACRO {cacm} {"Communications of the ACM"}
1105 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
1107 MACRO {ibmsj} {"IBM Systems Journal"}
1109 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
1111 MACRO {ieeetc} {"IEEE Transactions on Computers"}
1113 MACRO {ieeetcad}
1114  {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
1116 MACRO {ipl} {"Information Processing Letters"}
1118 MACRO {jacm} {"Journal of the ACM"}
1120 MACRO {jcss} {"Journal of Computer and System Sciences"}
1122 MACRO {scp} {"Science of Computer Programming"}
1124 MACRO {sicomp} {"SIAM Journal on Computing"}
1126 MACRO {tocs} {"ACM Transactions on Computer Systems"}
1128 MACRO {tods} {"ACM Transactions on Database Systems"}
1130 MACRO {tog} {"ACM Transactions on Graphics"}
1132 MACRO {toms} {"ACM Transactions on Mathematical Software"}
1134 MACRO {toois} {"ACM Transactions on Office Information Systems"}
1136 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1138 MACRO {tcs} {"Theoretical Computer Science"}
1141 READ
1143 FUNCTION {sortify}
1144 { purify$
1145   "l" change.case$
1148 INTEGERS { len }
1150 FUNCTION {chop.word}
1151 { 's :=
1152   'len :=
1153   s #1 len substring$ =
1154     { s len #1 + global.max$ substring$ }
1155     's
1156   if$
1159 FUNCTION {format.lab.names}
1160 { 's :=
1161   s #1 "{vv~}{ll}" format.name$
1162   s num.names$ duplicate$
1163   #2 >
1164     { pop$ " et~al." * }
1165     { #2 <
1166         'skip$
1167         { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1168             { " et~al." * }
1169             { " -- " * s #2 "{vv~}{ll}" format.name$ * } % CHANGE mudrd8mz 2005-10-12: changed "and"
1170           if$
1171         }
1172       if$
1173     }
1174   if$
1177 FUNCTION {author.key.label}
1178 { author empty$
1179     { key empty$
1180         { cite$ #1 #3 substring$ }
1181         'key
1182       if$
1183     }
1184     { author format.lab.names }
1185   if$
1188 FUNCTION {author.editor.key.label}
1189 { author empty$
1190     { editor empty$
1191         { key empty$
1192             { cite$ #1 #3 substring$ }
1193             'key
1194           if$
1195         }
1196         { editor format.lab.names }
1197       if$
1198     }
1199     { author format.lab.names }
1200   if$
1203 FUNCTION {author.key.organization.label}
1204 { author empty$
1205     { key empty$
1206         { organization empty$
1207             { cite$ #1 #3 substring$ }
1208             { "The " #4 organization chop.word #3 text.prefix$ }
1209           if$
1210         }
1211         'key
1212       if$
1213     }
1214     { author format.lab.names }
1215   if$
1218 FUNCTION {editor.key.organization.label}
1219 { editor empty$
1220     { key empty$
1221         { organization empty$
1222             { cite$ #1 #3 substring$ }
1223             { "The " #4 organization chop.word #3 text.prefix$ }
1224           if$
1225         }
1226         'key
1227       if$
1228     }
1229     { editor format.lab.names }
1230   if$
1233 FUNCTION {calc.short.authors}
1234 { type$ "book" =
1235   type$ "inbook" =
1236   or
1237     'author.editor.key.label
1238     { type$ "proceedings" =
1239         'editor.key.organization.label
1240         { type$ "manual" =
1241             'author.key.organization.label
1242             'author.key.label
1243           if$
1244         }
1245       if$
1246     }
1247   if$
1248   'short.list :=
1251 FUNCTION {calc.label}
1252 { calc.short.authors
1253   short.list
1254   "("
1255   *
1256   year duplicate$ empty$
1257   short.list key field.or.null = or
1258      { pop$ "" }
1259      'skip$
1260   if$
1261   *
1262   'label :=
1265 FUNCTION {sort.format.names}
1266 { 's :=
1267   #1 'nameptr :=
1268   ""
1269   s num.names$ 'numnames :=
1270   numnames 'namesleft :=
1271     { namesleft #0 > }
1272     {
1273       s nameptr "{vv{ } }{ll{ }}{  ff{ }}{  jj{ }}" format.name$ 't :=
1274       nameptr #1 >
1275         {
1276           "   "  *
1277           namesleft #1 = t "others" = and
1278             { "zzzzz" * }
1279             { numnames #2 > nameptr #2 = and
1280                 { "zz" * year field.or.null * "   " * }
1281                 'skip$
1282               if$
1283               t sortify *
1284             }
1285           if$
1286         }
1287         { t sortify * }
1288       if$
1289       nameptr #1 + 'nameptr :=
1290       namesleft #1 - 'namesleft :=
1291     }
1292   while$
1295 FUNCTION {sort.format.title}
1296 { 't :=
1297   "A " #2
1298     "An " #3
1299       "The " #4 t chop.word
1300     chop.word
1301   chop.word
1302   sortify
1303   #1 global.max$ substring$
1306 FUNCTION {author.sort}
1307 { author empty$
1308     { key empty$
1309         { "to sort, need author or key in " cite$ * warning$
1310           ""
1311         }
1312         { key sortify }
1313       if$
1314     }
1315     { author sort.format.names }
1316   if$
1319 FUNCTION {author.editor.sort}
1320 { author empty$
1321     { editor empty$
1322         { key empty$
1323             { "to sort, need author, editor, or key in " cite$ * warning$
1324               ""
1325             }
1326             { key sortify }
1327           if$
1328         }
1329         { editor sort.format.names }
1330       if$
1331     }
1332     { author sort.format.names }
1333   if$
1336 FUNCTION {author.organization.sort}
1337 { author empty$
1338     { organization empty$
1339         { key empty$
1340             { "to sort, need author, organization, or key in " cite$ * warning$
1341               ""
1342             }
1343             { key sortify }
1344           if$
1345         }
1346         { "The " #4 organization chop.word sortify }
1347       if$
1348     }
1349     { author sort.format.names }
1350   if$
1353 FUNCTION {editor.organization.sort}
1354 { editor empty$
1355     { organization empty$
1356         { key empty$
1357             { "to sort, need editor, organization, or key in " cite$ * warning$
1358               ""
1359             }
1360             { key sortify }
1361           if$
1362         }
1363         { "The " #4 organization chop.word sortify }
1364       if$
1365     }
1366     { editor sort.format.names }
1367   if$
1371 FUNCTION {presort}
1372 { calc.label
1373   label sortify
1374   "    "
1375   *
1376   type$ "book" =
1377   type$ "inbook" =
1378   or
1379     'author.editor.sort
1380     { type$ "proceedings" =
1381         'editor.organization.sort
1382         { type$ "manual" =
1383             'author.organization.sort
1384             'author.sort
1385           if$
1386         }
1387       if$
1388     }
1389   if$
1390   "    "
1391   *
1392   cite$
1393   *
1394   #1 entry.max$ substring$
1395   'sort.label :=
1396   sort.label *
1397   #1 entry.max$ substring$
1398   'sort.key$ :=
1401 ITERATE {presort}
1403 SORT
1405 STRINGS { longest.label last.label next.extra }
1407 INTEGERS { longest.label.width last.extra.num number.label }
1409 FUNCTION {initialize.longest.label}
1410 { "" 'longest.label :=
1411   #0 int.to.chr$ 'last.label :=
1412   "" 'next.extra :=
1413   #0 'longest.label.width :=
1414   #0 'last.extra.num :=
1415   #0 'number.label :=
1418 FUNCTION {forward.pass}
1419 { last.label label =
1420     { last.extra.num #1 + 'last.extra.num :=
1421       last.extra.num int.to.chr$ 'extra.label :=
1422     }
1423     { "a" chr.to.int$ 'last.extra.num :=
1424       "" 'extra.label :=
1425       label 'last.label :=
1426     }
1427   if$
1428   number.label #1 + 'number.label :=
1431 FUNCTION {reverse.pass}
1432 { next.extra "b" =
1433     { "a" 'extra.label := }
1434     'skip$
1435   if$
1436   extra.label 'next.extra :=
1437   extra.label
1438   duplicate$ empty$
1439     'skip$
1440     { "{\natexlab{" swap$ * "}}" * }
1441   if$
1442   'extra.label :=
1443   label extra.label * 'label :=
1446 EXECUTE {initialize.longest.label}
1448 ITERATE {forward.pass}
1450 REVERSE {reverse.pass}
1452 FUNCTION {bib.sort.order}
1453 { sort.label  'sort.key$ :=
1456 ITERATE {bib.sort.order}
1458 SORT
1460 FUNCTION {begin.bib}
1461 {   preamble$ empty$
1462     'skip$
1463     { preamble$ write$ newline$ }
1464   if$
1465   "\begin{thebibliography}{" number.label int.to.str$ * "}" *
1466   write$ newline$
1467   "\providecommand{\natexlab}[1]{#1}"
1468   write$ newline$
1469   "\providecommand{\url}[1]{\texttt{#1}}"
1470   write$ newline$
1471   "\expandafter\ifx\csname urlstyle\endcsname\relax"
1472   write$ newline$
1473   "  \providecommand{\doi}[1]{doi: #1}\else"
1474   write$ newline$
1475   "  \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi"
1476   write$ newline$
1479 EXECUTE {begin.bib}
1481 EXECUTE {init.state.consts}
1483 ITERATE {call.type$}
1485 FUNCTION {end.bib}
1486 { newline$
1487   "\end{thebibliography}" write$ newline$
1490 EXECUTE {end.bib}