Debian Codegraph @

texmf-dist/bibtex/bst/dk-bib/dk-apali.bst

raw
1 % BibTeX `apalike' bibliography style (24-Jan-88 version)
2 % Adapted from the `alpha' style, version 0.99a; for BibTeX version 0.99a.
3 % Copyright (C) 1988, all rights reserved.
4 % Copying of this file is allowed, provided that if you make any changes at all
5 % you name it something other than `apalike.bst'.
6 % This restriction helps ensure that all copies are identical.
7 % Differences between this style and `alpha' are generally heralded by a `%'.
8 % The file btxbst.doc has the documentation for alpha.bst.
9 %
10 % This style should be used with the `apalike' LaTeX style (apalike.sty).
11 % \cite's come out like "(Jones, 1986)" in the text but there are no labels
12 % in the bibliography, and something like "(1986)" comes out immediately
13 % after the author. Author (and editor) names appear as last name, comma,
14 % initials. A `year' field is required for every entry, and so is either
15 % an author (or in some cases, an editor) field or a key field.
16 %
17 % Editorial note:
18 % Many journals require a style like `apalike', but I strongly, strongly,
19 % strongly recommend that you not use it if you have a choice---use something
20 % like `plain' instead. Mary-Claire van Leunen (A Handbook for Scholars,
21 % Knopf, 1979) argues convincingly that a style like `plain' encourages better
22 % writing than one like `apalike'. Furthermore the strongest arguments for
23 % using an author-date style like `apalike'---that it's "the most practical"
24 % (The Chicago Manual of Style, University of Chicago Press, thirteenth
25 % edition, 1982, pages 400--401)---fall flat on their face with the new
26 % computer-typesetting technology. For instance page 401 anachronistically
27 % states "The chief disadvantage of [a style like `plain'] is that additions
28 % or deletions cannot be made after the manuscript is typed without changing
29 % numbers in both text references and list." LaTeX sidesteps the disadvantage.
30 %
31 % History:
32 % 15-sep-86 (SK,OP) Original version, by Susan King and Oren Patashnik.
33 % 10-nov-86 (OP) Truncated the sort.key$ string to the correct length
34 % in bib.sort.order to eliminate error message.
35 % 24-jan-88 (OP) Updated for BibTeX version 0.99a, from alpha.bst 0.99a;
36 % apalike now sorts by author, then year, then title;
37 % THIS `apalike' VERSION DOES NOT WORK WITH BIBTEX 0.98i.
38 % 20-jan-2005 (arne) Translated into Danish by [email protected].
39 % Now called `dk-apali'.
40 % This is dk-bib, Version 0.6 ($Id: dk-apali.bst 92 2006-05-21 21:18:10Z arne $)
41
42 ENTRY
43 { address
44 author
45 booktitle
46 chapter
47 edition
48 printing
49 editor
50 howpublished
51 institution
52 isbn
53 issn
54 url
55 annote
56 journal
57 key
58 % month not used in apalike
59 note
60 number
61 organization
62 pages
63 publisher
64 school
65 series
66 title
67 type
68 volume
69 year
70 }
71 {}
72 { label extra.label sort.label }
73
74 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
75
76 FUNCTION {init.state.consts}
77 { #0 'before.all :=
78 #1 'mid.sentence :=
79 #2 'after.sentence :=
80 #3 'after.block :=
81 }
82
83 STRINGS { s t }
84
85 FUNCTION {output.nonnull}
86 { 's :=
87 output.state mid.sentence =
88 { ", " * write$ }
89 { output.state after.block =
90 { add.period$ write$
91 newline$
92 "\newblock " write$
93 }
94 { output.state before.all =
95 'write$
96 { add.period$ " " * write$ }
97 if$
98 }
99 if$
100 mid.sentence 'output.state :=
101 }
102 if$
103 s
104 }
105
106 FUNCTION {output}
107 { duplicate$ empty$
108 'pop$
109 'output.nonnull
110 if$
111 }
112
113 FUNCTION {output.check}
114 { 't :=
115 duplicate$ empty$
116 { pop$ "empty " t * " in " * cite$ * warning$ }
117 'output.nonnull
118 if$
119 }
120
121 % apalike needs this function because
122 % the year has special punctuation;
123 % apalike ignores the month
124 FUNCTION {output.year.check}
125 { year empty$
126 { "empty year in " cite$ * warning$ }
127 { write$
128 " (" year * extra.label * ")" *
129 mid.sentence 'output.state :=
130 }
131 if$
132 }
133
134 FUNCTION {output.bibitem}
135 { newline$
136 "\bibitem[" write$
137 label write$
138 "]{" write$
139 cite$ write$
140 "}" write$
141 newline$
142 ""
143 before.all 'output.state :=
144 }
145
146 FUNCTION {output.annote}
147 { annote empty$
148 'skip$
149 { "\dkbibannote{" cite$ * "}{" * annote add.period$ * "}" *
150 write$ newline$ }
151 if$
152 }
153
154 FUNCTION {fin.entry}
155 { add.period$
156 write$
157 newline$
158 output.annote
159 }
160
161 FUNCTION {new.block}
162 { output.state before.all =
163 'skip$
164 { after.block 'output.state := }
165 if$
166 }
167
168 FUNCTION {output.isbn.issn}
169 { isbn empty$
170 'skip$
171 { new.block "\dkbibisbn{" isbn * "}" * output }
172 if$
173 issn empty$
174 'skip$
175 { new.block "\dkbibissn{" issn * "}" * output }
176 if$
177 }
178
179 FUNCTION {output.url}
180 { url empty$
181 'skip$
182 { new.block "\dkbiburl{" url * "}" * output }
183 if$
184 }
185
186 FUNCTION {new.sentence}
187 { output.state after.block =
188 'skip$
189 { output.state before.all =
190 'skip$
191 { after.sentence 'output.state := }
192 if$
193 }
194 if$
195 }
196
197 FUNCTION {not}
198 { { #0 }
199 { #1 }
200 if$
201 }
202
203 FUNCTION {and}
204 { 'skip$
205 { pop$ #0 }
206 if$
207 }
208
209 FUNCTION {or}
210 { { pop$ #1 }
211 'skip$
212 if$
213 }
214
215 FUNCTION {new.block.checkb}
216 { empty$
217 swap$ empty$
218 and
219 'skip$
220 'new.block
221 if$
222 }
223
224 FUNCTION {field.or.null}
225 { duplicate$ empty$
226 { pop$ "" }
227 'skip$
228 if$
229 }
230
231 FUNCTION {emphasize}
232 { duplicate$ empty$
233 { pop$ "" }
234 { "\emph{" swap$ * "}" * }
235 if$
236 }
237
238 INTEGERS { nameptr namesleft numnames }
239
240 FUNCTION {format.names}
241 { 's :=
242 #1 'nameptr :=
243 s num.names$ 'numnames :=
244 numnames 'namesleft :=
245 { namesleft #0 > }
246 { s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't := % last name first
247 nameptr #1 >
248 { namesleft #1 >
249 { ", " * t * }
250 { t "others" =
251 { " et~al." * }
252 { " og " * t * }
253 if$
254 }
255 if$
256 }
257 't
258 if$
259 nameptr #1 + 'nameptr :=
260 namesleft #1 - 'namesleft :=
261 }
262 while$
263 }
264
265 FUNCTION {format.authors}
266 { author empty$
267 { "" }
268 { author format.names }
269 if$
270 }
271
272 FUNCTION {format.key} % this function is just for apalike
273 { empty$
274 { key field.or.null }
275 { "" }
276 if$
277 }
278
279 FUNCTION {format.editors}
280 { editor empty$
281 { "" }
282 { editor format.names
283 editor num.names$ #1 >
284 { ", redakt\o rer" * }
285 { ", redakt\o r" * }
286 if$
287 }
288 if$
289 }
290
291 FUNCTION {format.title}
292 { title empty$
293 { "" }
294 { title "t" change.case$ }
295 if$
296 }
297
298 FUNCTION {n.dashify}
299 { 't :=
300 ""
301 { t empty$ not }
302 { t #1 #1 substring$ "-" =
303 { "\dkbibdash" *
304 t #2 global.max$ substring$ 't :=
305 { t #1 #1 substring$ "-" = }
306 { t #2 global.max$ substring$ 't := }
307 while$
308 t #1 #1 substring$ " " =
309 { "{}" * }
310 { " " * }
311 if$
312 }
313 { t #1 #1 substring$ *
314 t #2 global.max$ substring$ 't :=
315 }
316 if$
317 }
318 while$
319 }
320
321 FUNCTION {format.btitle}
322 { title emphasize
323 }
324
325 FUNCTION {tie.or.space.connect}
326 { duplicate$ text.length$ #3 <
327 { "~" }
328 { " " }
329 if$
330 swap$ * *
331 }
332
333 FUNCTION {either.or.check}
334 { empty$
335 'pop$
336 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
337 if$
338 }
339
340 FUNCTION {format.bvolume}
341 { volume empty$
342 { "" }
343 { "bind" volume tie.or.space.connect
344 series empty$
345 'skip$
346 { " af " * series emphasize * }
347 if$
348 "volume and number" number either.or.check
349 }
350 if$
351 }
352
353 FUNCTION {format.number.series}
354 { volume empty$
355 { number empty$
356 { series field.or.null }
357 { output.state mid.sentence =
358 { "nr." }
359 { "Nr." }
360 if$
361 number tie.or.space.connect
362 series empty$
363 { "there's a number but no series in " cite$ * warning$ }
364 { " i " * series * }
365 if$
366 }
367 if$
368 }
369 { "" }
370 if$
371 }
372
373 FUNCTION {ordinal.translate.i}
374 { duplicate$ "l" change.case$ "first" =
375 {pop$ "1"}
376 {skip$}
377 if$
378 duplicate$ "l" change.case$ "second" =
379 {pop$ "2"}
380 {skip$}
381 if$
382 duplicate$ "l" change.case$ "third" =
383 {pop$ "3"}
384 {skip$}
385 if$
386 duplicate$ "l" change.case$ "fourth" =
387 {pop$ "4"}
388 {skip$}
389 if$
390 duplicate$ "l" change.case$ "fifth" =
391 {pop$ "5"}
392 {skip$}
393 if$
394 }
395
396 FUNCTION {ordinal.translate.ii}
397 { duplicate$ "l" change.case$ "sixth" =
398 {pop$ "6"}
399 {skip$}
400 if$
401 duplicate$ "l" change.case$ "seventh" =
402 {pop$ "7"}
403 {skip$}
404 if$
405 duplicate$ "l" change.case$ "eighth" =
406 {pop$ "8"}
407 {skip$}
408 if$
409 duplicate$ "l" change.case$ "ninth" =
410 {pop$ "9"}
411 {skip$}
412 if$
413 duplicate$ "l" change.case$ "tenth" =
414 {pop$ "10"}
415 {skip$}
416 if$
417 }
418
419 FUNCTION {ordinal.translate.iii}
420 { duplicate$ "l" change.case$ "eleventh" =
421 {pop$ "11"}
422 {skip$}
423 if$
424 duplicate$ "l" change.case$ "twelfth" =
425 {pop$ "12"}
426 {skip$}
427 if$
428 duplicate$ "l" change.case$ "thirteenth" =
429 {pop$ "13"}
430 {skip$}
431 if$
432 duplicate$ "l" change.case$ "fourteenth" =
433 {pop$ "14"}
434 {skip$}
435 if$
436 duplicate$ "l" change.case$ "fifteenth" =
437 {pop$ "15"}
438 {skip$}
439 if$
440 }
441
442 FUNCTION {ordinal.translate.iv}
443 { duplicate$ "l" change.case$ "sixteenth" =
444 {pop$ "16"}
445 {skip$}
446 if$
447 duplicate$ "l" change.case$ "seventeenth" =
448 {pop$ "17"}
449 {skip$}
450 if$
451 duplicate$ "l" change.case$ "eighteenth" =
452 {pop$ "18"}
453 {skip$}
454 if$
455 duplicate$ "l" change.case$ "nineteenth" =
456 {pop$ "19"}
457 {skip$}
458 if$
459 duplicate$ "l" change.case$ "twentieth" =
460 {pop$ "20"}
461 {skip$}
462 if$
463 }
464
465 FUNCTION {ordinal.translate}
466 { ordinal.translate.i
467 ordinal.translate.ii
468 ordinal.translate.iii
469 ordinal.translate.iv
470 }
471
472 FUNCTION {format.edition}
473 { edition empty$
474 printing empty$
475 +
476 #2
477 =
478 { "" }
479 { output.state mid.sentence =
480 { "\dkbibedition{" }
481 { "\dkbibEdition{" }
482 if$
483 edition empty$
484 { "" }
485 { edition ordinal.translate
486 duplicate$ "l" change.case$
487 duplicate$ "u" change.case$
488 =
489 { purify$ }
490 { output.state mid.sentence =
491 { skip$ }
492 { "u" change.case$
493 "t" change.case$
494 }
495 if$
496 }
497 if$
498 }
499 if$
500 * "}{" *
501 printing empty$
502 { "" }
503 { printing ordinal.translate
504 duplicate$ "l" change.case$
505 duplicate$ "u" change.case$
506 =
507 { purify$ }
508 { skip$ }
509 if$
510 }
511 if$
512 * "}" *
513 }
514 if$
515 }
516
517 INTEGERS { multiresult }
518
519 FUNCTION {multi.page.check}
520 { 't :=
521 #0 'multiresult :=
522 { multiresult not
523 t empty$ not
524 and
525 }
526 { t #1 #1 substring$
527 duplicate$ "-" =
528 swap$ duplicate$ "," =
529 swap$ "+" =
530 or or
531 { #1 'multiresult := }
532 { t #2 global.max$ substring$ 't := }
533 if$
534 }
535 while$
536 multiresult
537 }
538
539 FUNCTION {format.pages}
540 { pages empty$
541 { "" }
542 { pages multi.page.check
543 { "side" pages n.dashify tie.or.space.connect }
544 { "side" pages tie.or.space.connect }
545 if$
546 }
547 if$
548 }
549
550 FUNCTION {format.vol.num.pages}
551 { volume field.or.null
552 number empty$
553 'skip$
554 { "(" number * ")" * *
555 volume empty$
556 { "there's a number but no volume in " cite$ * warning$ }
557 'skip$
558 if$
559 }
560 if$
561 pages empty$
562 'skip$
563 { duplicate$ empty$
564 { pop$ format.pages }
565 { ":" * pages n.dashify * }
566 if$
567 }
568 if$
569 }
570
571 FUNCTION {format.chapter.pages}
572 { chapter empty$
573 'format.pages
574 { type empty$
575 { "kapitel" }
576 { type "l" change.case$ }
577 if$
578 chapter tie.or.space.connect
579 pages empty$
580 'skip$
581 { ", " * format.pages * }
582 if$
583 }
584 if$
585 }
586
587 FUNCTION {format.in.ed.booktitle}
588 { booktitle empty$
589 { "" }
590 { editor empty$
591 { "I " booktitle emphasize * }
592 { "I " format.editors * ", " * booktitle emphasize * }
593 if$
594 }
595 if$
596 }
597
598 FUNCTION {format.thesis.type}
599 { type empty$
600 'skip$
601 { pop$
602 type "t" change.case$
603 }
604 if$
605 }
606
607 FUNCTION {format.tr.number}
608 { type empty$
609 { "Rapport" }
610 'type
611 if$
612 number empty$
613 { "t" change.case$ }
614 { number tie.or.space.connect }
615 if$
616 }
617
618 FUNCTION {format.article.crossref}
619 { "I" % this is for apalike
620 "~\cite{" * crossref * "}" *
621 }
622
623 FUNCTION {format.book.crossref}
624 { volume empty$
625 { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
626 "I "
627 }
628 { "Bind" volume tie.or.space.connect
629 " af " *
630 }
631 if$
632 "\cite{" * crossref * "}" * % this is for apalike
633 }
634
635 FUNCTION {format.incoll.inproc.crossref}
636 { "I" % this is for apalike
637 "~\cite{" * crossref * "}" *
638 }
639
640 FUNCTION {article}
641 { output.bibitem
642 format.authors "author" output.check
643 author format.key output % special for
644 output.year.check % apalike
645 new.block
646 format.title "title" output.check
647 new.block
648 crossref missing$
649 { journal emphasize "journal" output.check
650 format.vol.num.pages output
651 }
652 { format.article.crossref output.nonnull
653 format.pages output
654 }
655 if$
656 new.block
657 note output
658 output.isbn.issn
659 output.url
660 fin.entry
661 }
662
663 FUNCTION {book}
664 { output.bibitem
665 author empty$
666 { format.editors "author and editor" output.check
667 editor format.key output
668 }
669 { format.authors output.nonnull
670 crossref missing$
671 { "author and editor" editor either.or.check }
672 'skip$
673 if$
674 }
675 if$
676 output.year.check % special for apalike
677 new.block
678 format.btitle "title" output.check
679 crossref missing$
680 { format.bvolume output
681 new.block
682 format.number.series output
683 new.sentence
684 publisher "publisher" output.check
685 address output
686 }
687 { new.block
688 format.book.crossref output.nonnull
689 }
690 if$
691 format.edition output
692 new.block
693 note output
694 output.isbn.issn
695 output.url
696 fin.entry
697 }
698
699 FUNCTION {booklet}
700 { output.bibitem
701 format.authors output
702 author format.key output % special for
703 output.year.check % apalike
704 new.block
705 format.title "title" output.check
706 new.block
707 howpublished output
708 address output
709 new.block
710 note output
711 output.isbn.issn
712 output.url
713 fin.entry
714 }
715
716 FUNCTION {inbook}
717 { output.bibitem
718 author empty$
719 { format.editors "author and editor" output.check
720 editor format.key output
721 }
722 { format.authors output.nonnull
723 crossref missing$
724 { "author and editor" editor either.or.check }
725 'skip$
726 if$
727 }
728 if$
729 output.year.check % special for apalike
730 new.block
731 format.btitle "title" output.check
732 crossref missing$
733 { format.bvolume output
734 format.chapter.pages "chapter and pages" output.check
735 new.block
736 format.number.series output
737 new.sentence
738 publisher "publisher" output.check
739 address output
740 }
741 { format.chapter.pages "chapter and pages" output.check
742 new.block
743 format.book.crossref output.nonnull
744 }
745 if$
746 format.edition output
747 new.block
748 note output
749 output.isbn.issn
750 output.url
751 fin.entry
752 }
753
754 FUNCTION {incollection}
755 { output.bibitem
756 format.authors "author" output.check
757 author format.key output % special for
758 output.year.check % apalike
759 new.block
760 format.title "title" output.check
761 new.block
762 crossref missing$
763 { format.in.ed.booktitle "booktitle" output.check
764 format.bvolume output
765 format.number.series output
766 format.chapter.pages output
767 new.sentence
768 publisher "publisher" output.check
769 address output
770 format.edition output
771 }
772 { format.incoll.inproc.crossref output.nonnull
773 format.chapter.pages output
774 }
775 if$
776 new.block
777 note output
778 output.isbn.issn
779 output.url
780 fin.entry
781 }
782
783 FUNCTION {inproceedings}
784 { output.bibitem
785 format.authors "author" output.check
786 author format.key output % special for
787 output.year.check % apalike
788 new.block
789 format.title "title" output.check
790 new.block
791 crossref missing$
792 { format.in.ed.booktitle "booktitle" output.check
793 format.bvolume output
794 format.number.series output
795 format.pages output
796 address output % for apalike
797 new.sentence % there's no year
798 organization output % here so things
799 publisher output % are simpler
800 }
801 { format.incoll.inproc.crossref output.nonnull
802 format.pages output
803 }
804 if$
805 new.block
806 note output
807 output.isbn.issn
808 output.url
809 fin.entry
810 }
811
812 FUNCTION {conference} { inproceedings }
813
814 FUNCTION {manual}
815 { output.bibitem
816 format.authors output
817 author format.key output % special for
818 output.year.check % apalike
819 new.block
820 format.btitle "title" output.check
821 organization address new.block.checkb
822 organization output
823 address output
824 format.edition output
825 new.block
826 note output
827 output.isbn.issn
828 output.url
829 fin.entry
830 }
831
832 FUNCTION {mastersthesis}
833 { output.bibitem
834 format.authors "author" output.check
835 author format.key output % special for
836 output.year.check % apalike
837 new.block
838 format.title "title" output.check
839 new.block
840 "Specialeafhandling" format.thesis.type output.nonnull
841 school "school" output.check
842 address output
843 new.block
844 note output
845 output.isbn.issn
846 output.url
847 fin.entry
848 }
849
850 FUNCTION {misc}
851 { output.bibitem
852 format.authors output
853 author format.key output % special for
854 output.year.check % apalike
855 new.block
856 format.title output
857 new.block
858 howpublished output
859 new.block
860 note output
861 output.isbn.issn
862 output.url
863 fin.entry
864 }
865
866 FUNCTION {phdthesis}
867 { output.bibitem
868 format.authors "author" output.check
869 author format.key output % special for
870 output.year.check % apalike
871 new.block
872 format.btitle "title" output.check
873 new.block
874 "Ph.d.-afhandling" format.thesis.type output.nonnull
875 school "school" output.check
876 address output
877 new.block
878 note output
879 output.isbn.issn
880 output.url
881 fin.entry
882 }
883
884 FUNCTION {proceedings}
885 { output.bibitem
886 format.editors output
887 editor format.key output % special for
888 output.year.check % apalike
889 new.block
890 format.btitle "title" output.check
891 format.bvolume output
892 format.number.series output
893 address output % for apalike
894 new.sentence % we always output
895 organization output % a nonempty organization
896 publisher output % here
897 new.block
898 note output
899 output.isbn.issn
900 output.url
901 fin.entry
902 }
903
904 FUNCTION {techreport}
905 { output.bibitem
906 format.authors "author" output.check
907 author format.key output % special for
908 output.year.check % apalike
909 new.block
910 format.title "title" output.check
911 new.block
912 format.tr.number output.nonnull
913 institution "institution" output.check
914 address output
915 new.block
916 note output
917 output.isbn.issn
918 output.url
919 fin.entry
920 }
921
922 FUNCTION {unpublished}
923 { output.bibitem
924 format.authors "author" output.check
925 author format.key output % special for
926 output.year.check % apalike
927 new.block
928 format.title "title" output.check
929 new.block
930 note "note" output.check
931 output.isbn.issn
932 output.url
933 fin.entry
934 }
935
936 FUNCTION {default.type} { misc }
937
938 MACRO {jan} {"januar"}
939
940 MACRO {feb} {"februar"}
941
942 MACRO {mar} {"marts"}
943
944 MACRO {apr} {"april"}
945
946 MACRO {may} {"maj"}
947
948 MACRO {jun} {"juni"}
949
950 MACRO {jul} {"juli"}
951
952 MACRO {aug} {"august"}
953
954 MACRO {sep} {"september"}
955
956 MACRO {oct} {"oktober"}
957
958 MACRO {nov} {"november"}
959
960 MACRO {dec} {"december"}
961
962 MACRO {acmcs} {"ACM Computing Surveys"}
963
964 MACRO {acta} {"Acta Informatica"}
965
966 MACRO {cacm} {"Communications of the ACM"}
967
968 MACRO {ibmjrd} {"IBM Journal of Research and Development"}
969
970 MACRO {ibmsj} {"IBM Systems Journal"}
971
972 MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
973
974 MACRO {ieeetc} {"IEEE Transactions on Computers"}
975
976 MACRO {ieeetcad}
977 {"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
978
979 MACRO {ipl} {"Information Processing Letters"}
980
981 MACRO {jacm} {"Journal of the ACM"}
982
983 MACRO {jcss} {"Journal of Computer and System Sciences"}
984
985 MACRO {scp} {"Science of Computer Programming"}
986
987 MACRO {sicomp} {"SIAM Journal on Computing"}
988
989 MACRO {tocs} {"ACM Transactions on Computer Systems"}
990
991 MACRO {tods} {"ACM Transactions on Database Systems"}
992
993 MACRO {tog} {"ACM Transactions on Graphics"}
994
995 MACRO {toms} {"ACM Transactions on Mathematical Software"}
996
997 MACRO {toois} {"ACM Transactions on Office Information Systems"}
998
999 MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
1000
1001 MACRO {tcs} {"Theoretical Computer Science"}
1002
1003 READ
1004
1005 FUNCTION {sortify}
1006 { purify$
1007 "l" change.case$
1008 }
1009
1010 INTEGERS { len }
1011
1012 FUNCTION {chop.word}
1013 { 's :=
1014 'len :=
1015 s #1 len substring$ =
1016 { s len #1 + global.max$ substring$ }
1017 's
1018 if$
1019 }
1020
1021 % There are three apalike cases: one person (Jones),
1022 % two (Jones and de~Bruijn), and more (Jones et~al.).
1023 % This function is much like format.crossref.editors.
1024 %
1025 FUNCTION {format.lab.names}
1026 { 's :=
1027 s #1 "{vv~}{ll}" format.name$
1028 s num.names$ duplicate$
1029 #2 >
1030 { pop$ " et~al." * }
1031 { #2 <
1032 'skip$
1033 { s #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
1034 { " et~al." * }
1035 { " og " * s #2 "{vv~}{ll}" format.name$ * }
1036 if$
1037 }
1038 if$
1039 }
1040 if$
1041 }
1042
1043 FUNCTION {author.key.label}
1044 { author empty$
1045 { key empty$
1046 { cite$ #1 #3 substring$ }
1047 'key % apalike uses the whole key
1048 if$
1049 }
1050 { author format.lab.names }
1051 if$
1052 }
1053
1054 FUNCTION {author.editor.key.label}
1055 { author empty$
1056 { editor empty$
1057 { key empty$
1058 { cite$ #1 #3 substring$ }
1059 'key % apalike uses the whole key
1060 if$
1061 }
1062 { editor format.lab.names }
1063 if$
1064 }
1065 { author format.lab.names }
1066 if$
1067 }
1068
1069 FUNCTION {editor.key.label}
1070 { editor empty$
1071 { key empty$
1072 { cite$ #1 #3 substring$ }
1073 'key % apalike uses the whole key, no organization
1074 if$
1075 }
1076 { editor format.lab.names }
1077 if$
1078 }
1079
1080 FUNCTION {calc.label}
1081 { type$ "book" =
1082 type$ "inbook" =
1083 or
1084 'author.editor.key.label
1085 { type$ "proceedings" =
1086 'editor.key.label % apalike ignores organization
1087 'author.key.label % for labeling and sorting
1088 if$
1089 }
1090 if$
1091 ", " % these three lines are
1092 * % for apalike, which
1093 year field.or.null purify$ #-1 #4 substring$ % uses all four digits
1094 *
1095 'label :=
1096 }
1097
1098 FUNCTION {sort.format.names}
1099 { 's :=
1100 #1 'nameptr :=
1101 ""
1102 s num.names$ 'numnames :=
1103 numnames 'namesleft :=
1104 { namesleft #0 > }
1105 { nameptr #1 >
1106 { " " * }
1107 'skip$
1108 if$ % apalike uses initials
1109 s nameptr "{vv{ } }{ll{ }}{ f{ }}{ jj{ }}" format.name$ 't := % <= here
1110 nameptr numnames = t "others" = and
1111 { "et al" * }
1112 { t sortify * }
1113 if$
1114 nameptr #1 + 'nameptr :=
1115 namesleft #1 - 'namesleft :=
1116 }
1117 while$
1118 }
1119
1120 FUNCTION {sort.format.title}
1121 { sortify
1122 #1 global.max$ substring$
1123 }
1124
1125 FUNCTION {author.sort}
1126 { author empty$
1127 { key empty$
1128 { "to sort, need author or key in " cite$ * warning$
1129 ""
1130 }
1131 { key sortify }
1132 if$
1133 }
1134 { author sort.format.names }
1135 if$
1136 }
1137
1138 FUNCTION {author.editor.sort}
1139 { author empty$
1140 { editor empty$
1141 { key empty$
1142 { "to sort, need author, editor, or key in " cite$ * warning$
1143 ""
1144 }
1145 { key sortify }
1146 if$
1147 }
1148 { editor sort.format.names }
1149 if$
1150 }
1151 { author sort.format.names }
1152 if$
1153 }
1154
1155 FUNCTION {editor.sort}
1156 { editor empty$
1157 { key empty$
1158 { "to sort, need editor or key in " cite$ * warning$
1159 ""
1160 }
1161 { key sortify }
1162 if$
1163 }
1164 { editor sort.format.names }
1165 if$
1166 }
1167
1168 % apalike uses two sorting passes; the first one sets the
1169 % labels so that the `a's, `b's, etc. can be computed;
1170 % the second pass puts the references in "correct" order.
1171 % The presort function is for the first pass. It computes
1172 % label, sort.label, and title, and then concatenates.
1173 FUNCTION {presort}
1174 { calc.label
1175 label sortify
1176 " "
1177 *
1178 type$ "book" =
1179 type$ "inbook" =
1180 or
1181 'author.editor.sort
1182 { type$ "proceedings" =
1183 'editor.sort
1184 'author.sort
1185 if$
1186 }
1187 if$
1188 #1 entry.max$ substring$ % for
1189 'sort.label := % apalike
1190 sort.label % style
1191 *
1192 " "
1193 *
1194 title field.or.null
1195 sort.format.title
1196 *
1197 #1 entry.max$ substring$
1198 'sort.key$ :=
1199 }
1200
1201 ITERATE {presort}
1202
1203 SORT % by label, sort.label, title---for final label calculation
1204
1205 STRINGS { last.label next.extra } % apalike labels are only for the text;
1206
1207 INTEGERS { last.extra.num } % there are none in the bibliography
1208
1209 FUNCTION {initialize.extra.label.stuff} % and hence there is no `longest.label'
1210 { #0 int.to.chr$ 'last.label :=
1211 "" 'next.extra :=
1212 #0 'last.extra.num :=
1213 }
1214
1215 FUNCTION {forward.pass}
1216 { last.label label =
1217 { last.extra.num #1 + 'last.extra.num :=
1218 last.extra.num int.to.chr$ 'extra.label :=
1219 }
1220 { "a" chr.to.int$ 'last.extra.num :=
1221 "" 'extra.label :=
1222 label 'last.label :=
1223 }
1224 if$
1225 }
1226
1227 FUNCTION {reverse.pass}
1228 { next.extra "b" =
1229 { "a" 'extra.label := }
1230 'skip$
1231 if$
1232 label extra.label * 'label :=
1233 extra.label 'next.extra :=
1234 }
1235
1236 EXECUTE {initialize.extra.label.stuff}
1237
1238 ITERATE {forward.pass}
1239
1240 REVERSE {reverse.pass}
1241
1242 % Now that the label is right we sort for real,
1243 % on sort.label then year then title. This is
1244 % for the second sorting pass.
1245 FUNCTION {bib.sort.order}
1246 { sort.label
1247 " "
1248 *
1249 year field.or.null sortify
1250 *
1251 " "
1252 *
1253 title field.or.null
1254 sort.format.title
1255 *
1256 #1 entry.max$ substring$
1257 'sort.key$ :=
1258 }
1259
1260 ITERATE {bib.sort.order}
1261
1262 SORT % by sort.label, year, title---giving final bibliography order
1263
1264 FUNCTION {begin.bib}
1265 { preamble$ empty$
1266 'skip$
1267 { preamble$ write$ newline$ }
1268 if$
1269 "\begin{thebibliography}{}" write$ newline$ % no labels in apalike
1270 "\makeatletter" write$ newline$
1271 "\@tfor\dkbib@reserved@a:=0123456789\do{%" write$ newline$
1272 " \expandafter\sfcode\expandafter`\dkbib@reserved@a=1007}" write$ newline$
1273 "\providecommand{\dkbib@addperiod}{\ifnum\spacefactor=1007.\fi}" write$ newline$
1274 "\providecommand{\dkbibedition}[2]{#1\dkbib@addperiod~udgave}" write$ newline$
1275 "\providecommand{\dkbibEdition}[2]{#1\dkbib@addperiod~udgave}" write$ newline$
1276 "\providecommand{\dkbibisbn}[1]{\unskip\@gobble}" write$ newline$
1277 "\providecommand{\dkbibissn}[1]{\unskip\@gobble}" write$ newline$
1278 "\providecommand{\dkbiburl}[1]{\unskip\@gobble}" write$ newline$
1279 "\providecommand{\dkbibannote}[2]{\unskip}" write$ newline$
1280 "\providecommand{\dkbibdash}{\hbox{-}\penalty\@m}" write$ newline$
1281 "\makeatother" write$ newline$
1282 }
1283
1284 EXECUTE {begin.bib}
1285
1286 EXECUTE {init.state.consts}
1287
1288 ITERATE {call.type$}
1289
1290 FUNCTION {end.bib}
1291 { newline$
1292 "\end{thebibliography}" write$ newline$
1293 }
1294
1295 EXECUTE {end.bib}