-
Notifications
You must be signed in to change notification settings - Fork 0
/
achicago.bst
3551 lines (3449 loc) · 107 KB
/
achicago.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
%^^A* legal notices
% \iffalse
%
% This program is part of the Frankenstein bundle for LaTeX.
%
% Copyright 1995-2001 Matt Swift <swift@alum.mit.edu>.
%
% This file contains both the code and documentation for the
% achicago BibTeX style. It will work ONLY if it is placed in a
% proper directory. Files called README, INSTALL, achicago.tex
% and achicago.ins should have also been distributed to you
% with this file. See them for more information on how to typeset
% the documentation with LaTeX and how to generate a version of this
% file that will work faster than this one.
%
% This program is free software; you may redistribute it and/or
% modify it under the conditions of the LaTeX Project Public
% License, either version 1.2 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.2 or later is
% part of all distributions of LaTeX version 1999/12/01 or later.
%
% This program is distributed in the hope that it will be useful,
% but without any warranty; without even the implied warranty of
% merchantability or fitness for a particular purpose. See the
% LaTeX Project Public License for more details.
%
% \fi
%
%^^A* checks
%
%^^A NOTE: The character table, with two %'s, will get written to all files.
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%% Digits \0\1\2\3\4\5\6\7\8\9
%% Exclamation \! Double quote \" Hash (number) \#
%% Dollar \$ Percent \% Ampersand \&
%% Acute accent \' Left paren \( Right paren \)
%% Asterisk \* Plus \+ Comma \,
%% Minus \- Point \. Solidus \/
%% Colon \: Semicolon \; Less than \<
%% Equals \= Greater than \> Question mark \?
%% Commercial at \@ Left bracket \[ Backslash \\
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
%
% \CheckSum{46}
%
%^^A** new macros
% \newlet \entry\WrapquotesIN
% \newcommand*\field [1] {{\textitswitch\WrapquotesIN{#1}}}
% \newlet \gvar\texttt ^^A global variable
% \newlet \evar\texttt ^^A entry variable
% \newcommand*\function [1] {\texttt{\bfseries #1}}
% \newcommand\stack [2] {\par{\ttfamily #1 $\mapsto$ #2}\par}
% \newcommand\defentrytype [3] {Required: #1\par Optional: #2\par#3}
% \newcommand*\builtin [1] {\code{#1}\$}
%
% \todo{explain conventions; put some in \package{compsci}}
%
%^^A** nocites
% \nocite{*} ^^A FIX remove for distribution
% \nocite {abrams:natural}
% \nocite {ackerley:beckett:augustine}
% \nocite {amiran:beckett:wandering}
% \nocite {bair:beckett:bio}
% \nocite {beckett:cspr}
% \nocite {beckett:godot}
% \nocite {beckett:letter:yellow}
% \nocite {beckett:notebook:krapp,beckett:notebook:godot,^^A
% beckett:notebook:endgame,beckett:notebook:happy}
% \nocite {beckett:yellow}
% \nocite {blake:job}
% \nocite {bloom:anxiety:1}
% \nocite {bloom:beckett:trilogyintro}
% \nocite {borges:ficciones}
% \nocite {brater:beckett:why}
% \nocite {bryden:beckett:god}
% \nocite {bryden:beckett:smiles}
% \nocite {buning:beckett:via}
% \nocite {burrows:beckett:interview}
% \nocite {calder:beckett:bair}
% \nocite {carey:beckett:introjoyce}
% \nocite {carey:beckett:pieta}
% \nocite {carroll:dante:purgatorio,dante:mandelbaum:purgatorio,%
% dante:ciardi:purgatorio,vernon:dante:purgatorio}
% \nocite {carroll:dante:purgatorio}
% \nocite {cassedy:group}
% \nocite {chambers-murray}
% \nocite {chicago:14}
% \nocite {coetzee:beckett:revisions,stevenson:beckett:lobster}
% \nocite {coetzee:beckett:revisions}
% \nocite {cohn:beckett:play}
% \nocite {common-prayer}
% \nocite {companion:mind,gleitman:psych}
% \nocite {companion:mind}
% \nocite {copleston:phil:cusa}
% \nocite {copleston:phil:pseudo}
% \nocite {cronin:beckett:modernist}
% \nocite {culik:beckett:math}
% \nocite {culik:beckett:watt}
% \nocite {dante:ciardi:paradiso}
% \nocite {dante:ciardi:purgatorio}
% \nocite {dante:mandelbaum:purgatorio}
% \nocite {dearlove:beckett:residual}
% \nocite {donne:paradoxes}
% \nocite {driver:beckett:madeleine}
% \nocite {ellis:beckett:surds}
% \nocite {ellmann:joyce}
% \nocite {empson:ambiguity}
% \nocite {euclid:elements:brit}
% \nocite {farrow:beckett:art}
% \nocite {federman:beckett:works}
% \nocite {fergusson:dante:purgatorio}
% \nocite {fletcher:beckett:art}
% \nocite {freud:btpp:norton}
% \nocite {frye:anatomy:bate}
% \nocite {gardner:circus:cyclic}
% \nocite {gascoigne:works:posies}
% \nocite {gates:beckett:goon}
% \nocite {gleitman:psych}
% \nocite {gontarski:beckett:undoing}
% \nocite {green:beckett:augustine}
% \nocite {green:beckett:niente}
% \nocite {greene:repentance}
% \nocite {harper:beckett:irish,zurbrugg:beckett:irish,^^A
% harrington:beckett:local,obrien:beckett:country}
% \nocite {harvey:beckett:poet}
% \nocite {heraclitus:kirk:cosmic}
% \nocite {hill:vaughan}
% \nocite {hobson:beckett:year}
% \nocite {hopkins:gardner}
% \nocite {iser:beckett:negativity}
% \nocite {israel:beckett:bair}
% \nocite {james:principles}
% \nocite {jewinski:beckett:epiphany}
% \nocite {jones:beckett:murphy}
% \nocite {joyce:kershner:portrait}
% \nocite {joyce:ulysses:gabler}
% \nocite {joyce:wake}
% \nocite {juliet:beckett:conversations}
% \nocite {jung:psych-lit}
% \nocite {jung:tav:3}
% \nocite {jung:tav}
% \nocite {kennedy:beckett:murphy}
% \nocite {kenner:beckett:study}
% \nocite {kenner:beckett:syntax}
% \nocite {knowlson:beckett:frescoes}
% \nocite {knowlson:beckett:life}
% \nocite {koffka:gestalt}
% \nocite {krance:beckett:physics}
% \nocite {kroll:beckett:bel}
% \nocite {lakoff:johnson,lakoff:women,johnson:body}
% \nocite {lees:beckett:music}
% \nocite {levy:beckett:conv}
% \nocite {lippman:beckett:noti}
% \nocite {lodge:beckett:ping}
% \nocite {marculescu:beckett:solipsism}
% \nocite {mchugh:wake}
% \nocite {mcmillan:beckett:allegory}
% \nocite {merwin:ladders}
% \nocite {milton:riverside:paralost}
% \nocite {miskinis:beckett:recurrrence}
% \nocite {montgomery:beckett:quantum}
% \nocite {mood:beckett:system}
% \nocite {murphy:beckett:criticism}
% \nocite {niven:numbers}
% \nocite {norton:english}
% \nocite {obrien:beckett:country}
% \nocite {obrien:dreamforward}
% \nocite {ohara:beckett:jung:jobs,ohara:beckett:freud:jobs}
% \nocite {ohara:beckett:valery}
% \nocite {opie:nursery}
% \nocite {ovid:loeb}
% \nocite {perkins:romantic}
% \nocite {pilling:beckett:companion}
% \nocite {posnock:beckett:valery}
% \nocite {princeton:poetics}
% \nocite {rabinovitz:beckett:aphorisms}
% \nocite {rabinovitz:beckett:development,rabinovitz:beckett:innovation}
% \nocite {rabinovitz:beckett:development}
% \nocite {rabinovitz:beckett:innovation}
% \nocite {rabinovitz:beckett:psych}
% \nocite {random,OED:2,heritage,webster:3}
% \nocite {random}
% \nocite {renaud:beckett:mag}
% \nocite {ricks:beckett:dying}
% \nocite {rudin:math:analysis}
% \nocite {sacks:wife}
% \nocite {scruton:beckett:descartes}
% \nocite {segre:beckett:ping}
% \nocite {sharp:folksongs}
% \nocite {shenker:beckett:moody}
% \nocite {shimony:newphys}
% \nocite {smith:beckett:aporia}
% \nocite {stern:beckett:inter}
% \nocite {stevenson:beckett:lobster}
% \nocite {swift:tub}
% \nocite {topsfield:beckett:humour}
% \nocite {unger:ayer:exist}
% \nocite {vernon:dante:purgatorio}
% \nocite {webster:3}
% \nocite {winston:beckett:footnote}
% \nocite {wolfson:religion:history}
% \nocite {wolosky:beckett:mysticism}
% \nocite {work:folksongs}
% \nocite {zeifman:beckett:religion}
% \nocite{acheson:beckett:murphy}
% \nocite{anspaugh:beckett:faith}
% \nocite{bair:beckett:bio}
% \nocite{beckett:pricks}
% \nocite{carey:beckett:joyce}
% \nocite{cohn:beckett:collection}
% \nocite{common-prayer}
% \nocite{connor:beckett:animals}
% \nocite{davies:beckett:ideal}
% \nocite{eliot:middlemarch:random}
% \nocite{farrow:beckett:art}
% \nocite{freud:btpp:norton}
% \nocite{harvey:beckett:poet}
% \nocite{joyce:dubliners}
% \nocite{juliet:beckett:conversations}
% \nocite{jung:tav}
% \nocite{kroll:beckett:bel}
% \nocite{linden:herbert}
% \nocite{mccarthy:beckett:essays}
% \nocite{mcmillan:beckett:allegory}
% \nocite{melville:dick:newberry}
% \nocite{murphy:beckett:criticism}
% \nocite{norton:modern}
% \nocite{obrien:beckett:country}
% \nocite{obrien:dreamforward}
% \nocite{pilling:beckett:before}
% \nocite{putnam:beckett:caravan}
% \nocite{rabinovitz:beckett:aphorisms}
% \nocite{rabinovitz:beckett:development}
% \nocite{rabinovitz:beckett:innovation}
% \nocite{random}
% \nocite{ricks:beckett:dying}
% \nocite{scruton:beckett:descartes}
% \nocite{stern:beckett:inter}
% \nocite{whitman:leaves:norton}
%
%^^A** abstract
% \begin{abstract}
% \manual bibliography style \BibTeX{} macros.
% \end{abstract}
% \tableofcontents
%
% \part{Discussion}
%
% \caveat{The dox are spotty for this bibstyle---sorry! This is a pretty
% stable style, however. I've included almost my entire test cases. If you're
% puzzled, you may compare \file{frankenstein.bib} with what you see in the
% References section at the end of this document. Or please write me.}
%
% Reference list ordering: alphabetical by author or whatever passes for author
% in the absence of one.
%
% \section{Pros and cons of this style}
%
% See a discussion in the documentation for the \package{achicago} package.
%
% \section{User documentation}
%
% \AddToCheckSum{-10} ^^A In this file we don't have the usual 5 version \defs
% \AddToCheckSum{-2} ^^A Subtract two more for the \initelyHavECitationS def
% \AddToCheckSum{-24} ^^A Sum of 17 and 7 in part-3.dtx
%
% No bibstyle is going to elgantly handle everything while using them in a way
% that's at all compatible with the majority of existing bibstyles out there.
% And it's not clear that such a bibstyle would be worth the effort to write
% and learn to use properly. The time would be better spent, I think, writing
% some macros to make inserting hand-done exceptions seamlessly into the
% bibliography, so that the whole process could remain clean and automatic.
%
% For the sceptical, and for your entertainment, an example. I wanted to a
% cite a certain paper by Freud in my dissertation. The cited paper has a
% title, date of first publication, and chapter number; I read this paper in a
% volume of Freud's papers with a title, volume editor, volume date, publisher,
% reprint date, and reprint publisher; this volume has a number in a series of
% publications (The International Psycho-Analytic Library) with a series
% editor; and also this volume has a volume number within a multivolume work
% with its own title (\book{Collected Papers}) and (supervising)
% translator. Readers honestly don't need all that information, but each one
% of those 15 pieces of information might be highly important for another
% citation, for which only two or three pieces of information were relevant or
% available. No one needs to write a bibstyle that handles it all, so at
% several places, the fields are assumed to be used for either one thing or
% another. For example, \field{series} \emph{either} contains the title of the
% inclusive multivolume work \emph{or} the series. When, as rarely happens, a
% volume is part of both at once, you have to give up one or the other.
%
% \caveat{This is a complex bibstyle and the number of potential cases is very
% high. Please check your output, and write me with cases that are not set
% according to \manual percepts. Please refer to \manual whenever
% possible.}
%
% \todo{star the new fields.}
%
% \newcommand\deffield [2] {#1\\}
% \DeleteShortVerb{\|}
% \begin{longtable}{|lp{3.5in}|}
%
% \larger\bfseries entry type & \larger\bfseries\hfil description\\\hline\endhead
% \hline\caption{Entry types.} \endfoot
%
% address & Address of publisher of \emph{cited} edition, whether a reprint or
% not. \\
% annotation & A complete paragraph or more. \\
% author & \\
% bookauthor & Book's author whenever \field{author} is referring to the author of a
% part of the book. Usually an \entry{inbook} or \entry{incollection} entry refers to a
% book with an editor but no author, but in the case of introductions etc.\ you
% have an author for each.\\
% booktitle & Book's title whenever \field{title} is referring to a part of the
% book. \\
% chapter & The \field{title} names the \field{chapter}th part of the book. One expects to
% have nonempty \field{booktitle}. See also \field{type}. \\
% edition & Edition information to be given after the book's title, which is
% \field{booktitle} if that is nonempty and \field{title} otherwise. Example:
% \code{2d~ed., 2~vols. in 1~book} \\
% editor & \\
% & NOTE all f* and o* fields are only going to apply
% to \entry{book}, \entry{incollection}, \entry{inbook} entries.
% FIX: check -- booklet? etc. \\
% faddress & Address of publisher of first-published edition. Not used unless
% \field{fyear} is nonempty. \\
% flanguage & Language of first-published edition. Not used unless
% \field{translator} or \field{fyear} is nonempty. \\
% fpublisher & Publisher of first-published edition. Not used unless \field{fyear}
% is nonempty. \\
% ftitle & Title of first-published edition (probably in \field{flanguage}). Not
% used unless \field{fyear} is nonempty. \\
% fyear & Publication date of first-published edition. \\
% howpublished & \\
% illustrator & For \entry{book} entries only. When the author or editor
% illustrates, use a construction like \code{{the editor} and others}. \\
% institution & For thesis entries only. FIX check \\
% journal & For \entry{article} entries only. \\
% key & often default with empty author, editor, organization \\
% month & For \entry{journal} entries, also season, e.g., Winter \\
% note & Begins its own block, so capitalize. Concluding puctuation is
% supplied automatically if not given in the field. \\
% number & For \entry{journal} entry, number of the journal (if no \field{volume}) or
% number within the volume. For \entry{book} entry, number of the book in the
% \field{series}. Makes sense only when \field{series} is a series rather than the title
% of a multivolume work. \\
% oaddress & For a reprint, address of ORIGINAL publisher. \\
% opublisher & For a reprint, publisher of ORIGINAL edition. A nonempty
% value implies the cited edition IS a reprint (and so must have \field{oyear}). \\
% organization & \\
% oyear & For a reprint, publication date of ORIGINAL edition A nonempty
% value implies the cited edition IS a reprint (and so OUGHT TO have
% \field{opublisher}). The value will almost always differ from \field{year}. \\
% pages & \\
% publisher & Publisher of the cited edition. \\
% school & \\
% series & Series to which \field{title} belongs, or title of a multivolume work
% where the volumes have their own titles given in \field{booktitle} or \field{title}. \\
% seriesedition & Edition information to be given after \field{series}. Makes
% sense only when \field{series} is the title of a multivolume work with titled
% volumes. In the entry for the multivolume work, that is, when \field{series}
% and \field{title} are identical, use \field{seriesedition} not
% \field{edition}. See also \field{edition}. Consequence of disobeying last is
% when references are less than min-crossrefs (i.e., no separate entry for the
% multivolume work) you get the edition information for the multivolume work
% appearing after the title of the component volume. Note: you can't really
% get away with putting a series editor here. I think you'd have to use the
% \field{note} field for that; or we could make yet another field. \\
% title & \\
% translator & For \entry{book} entries only, the translator(s). See also
% \field{flanguage}. When the author or editor translates, use a construction like
% \code{{the editor} and others}. \\
% type & For \entry{inbook} entries, the value overrides \code{Chapter}. When
% \field{type} is empty you get \code{Chapter~<chapter> of}. FIX: CHECK: For *-thesis
% entries, gives thesis-type word, e.g. \code{Master's Thesis}. \\
% volume & For \entry{journal} entry, it's volume. For \entry{book} entry, its number in
% the \field{series}, or its volume number in a multivolume book. \\
% year & Year of publication of cited edition, whether a reprint or not. \\
% yearcomp & Year work composed. For \entry{book} entry only (so far).\\
% \end{longtable}
% \MakeShortVerb{\|}
%
% \StopEventually{}
%
% \part{Implementation}
%
% \section{Version control}
%
%
% ^^A NOTE: We have to compensate for the above backslashes, which are not
% ^^A actually in the .dtx file the author works on, by adding to the
% ^^A CheckSum.
%%
% \AddToCheckSum{17}^^A `dtx-update-checksum' automatically handles this.
% \AddToCheckSum{7}^^A The half a macrocode env. at the top is missed, however...
% \AddToCheckSum{10}^^A ... and so are the 5 \defs from the .dtx file
% ^^A that precede it.
% \IfCitations {%
% \AddToCheckSum{2}^^A When \initelyHavECitationS is defined in
% } ^^A the .dtx file, we need 2 more in the CheckSum.
%
% Version information:
% \begin{macrocode}^^A Keep the /^ %% \def\file.../ beginning exact!
%% A BibTeX bibliography style
%% conforming to the Chicago Manual's A style
%% but with B style author-date citations
%% by Matt Swift <swift@alum.mit.edu>
%%
%% \def\fileinfo{A Chicago Manual BibTeX style}
%% \def\DoXPackageS {longtable}
%% \def\initelyHavECitationS {}
%% \def\fileversion{v1}
%% \def\filedate{2001/08/31}
%% \def\docdate{2001/08/31}
%%
% \end{macrocode}
%
% \section{Implementation}
% \subsection{Define fields and variables}
%
% \subsubsection{Global variables}
%
% \gvar{output.state} will have one of the four scalar values
% \gvar{before.all}, \gvar{mid.sentence}, \gvar{after.sentence}, and
% \gvar{after.block}, telling us where we are in producing the entry.
%
% \bst{Achicago} uses only \term{blocks}, not \term{sentences}, to delimit
% units in the bibentry (some other bibstyles use both). The
% \package{achicago} package defines \cs\newblock to add a very small and
% rubber amount of horizontal space, relaxing somewhat the \cs\frenchspacing in
% effect. I have not removed the programming structures that distinguish
% sentences and blocks, but I have not concerned myself with them either;
% anyone wishing to revise this style to begin using them should check their
% work carefully.
% \begin{macrocode}
INTEGERS { output.state before.all mid.sentence after.sentence after.block }
% \end{macrocode}
%
% The entry variable \evar{principal-type} will have one of the five scalar
% values \gvar{author.ptype}, \gvar{editor.ptype}, \gvar{organization.ptype},
% \gvar{key.ptype}, and \gvar{emergency.ptype}, telling us what type of
% information is in the principal field. See also the discussion of
% \function{key.special.p}.
% \begin{macrocode}
INTEGERS { author.ptype editor.ptype organization.ptype key.ptype
emergency.ptype }
% \end{macrocode}
%
% These are used during the forward and reverse passes to hold information
% about the previously-processed record.
% \begin{macrocode}
INTEGERS { last.year.tag.num }
STRINGS { last.leaditem last.label.and.year following.year.label.tag }
% \end{macrocode}
%
% These variables are used locally within various functions or function groups,
% where their particular use is documented.
%
% \todo{document which if any are used in a nonlocal way}
%
% \caveat{Suspect a conflict among these scratch variables if a strange problem
% occurs! I think \gvar{u} is the only one that will hold its value past an
% \function{output}.}
% \begin{macrocode}
INTEGERS { j nameptr namesleft numnames len }
STRINGS { s t u v w }
% \end{macrocode}
%
% \subsubsection{Bibfields}
% The list of fields that will be examined in database records, if they exist.
% Fields in the \ext{bib} database not on this list will be ignored. Not every
% entry type makes use of every field. Each entry type function below lists
% its required, optional, and ignored fields. Expected use of these fields is
% documented above in the user documentation.
% \begin{macrocode}
ENTRY
{ address
annotation
author
bookauthor
booktitle
chapter
edition
editor
faddress
flanguage
fpublisher
ftitle
fyear
howpublished
illustrator
institution
journal
key
month
note
number
oaddress
opublisher
organization
oyear
pages
publisher
school
series
seriesedition
title
translator
type
volume
year
yearcomp
}
% \end{macrocode}
%
% Entry variables have a per-record value but are not initialized from a field.
%
% The integer \evar{principal-type} will contain one of the scalars
% \gvar{author.ptype}, \gvar{editor.ptype}, etc.\ (see their declarations above
% for further information). \evar{principal-type} is set in the function
% \function{set.principal-field.principal-type}.
% \begin{macrocode}
{ principal-type }
% \end{macrocode}
%
% The strings \evar{label}, \evar{year.label} and \evar{year.label.tag} are
% used to construct the citation (the running text at the location of the
% user's \cs\cite command). In most cases, \evar{label} will contain a string
% derived from the \evar{principal-field} (see \function{make.label}).
% \begin{macrocode}
{ label
% \end{macrocode}
%
% \evar{year.label} will contain a string representing the date. It's not
% necessarily the same as \field{year} (see \function{make.year.label}).
% \evar{year.label.tag} will either be empty or be a lower-case letter, as
% determined in the forward and reverse passes.
% \begin{macrocode}
year.label year.label.tag
% \end{macrocode}
%
% \evar{principal-field} will contain one of the fields, depending on entry
% type and what fields are nonempty (see
% \function{set.principal-field.principal-type}).
%
% In most cases, \evar{leaditem} will contain the \evar{principal-field}
% properly formatted for apearance at the beginning of the bibliography entry
% (see \function{make.leaditem}). When it is identical to the previous entry's
% \evar{leaditem}, it will be wrapped in \cs\SCduplicate by the forward and
% reverse passes.
% \begin{macrocode}
principal-field
leaditem
}
% \end{macrocode}
%
% \subsection{Define macros}
%
% These are macro abbreviations required by convention in every bibstyle. The
% user can redefine them with \texttt{@STRING} declarations in the \ext{bib}
% database.
% \begin{macrocode}
MACRO {jan} {"January"}
MACRO {feb} {"February"}
MACRO {mar} {"March"}
MACRO {apr} {"April"}
MACRO {may} {"May"}
MACRO {jun} {"June"}
MACRO {jul} {"July"}
MACRO {aug} {"August"}
MACRO {sep} {"September"}
MACRO {oct} {"October"}
MACRO {nov} {"November"}
MACRO {dec} {"December"}
% \end{macrocode}
%
% \subsection{Debugging functions}
%
% \begin{macro}{debugval}
% \begin{macro}{debugmsg}
% \mbox{}
% \begin{macrocode}
FUNCTION {debugval}
{ ": [" *
swap$ * %$
"] in " * cite$ * %$
top$ %$
}
FUNCTION {debugmsg}
{ " in " * cite$ * top$
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \subsection{Initialization functions}
%
% \begin{macro}{init.scalars}
% This should be called before any processing begins.
% \begin{macrocode}
FUNCTION {init.scalars}
{ #0 'before.all :=
#1 'mid.sentence :=
#2 'after.sentence :=
#3 'after.block :=
#0 'author.ptype :=
#1 'editor.ptype :=
#2 'organization.ptype :=
#3 'key.ptype :=
#4 'emergency.ptype :=
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Boolean logic}
%
% \begin{macro}{not}
% \begin{macro}{and}
% \begin{macro}{or}
% \mbox{}
% \begin{macrocode}
FUNCTION {not}
{ { #0
}
{ #1
}
if$ %$
}
FUNCTION {and}
{ 'skip$ %$
{ pop$ %$
#0
}
if$ %$
}
FUNCTION {or}
{ { pop$ %$
#1
}
'skip$ %$
if$ %$
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Constant functions}
%
% \begin{macro}{comma}
% \begin{macro}{period}
% \begin{macro}{hyphen}
% \begin{macro}{colon}
% \begin{macro}{space}
% \begin{macro}{delimiter.name-part}
% \begin{macro}{delimiter.name}
% \begin{macro}{delimiter.sub-sortkey}
% \begin{macro}{tie}
% \begin{macro}{etal}
% \begin{macro}{unidentified}
% These definitions are made so that later functions are easier to read and so
% that adapting this bibstyle to another language will be simpler.
%
% The reason these are functions not macros is so the user cannot change them.
% \begin{macrocode}
FUNCTION {comma}
{ ","
}
FUNCTION {period}
{ "."
}
FUNCTION {hyphen}
{ "-"
}
FUNCTION {colon}
{ ":"
}
FUNCTION {space}
{ " "
}
FUNCTION {delimiter.name-part}
{ " "
}
FUNCTION {delimiter.name}
{ " "
}
FUNCTION {delimiter.sub-sortkey}
{ " "
}
FUNCTION {tie}
{ "~"
}
FUNCTION {etal}
{ " et~al."
}
% \end{macrocode}
% Below, we need to be able to set a string to a value which would never be
% generated from any string in a bibliography database. It's safe to assume
% that this string is such a one.
% \begin{macrocode}
FUNCTION {unidentified}
{ "HiGHlY*Peco@lIEr"
}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Output functions}
%
% The \function{output} function automatically handles interunit punctuation.
%
% \function{output} should be called with a string and a punctuation mark on
% the stack. The punctuation mark is what should \emph{precede} the string in
% the case the string begins in the middle of a sentence. Strings which begin
% sentences are preceded by periods. Strings which begin a new block are
% preceded by periods and the \cs\newblock command. (It makes no sense for a
% string to begin at the end of a sentence.)
%
% Calls to \function{output.internal} leave the string on the stack until the
% next time \function{output.internal} is called, when it will get written.
% The function \function{output.begin} puts an empty string on the stack, and
% should be called before beginning any series of calls to \function{output}.
% \function{output.end} cleans up and should be called at the conclusion of a
% series of calls to \function{output}.
%
% \begin{macro}{output.begin}
% Prepare for a series of calls to \function{output}. Put an empty string on the
% stack and set \gvar{output.state} to \gvar{before.all}.
% \begin{macrocode}
FUNCTION{output.begin}
{ ""
before.all 'output.state :=
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{output.end}
% Conclude a series of calls to \function{output}. Simply calls \builtin{write}.
% \begin{macrocode}
FUNCTION {output.end}
{ write$ %$
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{new.block}
% Begin a new block.
% \begin{macrocode}
FUNCTION {new.block}
{ output.state before.all =
'skip$ %$
{ after.block 'output.state :=
}
if$ %$
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{new.sentence}
% Begin a new sentence. FIX: hmm, wouldn't we want to put a TeX command here
% for intersentence space now? Why do we mess with the usual spacefactor for
% periods anyway? When in bibliogrphies are the usual TeX rules not going to
% be what we want, and give too much space after a period? answer: when a
% lowercase letter followed by period, in e.g. sec. 2 and so on. often
% bibstyle will put tie there, but sometimes not I think, so need to have that
% be not an intersentence space. well, if i start using sentences instead of
% blocks, I think perhaps doing the same hskip after a sentence with a new
% command \cs\newsentence perhaps as in \cs\newblock would be the right thing
% to do.
% \begin{macrocode}
FUNCTION {new.sentence}
{ output.state before.all = output.state after.block = or
'skip$ %$
{ after.sentence 'output.state :=
}
if$ %$
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{output.internal}
% \cs\stack{punct string/entry(nonnull)}{null}
% \begin{macrocode}
FUNCTION {output.internal}
{ 's := % s := string/entry(nonnull)
space * 't := % t := punctuation + space
output.state mid.sentence =
{ t * write$ %$
}
{ output.state after.block =
{ add.period$ write$
newline$ %$
"\newblock " write$ %$
}
{ output.state before.all =
'write$ %$
% \end{macrocode}
% Final case is \gvar{output.state} = `after.sentence', which means we just add a
% period, but no newline or \cs\newblock command.
% \begin{macrocode}
{ add.period$ space * write$
}
if$ %$
}
if$ %$
% \end{macrocode}
% We are now mid-sentence, whether we were before or not.
% \begin{macrocode}
mid.sentence 'output.state :=
}
if$ %$
% \end{macrocode}
% The actual string given to `output.internal' is left on the stack here for
% next time we call `output.internal' or `output.end', whichever comes next.
% \begin{macrocode}
s
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{output}
% \cs\stack{string/entry punct}{either null OR punct string/entry(nonnull)}
%
% Check if string/entry is null. If it's null do nothing. If it's nonempty
% call \function{output.internal} on it with the given punctuation.
% \begin{macrocode}
FUNCTION {output}
{ swap$ duplicate$ empty$
{ pop$
pop$ %$
}
'output.internal
if$ %$
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{output.bibitem}
% The optional argument to \cs\bibitem will be made the definition of
% \cname{b@foo} where |foo| is the \builtin{cite} key. \cname{b@foo} will be
% executed by all the various citing commands with a definition of \cs\SCcite
% that is appropriate to each citing command.
%
% The \env{thebibliography} environment actually ignores the optional argument
% to \cs\bibitem. The environment sets the formatting so that the first part
% of the main entry hangs out to the left and looks like a label.
%
% The unexpandable protection is necessary, instead of a simple protection, in
% order to work with \package{newclude}'s \option{tag} option.
%
% I guess we use \builtin{write} for each part instead of catenating them and using a
% single \builtin{write} in case the catenation gets longer than \BibTeX{} can
% handle. I don't know, this is how I found it. It seems like catenation and
% a single call to \builtin{write} would be faster. FIX.
% \begin{macrocode}
FUNCTION {output.bibitem}
{ newline$ %$
"\bibitem[\UnexpandableProtect\SCcite{" write$ %$
label write$ %$
"}{" write$ %$
year.label year.label.tag * write$ %$
"}]{" write$ %$
cite$ write$
"}" write$ %$
newline$ %$
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Simple auxiliary functions}
%
% \begin{macro}{field.or.null}
% \cs\stack{field literal}{field contents or null string if the field was
% missing}
% \begin{macrocode}
FUNCTION {field.or.null}
{ duplicate$ empty$
{ pop$ %$
""
}
'skip$ %$
if$ %$
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{italicize}
% \cs\stack{string or entry}{string}
%
% Italicize the top string on the stack and provide italic corrections. Null
% goes to null. We want to explicitly italicize rather than use \cs\emph,
% since semantic emphasis might be indicated in some other way in the document,
% e.g., slanted type.
% \begin{macrocode}
FUNCTION {italicize}
{ duplicate$ empty$
{ pop$ %$
""
}
{ "\textitswitch{" swap$ * "}" * %$
}
if$ %$
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{parenthesize}
% \cs\stack{string-or-entry:S}{"(" + S + ")"}
% \begin{macrocode}
FUNCTION {parenthesize}
{ duplicate$ empty$
{ pop$ %$
""
}
{ "(" swap$ * ")" * %$
}
if$ %$
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{format.clip}
% \cs\stack{string}{string} FIX: the difference between \builtin{entry.max} and
% \builtin{global.max}: max for an entry string, max for a global string.
%
% \begin{macro}{format.clip}
% \cs\stack{string-S}{string-S-possibly-shortened}
%
% Clips a string down to the smaller of \builtin{entry.max} and \builtin{global.max}.
% \begin{macrocode}
FUNCTION {format.clip}
{ #1 entry.max$ substring$
#1 global.max$ substring$
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{format.sortify.clip}