-
Notifications
You must be signed in to change notification settings - Fork 3
/
apacann.bst
5259 lines (4903 loc) · 144 KB
/
apacann.bst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%%
%% This is file `apacann.bst',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% apacite.dtx (with options: `bibstyle,annotated')
%%
%% This is a generated file.
%%
%% Copyright (C) 1994-2009 Erik Meijer and any individual authors listed
%% elsewhere in this file.
%%
%% This file is part of the `apacite' package.
%% -------------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%%
%% The `apacite' package consists of the files apacite.dtx and
%% apacite.ins, and the following generated files:
%% apacite.sty, apacite.bst, apacitex.bst, apa5ex.bib,
%% apacite.drv, apacdoc.sty, apacann.bst, apacannx.bst,
%% english.apc, dutch.apc, finnish.apc, french.apc, german.apc,
%% ngerman.apc, greek.apc, norsk.apc, spanish.apc, swedish.apc.
%%
%% This work has the LPPL maintenance status `maintained'
%%
%% The Current Maintainer of this work is Erik Meijer
%%
%% This file may only be distributed together with a copy of the
%% source files of the apacite package, i.e., apacite.dtx and
%% apacite.ins. You may however distribute the apacite package without
%% the generated files.
%%
%% apacann.bst
%% [2009/03/01 v4.05 APA annotated bibliography style]
%% apacann.bst : reference list according to APA manual
%% with annotations
%% Written by Erik Meijer
FUNCTION {identify.apacite.version}
{ % Put identifying string in the .blg file
"apacann.bst"
" [2009/03/01 v4.05 APA annotated bibliography style]"
* top$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ENTRY
{ address
annote % only used for annotated version
annotate % only used for annotated version
author
booktitle % for articles in books
chair % for lectures
chapter % for incollection, esp. internet documents
day
edition
editor
englishtitle % english translation of title in other language
firstkey % key for first citation
howpublished
institution % for technical reports
journal
key % key for second and later citations, or all
% citations if firstkey is missing
lastchecked % for URL's
month
note
number % number of journal or report
organization % for unpublished
%
% for reprints, translations, etc.
%
originaladdress
originalbooktitle
originaledition
originaleditor
originaljournal
originalnumber
originalpages
originalpublisher
originalvolume
originalyear
%
% back to normal
%
pages
publisher
school % for theses
series % not used
symposium % for lectures
text % for literals
title
translator % translator of book (or article)
type % type of phdthesis (e.g., Doctoral dissertation)
% or type of article (e.g., Letter to the editor)
% etc.
url
volume
year
}
{ title.number % for sorting titles
cite.initials % dummy (0-1) indicating whether or not
% initials of the 1st author must
% be used for citing
cite.num.names.full % number of names to be cited for full and
cite.num.names.short % short cite
add.to.year % For a, b, c, etc. after year
% in multiple citations with same author-year
}
{ year.label % For sorting entries by year
author.year.sort.label % For sorting entries and checking whether
% initials should be added, how many authors
% should be cited and whether a, b, etc.
% after year is necessary
title.sort.label % for sorting titles
type.2 % Replacement for type with misc entries and
% entries that revert to misc.
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INTEGERS { len pos name.max old.number numnames numnames.old
nameptr lastname format.num.names cite.initials.old
cite.num.names.old add.to.year.old forward
multiresult dot brace.level
}
STRINGS { s t u old.label field
aut1f aut1s aut1f.old aut1s.old
aut2 aut2.old
aut3 aut3.old
aut4 aut4.old
aut5 aut5.old
aut6 aut6.old
year.label.old
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {test} { #0 }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {make.index} { #0 }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MACRO {jan} {"{\APACmonth{01}}"}
MACRO {feb} {"{\APACmonth{02}}"}
MACRO {mar} {"{\APACmonth{03}}"}
MACRO {apr} {"{\APACmonth{04}}"}
MACRO {may} {"{\APACmonth{05}}"}
MACRO {jun} {"{\APACmonth{06}}"}
MACRO {jul} {"{\APACmonth{07}}"}
MACRO {aug} {"{\APACmonth{08}}"}
MACRO {sep} {"{\APACmonth{09}}"}
MACRO {oct} {"{\APACmonth{10}}"}
MACRO {nov} {"{\APACmonth{11}}"}
MACRO {dec} {"{\APACmonth{12}}"}
MACRO {winter} {"{\APACmonth{13}}"}
MACRO {spring} {"{\APACmonth{14}}"}
MACRO {summer} {"{\APACmonth{15}}"}
MACRO {fall} {"{\APACmonth{16}}"}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {not}
{ { #0 }
{ #1 }
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {and}
{ 'skip$
{ pop$ #0 }
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {or}
{ { pop$ #1 }
'skip$
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% issues warning if field is empty
% call with
% "field" field warning.if.empty
% Note that the first field must be between quotes
% because it is the fieldname for use in the warning message.
%
FUNCTION {warning.if.empty}
{ empty$
{ "No " swap$ * " in " * cite$ * warning$ }
{ pop$ }
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% issues warning if title, type, and howpublished are empty
%
FUNCTION {check.relevant.fields}
{ title empty$
type empty$ and
howpublished empty$ and
{ "No title, type, and howpublished in " cite$ * warning$ }
'skip$
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% delivers 1 if (both editor and translator
% not empty and not equal to each other)
% 0 if (editor or translator empty) or
% (editor = translator)
%
FUNCTION {editor.ne.trans}
{ translator empty$
{ #0 }
{ editor empty$
{ #0 }
{ translator editor =
{ #0 }
{ #1 }
if$
}
if$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {conv.int.to.str}
{ duplicate$ #10 <
{ "0000" swap$ int.to.str$ * }
{ duplicate$ #100 <
{ "000" swap$ int.to.str$ * }
{ duplicate$ #1000 <
{ "00" swap$ int.to.str$ * }
{ duplicate$ #10000 <
{ "0" swap$ int.to.str$ * }
{ int.to.str$ }
if$
}
if$
}
if$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {ref.type}
{ type$ "article" =
type$ "magazine" =
type$ "newspaper" =
type$ "book" =
type$ "techreport" =
type$ "unpublished" =
type$ "misc" =
type$ "booklet" =
type$ "manual" =
type$ "proceedings" =
or
or
or
or
or
or
or
or
or
{ #1 }
{ type$ "incollection" =
type$ "phdthesis" =
type$ "mastersthesis" =
type$ "lecture" =
type$ "inbook" =
type$ "inproceedings" =
type$ "conference" =
type$ "intechreport" =
or
or
or
or
or
or
or
{ #2 }
{ type$ "literal" =
{ #3 }
{ #0 }
if$
}
if$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {is.atype}
{ type$ "article" =
type$ "magazine" =
type$ "newspaper" =
type$ "incollection" =
type$ "inbook" =
type$ "inproceedings" =
type$ "conference" =
type$ "intechreport" =
type$ "manual" =
or
or
or
or
or
or
or
or
{ #1 }
{ journal empty$ not
%
type$ "phdthesis" =
type$ "mastersthesis" =
or
%
and
{ #1 }
{ type$ "misc" =
type empty$ not and
{ type "\bibmessage" =
type "\bibcomputerprogram" =
type "\bibcomputerprogrammanual" =
type "\bibcomputerprogramandmanual" =
type "\bibcomputersoftware" =
type "\bibcomputersoftwaremanual" =
type "\bibcomputersoftwareandmanual" =
type "\bibprogramminglanguage" =
or
or
or
or
or
or
or
{ #1 }
{ #0 }
if$
}
{ #0 }
if$
}
if$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% connects two strings with connect string
% if one of them empty, then connect string
% is left out
%
% call with S1 S2 connectstring connect.check
%
FUNCTION {connect.check}
{ 'u :=
%
% if S2 = ""
%
duplicate$ empty$
%
% then remove S2
%
{ pop$
%
% S1 is on top of stack.
% if it is empty, it is replaced by the empty string ""
%
duplicate$ empty$
{ pop$ "" }
'skip$
if$
}
%
% else swap S1 and S2 so that S1 can be checked
%
{ swap$
%
% if S1 is empty, remove S1 so that S2 is left on the
% stack and is the result is given
%
duplicate$ empty$
{ pop$ }
%
% now the real work starts:
% push the connect string "C"
% so that top of stack is "C" "S1" "S2"
% concatenate, so that top of stack is
% "S1+C" "S2"
%
{ u *
%
% swap and concatenate
%
swap$ *
}
if$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% connects two strings with space ("\ ")
% if length of second is 4 or larger,
% connects them with non-breaking space ("tie", "~")
% if length of second smaller than 4
%
% call with S1 S2 tie.or.space.connect
% result: "S1\ S2" or "S1~S2"
%
FUNCTION {tie.or.space.connect}
{ duplicate$ text.length$ #4 <
{ "~" }
{ "\ " }
if$
swap$ * *
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% connects two strings with comma (", ")
% if one of them is empty, the comma is left out
%
% call with S1 S2 connect.with.comma.check
% result: "S1, S2"
%
FUNCTION {connect.with.comma.check}
{ ", " connect.check }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% connects two strings with semicolon ("; ")
% if one of them is empty, semicolon is left out
%
% call with S1 S2 connect.with.semicolon.check
% result: "S1; S2"
%
FUNCTION {connect.with.semicolon.check}
{ "; " connect.check }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% connects two strings with colon (": ")
% if one of them is empty, colon is left out
%
% call with S1 S2 connect.with.colon.check
% result: "S1: S2"
%
FUNCTION {connect.with.colon.check}
{ ": " connect.check }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% connects two strings with space ("\ ")
%
% call with S1 S2 connect.with.space.check
% result: "S1\ S2"
%
FUNCTION {connect.with.space.check}
{ "\ " connect.check }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% encloses string in pre- and postfix string
% call with
% prefix postfix S enclose.check
% delivers empty string if S empty
%
FUNCTION {enclose.check}
{ duplicate$ empty$
{ pop$ pop$ pop$
""
}
{ swap$ * * }
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% emphasizes top of stack
% call with
% "string" emphasize.check
%
FUNCTION {emphasize.check}
{ "\Bem{" swap$
"}" swap$
enclose.check
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% brackets top of stack
% call with
% "string" bracket
%
FUNCTION {bracket.check}
{ "[" swap$
"]" swap$
enclose.check
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% parenthesizes top of stack
% call with
% "string" parenthesize
%
FUNCTION {parenthesize.check}
{ "(" swap$
")" swap$
enclose.check
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% checks whether argument is "multiresult":
% whether it contains '-', '+', or ',' characters
% used with pages to check whether pp. or p. must be used
%
FUNCTION {multi.result.check}
{ 't :=
#0 'multiresult :=
%
% while (not multiresult) and (length(t) > 1) do
%
{ multiresult not
t text.length$ #1 >
and
}
%
% if t(1-2) = "--" or t(1) = "+" or ","
% then multiresult = 1
% else t = t(2-last)
%
{ t #1 #2 substring$ 's :=
"--" s =
{ #1 'multiresult := }
{ t #1 #1 substring$ 's :=
"+" s =
"," s =
or
{ #1 'multiresult := }
{ t #2 global.max$ substring$ 't := }
if$
}
if$
}
while$
multiresult
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Checks whether an author is a corporate author, i.e.,
% whether the field starts with "{\bibcorporate".
% Call with
% field is.bibcorporate
%
FUNCTION {is.bibcorporate}
{ #1 #14 substring$ "{\bibcorporate" = }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {sortify}
{ purify$
"l" change.case$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {remove.spaces}
{ % Remove spaces from string.
% Works best if string only contains alphanumeric characters and spaces.
's := % The original string
s text.length$ 'len := % Its length (no. of characters)
"" 't := % Initialize the transformed string
#0 'pos :=
%
% while (pos < len) do
%
{ pos len < }
{ pos #1 + 'pos :=
s pos #1 substring$ 'u :=
%
% u is the pos-th character in s
% If it is a space, move to next character,
% else copy character to output.
%
u " " =
'skip$
{ t u * 't := }
if$
}
while$
%
% Now push the result back on the stack
t
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% starting new block by writing what's left on the stack,
% starting a new line and adding some extra space or
% whatever is more defined in \newblock
%
FUNCTION {output.end.block}
{ write$
newline$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% starting new block by writing what's left on the stack,
% starting a new line and adding some extra space or
% whatever is more defined in \newblock
%
FUNCTION {output.new.block}
{ output.end.block
"\newblock" write$
newline$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% starting new block by writing what's left on the stack,
% starting a new line and adding some extra space or
% whatever is more defined in \newblock
%
FUNCTION {output.dot.new.block}
{ add.period$
output.new.block
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {start.new.block}
{ newline$
"\unskip\ " write$ newline$
"\newblock " write$ newline$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% finish current entry
% by writing what's left on the stack and starting a new line
%
FUNCTION {fin.entry}
{ output.end.block
"\PrintBackRefs{\CurrentBib}" write$ newline$
test
{ "\vspace{\baselineskip}" write$ newline$ }
'skip$
if$
%
% According to TLC2, pp. 810-811, both annote and annotate fields are
% known, so support them both, but do not print them both, in case
% someone wants to make a file that is compatible with both the annotate
% and annotation styles and thus duplicates the information. Instead, we
% give annote priority.
%
annote empty$
{% Try annotate
annotate empty$
'skip$
{ % add annotation
"\begin{APACrefannotation}" write$ newline$
annotate write$ newline$
"\end{APACrefannotation}" write$ newline$
}
if$
}
{ % add annotation
"\begin{APACrefannotation}" write$ newline$
annote write$ newline$
"\end{APACrefannotation}" write$ newline$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {sort.name.format} { "{ll{}}{ f{}}{ vv{}}{ jj{}}" }
FUNCTION {cite.name.format} { "{ll}" }
FUNCTION {cite.initials.name.format} { "{f{\BPBI }.~~}{vv }{ll}{ jj}" }
FUNCTION {author.name.format} { "{ll}{, f{\BPBI }.}{ vv}{, jj}" }
FUNCTION {editor.name.format} { "{f{\BPBI }.~~}{vv }{ll}{ jj}" }
FUNCTION {index.name.format} { "{ll}{, f{\BPBI }.}{ vv}{, jj}" }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {init.initials}
{ "yyyyy" 'aut1f.old :=
"yyyyy" 'aut1s.old :=
#0 'cite.initials.old :=
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {update.no.initials}
{ 'field :=
field 'aut1f.old :=
field 'aut1s.old :=
#0 'cite.initials.old :=
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {check.add.initials.aut}
{ %
% If last name is equal to previous last name
% but initials are different, then initials should
% be cited. If initials are also the same, initials
% should be cited if that is the case for the previous
% author .
%
aut1s aut1s.old =
{ aut1f aut1f.old =
{ cite.initials.old 'cite.initials := }
{ #1 'cite.initials :=
aut1f 'aut1f.old :=
aut1s 'aut1s.old :=
cite.initials 'cite.initials.old :=
}
if$
}
{ %
% Different last name.
aut1f 'aut1f.old :=
aut1s 'aut1s.old :=
cite.initials 'cite.initials.old :=
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {check.add.initials.field}
{ 'field :=
field #1 cite.initials.name.format format.name$ 'aut1f :=
field #1 cite.name.format format.name$ 'aut1s :=
%
% Now do the actual work
%
check.add.initials.aut
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {check.add.initials}
{ %
% Check whether author or editor or other field acts as author.
% Initials are only relevant with author or editor.
%
firstkey empty$ not
{ key empty$ not
{ %
% Both key and firstkey are nonempty.
% Then, key is treated as last name of first author,
% and firstkey is treated as last name + initials of
% first author .
%
firstkey sortify remove.spaces 'aut1f :=
key sortify remove.spaces 'aut1s :=
check.add.initials.aut
}
{ firstkey sortify remove.spaces update.no.initials }
if$
}
{ key empty$ not
{ key sortify remove.spaces update.no.initials }
{ %
% No key or firstkey, so find out which field
% to use as author.
%
% Check reference type:
% if result is 1 then possibly editor acts as author
% 2 then editor does not act as author
% 3 then key should have been used
% 0 then unknown reference type
ref.type #2 =
{ %
% Format first author with and without initials
author empty$
{ title.sort.label update.no.initials }
{ author check.add.initials.field }
if$
}
{ %
% Format first author with and without initials
author empty$
{ editor empty$
{ title.sort.label update.no.initials }
{ editor check.add.initials.field }
if$
}
{ author check.add.initials.field }
if$
}
if$
}
if$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {tentative.cite.num.names.field}
{ 'field :=
field num.names$ 'numnames :=
numnames #3 <
{ %
% 1 or 2 names: always cite all of them.
numnames 'cite.num.names.full :=
numnames 'cite.num.names.short :=
}
{ numnames #6 <
{ %
% 3-5 names: cite all of them the first time,
% only the first name later times
numnames 'cite.num.names.full :=
#1 'cite.num.names.short :=
}
{ %
% 6 or more names: cite only the first name
#1 'cite.num.names.full :=
#1 'cite.num.names.short :=
}
if$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {tentative.cite.num.names}
{ %
% Check whether author or editor or other field acts as author.
% Number of names is only relevant with author or editor.
%
firstkey empty$ not
{
#1 'cite.num.names.full :=
#1 'cite.num.names.short :=
}
{ key empty$ not
{
#1 'cite.num.names.full :=
#1 'cite.num.names.short :=
}
{ %
% No key or firstkey, so find out which field
% to use as author.
%
% Check reference type:
% if result is 1 then possibly editor acts as author
% 2 then editor does not act as author
% 3 then key should have been used
% 0 then unknown reference type
ref.type #2 =
{ %
% Format first author with and without initials
author empty$
{
#1 'cite.num.names.full :=
#1 'cite.num.names.short :=
}
{ author tentative.cite.num.names.field }
if$
}
{ %
% Format first author with and without initials
author empty$
{ editor empty$
{
#1 'cite.num.names.full :=
#1 'cite.num.names.short :=
}
{ editor tentative.cite.num.names.field }
if$
}
{ author tentative.cite.num.names.field }
if$
}
if$
}
if$
}
if$
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {init.cite.num.names}
{ #0 'cite.num.names.old :=
#0 'numnames.old :=
"yyyy" 'year.label.old :=
#0 'add.to.year.old :=
"" 'aut1f.old :=
"" 'aut2.old :=
"" 'aut3.old :=
"" 'aut4.old :=
"" 'aut5.old :=
"" 'aut6.old :=
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {update.cite.num.names}
{ cite.num.names.short 'cite.num.names.old :=
numnames 'numnames.old :=
year.label 'year.label.old :=
add.to.year 'add.to.year.old :=
aut1f 'aut1f.old :=
aut2 'aut2.old :=
aut3 'aut3.old :=
aut4 'aut4.old :=
aut5 'aut5.old :=
aut6 'aut6.old :=
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FUNCTION {format.6.authors}
{ %
% First author: with initials.
%
field #1 cite.initials.name.format format.name$ 'aut1f :=
%
% Second and later authors: without initials.
%
numnames #1 >