Debian Codegraph @

texmf-dist/bibtex/bst/econ-bst/econ-aea.bst

raw
1 %% econ-aea.bst: BibTeX style file for journals of American Economic Association (AEA).
2 %
3 % Author: Shiro Takeda
4 % Maintainer: Shiro Takeda
5 % Copyright (C) 2001-2025 Shiro Takeda
6 % First-written: <2007/07/28>
7 % Version: 3.3
8 % Keywords: TeX, BibTeX, bst
9 % URL: https://github.com/ShiroTakeda/econ-bst
10
11 % It may be distributed and/or modified under the
12 % conditions of the LaTeX Project Public License, either version 1.3c
13 % of this license or (at your option) any later version.
14 % The latest version of this license is in
15 % https://www.latex-project.org/lppl.txt
16 % and version 1.3c or later is part of all distributions of LaTeX
17 % version 2008 or later.
18 %
19 % This work has the LPPL maintenance status "maintained".
20 %
21 % The Current Maintainer of this work is Shiro Takeda.
22
23 %% Main features of econ-aea.bst
24
25 % "econ-aea.bst" is a BibTeX style file for journals of American Economic
26 % Association such as
27 % - The American Economic Review
28 % - Papers and Proceedins
29 % - Journal of Economic Literature
30 % - American Economics Journals
31 %
32 % AEA Style Guide is found at the following site:
33 % https://www.aeaweb.org/journals/aer/submissions/accepted-articles/styleguide
34
35 % "econ-aea.bst" is created from "econ.bst" which is distributed from
36 % https://github.com/ShiroTakeda/econ-bst
37
38 % version number
39 FUNCTION {econ.version} { "3.3" }
40
41 % File name
42 FUNCTION {econ.file} { "econ-aea.bst" }
43
44 % Debug mode. Non-zero makes debug mode on.
45 FUNCTION {econ.debug}
46 { #0 } % Debug mode off (default).
47 % { #1 } % Debug mode on.
48
49
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 %% Explanation of terms used in this program
52
53 %% [Entry]
54 %% An entry is a single document in the reference. The "entry type" refers to
55 %% the type of document, such as an article or a book.
56
57 %% [Field]
58 %% Field is the title, author, year, etc. specified in an entry.
59
60 %% [Citation keyword]
61 %% The "citation keyword" is a set of characters specified in each entry. This
62 %% is the argument of the "\cite" command.
63
64
65 ENTRY
66 %%% Declaration of field
67 { access address author booktitle chapter doi edition editor howpublished
68 institution journal key month note number organization pages publisher
69 school series title type url volume year
70 % Fields specific to econ.bst
71 order absorder nameorder sortname
72 }
73
74 % Definition of entry variable. The entry variable is a variable which has
75 % different values according to different entries.
76 %% Integer entry variable:
77 { order.cited }
78
79 %% String entry variable
80 { label cyear flabel alabel extra.label sort.label sort.label.abb
81 extra.label.bysame nameorder.temp jname }
82
83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
84 %%
85 %% Functions for customization:
86 %%
87 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88
89 % Use \bysame or not.
90 %
91 % If set to #0, \bysame is not used.
92 % If set to #1, \bysame is used
93 % If set to #2, \bysame is used (alternative abbreviation style).
94 %
95 % Note that integer number is expressed as # + integer in bst file.
96 % \bysame is the function that abbreviates succession of the same authors' name by ---.
97 %
98 % See econ-sample.pdf for details.
99 %
100 FUNCTION {bst.use.bysame}
101 { #0 } % Not use \bysame
102 % { #1 } % -> Use \bysame (default)
103 % { #2 } % -> Use \bysame of alternative style.
104
105 % The definition of \bysame command.
106 %
107 FUNCTION {bst.bysame.definition}
108 { "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default)
109 % { "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this.
110
111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
112
113 % The order of fist and last name.
114 %
115 FUNCTION {bst.author.name}
116 { #0 } % (default)
117 % { #1 }
118 % { #2 }
119
120 % Case of #0: First author -> last-first, other authors -> first-last.
121 % Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables.
122
123 % Case of #1: All authors -> last-first
124 % Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J.
125
126 % Case of #2: All authors -> first-last
127 % Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables.
128
129 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
130
131 % Abbreviate first name of authors (editors):
132 %
133 FUNCTION {bst.first.name.initial}
134 { #0 } % #0 -> full letters (default).
135 % { #1 } % Non-zero -> initial letter only.
136
137 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
138
139 % Decapitalize of strings in title field.
140 %
141 FUNCTION {bst.title.lower.case}
142 { #0 } % If #0, not decapitalize title (default).
143 % { #1 } % If non-#0, decapitalize title
144
145 % Hide title filed.
146 %
147 FUNCTION {bst.hide.title}
148 { #0 } % #0 -> Title field is displayed (default)
149 % { #1 } % Non-zer -> Title field is hidden
150
151 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152
153 % Hide month.
154 %
155 FUNCTION {bst.hide.month}
156 { #0 } % #0 -> show month field (default).
157 % { #1 } % non-#0 -> hide month field.
158
159 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
160
161 % Attach number index like plain.bst.
162 %
163 FUNCTION {bst.use.number.index}
164 { #0 } % Not use number index (default).
165 % { #1 } % Non-#0 -> Use number index
166
167 % The string before number index:
168 %
169 FUNCTION {bst.number.index.pre}
170 { "[" } % (default)
171
172 % The string after number index. Adjustment is recommended.
173 %
174 FUNCTION {bst.number.index.post}
175 { "]\hskip1.0em " } % (default)
176
177 % Maximum digit of number index:
178 % If the number of reference items >= 100, set 3 to this function.
179 % If the number of reference items < 100, set 2 to this function.
180 % If the number of reference items < 10, set 1 to this function.
181 %
182 FUNCTION {bst.number.index.digit}
183 { "2" } % (default)
184 % { "3" }
185
186 % The functions below are used to adjust space and postion. If you use fonts
187 % other than computer modern fonts, you had better make adjustments.
188 %
189 % Setting for bst.number.index.digit = 1:
190 FUNCTION {bst.number.index.bibhang.one}
191 { "2.05em" } % (default)
192 % Setting for bst.number.index.digit = 2:
193 FUNCTION {bst.number.index.bibhang.ten}
194 { "2.55em" } % (default)
195 % Setting for bst.number.index.digit = 3:
196 FUNCTION {bst.number.index.bibhang.hund}
197 { "3.05em" } % (default).
198
199 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200
201 % Position of "year":
202 %
203 % You can choose the position of year by this function.
204 %
205 % If set to #0, year is placed right after "author".
206 % If set to non-zero, year is placed at the end (before note field) except for
207 % aritcle type entry.
208 %
209 % In article type entry, the position of year changes according to the
210 % following rule:
211 %
212 % #1 -> year is placed at the end.
213 % #2 -> year is placed after journal name in aritcle type entry.
214 % #3 -> year is placed after volume in aritcle type entry.
215 %
216 FUNCTION {bst.year.position}
217 { #0 } % (default).
218 % { #1 } % Last place before note.
219 % { #2 } % After journal name for aticle type entry.
220 % { #3 } % After volume for aticle type entry.
221
222 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
223
224 % If 0, references are sorted by old documents -> recent documents. If
225 % non-zero, reverse order.
226 FUNCTION {bst.reverse.year}
227 { #0 } % Normal order (old -> recent) (default).
228 % { #1 } % inverse order (recent -> old)
229
230 % If non-zero, sort references by using year field as the primary key
231 % (chronological sorting).
232 FUNCTION {bst.sort.year}
233 { #0 } % Normal case: year is used as the sorting key next to author (default).
234 % { #1 } % year is used as the primary sorting key.
235
236
237 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238
239 % If non-zero, references are listed in citation order.
240 %
241 FUNCTION {bst.no.sort}
242 { #0 } % (default)
243 % { #1 } % listed in citation order.
244
245 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
246
247 % Non-zero -> sort references by entry type (article, book, incollection etc.)
248 %
249 FUNCTION {bst.sort.entry.type}
250 { #0 } % #0 -> Normal (not sort references by entry type) (default).
251 % { #1 } % Non-zero -> sort references by entry type.
252
253 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
254
255 % 0 -> use absorder field to sort items. Otherwise, ignore absorder field.
256 %
257 FUNCTION {bst.notuse.absorder.field}
258 { #0 } % #0 -> Use absorder (default).
259 % { #1 } % Non-#0 -> Not use absorder.
260 %
261 % Order of priority to sort items
262 %
263 % absorder -> author -> year -> order -> month -> title
264 %
265 % wehre absorder and order fields are specific to econ.bst.
266
267 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268
269 % 0 -> use order field to sort items. Otherwise, ignore order field.
270 % Note: order field is specific to econ.bst.
271 FUNCTION {bst.notuse.order.field}
272 { #0 } % #0 -> Use order field (default).
273 % { #1 } % Non-#0 -> not use order field.
274
275 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
276 %%% and
277
278 %%% String used to separate author names in references.
279 %
280 % String replaced with _ in "Mr. A _ Mr. B "
281 %
282 FUNCTION {bst.and}
283 { ", and " }
284 % { " and " } % (default)
285
286 %%% String used to separate author names in references (more than two authors).
287 %
288 % String replaced with _ in "Mr. A, Mr. B _ Mr. C"
289 %
290 FUNCTION {bst.ands}
291 { ", and " } % (default)
292
293 %%% String used to separate author names in citation part.
294 %
295 % String replaced with _ in "Mr. A _ Mr. B "
296 %
297 FUNCTION {bst.cite.and}
298 { " and " } % (default)
299
300 %%% String used to separate author names in citation part (more than two authors).
301 %
302 % String replaced with _ in "Mr. A, Mr. B _ Mr. C"
303 %
304 FUNCTION {bst.cite.ands}
305 { ", and " }
306 % { " and " } % (default)
307
308 %%% If you want to use random author order for some bibliography entries, set
309 % non-zero to this function.
310 %
311 FUNCTION {bst.use.nameorder}
312 { #1 } % Use random order (default)
313 % { #0 } % Not use random order
314
315 %%% String used to separate author names in references for the entry of random
316 % author order.
317 %
318 FUNCTION {bst.and.nameorder}
319 { " \textcircled{r} " } % (default)
320
321 %%% String used to separate author names in citation part for the entry of
322 % random author order
323 %
324 FUNCTION {bst.cite.and.nameorder}
325 { " \textcircled{r} " } % (default)
326
327
328 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329
330 % Author names in the citation part are abbreviated by et al. if the number of
331 % authors is greater or equal to bst.and.others.num.
332 FUNCTION {bst.and.others.num}
333 { #3 } % If the number of authors is greater or equal to three (default).
334
335 % If the number of authors is greater than N1, only the first N2 authors are
336 % displayed in the reference part (and other authors' names are omitted by "et
337 % al".
338 %
339 % The following function determines the value of N1.
340 FUNCTION {bst.max.author.num}
341 { #8 } % (default).
342
343 % The following function determines the value of N2.
344 FUNCTION {bst.max.author.num.display}
345 { #3 } % (default).
346
347
348 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
349
350 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
351
352 % Strings used when abbreviating multiple-authors in citation part.
353 FUNCTION {bst.and.others}
354 { " et~al." } % (default)
355
356 % Strings used when abbreviating multiple-authors in citation part for entries
357 % with random author order.
358 FUNCTION {bst.and.others.nameorder}
359 { " \textcircled{r}~al." } % (default)
360
361 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
362 % author
363
364 % The string before author:
365 %
366 FUNCTION {bst.author.pre}
367 { "\textbf{" }
368 % { "" } % (default)
369
370 % The string after author:
371 %
372 FUNCTION {bst.author.post}
373 { ".}" }
374 % { "" } % (default)
375
376 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
377 % year
378
379 % The string before year only for aritcle type entry.
380 %
381 FUNCTION {bst.year.pre}
382 { ", " }
383 % { " (" } % (default)
384
385 % The string after year only for aritcle type entry.
386 %
387 FUNCTION {bst.year.post}
388 { ". " }
389 % { ") " } % (default)
390
391 % The string after year for non-article type entry (book, incollection etc)
392 %
393 FUNCTION {bst.year.na.pre}
394 { ", " }
395 % { " (" } % (default)
396
397 % The string after year for non-article type entry (book, incollection etc)
398 %
399 FUNCTION {bst.year.na.post}
400 { ". " }
401 % { ") " } % (default)
402
403 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
404 % title (except for title in book)
405
406 % The string before title:
407 %
408 FUNCTION {bst.title.pre}
409 { "``" } % (default)
410
411 % The string after title:
412 %
413 FUNCTION {bst.title.post}
414 { ".''" }
415 % { ",''" } % (default)
416
417 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
418 % tile for book:
419
420 % The string before book title:
421 %
422 FUNCTION {bst.book.pre}
423 { " \textit{" } % (default)
424
425 % The string after book title:
426 %
427 FUNCTION {bst.book.post}
428 { "}." }
429 % { "}," } % (default)
430
431 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
432 % booktitle
433
434 % The string before booktitle:
435 %
436 FUNCTION {bst.btitle.pre}
437 { " \textit{" } % (default)
438
439 % The string after booktitle:
440 %
441 FUNCTION {bst.btitle.post}
442 { "}," } % (default)
443
444 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
445 % journal name
446
447 % The string before journal name:
448 %
449 FUNCTION {bst.journal.pre}
450 { " \textit{" } % (default)
451
452 % The string after journal name:
453 %
454 FUNCTION {bst.journal.post}
455 { "}" } % (default)
456
457 % Use the abbreviated journal name
458 %
459 % If set to #0, do not use abbreviated journal name.
460 % If set to non-#0, use abbreviated journal name.
461 %
462 FUNCTION {bst.journal.name.abb}
463 { #0 } % (default)
464
465 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
466 % editor notation:
467
468 % The string that indicates multiple editors:
469 %
470 FUNCTION {bst.editors}
471 { " \textbf{eds.}" }
472 % { " eds. " } % (default)
473
474 % The string that indicates single editor:
475 %
476 FUNCTION {bst.editor}
477 { " \textbf{ed.}" }
478 % { " ed. " } % (default)
479
480 % Order of editor and booktitle in incollection and inproceedings entries.
481 %
482 % If set to #0: editors -> booktitle order
483 % If set to non-zero: booktitle -> editors order
484 %
485 FUNCTION {bst.editor.btitle.order}
486 { #1 }
487 % { #0 } % (default)
488
489 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
490 % edition
491
492 % The string before edition:
493 %
494 FUNCTION {bst.edition.pre}
495 { ", " } % (default)
496
497 % The string after edition:
498 %
499 FUNCTION {bst.edition.post}
500 { " edition" } % (default)
501
502 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
503 % volume
504
505 % The string before volume:
506 %
507 FUNCTION {bst.volume.pre}
508 { " " }
509 % { ", " } % (default)
510
511 % The string after volume:
512 %
513 FUNCTION {bst.volume.post}
514 { "" } % (default)
515
516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
517 % volume for book
518
519 % The string before volume in book:
520 %
521 FUNCTION {bst.bvolume.pre}
522 { ", Vol.~" } % (default)
523
524 % The string after volume in book
525 %
526 FUNCTION {bst.bvolume.post}
527 { "" } % (default)
528
529 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
530 % number
531
532 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
533
534 % Hide number. If non-zero, number is suppressed.
535 FUNCTION {bst.hide.number}
536 { #0 } % #0 -> show number field (default)
537 % { #1 } % non-#0 -> Hide number field.
538
539 % The string before number:
540 %
541 FUNCTION {bst.number.pre}
542 { " (" } % (default)
543
544 % The string after number:
545 %
546 FUNCTION {bst.number.post}
547 { "): " }
548 % { ")" } % (default)
549
550 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
551 % in
552
553 % In
554 %
555 FUNCTION {bst.in}
556 { " In " }
557 % { " in " } % (default)
558
559 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
560 % page
561
562 % The string before page (multiple pages):
563 %
564 FUNCTION {bst.pages.pre}
565 { " " }
566 % { ", " } % (default)
567
568 % The string before page:
569 %
570 FUNCTION {bst.page.pre}
571 { "" }
572 % { ", " } % (default)
573
574 % The string after page (multiple pages):
575 %
576 FUNCTION {bst.pages.post}
577 { "" } % (default)
578
579 % The string after page:
580 %
581 FUNCTION {bst.page.post}
582 { "" } % (default)
583
584 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
585 % chapter
586
587 % The string before chapter:
588 %
589 FUNCTION {bst.chapter.pre}
590 { ", Chap." } % (default)
591
592 % The string after chapter:
593 %
594 FUNCTION {bst.chapter.post}
595 { ", " }
596 % { "" } % (default)
597
598 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
599 % month
600
601 % The string before month:
602 %
603 FUNCTION {bst.month.pre}
604 { ", " } % (default)
605
606 % The string after month:
607 %
608 FUNCTION {bst.month.post}
609 { "" } % (default)
610
611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
612 % address
613 % The string before address:
614 %
615 FUNCTION {bst.address.pre}
616 { ", " } % (default)
617
618 % The string after address:
619 %
620 FUNCTION {bst.address.post}
621 { "" } % (default)
622
623 % You can choose the order of address and publisher by this function.
624 %
625 % If #0, address -> publisher order (the default value).
626 % If non-zero, publisher -> address order.
627
628 FUNCTION {bst.address.position}
629 { #0 } % Address is placed before publisher (default)
630 % { #1 } % Address is placed after publisher
631
632 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
633 % publisher
634
635 % The string before publisher:
636 %
637 FUNCTION {bst.publisher.pre}
638 { ": " } % (default)
639
640 % The string after publisher:
641 %
642 FUNCTION {bst.publisher.post}
643 { "" } % (default)
644
645 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
646 % series
647
648 % The string before series:
649 %
650 FUNCTION {bst.series.pre}
651 { ", " } % (default)
652
653 % The string after series:
654 %
655 FUNCTION {bst.series.post}
656 { "" } % (default)
657
658 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
659 % organization
660
661 % The string before organization:
662 %
663 FUNCTION {bst.organization.pre}
664 { ", " } % (default)
665
666 % The string after organization:
667 %
668 FUNCTION {bst.organization.post}
669 { "" } % (default)
670
671 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
672 % school
673
674 % The string before school:
675 %
676 FUNCTION {bst.school.pre}
677 { ", " } % (default)
678
679 % The string after school:
680 %
681 FUNCTION {bst.school.post}
682 { "" } % (default)
683
684 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
685 % institution
686
687 % The string before institution:
688 %
689 FUNCTION {bst.institution.pre}
690 { ", " } % (default)
691
692 % The string after institution:
693 %
694 FUNCTION {bst.institution.post}
695 { "" } % (default)
696
697 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
698 % howpublished
699
700 % The string before howpublished:
701 %
702 FUNCTION {bst.howpublished.pre}
703 { " " } % (default)
704
705 % The string after howpublished:
706 %
707 FUNCTION {bst.howpublished.post}
708 { "" } % (default)
709
710 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
711 % url
712
713 % Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed.
714 FUNCTION {bst.show.url}
715 { #1 } % non-#0 -> Show url field (default)
716 % { #0 } % #0 -> Not show url field.
717
718 % The string before url:
719 %
720 FUNCTION {bst.url.pre}
721 { ", \urlstyle{tt}\url{" } % (default)
722
723 % The string after url:
724 %
725 FUNCTION {bst.url.post}
726 { "}" } % (default)
727
728
729 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
730 % Access
731
732 % This setting is valid only if there are "access" field in bib
733 % files. The value of access field indicates accessed date for URL.
734
735 % The string before access.
736 FUNCTION {bst.access.pre}
737 { ", accessed on " } % (default)
738
739 % The string after access.
740 FUNCTION {bst.access.post}
741 { "" } % (default)
742
743 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
744 % DOI (digital object identifier)
745
746 % This setting is valid only if there are "doi" field in bib files.
747
748 % Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed.
749 FUNCTION {bst.show.doi}
750 { #1 } % non-#0 -> Show DOI field (default)
751 % { #0 } % #0 -> Not show DOI field.
752
753 % The string before DOI:
754 %
755 FUNCTION {bst.doi.pre}
756 { ". \href{https://doi.org/" doi * "}{\urlstyle{tt}\nolinkurl{" * }
757 % { ", \href{https://doi.org/" doi * "}{\urlstyle{tt}\nolinkurl{" * } % (default)
758
759 % The string after DOI:
760 %
761 FUNCTION {bst.doi.post}
762 { "}}" } % (default)
763
764 % How to show URL and DOI fields when both fields exist.
765 %
766 % #0 -> Both fields are displayed
767 % #1 -> Only URL field is displayed
768 % #2 -> Only DOI field is displayed
769 %
770 FUNCTION {bst.url.doi}
771 % { #0 } % -> Both fields are displayed
772 % { #1 } % -> Only URL field is displayed
773 { #2 } % (default) --> Only DOI field is displayed
774
775 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
776 % Other functions:
777
778 % The string before note.
779 FUNCTION {bst.note.pre}
780 { ", " } % (default)
781
782 % The string after note.
783 FUNCTION {bst.note.post}
784 { "" } % (default)
785
786 % The string that represents Technical report:
787 %
788 FUNCTION {bst.techrep}
789 { ", Technical Report" } % (default)
790
791 % The string that represents master thesis:
792 %
793 FUNCTION {bst.mthesis}
794 { ", Master's thesis" } % (default)
795
796 % The string that represents phd thesis:
797 %
798 FUNCTION {bst.phdthesis}
799 { ", Ph.D. dissertation" } % (default)
800
801 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
802 %%
803 %% Functions for customization end here:
804 %%
805 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
806
807 FUNCTION {bst.first}
808 { "1st" }
809
810 FUNCTION {bst.second}
811 { "2nd" }
812
813 FUNCTION {bst.third}
814 { "3rd" }
815
816 FUNCTION {bst.fourth}
817 { "4th" }
818
819 FUNCTION {bst.fifth}
820 { "5th" }
821
822 FUNCTION {bst.st}
823 { "st" }
824
825 FUNCTION {bst.nd}
826 { "nd" }
827
828 FUNCTION {bst.rd}
829 { "rd" }
830
831 FUNCTION {bst.th}
832 { "th" }
833
834 %%%%% memo by Takeda
835
836 % "a" 'b := indicates substituting string "a" for variable b.
837
838 % Integer number #0, #1,...
839
840 %%% Function definition:
841 %
842 % FUNCTION {name}
843 % { 's :=
844 %
845 % }
846 %
847 % This is the definition of a function named "name". The function "name" is
848 % used in the following way
849 %
850 % "foo" name
851 % "foo" is an argument for the function "name".
852 %
853 % About the definition of a function with more than two arguments, see the
854 % definition of "chop.word".
855
856 %%% Declaration of variables:
857
858 %% String global variables:
859 STRINGS { s t tt }
860 STRINGS { year.num }
861 STRINGS { preone preten }
862 STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author }
863 STRINGS { hang }
864 STRINGS { item.type }
865 STRINGS { tempa tempb }
866
867 %% Integer global variables:
868 INTEGERS { nameptr namesleft numnames name.num numtrunc }
869 INTEGERS { multiresult }
870 INTEGERS { index }
871 INTEGERS { len }
872 INTEGERS { last.extra.num }
873 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
874 INTEGERS { last.period.comma }
875 INTEGERS { len1.aer len2.aer i.aer }
876
877 % output.state
878 % -> This is a variable that holds which location in a single bibliography entry.
879 % -> before.all or mid.sentence
880
881 %%% Definition of functions:
882 FUNCTION {not}
883 { { #0 }
884 { #1 }
885 if$
886 }
887
888 FUNCTION {and}
889 { 'skip$
890 { pop$ #0 }
891 if$
892 }
893
894 FUNCTION {or}
895 { { pop$ #1 }
896 'skip$
897 if$
898 }
899
900 %%% Initialize variables:
901 FUNCTION {init.state.consts}
902 { #0 'before.all :=
903 #1 'mid.sentence :=
904 #2 'after.sentence :=
905 #3 'after.block :=
906 }
907
908 %%% Remove comma and add period:
909 %
910 FUNCTION {add.period.x}
911 { duplicate$ 't :=
912 t #-1 #1 substring$ "," =
913 { #-2 global.max$ substring$ "." * }
914 { t #-1 #2 substring$ ". " =
915 { #-3 global.max$ substring$ "." * }
916 { t #-1 #2 substring$ ", " =
917 { #-3 global.max$ substring$ "." * }
918 { t #-1 #2 substring$ ",'" =
919 { #-3 global.max$ substring$ ".'" * }
920 { t #-1 #2 substring$ ".'" =
921 { #-3 global.max$ substring$ ".'" * }
922 { t #-1 #2 substring$ ".~" =
923 { #-3 global.max$ substring$ ".~" * }
924 { t #-1 #2 substring$ ",~" =
925 { #-3 global.max$ substring$ ".~" * }
926 { t #-1 #3 substring$ ",''" =
927 { #-4 global.max$ substring$ ".''" * }
928 { t #-1 #3 substring$ ".''" =
929 { #-4 global.max$ substring$ ".''" * }
930 { t #-1 #2 substring$ ": " =
931 { #-3 global.max$ substring$ "." * }
932 { add.period$ }
933 if$
934 }
935 if$
936 }
937 if$
938 }
939 if$
940 }
941 if$
942 }
943 if$
944 }
945 if$
946 }
947 if$
948 }
949 if$
950 }
951 if$
952 }
953
954 %%% If the last character is period or comma, set non-zero to
955 %%% last.period.comma.
956 FUNCTION {last.period.comma.p}
957 { duplicate$ 't :=
958 t #-1 #1 substring$ "." =
959 t #-1 #1 substring$ "," = or
960 t #-1 #2 substring$ ". " = or
961 t #-1 #2 substring$ ", " = or
962 t #-1 #2 substring$ ".'" = or
963 t #-1 #2 substring$ ",'" = or
964 t #-1 #3 substring$ ".''" = or
965 t #-1 #3 substring$ ",''" = or
966 t #-1 #2 substring$ ".~" = or
967 t #-1 #2 substring$ ",~" = or
968 t #-1 #1 substring$ ":" = or
969 t #-1 #2 substring$ ": " = or
970 t #-1 #2 substring$ ".}" = or
971 t #-1 #2 substring$ ",}" = or
972 { #1 'last.period.comma := }
973 { #0 'last.period.comma := }
974 if$
975 }
976
977 %%% remove comma
978 % A function that removes the period or comma at the beginning of a field.
979 FUNCTION {remove.pre.comma}
980 { 's :=
981 s #1 #1 substring$ "," =
982 { s #2 global.max$ substring$ }
983 { s #1 #1 substring$ "." =
984 { s #2 global.max$ substring$ }
985 { s #1 #1 substring$ ":" =
986 { s #2 global.max$ substring$ }
987 's
988 if$
989 }
990 if$
991 }
992 if$
993 }
994
995 FUNCTION {output.field}
996 { 's :=
997 output.state mid.sentence =
998 % mid.sentence
999 { last.period.comma.p % Check whether the last of the previous field is
1000 % period or comma -> Assign to the variable
1001 % last.period.comma.
1002 write$ } % Write the contents of the previous field.
1003 % not mid.sentence
1004 { output.state before.all =
1005 % before.all
1006 'write$ % Write the contents of the previous field.
1007 % not before.all
1008 'skip$ % This line is never executed.
1009 if$
1010 mid.sentence 'output.state :=
1011 }
1012 if$
1013 last.period.comma #0 =
1014 % The last character in the field before the one is not a period or comma.
1015 { s }
1016 % The last character in the field before the one is a period or comma.
1017 { s remove.pre.comma }
1018 if$
1019 }
1020
1021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1022 %%% Format in bbl file:
1023
1024 % \harvarditem[Brezis et~al.]{Brezis, Krugman and
1025 % Tsiddon}{1993}{brezis93:_leapf_inter_compet}
1026 % Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in
1027 % International Competition: A Theory of Cycles in National Technological
1028 % Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp.
1029 % 1211--1219.
1030
1031 % \harvarditem[abbreviated citation]{full citation}{year}{keyword} ...
1032
1033 %%% Add period and newline.
1034 FUNCTION {fin.entry}
1035 { add.period.x
1036 write$
1037 newline$
1038 }
1039
1040 FUNCTION {field.or.null}
1041 { duplicate$ empty$
1042 { pop$ "" }
1043 'skip$
1044 if$
1045 }
1046
1047 %%% booktitle
1048 FUNCTION {format.btitle}
1049 { booktitle empty$
1050 { "" }
1051 { bst.btitle.pre booktitle * bst.btitle.post * }
1052 if$
1053 }
1054
1055 FUNCTION {journal.name.sub}
1056 { 't :=
1057 t #1 #4 substring$ "The " =
1058 % Use #30 to handle with the long journal name.
1059 { t #5 #30 substring$ 't := }
1060 'skip$
1061 if$
1062 t
1063 }
1064
1065 FUNCTION {format.journal.name.abb}
1066 { journal 's :=
1067 journal 'jname :=
1068 s journal.name.sub 's :=
1069 bst.journal.name.abb #0 =
1070 'skip$
1071 {
1072 s "Academic Management Review" =
1073 { "Acad. Manage. J." 'jname := }
1074 'skip$
1075 if$
1076 }
1077 if$
1078 jname
1079 }
1080
1081 %%% Remove commas in the cases like "?." and "?,".
1082 FUNCTION {remove.irrelevant.period.comma}
1083 { 's :=
1084 s empty$
1085 { "" }
1086 { s #-1 #3 substring$ "?,'" =
1087 s #-1 #3 substring$ "?.'" = or
1088 { s #-3 global.max$ substring$ "'" * }
1089 { s #-1 #4 substring$ "?,''" =
1090 s #-1 #4 substring$ "?.''" = or
1091 { s #-4 global.max$ substring$ "''" * }
1092 { s #-1 #2 substring$ "?," =
1093 s #-1 #2 substring$ "?." = or
1094 { s #-2 global.max$ substring$ "" * }
1095 { s #-1 #3 substring$ "?,~" =
1096 s #-1 #3 substring$ "?.~" = or
1097 { s #-4 global.max$ substring$ "?~" * }
1098 { s #-1 #3 substring$ ".}." =
1099 { s #-3 global.max$ substring$ "}" * }
1100 's
1101 if$
1102 }
1103 if$
1104 }
1105 if$
1106 }
1107 if$
1108 }
1109 if$
1110 }
1111 if$
1112 }
1113
1114 %%% journal
1115 FUNCTION {format.output.journal}
1116 { journal empty$
1117 'skip$
1118 { bst.journal.pre format.journal.name.abb * bst.journal.post * 'jname :=
1119 jname remove.irrelevant.period.comma output.field }
1120 if$
1121 }
1122
1123 FUNCTION {format.output.book}
1124 { title empty$
1125 { "there's no title in " cite$ * warning$ }
1126 { bst.hide.title #0 = not
1127 'skip$
1128 { bst.book.pre title * bst.book.post * output.field }
1129 if$
1130 }
1131 if$
1132 }
1133
1134 FUNCTION {format.output.url}
1135 { type$ "online" = bst.show.url or
1136 { bst.url.pre url * bst.url.post *
1137 access empty$
1138 { "" * output.field }
1139 { bst.access.pre * access * bst.access.post * output.field }
1140 if$
1141 }
1142 'skip$
1143 if$
1144 }
1145
1146 FUNCTION {format.output.doi}
1147 { bst.show.doi
1148 { bst.doi.pre doi * bst.doi.post * output.field }
1149 'skip$
1150 if$
1151 }
1152
1153 FUNCTION {format.output.url.doi}
1154 { url empty$
1155 { doi empty$
1156 'skip$
1157 { format.output.doi }
1158 if$
1159 }
1160 { doi empty$
1161 { format.output.url }
1162 { bst.url.doi #0 =
1163 { format.output.url
1164 format.output.doi }
1165 { bst.url.doi #1 =
1166 { format.output.url }
1167 { format.output.doi }
1168 if$
1169 }
1170 if$
1171 }
1172 if$
1173 }
1174 if$
1175 }
1176
1177 %%% and others
1178 FUNCTION {bst.and.others.output}
1179 { nameorder.temp "random" =
1180 bst.use.nameorder #0 = not and
1181 { bst.and.others.nameorder }
1182 { bst.and.others }
1183 if$
1184 }
1185
1186 %%% author and editor
1187
1188 % nameptr: author number
1189 % numnames: the total number of authors
1190 % namesleft: the number of authors which have not been processed.
1191 % numtrunc: bst.max.author.num.display
1192
1193 %%% name
1194 FUNCTION {format.names}
1195 { 's :=
1196 % insert 1 to nameptr.
1197 #1 'nameptr :=
1198 % Set the number of authors to numnames.
1199 s num.names$ 'numnames :=
1200 numnames 'namesleft :=
1201
1202 numnames bst.max.author.num >
1203 % If numnames > bst.max.author.num
1204 { bst.max.author.num.display 'numtrunc := }
1205 { #0 'numtrunc := }
1206 if$
1207 % Repeat if namesleft > 0 ---- Repeat from here
1208 { namesleft #0 > }
1209 {
1210 % Block A starts
1211 nameptr #1 =
1212 % A-1: If the author is the 1st author
1213 { bst.author.name #0 =
1214 bst.author.name #1 = or
1215 { bst.first.name.initial #0 =
1216 { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := }
1217 { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := }
1218 if$
1219 }
1220 { bst.first.name.initial #0 =
1221 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
1222 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
1223 if$
1224 }
1225 if$
1226 }
1227 % A-2: If the author is the second or later authors (not the 1st author).
1228 { bst.author.name #0 =
1229 bst.author.name #2 =
1230 or
1231 { bst.first.name.initial #0 =
1232 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
1233 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
1234 if$
1235 }
1236 { bst.first.name.initial #0 =
1237 { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := }
1238 { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := }
1239 if$
1240 }
1241 if$
1242 }
1243 if$
1244 % Block A ends
1245
1246 % Block B starts
1247 nameptr #1 >
1248 % B-1: If the author is the second or later authors
1249 { nameptr #1 - numtrunc =
1250 % If nameptr - 1 = numtrunc
1251 { #1 'namesleft :=
1252 "others" 't := }
1253 'skip$
1254 if$
1255 % If numnames <= bst.max.author.num
1256 nameorder.temp "random" =
1257 bst.use.nameorder #0 = not and
1258 % If random ordering is used
1259 { bst.and.nameorder * t * }
1260 % If random ordering is not used
1261 { namesleft #1 >
1262 % If more than one authors are left
1263 { ", " * t * }
1264 % If the author is the last author.
1265 { t "others" =
1266 % If the name is "others"
1267 { bst.and.others.output * }
1268 % If the name is not "others"
1269 { numnames #2 =
1270 % If the entry have two authors
1271 { bst.and * t * }
1272 % If the entry have more than two authors
1273 { bst.ands * t * }
1274 if$
1275 }
1276 if$
1277 }
1278 if$
1279 }
1280 if$
1281 }
1282 % When the author is the first author.
1283 't
1284 if$
1285 % Block B ends
1286 nameptr #1 + 'nameptr :=
1287 namesleft #1 - 'namesleft :=
1288 }
1289 while$ % ---- Repeat until here
1290 }
1291
1292 %%% name
1293 FUNCTION {format.names.editors}
1294 { 's :=
1295 % insert 1 to nameptr.
1296 #1 'nameptr :=
1297 % Set the number of authors to numnames.
1298 s num.names$ 'numnames :=
1299 numnames 'namesleft :=
1300
1301 numnames bst.max.author.num >
1302 % If numnames > bst.max.author.num
1303 { bst.max.author.num.display 'numtrunc := }
1304 { #0 'numtrunc := }
1305 if$
1306 % Repeat if namesleft > 0 ---- Repeat from here
1307 { namesleft #0 > }
1308 {
1309 % Block A starts
1310 bst.first.name.initial #0 =
1311 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
1312 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
1313 if$
1314 % Block A ends
1315 % Block B starts
1316 nameptr #1 >
1317 % B-1: If the author is the second or later authors
1318 { nameptr #1 - numtrunc =
1319 % If nameptr - 1 = numtrunc
1320 { #1 'namesleft :=
1321 "others" 't := }
1322 'skip$
1323 if$
1324 namesleft #1 >
1325 % If more than one authors are left
1326 { ", " * t * }
1327 % If the author is the last author.
1328 { t "others" =
1329 % If the name is "others"
1330 { bst.and.others.output * }
1331 % If the name is not "others"
1332 { numnames #2 =
1333 % If the entry have two authors
1334 { bst.and * t * }
1335 % If the entry have more than two authors
1336 { bst.ands * t * }
1337 if$
1338 }
1339 if$
1340 }
1341 if$
1342 }
1343 % When the author is the first author.
1344 't
1345 if$
1346 % Block B ends
1347 nameptr #1 + 'nameptr :=
1348 namesleft #1 - 'namesleft :=
1349 }
1350 while$ % ---- Repeat until here
1351 }
1352
1353 % remove successive periods (commas) from author
1354 FUNCTION {remove.ss.period.auth}
1355 { 's :=
1356 s format.names 'tempa :=
1357 bst.author.post 'tempb :=
1358 tempb #1 #1 substring$ "}" =
1359 { tempa tempb * }
1360 { tempa #-1 #1 substring$ tempb #1 #1 substring$ =
1361 { tempa tempb #2 global.max$ substring$ * }
1362 { tempa tempb * }
1363 if$
1364 }
1365 if$
1366 }
1367
1368 % <prev name list> <new name list> compare.names <modified name list>
1369 FUNCTION {compare.names.aer}
1370 { 's :=
1371 'tempa :=
1372
1373 % "current.author = " s * "\\" * write$ newline$
1374 % "prev.author = " tempa * "\\" * write$ newline$
1375
1376 tempa num.names$ 'len1.aer := % len1 = the number of previous authors
1377 s num.names$ 'len2.aer := % len2 = the number of current authors
1378
1379 % len1.aer := min(len1.aer,len2.aer)
1380 % len1 -> min{ the number of previous authors, the number of current authors }
1381 len1.aer len2.aer >
1382 { len2.aer 'len1.aer := }
1383 { }
1384 if$
1385
1386 % start with an empty string, then while the components are the same
1387 % add "\bysame"
1388 ""
1389 #1 'i.aer :=
1390
1391 { i.aer len1.aer > not }
1392 { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$
1393 s i.aer "{ff }{vv }{ll}{ jj}" format.name$
1394 =
1395 { #1 i.aer <
1396 { " and " * }
1397 { }
1398 if$
1399 "\bysame{}" *
1400 i.aer #1 + 'i.aer := }
1401 { #-1 'len1.aer := }
1402 if$
1403 }
1404 while$
1405
1406 % add the rest of the second string
1407 { i.aer len2.aer > not }
1408 { #1 i.aer <
1409 { " and " * }
1410 { }
1411 if$
1412 s i.aer "{ff }{vv }{ll}{ jj}" format.name$ *
1413 i.aer #1 + 'i.aer :=
1414 }
1415 while$
1416 }
1417
1418 %%% author
1419 FUNCTION {format.output.authors}
1420 { author empty$
1421 'skip$
1422 { bst.use.bysame #2 =
1423 { prev.author.aer author compare.names.aer 's :=
1424 author 'prev.author.aer := }
1425 { author 's := }
1426 if$
1427 extra.label.bysame "bysame" =
1428 { "\bysame " }
1429 { bst.author.pre s remove.ss.period.auth * }
1430 if$
1431 output.field
1432 }
1433 if$
1434 }
1435
1436 %%% editor
1437 FUNCTION {format.output.editors}
1438 { editor empty$
1439 'skip$
1440 { bst.use.bysame #2 =
1441 { prev.author.aer editor compare.names.aer 's :=
1442 editor 'prev.author.aer := }
1443 { editor 's := }
1444 if$
1445 extra.label.bysame "bysame" =
1446 { "\bysame " }
1447 { bst.author.pre s remove.ss.period.auth * }
1448 if$
1449 s num.names$ #1 >
1450 { bst.editors * output.field }
1451 { bst.editor * output.field }
1452 if$
1453 }
1454 if$
1455 }
1456
1457 FUNCTION {format.authors.alt}
1458 { author empty$
1459 { "" }
1460 { extra.label.bysame "bysame" =
1461 {"\bysame "}
1462 { bst.author.pre author remove.ss.period.auth * }
1463 if$
1464 }
1465 if$
1466 }
1467
1468 %%% editor
1469 FUNCTION {format.editors.alt}
1470 { editor empty$
1471 { "" }
1472 { extra.label.bysame "bysame" =
1473 { "\bysame " }
1474 { bst.author.pre editor remove.ss.period.auth * }
1475 if$
1476 }
1477 if$
1478 }
1479
1480 FUNCTION {format.editors.x}
1481 { bst.editor.btitle.order #0 =
1482 { "" }
1483 { editor num.names$ #1 >
1484 { " edited by " } % For econ-aea.bst
1485 { " edited by " } % For econ-aea.bst
1486 % { bst.editors " by " * }
1487 % { bst.editor " by " * }
1488 if$
1489 }
1490 if$
1491 editor format.names.editors *
1492 bst.editor.btitle.order #0 =
1493 { editor num.names$ #1 >
1494 { bst.editors * }
1495 { bst.editor * }
1496 if$
1497 }
1498 { ", " * }
1499 if$
1500 }
1501
1502 %%% title
1503 FUNCTION {format.title}
1504 { bst.title.lower.case #0 =
1505 { bst.title.pre title * bst.title.post * }
1506 { bst.title.pre title "t" change.case$ * bst.title.post * }
1507 if$
1508 }
1509
1510 %%% title
1511 FUNCTION {format.output.title}
1512 { title empty$
1513 { "there's no title in " cite$ * warning$ }
1514 { bst.hide.title #0 = not
1515 'skip$
1516 { format.title remove.irrelevant.period.comma output.field }
1517 if$
1518 }
1519 if$
1520 }
1521
1522 % Convert "-" to "--" (for pages field)
1523 FUNCTION {n.dashify}
1524 { 't :=
1525 ""
1526 %% while$
1527 { t empty$ not }
1528 { t #1 #1 substring$ "-" =
1529 { t #1 #2 substring$ "--" = not
1530 { "--" *
1531 t #2 global.max$ substring$ 't :=
1532 }
1533 { { t #1 #1 substring$ "-" = }
1534 { "-" *
1535 t #2 global.max$ substring$ 't :=
1536 }
1537 while$
1538 }
1539 if$
1540 }
1541 { t #1 #1 substring$ *
1542 t #2 global.max$ substring$ 't :=
1543 }
1544 if$
1545 }
1546 while$
1547 }
1548
1549 %%% year
1550 FUNCTION {format.output.year}
1551 { year empty$
1552 { "there's no year in " cite$ * warning$ }
1553 { type$ "article" =
1554 { bst.year.pre year * extra.label * bst.year.post * }
1555 { bst.year.na.pre year * extra.label * bst.year.na.post * }
1556 if$
1557 output.field
1558 }
1559 if$
1560 }
1561
1562 %%% Attach tie for the string with two or less characters.
1563 FUNCTION {tie.or.space.connect}
1564 { duplicate$ text.length$ #3 <
1565 { "~" }
1566 { "" }
1567 if$
1568 swap$ * *
1569 }
1570
1571 FUNCTION {tie.or.space.connect.alt}
1572 { duplicate$ text.length$ #3 <
1573 { "~" }
1574 { " " }
1575 if$
1576 swap$ *
1577 }
1578
1579 FUNCTION {either.or.check}
1580 { empty$
1581 'pop$
1582 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
1583 if$
1584 }
1585
1586 %%% page for book
1587 FUNCTION {format.output.book.pages}
1588 { pages empty$
1589 'skip$
1590 { bst.pages.pre pages n.dashify tie.or.space.connect.alt * bst.pages.post *
1591 output.field }
1592 if$
1593 }
1594
1595 %%% volume for book
1596 FUNCTION {format.output.bvolume}
1597 { volume empty$
1598 'skip$
1599 % { bst.bvolume.pre volume * bst.bvolume.post *
1600 { " Volume " volume * "." * % For econ-aea.bst
1601 series empty$
1602 'skip$
1603 %% If there is series field
1604 { " of " * series * bst.series.post * }
1605 if$
1606 output.field
1607 }
1608 if$
1609 }
1610
1611 %%% series
1612 FUNCTION {format.output.series}
1613 { series empty$
1614 'skip$
1615 { bst.series.pre series * bst.series.post * output.field }
1616 if$
1617 }
1618
1619 %%% number and series
1620 FUNCTION {format.output.number.series}
1621 { number empty$
1622 bst.hide.number #0 = not or
1623 % number is empty
1624 { series empty$
1625 'skip$
1626 % series is not empty.
1627 { format.output.series }
1628 if$
1629 }
1630 % number is not empty$
1631 { series empty$
1632 { bst.number.pre number * bst.number.post * output.field }
1633 % series is not empty.
1634 { bst.in bst.series.pre * series * bst.series.post *
1635 bst.number.pre * number * bst.number.post * output.field }
1636 if$
1637 }
1638 if$
1639 }
1640
1641 %%% Number or not.
1642 FUNCTION {is.num}
1643 { chr.to.int$
1644 duplicate$ "0" chr.to.int$ < not
1645 swap$ "9" chr.to.int$ > not and
1646 }
1647
1648 FUNCTION {extract.num}
1649 { duplicate$ 't :=
1650 "" 's :=
1651 { t empty$ not }
1652 { t #1 #1 substring$
1653 t #2 global.max$ substring$ 't :=
1654 duplicate$ is.num
1655 { s swap$ * 's := }
1656 { pop$ "" 't := }
1657 if$
1658 }
1659 while$
1660 s empty$
1661 'skip$
1662 { pop$ s }
1663 if$
1664 }
1665
1666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1667 %% edition
1668
1669 % Convert edition to 1st, 2nd, 3rd, 4th etc
1670 FUNCTION {eng.ord}
1671 { duplicate$ "1" swap$ *
1672 #-2 #1 substring$ "1" =
1673 { bst.th * }
1674 { duplicate$ #-1 #1 substring$
1675 duplicate$ "1" =
1676 { pop$ bst.st * }
1677 { duplicate$ "2" =
1678 { pop$ bst.nd * }
1679 { "3" =
1680 { bst.rd * }
1681 { bst.th * }
1682 if$
1683 }
1684 if$
1685 }
1686 if$
1687 }
1688 if$
1689 }
1690
1691 % Convert first, second etc in edition field to 1st, 2nd (from jfm.bst)
1692 FUNCTION {convert.edition}
1693 { edition extract.num "l" change.case$ 's :=
1694 s "first" = s "1" = or
1695 { bst.first }
1696 { s "second" = s "2" = or
1697 { bst.second }
1698 { s "third" = s "3" = or
1699 { bst.third }
1700 { s "fourth" = s "4" = or
1701 { bst.fourth }
1702 { s "fifth" = s "5" = or
1703 { bst.fifth }
1704 { s #1 #1 substring$ is.num
1705 { s eng.ord }
1706 { edition }
1707 if$
1708 }
1709 if$
1710 }
1711 if$
1712 }
1713 if$
1714 }
1715 if$
1716 }
1717 if$
1718 }
1719
1720 %%% edition
1721 FUNCTION {format.output.edition}
1722 { edition empty$
1723 'skip$
1724 { bst.edition.pre convert.edition "l" change.case$ * bst.edition.post * output.field }
1725 if$
1726 }
1727
1728 %%% month
1729 FUNCTION {format.output.month}
1730 { month empty$
1731 bst.hide.month #0 = not or
1732 'skip$
1733 { bst.month.pre month * bst.month.post * output.field }
1734 if$
1735 }
1736
1737 FUNCTION {format.output.date}
1738 { month empty$
1739 { year empty$
1740 'skip$
1741 { format.output.year }
1742 if$
1743 }
1744 { year empty$
1745 { format.output.month }
1746 { format.output.month
1747 format.output.year }
1748 if$
1749 }
1750 if$
1751 }
1752
1753 %%% Is multiple pages like 1-100?
1754 FUNCTION { multi.page.check }
1755 { 't :=
1756 #0 'multiresult :=
1757 { multiresult not
1758 t empty$ not
1759 and
1760 }
1761 { t #1 #1 substring$
1762 duplicate$ "-" =
1763 swap$ duplicate$ "," =
1764 swap$ "+" =
1765 or or
1766 { #1 'multiresult := }
1767 { t #2 global.max$ substring$ 't := }
1768 if$
1769 }
1770 while$
1771 multiresult
1772 }
1773
1774 %%% pages
1775 FUNCTION {format.pages}
1776 { pages multi.page.check
1777 { bst.pages.pre pages n.dashify tie.or.space.connect.alt * bst.pages.post * }
1778 { bst.page.pre pages tie.or.space.connect.alt * bst.page.post * }
1779 if$
1780 }
1781
1782 FUNCTION {format.output.pages}
1783 { pages empty$
1784 'skip$
1785 { format.pages output.field }
1786 if$
1787 }
1788
1789 %%% number
1790 FUNCTION {format.output.number}
1791 { number empty$
1792 bst.hide.number #0 = not or
1793 'skip$
1794 { bst.number.pre number * bst.number.post * output.field }
1795 if$
1796 }
1797
1798 %%% volume
1799 FUNCTION {format.output.volume}
1800 { volume empty$
1801 'skip$
1802 { bst.volume.pre volume * bst.volume.post * output.field }
1803 if$
1804 }
1805
1806 %%% chapter
1807 FUNCTION {format.output.chapter}
1808 { chapter empty$
1809 'skip$
1810 { bst.chapter.pre chapter tie.or.space.connect.alt * bst.chapter.post * output.field }
1811 if$
1812 }
1813
1814 %%% editor and booktitle
1815 FUNCTION {format.output.in.ed.booktitle}
1816 { booktitle empty$
1817 'skip$
1818 { editor empty$
1819 { bst.in format.btitle * }
1820 { bst.editor.btitle.order #0 =
1821 { bst.in format.editors.x * " " * format.btitle * }
1822 { bst.in format.btitle * " " * format.editors.x * }
1823 if$
1824 }
1825 if$
1826 output.field
1827 }
1828 if$
1829 }
1830
1831 %%% howpublished
1832 FUNCTION {format.output.howpublished}
1833 { howpublished empty$
1834 'skip$
1835 { bst.howpublished.pre howpublished * bst.howpublished.post * output.field }
1836 if$
1837 }
1838
1839 %%% address
1840 FUNCTION {format.output.address}
1841 { address empty$
1842 'skip$
1843 { bst.address.pre address * bst.address.post * output.field }
1844 if$
1845 }
1846
1847 %%% publisher
1848 FUNCTION {format.output.publisher}
1849 { publisher empty$
1850 'skip$
1851 { address empty$ % For econ-aea.bst
1852 { ", " publisher * bst.publisher.post * output.field }
1853 { bst.publisher.pre publisher * bst.publisher.post * output.field }
1854 if$
1855 }
1856 if$
1857 }
1858
1859 %%% organization
1860 FUNCTION {format.output.organization}
1861 { organization empty$
1862 'skip$
1863 { bst.organization.pre organization * bst.organization.post * output.field }
1864 if$
1865 }
1866
1867 %% publisher and address
1868 FUNCTION {format.output.publisher.address}
1869 { bst.address.position #0 =
1870 { format.output.address
1871 format.output.publisher }
1872 { format.output.publisher
1873 format.output.address }
1874 if$
1875 }
1876
1877 %% address, organization, publisher
1878 FUNCTION {format.output.address.organization.publisher}
1879 { format.output.organization
1880 bst.address.position #0 =
1881 { format.output.address
1882 format.output.publisher }
1883 { format.output.publisher
1884 format.output.address }
1885 if$
1886 }
1887
1888 %%% misc
1889 FUNCTION {empty.misc.check}
1890 { author empty$ title empty$ howpublished empty$
1891 month empty$ year empty$ note empty$
1892 and and and and and
1893 key empty$ not and
1894 { "All relevant fields are empty in " cite$ * warning$ }
1895 'skip$
1896 if$
1897 }
1898
1899 FUNCTION {format.thesis.type}
1900 { type empty$
1901 'skip$
1902 { pop$ ", " type * }
1903 if$
1904 }
1905
1906 FUNCTION {format.tr.number}
1907 { type empty$
1908 { bst.techrep }
1909 { ", " type * }
1910 if$
1911 number empty$
1912 bst.hide.number #0 = not or
1913 { "t" change.case$ }
1914 { number tie.or.space.connect }
1915 if$
1916 }
1917
1918 %%% phdthesis
1919 FUNCTION {format.output.phd}
1920 { bst.phdthesis format.thesis.type output.field }
1921
1922 %%% mastersthesis
1923 FUNCTION {format.output.mthesis}
1924 { bst.mthesis format.thesis.type output.field }
1925
1926 %%% school
1927 FUNCTION {format.output.school}
1928 { school empty$
1929 'skip$
1930 { bst.school.pre school * bst.school.post * output.field }
1931 if$
1932 }
1933
1934 %%% institution
1935 FUNCTION {format.output.institution}
1936 { institution empty$
1937 'skip$
1938 { bst.institution.pre institution * bst.institution.post * output.field }
1939 if$
1940 }
1941
1942 FUNCTION {format.output.note}
1943 { note empty$
1944 'skip$
1945 { bst.note.pre note * bst.note.post * output.field }
1946 if$
1947 }
1948
1949 %%% remove first ? characters.
1950 % example
1951 %
1952 % "abc" #3" x1 chop.word
1953 %
1954 % If the first three characters of x1 are equal to abc, the function returns
1955 % the string with abc removed. Otherwise, it returns x1 as is.
1956 FUNCTION {chop.word}
1957 { 's :=
1958 'len :=
1959 s #1 len substring$ =
1960 { s len #1 + global.max$ substring$ }
1961 's
1962 if$
1963 }
1964
1965 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1966 % \havarditem
1967
1968 FUNCTION {output.bibitem}
1969 { newline$
1970 "\harvarditem[" write$
1971 alabel write$ % alabel <- abbreviated citation
1972 "]{" write$
1973 flabel write$ % flabel <- full citation
1974 "}{" write$
1975 cyear write$
1976 % cyear = year
1977 "}{" write$
1978 cite$ write$ % cite$ -> pusch keyword
1979 "}" write$
1980 % If number index is on
1981 bst.use.number.index #0 =
1982 'skip$
1983 { index #1 + 'index :=
1984 "" 'preone :=
1985 "" 'preten :=
1986 bst.number.index.digit "1" =
1987 'skip$
1988 { bst.number.index.digit "2" =
1989 { "\hskip0.5em" 'preone := }
1990 { bst.number.index.digit "3" =
1991 { "\hskip1em" 'preone :=
1992 "\hskip0.5em" 'preten := }
1993 'skip$
1994 if$
1995 }
1996 if$
1997 }
1998 if$
1999 }
2000 if$
2001 newline$
2002 before.all 'output.state :=
2003 ""
2004 % number index
2005 bst.use.number.index #0 =
2006 'skip$
2007 { index #10 <
2008 % Insert spaces according to digit of number index.
2009 { preone }
2010 { index #100 <
2011 { preten }
2012 { "" }
2013 if$
2014 }
2015 if$
2016 bst.number.index.pre * index int.to.str$ * bst.number.index.post * write$
2017 }
2018 if$
2019 }
2020
2021 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2022 % article
2023
2024 FUNCTION {article}
2025 { output.bibitem
2026 format.output.authors
2027 bst.year.position #0 =
2028 { format.output.year }
2029 'skip$
2030 if$
2031 format.output.title
2032 format.output.journal
2033 bst.year.position #2 =
2034 { format.output.year }
2035 'skip$
2036 if$
2037 format.output.volume
2038 bst.year.position #3 =
2039 { format.output.year }
2040 'skip$
2041 if$
2042 format.output.number
2043 format.output.pages
2044 bst.year.position #1 =
2045 { format.output.year }
2046 'skip$
2047 if$
2048 format.output.url.doi
2049 format.output.note
2050 fin.entry
2051 }
2052
2053 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2054 % book
2055
2056 FUNCTION {book}
2057 { output.bibitem
2058 author empty$
2059 { format.output.editors }
2060 { format.output.authors
2061 "author and editor" editor either.or.check
2062 }
2063 if$
2064 bst.year.position #0 =
2065 { format.output.year }
2066 'skip$
2067 if$
2068 format.output.book
2069 format.output.bvolume
2070 format.output.number.series
2071 format.output.edition
2072 format.output.publisher.address
2073 bst.year.position #0 = not
2074 { format.output.year }
2075 'skip$
2076 if$
2077 format.output.url.doi
2078 format.output.note
2079 fin.entry
2080 }
2081
2082 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2083 % booklet
2084
2085 FUNCTION {booklet}
2086 { output.bibitem
2087 % Only the author field can be used? The editor field cannot be used?
2088 format.output.authors
2089 bst.year.position #0 =
2090 { format.output.year }
2091 'skip$
2092 if$
2093 format.output.title
2094 format.output.howpublished
2095 format.output.address
2096 bst.year.position #0 = not
2097 { format.output.year }
2098 'skip$
2099 if$
2100 format.output.url.doi
2101 format.output.note
2102 fin.entry
2103 }
2104
2105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2106 % inbook
2107
2108 FUNCTION {inbook}
2109 { output.bibitem
2110 author empty$
2111 { format.output.editors }
2112 { format.output.authors
2113 "author and editor" editor either.or.check
2114 }
2115 if$
2116 bst.year.position #0 =
2117 { format.output.year }
2118 'skip$
2119 if$
2120 format.output.book
2121 format.output.edition
2122 format.output.bvolume
2123 format.output.chapter
2124 format.output.pages
2125 format.output.number.series
2126 format.output.publisher.address
2127 bst.year.position #0 = not
2128 { format.output.year }
2129 'skip$
2130 if$
2131 format.output.url.doi
2132 format.output.note
2133 fin.entry
2134 }
2135
2136 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2137 % incollection
2138
2139 FUNCTION {incollection}
2140 { output.bibitem
2141 format.output.authors
2142 bst.year.position #0 =
2143 { format.output.year }
2144 'skip$
2145 if$
2146 format.output.title
2147 format.output.in.ed.booktitle
2148 format.output.bvolume
2149 format.output.edition
2150 format.output.chapter
2151 format.output.pages
2152 format.output.address.organization.publisher
2153 bst.year.position #0 = not
2154 { format.output.year }
2155 'skip$
2156 if$
2157 format.output.url.doi
2158 format.output.note
2159 fin.entry
2160 }
2161
2162 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2163 % inproceedings
2164
2165 FUNCTION {inproceedings}
2166 { output.bibitem
2167 format.output.authors
2168 bst.year.position #0 =
2169 { format.output.year }
2170 'skip$
2171 if$
2172 format.output.title
2173 format.output.in.ed.booktitle
2174 format.output.bvolume
2175 format.output.number.series
2176 format.output.pages
2177 format.output.address.organization.publisher
2178 bst.year.position #0 = not
2179 { format.output.date }
2180 { format.output.month }
2181 if$
2182 format.output.url.doi
2183 format.output.note
2184 fin.entry
2185 }
2186
2187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2188 % conference
2189
2190 FUNCTION {conference}
2191 { inproceedings }
2192
2193 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2194 % manual
2195
2196 FUNCTION {manual}
2197 { output.bibitem
2198 format.output.authors
2199 bst.year.position #0 =
2200 { format.output.year }
2201 'skip$
2202 if$
2203 format.output.book
2204 format.output.address.organization.publisher
2205 format.output.edition
2206 bst.year.position #0 = not
2207 { format.output.year }
2208 'skip$
2209 if$
2210 format.output.url.doi
2211 format.output.note
2212 fin.entry
2213 }
2214
2215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2216 % mastersthesis
2217
2218 FUNCTION {masterthesis}
2219 { output.bibitem
2220 format.output.authors
2221 bst.year.position #0 =
2222 { format.output.year }
2223 'skip$
2224 if$
2225 format.output.title
2226 format.output.mthesis
2227 format.output.school
2228 format.output.address
2229 bst.year.position #0 = not
2230 { format.output.year }
2231 'skip$
2232 if$
2233 format.output.url.doi
2234 format.output.note
2235 fin.entry
2236 }
2237
2238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2239 % phdthesis
2240
2241 FUNCTION {phdthesis}
2242 { output.bibitem
2243 format.output.authors
2244 bst.year.position #0 =
2245 { format.output.year }
2246 'skip$
2247 if$
2248 format.output.book
2249 format.output.phd
2250 format.output.school
2251 format.output.address
2252 bst.year.position #0 = not
2253 { format.output.year }
2254 'skip$
2255 if$
2256 format.output.url.doi
2257 format.output.note
2258 fin.entry
2259 }
2260
2261 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2262 % proceedings
2263
2264 FUNCTION {proceedings}
2265 { output.bibitem
2266 editor empty$
2267 { organization output.field }
2268 { format.output.editors }
2269 if$
2270 bst.year.position #0 =
2271 { format.output.year }
2272 'skip$
2273 if$
2274 format.output.book
2275 format.output.bvolume
2276 format.output.number.series
2277 format.output.address.organization.publisher
2278 bst.year.position #0 = not
2279 { format.output.year }
2280 'skip$
2281 if$
2282 format.output.url.doi
2283 format.output.note
2284 fin.entry
2285
2286 }
2287
2288 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2289 % techreport
2290
2291 FUNCTION {techreport}
2292 { output.bibitem
2293 format.output.authors
2294 bst.year.position #0 =
2295 { format.output.year }
2296 'skip$
2297 if$
2298 format.output.title
2299 format.tr.number output.field
2300 format.output.institution
2301 format.output.address
2302 bst.year.position #0 = not
2303 { format.output.year }
2304 'skip$
2305 if$
2306 format.output.url.doi
2307 format.output.note
2308 fin.entry
2309 }
2310
2311 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2312 % unpublished
2313
2314 FUNCTION {unpublished}
2315 { output.bibitem
2316 format.output.authors
2317 bst.year.position #0 =
2318 { format.output.year }
2319 'skip$
2320 if$
2321 format.output.title
2322 bst.year.position #0 = not
2323 { format.output.date }
2324 { format.output.month }
2325 if$
2326 format.output.url.doi
2327 format.output.note
2328 fin.entry
2329 }
2330
2331 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2332 % online
2333
2334 FUNCTION {online}
2335 { output.bibitem
2336 format.output.authors
2337 bst.year.position #0 =
2338 { format.output.year }
2339 'skip$
2340 if$
2341 format.output.title
2342 format.output.howpublished
2343 bst.year.position #0 = not
2344 { format.output.date }
2345 { format.output.month }
2346 if$
2347 format.output.url.doi
2348 format.output.note
2349 fin.entry
2350 }
2351
2352 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2353 % misc
2354
2355 FUNCTION {misc}
2356 { output.bibitem
2357 format.output.authors
2358 bst.year.position #0 =
2359 { format.output.year }
2360 'skip$
2361 if$
2362 format.output.title
2363 format.output.howpublished
2364 bst.year.position #0 = not
2365 { format.output.date }
2366 { format.output.month }
2367 if$
2368 format.output.url.doi
2369 format.output.note
2370 fin.entry
2371 empty.misc.check
2372 }
2373
2374 FUNCTION {default.type}
2375 { misc }
2376
2377 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2378 % Alias for month names:
2379
2380 MACRO {jan} {"January"}
2381 MACRO {feb} {"February"}
2382 MACRO {mar} {"March"}
2383 MACRO {apr} {"April"}
2384 MACRO {may} {"May"}
2385 MACRO {jun} {"June"}
2386 MACRO {jul} {"July"}
2387 MACRO {aug} {"August"}
2388 MACRO {sep} {"September"}
2389 MACRO {oct} {"October"}
2390 MACRO {nov} {"November"}
2391 MACRO {dec} {"December"}
2392
2393 %%% Read entries:
2394 READ
2395
2396 %%% Variable for remembering the order of citation.
2397 INTEGERS { order.num }
2398 FUNCTION {initialize.order.num}
2399 {
2400 #1 'order.num :=
2401 }
2402 %%% Initialize a variables
2403 EXECUTE {initialize.order.num}
2404
2405 %%% Variable for remembering the order of citation.
2406 FUNCTION {set.order.cited}
2407 {
2408 order.num 'order.cited :=
2409 #1 order.num + 'order.num :=
2410 }
2411 %%% Iterate for all entries:
2412 ITERATE {set.order.cited}
2413
2414 %%% check the value of nameorder field.
2415 FUNCTION {set.nameorder}
2416 { nameorder empty$
2417 { "" 'nameorder.temp := }
2418 { nameorder 'nameorder.temp := }
2419 if$
2420 }
2421 %%% Iterate for all entries:
2422 ITERATE {set.nameorder}
2423
2424 %%% Remove symbols and convert to lowercase.
2425 FUNCTION {sortify}
2426 { purify$ "l" change.case$ }
2427
2428 %%% names for sorting
2429 FUNCTION {sort.format.names}
2430 { 's :=
2431 #1 'nameptr :=
2432 ""
2433 s num.names$ 'numnames :=
2434 numnames 'namesleft :=
2435 { namesleft #0 > }
2436 { nameptr #1 >
2437 { ", " * }
2438 'skip$
2439 if$
2440 s nameptr "{ll}{ f}{ j}" format.name$ 't :=
2441 nameptr numnames = t "others" = and
2442 { bst.and.others.output *}
2443 { t sortify * }
2444 if$
2445 nameptr #1 + 'nameptr :=
2446 namesleft #1 - 'namesleft :=
2447 }
2448 while$
2449 }
2450
2451 FUNCTION {sort.format.names.abb}
2452 { 's :=
2453 s num.names$ 'numnames :=
2454 numnames bst.and.others.num <
2455 { s sort.format.names }
2456 { s #1 "{ll}{ f}{ j}" format.name$ " zz " * }
2457 if$
2458 }
2459
2460 %%% Label for full author name.
2461 FUNCTION {format.lab.names.full}
2462 { 's :=
2463 #1 'nameptr :=
2464 s num.names$ 'numnames :=
2465 numnames 'namesleft :=
2466 { namesleft #0 > }
2467 { s nameptr "{vv~}{ll}" format.name$ 't :=
2468 nameptr #1 >
2469 { namesleft #1 >
2470 { nameorder.temp "random" = bst.use.nameorder #0 = not and
2471 { bst.and.nameorder * t * }
2472 { ", " * t * }
2473 if$
2474 }
2475 { t "others" =
2476 { bst.and.others.output * }
2477 { numnames #2 >
2478 { nameorder.temp "random" = bst.use.nameorder #0 = not and
2479 { bst.cite.and.nameorder * t * }
2480 { bst.cite.ands * t * }
2481 if$
2482 }
2483 { nameorder.temp "random" = bst.use.nameorder #0 = not and
2484 { bst.cite.and.nameorder * t * }
2485 { bst.cite.and * t * }
2486 if$
2487 }
2488 if$
2489 }
2490 if$
2491 }
2492 if$
2493 }
2494 't
2495 if$
2496 nameptr #1 + 'nameptr :=
2497 namesleft #1 - 'namesleft :=
2498 }
2499 while$
2500 numnames #1 > #1 #2 = and {", eds" *} {} if$
2501 numnames #1 = #1 #2 = and {", ed" *} {} if$
2502 }
2503
2504 %%% laberl for abbreviated author name.
2505 FUNCTION {format.lab.names.abb}
2506 { 's :=
2507 s num.names$ 'numnames :=
2508 numnames bst.and.others.num <
2509 % if the number of authors is less than bst.and.others.num, full name.
2510 { s format.lab.names.full }
2511 % if the number of authors is equal or more than bst.and.others.num, abbreviated name.
2512 { s #1 "{vv~}{ll}" format.name$ bst.and.others.output * }
2513 if$
2514 }
2515
2516 %%% abbreviated author
2517 FUNCTION {author.key.label.abb}
2518 { author empty$
2519 { key empty$
2520 { cite$ #1 #3 substring$ }
2521 { key #3 text.prefix$ }
2522 if$
2523 }
2524 { author format.lab.names.abb }
2525 if$
2526 }
2527
2528 %%% full author
2529 FUNCTION {author.key.label.full}
2530 { author empty$
2531 { key empty$
2532 { cite$ #1 #3 substring$ }
2533 { key #3 text.prefix$ }
2534 if$
2535 }
2536 { author format.lab.names.full }
2537 if$
2538 }
2539
2540 FUNCTION {format.names.full.wo.and}
2541 { 's :=
2542 #1 'nameptr :=
2543 s num.names$ 'numnames :=
2544 numnames 'namesleft :=
2545 { namesleft #0 > }
2546 { s nameptr "{ll}{, ff}{, jj}" format.name$ 't :=
2547 nameptr #1 >
2548 { namesleft #1 >
2549 { " " * t * }
2550 { t "others" =
2551 { " " * }
2552 { numnames #2 >
2553 { " " * t * }
2554 { " " * t * }
2555 if$
2556 }
2557 if$
2558 }
2559 if$
2560 }
2561 't
2562 if$
2563 nameptr #1 + 'nameptr :=
2564 namesleft #1 - 'namesleft :=
2565 }
2566 while$
2567 }
2568
2569 FUNCTION {author.key.full.wo.and}
2570 { sortname empty$ not
2571 { sortname format.names.full.wo.and }
2572 { author empty$ not
2573 { author format.names.full.wo.and }
2574 { key empty$ not
2575 { key #3 text.prefix$ }
2576 { cite$ #1 #3 substring$ }
2577 if$
2578 }
2579 if$
2580 }
2581 if$
2582 }
2583
2584 FUNCTION {author.editor.key.full.wo.and}
2585 { sortname empty$ not
2586 { sortname format.names.full.wo.and }
2587 { author empty$ not
2588 { author format.names.full.wo.and }
2589 { editor empty$ not
2590 { editor format.names.full.wo.and }
2591 { key empty$
2592 { cite$ #1 #3 substring$ }
2593 { key #3 text.prefix$ }
2594 if$
2595 }
2596 if$
2597 }
2598 if$
2599 }
2600 if$
2601 }
2602
2603 FUNCTION {editor.key.organization.key.full.wo.and}
2604 { sortname empty$ not
2605 { sortname format.names.full.wo.and }
2606 { editor empty$ not
2607 { editor format.names.full.wo.and }
2608 { key empty$ not
2609 { key #3 text.prefix$ }
2610 { organization empty$ not
2611 { "The " #4 organization chop.word #3 text.prefix$ }
2612 { cite$ #1 #3 substring$ }
2613 if$
2614 }
2615 if$
2616 }
2617 if$
2618 }
2619 if$
2620 }
2621
2622 FUNCTION {author.key.organization.key.full.wo.and}
2623 { sortname empty$ not
2624 { sortname format.names.full.wo.and }
2625 { author empty$ not
2626 { author format.names.full.wo.and }
2627 { key empty$ not
2628 { key #3 text.prefix$ }
2629 { organization empty$ not
2630 { "The " #4 organization chop.word #3 text.prefix$ }
2631 { cite$ #1 #3 substring$ }
2632 if$
2633 }
2634 if$
2635 }
2636 if$
2637 }
2638 if$
2639 }
2640
2641 %%% abbreviated author
2642 FUNCTION {author.editor.key.label.abb}
2643 { author empty$
2644 { editor empty$
2645 { key empty$
2646 { cite$ #1 #3 substring$ }
2647 { key #3 text.prefix$ }
2648 if$
2649 }
2650 { editor format.lab.names.abb }
2651 if$
2652 }
2653 { author format.lab.names.abb }
2654 if$
2655 }
2656
2657 %%% full author
2658 FUNCTION {author.editor.key.label.full}
2659 { author empty$
2660 { editor empty$
2661 { key empty$
2662 { cite$ #1 #3 substring$ }
2663 { key #3 text.prefix$ }
2664 if$
2665 }
2666 { editor format.lab.names.full }
2667 if$
2668 }
2669 { author format.lab.names.full }
2670 if$
2671 }
2672
2673 FUNCTION {author.key.organization.label.full}
2674 { author empty$
2675 { key empty$
2676 { organization empty$
2677 { cite$ #1 #3 substring$ }
2678 { "The " #4 organization chop.word #3 text.prefix$ }
2679 if$
2680 }
2681 { key #3 text.prefix$ }
2682 if$
2683 }
2684 { author format.lab.names.full }
2685 if$
2686 }
2687
2688 FUNCTION {author.key.organization.label.abb}
2689 { author empty$
2690 { key empty$
2691 { organization empty$
2692 { cite$ #1 #3 substring$ }
2693 { "The " #4 organization chop.word #3 text.prefix$ }
2694 if$
2695 }
2696 { key #3 text.prefix$ }
2697 if$
2698 }
2699 { author format.lab.names.abb }
2700 if$
2701 }
2702
2703 FUNCTION {editor.key.organization.label.full}
2704 { editor empty$
2705 { key empty$
2706 { organization empty$
2707 { cite$ #1 #3 substring$ }
2708 { "The " #4 organization chop.word #3 text.prefix$ }
2709 if$
2710 }
2711 { key #3 text.prefix$ }
2712 if$
2713 }
2714 { editor format.lab.names.full }
2715 if$
2716 }
2717
2718 FUNCTION {editor.key.organization.label.abb}
2719 { editor empty$
2720 { key empty$
2721 { organization empty$
2722 { cite$ #1 #3 substring$ }
2723 { "The " #4 organization chop.word #3 text.prefix$ }
2724 if$
2725 }
2726 { key #3 text.prefix$ }
2727 if$
2728 }
2729 { editor format.lab.names.abb }
2730 if$
2731 }
2732
2733 %%% Convert numbers: 0->9, 1->8, 2->7,..., 9->0
2734 FUNCTION {reverse.num}
2735 { 's :=
2736 s "1" =
2737 { "8" 'year.num := }
2738 { s "2" =
2739 { "7" 'year.num := }
2740 { s "3" =
2741 { "6" 'year.num := }
2742 { s "4" =
2743 { "5" 'year.num := }
2744 { s "5" =
2745 { "4" 'year.num := }
2746 { s "6" =
2747 { "3" 'year.num := }
2748 { s "7" =
2749 { "2" 'year.num := }
2750 { s "8" =
2751 { "1" 'year.num := }
2752 { s "9" =
2753 { "0" 'year.num := }
2754 { s "0" =
2755 { "9" 'year.num := }
2756 { "9" 'year.num := }
2757 if$
2758 }
2759 if$
2760 }
2761 if$
2762 }
2763 if$
2764 }
2765 if$
2766 }
2767 if$
2768 }
2769 if$
2770 }
2771 if$
2772 }
2773 if$
2774 }
2775 if$
2776 year.num
2777 }
2778
2779 %%% Convert year (large number -> small number)
2780 FUNCTION {convert.year}
2781 { 't :=
2782 bst.reverse.year #0 =
2783 { t 'tt := }
2784 { t #1 #1 substring$ reverse.num
2785 t #2 #1 substring$ reverse.num *
2786 t #3 #1 substring$ reverse.num *
2787 t #4 #1 substring$ reverse.num * 'tt := }
2788 if$
2789 tt
2790 }
2791
2792 %%% cyear
2793 FUNCTION {calc.cyear}
2794 { type$ "book" =
2795 type$ "inbook" =
2796 or
2797 'author.editor.key.full.wo.and
2798 { type$ "proceedings" =
2799 'editor.key.organization.key.full.wo.and
2800 { type$ "manual" =
2801 'author.key.organization.key.full.wo.and
2802 'author.key.full.wo.and
2803 if$
2804 }
2805 if$
2806 }
2807 if$
2808 duplicate$
2809 year empty$
2810 { "2199" 'cyear := }
2811 { year 'cyear := }
2812 if$
2813 year empty$
2814 { " " "2199" convert.year * field.or.null * }
2815 { " " year convert.year * field.or.null * }
2816 if$
2817 sortify 'sort.label :=
2818 % For debug
2819 econ.debug #0 = not
2820 { "sort.label = ``\texttt{" write$
2821 sort.label write$
2822 "}''\\" write$
2823 newline$
2824 }
2825 'skip$
2826 if$
2827 pop$
2828 }
2829
2830 FUNCTION {calc.sort.label.abb}
2831 { sortname empty$ not
2832 { sortname 's := }
2833 { author empty$ not
2834 { author 's := }
2835 { editor empty$ not
2836 { editor 's := }
2837 { "" }
2838 if$
2839 }
2840 if$
2841 }
2842 if$
2843 s sort.format.names.abb 't :=
2844 year empty$
2845 { t sortify " " * "2199" convert.year * 'sort.label.abb := }
2846 { t sortify " " * year convert.year * 'sort.label.abb := }
2847 if$
2848 econ.debug #0 = not
2849 { "sort.label.abb = ``\texttt{" write$
2850 sort.label.abb write$
2851 "}''\\" write$
2852 newline$
2853 }
2854 'skip$
2855 if$
2856 }
2857
2858 %%% flabel
2859 FUNCTION {calc.flabel}
2860 { type$ "book" =
2861 type$ "inbook" =
2862 or
2863 'author.editor.key.label.full
2864 { type$ "proceedings" =
2865 'editor.key.organization.label.full
2866 { type$ "manual" =
2867 'author.key.organization.label.full
2868 'author.key.label.full
2869 if$
2870 }
2871 if$
2872 }
2873 if$
2874 'flabel :=
2875 author empty$
2876 'skip$
2877 { author num.names$ 'numnames :=
2878 numnames bst.max.author.num >
2879 { alabel 'flabel := }
2880 'skip$
2881 if$
2882 }
2883 if$
2884 % For debug
2885 econ.debug #0 = not
2886 { "flabel = ``\texttt{" write$
2887 flabel write$
2888 "}''\\" write$
2889 newline$
2890 }
2891 'skip$
2892 if$
2893 }
2894
2895 %%% alabel
2896 FUNCTION {calc.alabel}
2897 { type$ "book" =
2898 type$ "inbook" =
2899 or
2900 'author.editor.key.label.abb
2901 { type$ "proceedings" =
2902 'editor.key.organization.label.abb
2903 { type$ "manual" =
2904 'author.key.organization.label.abb
2905 'author.key.label.abb
2906 if$
2907 }
2908 if$
2909 }
2910 if$
2911 'alabel :=
2912 % For debug
2913 econ.debug #0 = not
2914 { "alabel = ``\texttt{" write$
2915 alabel write$
2916 "}''\\" write$
2917 newline$
2918 }
2919 'skip$
2920 if$
2921 }
2922
2923 %%% title for sorting
2924 FUNCTION {sort.format.title}
2925 { 't :=
2926 "A " #2
2927 "An " #3
2928 "The " #4 t chop.word
2929 chop.word
2930 chop.word
2931 sortify
2932 #1 global.max$ substring$
2933 }
2934
2935 %%% author for sorting
2936 FUNCTION {author.sort}
2937 { author empty$
2938 { key empty$
2939 { "to sort, need author or key in " cite$ * warning$
2940 ""
2941 }
2942 { key sortify }
2943 if$
2944 }
2945 { author sort.format.names }
2946 if$
2947 }
2948
2949 %%% editor for sorting
2950 FUNCTION {author.editor.sort}
2951 { author empty$
2952 { editor empty$
2953 { key empty$
2954 { "to sort, need author, editor, or key in " cite$ * warning$
2955 ""
2956 }
2957 { key sortify }
2958 if$
2959 }
2960 { editor sort.format.names }
2961 if$
2962 }
2963 { author sort.format.names }
2964 if$
2965 }
2966
2967 FUNCTION {author.organization.sort}
2968 { author empty$
2969 { organization empty$
2970 { key empty$
2971 { "to sort, need author, organization, or key in " cite$ * warning$
2972 ""
2973 }
2974 { key sortify }
2975 if$
2976 }
2977 { "The " #4 organization chop.word sortify }
2978 if$
2979 }
2980 { author sort.format.names }
2981 if$
2982 }
2983
2984 FUNCTION {editor.organization.sort}
2985 { editor empty$
2986 { organization empty$
2987 { key empty$
2988 { "to sort, need editor, organization, or key in " cite$ * warning$
2989 ""
2990 }
2991 { key sortify }
2992 if$
2993 }
2994 { "The " #4 organization chop.word sortify }
2995 if$
2996 }
2997 { editor sort.format.names }
2998 if$
2999 }
3000
3001 %%% 1,...,9 -> 001,...,009
3002 %%% 10,...,99 -> 010,...,099
3003 FUNCTION {add.zero.to.number}
3004 { 's :=
3005 s text.length$ #1 =
3006 { "00" s * }
3007 { s text.length$ #2 =
3008 { "0" s * }
3009 { s }
3010 if$
3011 }
3012 if$
3013 }
3014
3015 %% entry type
3016 FUNCTION {bst.sort.entry.type.order}
3017 { 'item.type :=
3018 item.type "article" =
3019 { "01" }
3020 { item.type "book" =
3021 { "02" }
3022 { item.type "booklet" =
3023 { "03" }
3024 { item.type "comment" =
3025 { "04" }
3026 { item.type "conference" =
3027 { "05" }
3028 { item.type "inbook" =
3029 { "06" }
3030 { item.type "incollection" =
3031 { "07" }
3032 { item.type "inproceedings" =
3033 { "08" }
3034 { item.type "manual" =
3035 { "09" }
3036 { item.type "masterthesis" =
3037 { "10" }
3038 { item.type "misc" =
3039 { "11" }
3040 { item.type "phdthesis" =
3041 { "12" }
3042 { item.type "proceedings" =
3043 { "13" }
3044 { item.type "techreport" =
3045 { "14" }
3046 { item.type "unpublished" =
3047 { "15" }
3048 { "16" }
3049 if$
3050 }
3051 if$
3052 }
3053 if$
3054 }
3055 if$
3056 }
3057 if$
3058 }
3059 if$
3060 }
3061 if$
3062 }
3063 if$
3064 }
3065 if$
3066 }
3067 if$
3068 }
3069 if$
3070 }
3071 if$
3072 }
3073 if$
3074 }
3075 if$
3076 }
3077 if$
3078 }
3079
3080 %%% Create sort.key$: absorder -> author -> year -> order -> month -> title.
3081 FUNCTION {presort.one}
3082 {
3083 bst.no.sort #0 = not
3084 { order.cited int.to.str$ add.zero.to.number " " * }
3085 { "" }
3086 if$
3087 bst.sort.year #0 = not
3088 %% Use year field as the primary sorting key.
3089 { year convert.year * }
3090 'skip$
3091 if$
3092 bst.sort.entry.type #0 = not
3093 { type$ bst.sort.entry.type.order * " " * }
3094 'skip$
3095 if$
3096 absorder empty$
3097 { "/// " * }
3098 { bst.notuse.absorder.field #0 =
3099 { absorder "999" =
3100 { "zzz " * }
3101 { absorder add.zero.to.number "000" =
3102 { "/// " * }
3103 { absorder add.zero.to.number * " " * }
3104 if$
3105 }
3106 if$
3107 }
3108 { "/// " * }
3109 if$
3110 }
3111 if$
3112 " " *
3113 sort.label.abb *
3114 " " *
3115 type$ "book" = type$ "inbook" = or
3116 'author.editor.sort
3117 { type$ "proceedings" =
3118 'editor.organization.sort
3119 { type$ "manual" =
3120 'author.organization.sort
3121 'author.sort
3122 if$
3123 }
3124 if$
3125 }
3126 if$
3127 * " "
3128 order empty$
3129 { "/// " * }
3130 { bst.notuse.order.field #0 =
3131 { order "999" =
3132 { "zzz " * }
3133 { order add.zero.to.number "000" =
3134 { "/// " * }
3135 { order add.zero.to.number * " " * }
3136 if$
3137 }
3138 if$
3139 }
3140 { "/// " * }
3141 if$
3142 }
3143 if$
3144 month empty$
3145 { * "/// " * }
3146 { month "999" =
3147 { * month add.zero.to.number * "zzz " * }
3148 { month add.zero.to.number "000" =
3149 { * month add.zero.to.number * "/// " * }
3150 { * month add.zero.to.number * " " * }
3151 if$
3152 }
3153 if$
3154 }
3155 if$
3156 title field.or.null sort.format.title
3157 *
3158 #1 entry.max$ substring$
3159 'sort.key$ :=
3160 % For debug
3161 econ.debug #0 = not
3162 { "``\texttt{" write$
3163 sort.key$ write$
3164 "}''\\" write$
3165 newline$
3166 }
3167 'skip$
3168 if$
3169 }
3170
3171 FUNCTION {presort.two}
3172 {
3173 bst.no.sort #0 = not
3174 { order.cited int.to.str$ add.zero.to.number " " * }
3175 { "" }
3176 if$
3177 bst.sort.year #0 = not
3178 %% Use year field as the primary sorting key.
3179 { year convert.year * }
3180 'skip$
3181 if$
3182 bst.sort.entry.type #0 = not
3183 { type$ bst.sort.entry.type.order * " " * }
3184 'skip$
3185 if$
3186 absorder empty$
3187 { "/// " * }
3188 { bst.notuse.absorder.field #0 =
3189 { absorder "999" =
3190 { "zzz " * }
3191 { absorder add.zero.to.number "000" =
3192 { "/// " * }
3193 { absorder add.zero.to.number * " " * }
3194 if$
3195 }
3196 if$
3197 }
3198 { "/// " * }
3199 if$
3200 }
3201 if$
3202 " " * sort.label * " "
3203 order empty$
3204 { "/// " * }
3205 { bst.notuse.order.field #0 =
3206 { order "999" =
3207 { "zzz " * }
3208 { order add.zero.to.number "000" =
3209 { "/// " * }
3210 { order add.zero.to.number * " " * }
3211 if$
3212 }
3213 if$
3214 }
3215 { "/// " * }
3216 if$
3217 }
3218 if$
3219 month empty$
3220 { * "/// " * }
3221 { month "999" =
3222 { * month add.zero.to.number * "zzz " * }
3223 { month add.zero.to.number "000" =
3224 { * month add.zero.to.number * "/// " * }
3225 { * month add.zero.to.number * " " * }
3226 if$
3227 }
3228 if$
3229 }
3230 if$
3231 title field.or.null sort.format.title
3232 *
3233 #1 entry.max$ substring$
3234 'sort.key$ :=
3235 % For debug
3236 econ.debug #0 = not
3237 { "``\texttt{" write$
3238 sort.key$ write$
3239 "}''\\" write$
3240 newline$
3241 }
3242 'skip$
3243 if$
3244 }
3245
3246 %%% Codes for debugging
3247 FUNCTION {calc.alabel.mess}
3248 { econ.debug #0 = not
3249 { "\textbf{Iteration of calc.alabel: alabel = }\\" write$
3250 newline$ }
3251 'skip$
3252 if$
3253 }
3254 FUNCTION {calc.flabel.mess}
3255 { econ.debug #0 = not
3256 { "\textbf{Iteration of calc.flabel: flabel = }\\" write$
3257 newline$ }
3258 'skip$
3259 if$
3260 }
3261 FUNCTION {presort.one.mess}
3262 { econ.debug #0 = not
3263 { "\textbf{Iteration of presort (1st time): \$sort.key = }\\" write$
3264 newline$ }
3265 'skip$
3266 if$
3267 }
3268
3269 FUNCTION {presort.two.mess}
3270 { econ.debug #0 = not
3271 { "\textbf{Iteration of presort (2nd time): \$sort.key = }\\" write$
3272 newline$ }
3273 'skip$
3274 if$
3275 }
3276
3277 FUNCTION {calc.cyear.mess}
3278 { econ.debug #0 = not
3279 { "\textbf{Iteration of calc.cyear: sort.label = }\\" write$
3280 newline$ }
3281 'skip$
3282 if$
3283 }
3284
3285 FUNCTION {calc.sort.label.abb.mess}
3286 { econ.debug #0 = not
3287 { "\textbf{Iteration of calc.sort.label.abb: sort.label.abb = }\\" write$
3288 newline$ }
3289 'skip$
3290 if$
3291 }
3292
3293 %%% alabel
3294 EXECUTE {calc.alabel.mess}
3295 ITERATE {calc.alabel}
3296
3297 %%% flabel
3298 EXECUTE {calc.flabel.mess}
3299 ITERATE {calc.flabel}
3300
3301 %%% cyear and sort.label
3302 EXECUTE {calc.cyear.mess}
3303 ITERATE {calc.cyear}
3304
3305 %%%
3306 EXECUTE {calc.sort.label.abb.mess}
3307 ITERATE {calc.sort.label.abb}
3308
3309 %%% Sorting by $sort.key (first time)
3310 %
3311 % Sorting is done in two times. This is the first time.
3312 %
3313 EXECUTE {presort.one.mess}
3314 ITERATE {presort.one}
3315 SORT
3316
3317 FUNCTION {forward.pass}
3318 { bst.use.bysame #0 = bst.use.bysame #2 = or
3319 % Not use \bysame
3320 { last.sort.label sort.label.abb =
3321 { last.extra.num #1 + 'last.extra.num :=
3322 last.extra.num int.to.chr$ 'extra.label :=
3323 }
3324 { "a" chr.to.int$ 'last.extra.num :=
3325 "" 'extra.label :=
3326 sort.label.abb 'last.sort.label :=
3327 }
3328 if$
3329 }
3330 % Use \bysame
3331 { last.sort.label sort.label.abb =
3332 { last.extra.num #1 + 'last.extra.num :=
3333 last.extra.num int.to.chr$ 'extra.label :=
3334 }
3335 { "a" chr.to.int$ 'last.extra.num :=
3336 "" 'extra.label :=
3337 sort.label.abb 'last.sort.label :=
3338 }
3339 if$
3340 author empty$
3341 { editor empty$
3342 { "" }
3343 'format.editors.alt
3344 if$
3345 }
3346 'format.authors.alt
3347 if$
3348 'this.author :=
3349 % format.names 'this.author :=
3350 this.author prev.author =
3351 { "bysame" 'extra.label.bysame := }
3352 { this.author "" =
3353 { "abcxyz" }
3354 'this.author
3355 if$
3356 'prev.author :=
3357 }
3358 if$
3359 }
3360 if$
3361 }
3362
3363 FUNCTION {reverse.pass}
3364 { next.extra "b" =
3365 { "a" 'extra.label := }
3366 'skip$
3367 if$
3368 extra.label empty$ not
3369 { cyear extra.label * }
3370 { cyear "" * }
3371 if$
3372 "" field.or.null *
3373 'cyear :=
3374 extra.label 'next.extra :=
3375 }
3376
3377 %%% \bysame
3378 ITERATE {forward.pass}
3379
3380 REVERSE {reverse.pass}
3381
3382 %%% Sorting by sort.key$ (second time)
3383 EXECUTE {presort.two.mess}
3384 ITERATE {presort.two}
3385 SORT
3386
3387 FUNCTION {reset.prev.author}
3388 { "xxyyzz" 'prev.author := }
3389
3390 EXECUTE {reset.prev.author}
3391
3392 FUNCTION {forward.pass.two}
3393 { bst.use.bysame #1 =
3394 { author empty$
3395 { editor empty$
3396 { "" }
3397 'format.editors.alt
3398 if$
3399 }
3400 'format.authors.alt
3401 if$
3402 'this.author :=
3403 this.author prev.author =
3404 { "bysame" 'extra.label.bysame := }
3405 { this.author "" =
3406 { "abcxyz" }
3407 'this.author
3408 if$
3409 'prev.author :=
3410 }
3411 if$
3412 }
3413 'skip$
3414 if$
3415 }
3416
3417 ITERATE {forward.pass.two}
3418
3419 FUNCTION{punctuation}
3420 {
3421 "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$
3422 "% This bbl file is created by " econ.file * " ver." * econ.version * write$ newline$
3423 "% The latest " econ.file * " is available at " * write$ newline$
3424 "% <https://github.com/ShiroTakeda/econ-bst>" write$ newline$ newline$
3425 }
3426
3427 EXECUTE {punctuation}
3428
3429 FUNCTION {begin.bib}
3430 {
3431 preamble$ empty$
3432 'skip$
3433 { preamble$ write$ newline$ }
3434 if$
3435 bst.use.bysame #0 =
3436 % Not use \bysame.
3437 'skip$
3438 % Use \bysame.
3439 { "%%% Definition of \bysame" write$ newline$
3440 "\ifx\undefined\bysame" write$ newline$
3441 "\newcommand{\bysame}{" bst.bysame.definition * "}" *
3442 write$ newline$
3443 "\fi" write$ newline$ newline$ }
3444 if$
3445 %% When number index is attached to the beginning of each item.
3446 bst.use.number.index #0 =
3447 'skip$
3448 { bst.number.index.digit "1" =
3449 % one digit.
3450 { bst.number.index.bibhang.one }
3451 { bst.number.index.digit "2" =
3452 % two digits.
3453 { bst.number.index.bibhang.ten }
3454 % three or more digits.
3455 { bst.number.index.bibhang.hund }
3456 if$
3457 }
3458 if$
3459 'hang :=
3460 "%%% Redefinition of \bibhang" write$ newline$
3461 "\ifx\undefined\bibhang" write$ newline$
3462 "\relax" write$ newline$
3463 "\else" write$ newline$
3464 "\setlength{\bibhang}{"
3465 hang * "}" * write$ newline$
3466 "\fi" write$ newline$ newline$
3467 }
3468 if$
3469 "\begin{thebibliography}{xxx}" write$ newline$
3470
3471 %% Initialize the variable `index'.
3472 #0 'index :=
3473 }
3474
3475 FUNCTION {end.bib}
3476 { newline$ "\end{thebibliography}" write$ newline$ }
3477
3478 EXECUTE {begin.bib}
3479
3480 EXECUTE {init.state.consts}
3481
3482 ITERATE {call.type$}
3483
3484 EXECUTE {end.bib}
3485
3486 % --------------------
3487 % Local Variables:
3488 % fill-column: 78
3489 % coding: utf-8
3490 % mode: bibtex-style
3491 % End: