Debian Codegraph @

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

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