Debian Codegraph @

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

raw
1 %% 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 %% Main features of econ.bst.
24
25 % "econ.bst" is a BibTeX style file for economics. It provides the following
26 % features:
27
28 % 1) The author-year type citation (you need "natbib.sty" as well).
29 % 2) Reference style used in economics papers ("econ.bst" is not a BibTeX style
30 % for a specific journal).
31 % 3) Highly customizable. You can easily customize reference style as you wish.
32 % 4) You can use "certified random order" proposed by Ray ⓡ Robson (2018)
33 % (http://dx.doi.org/10.1257/aer.20161492).
34
35 % Bug reports, requests and suggestions are welcome.
36
37 % For changelogs, see CHANGES.txt file.
38
39 % version number
40 FUNCTION {econ.version} { "3.3" }
41
42 % File name
43 FUNCTION {econ.file} { "econ.bst" }
44
45 % Debug mode. Non-zero makes debug mode on.
46 FUNCTION {econ.debug}
47 { #0 } % Debug mode off (default).
48 % { #1 } % Debug mode on.
49
50
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 %% Explanation of terms used in this program
53
54 %% [Entry]
55 %% An entry is a single document in the reference. The "entry type" refers to
56 %% the type of document, such as an article or a book.
57
58 %% [Field]
59 %% Field is the title, author, year, etc. specified in an entry.
60
61 %% [Citation keyword]
62 %% The "citation keyword" is a set of characters specified in each entry. This
63 %% is the argument of the "\cite" command.
64
65
66 ENTRY
67 %%% Declaration of field
68 { access address author booktitle chapter doi edition editor howpublished
69 institution journal key month note number organization pages publisher
70 school series title type url volume year
71 % Fields specific to econ.bst
72 order absorder nameorder sortname
73 }
74
75 % Definition of entry variable. The entry variable is a variable which has
76 % different values according to different entries.
77 %% Integer entry variable:
78 { order.cited }
79
80 %% String entry variable
81 { label cyear flabel alabel extra.label sort.label sort.label.abb
82 extra.label.bysame nameorder.temp jname }
83
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85 %%
86 %% Functions for customization:
87 %%
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89
90 % Use \bysame or not.
91 %
92 % If set to #0, \bysame is not used.
93 % If set to #1, \bysame is used
94 % If set to #2, \bysame is used (alternative abbreviation style).
95 %
96 % Note that integer number is expressed as # + integer in bst file.
97 % \bysame is the function that abbreviates succession of the same authors' name by ---.
98 %
99 % See econ-sample.pdf for details.
100 %
101 FUNCTION {bst.use.bysame}
102 % { #0 } % Not use \bysame
103 { #1 } % -> Use \bysame (default)
104 % { #2 } % -> Use \bysame of alternative style.
105
106 % The definition of \bysame command.
107 %
108 FUNCTION {bst.bysame.definition}
109 { "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default)
110 % { "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this.
111
112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113
114 % The order of fist and last name.
115 %
116 FUNCTION {bst.author.name}
117 { #0 } % (default)
118 % { #1 }
119 % { #2 }
120
121 % Case of #0: First author -> last-first, other authors -> first-last.
122 % Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables.
123
124 % Case of #1: All authors -> last-first
125 % Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J.
126
127 % Case of #2: All authors -> first-last
128 % Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables.
129
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131
132 % Abbreviate first name of authors (editors):
133 %
134 FUNCTION {bst.first.name.initial}
135 { #0 } % #0 -> full letters (default).
136 % { #1 } % Non-zero -> initial letter only.
137
138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139
140 % Decapitalize of strings in title field.
141 %
142 FUNCTION {bst.title.lower.case}
143 { #0 } % If #0, not decapitalize title (default).
144 % { #1 } % If non-#0, decapitalize title
145
146 % Hide title filed.
147 %
148 FUNCTION {bst.hide.title}
149 { #0 } % #0 -> Title field is displayed (default)
150 % { #1 } % Non-zer -> Title field is hidden
151
152 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
153
154 % Hide month.
155 %
156 FUNCTION {bst.hide.month}
157 { #0 } % #0 -> show month field (default).
158 % { #1 } % non-#0 -> hide month field.
159
160 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161
162 % Attach number index like plain.bst.
163 %
164 FUNCTION {bst.use.number.index}
165 { #0 } % Not use number index (default).
166 % { #1 } % Non-#0 -> Use number index
167
168 % The string before number index:
169 %
170 FUNCTION {bst.number.index.pre}
171 { "[" } % (default)
172
173 % The string after number index. Adjustment is recommended.
174 %
175 FUNCTION {bst.number.index.post}
176 { "]\hskip1.0em " } % (default)
177
178 % Maximum digit of number index:
179 % If the number of reference items >= 100, set 3 to this function.
180 % If the number of reference items < 100, set 2 to this function.
181 % If the number of reference items < 10, set 1 to this function.
182 %
183 FUNCTION {bst.number.index.digit}
184 { "2" } % (default)
185 % { "3" }
186
187 % The functions below are used to adjust space and postion. If you use fonts
188 % other than computer modern fonts, you had better make adjustments.
189 %
190 % Setting for bst.number.index.digit = 1:
191 FUNCTION {bst.number.index.bibhang.one}
192 { "2.05em" } % (default)
193 % Setting for bst.number.index.digit = 2:
194 FUNCTION {bst.number.index.bibhang.ten}
195 { "2.55em" } % (default)
196 % Setting for bst.number.index.digit = 3:
197 FUNCTION {bst.number.index.bibhang.hund}
198 { "3.05em" } % (default).
199
200 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
201
202 % Position of "year":
203 %
204 % You can choose the position of year by this function.
205 %
206 % If set to #0, year is placed right after "author".
207 % If set to non-zero, year is placed at the end (before note field) except for
208 % aritcle type entry.
209 %
210 % In article type entry, the position of year changes according to the
211 % following rule:
212 %
213 % #1 -> year is placed at the end.
214 % #2 -> year is placed after journal name in aritcle type entry.
215 % #3 -> year is placed after volume in aritcle type entry.
216 %
217 FUNCTION {bst.year.position}
218 { #0 } % (default).
219 % { #1 } % Last place before note.
220 % { #2 } % After journal name for aticle type entry.
221 % { #3 } % After volume for aticle type entry.
222
223 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
224
225 % If 0, references are sorted by old documents -> recent documents. If
226 % non-zero, reverse order.
227 FUNCTION {bst.reverse.year}
228 { #0 } % Normal order (old -> recent) (default).
229 % { #1 } % inverse order (recent -> old)
230
231 % If non-zero, sort references by using year field as the primary key
232 % (chronological sorting).
233 FUNCTION {bst.sort.year}
234 { #0 } % Normal case: year is used as the sorting key next to author (default).
235 % { #1 } % year is used as the primary sorting key.
236
237
238 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
239
240 % If non-zero, references are listed in citation order.
241 %
242 FUNCTION {bst.no.sort}
243 { #0 } % (default)
244 % { #1 } % listed in citation order.
245
246 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
247
248 % Non-zero -> sort references by entry type (article, book, incollection etc.)
249 %
250 FUNCTION {bst.sort.entry.type}
251 { #0 } % #0 -> Normal (not sort references by entry type) (default).
252 % { #1 } % Non-zero -> sort references by entry type.
253
254 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
255
256 % 0 -> use absorder field to sort items. Otherwise, ignore absorder field.
257 %
258 FUNCTION {bst.notuse.absorder.field}
259 { #0 } % #0 -> Use absorder (default).
260 % { #1 } % Non-#0 -> Not use absorder.
261 %
262 % Order of priority to sort items
263 %
264 % absorder -> author -> year -> order -> month -> title
265 %
266 % wehre absorder and order fields are specific to econ.bst.
267
268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
269
270 % 0 -> use order field to sort items. Otherwise, ignore order field.
271 % Note: order field is specific to econ.bst.
272 FUNCTION {bst.notuse.order.field}
273 { #0 } % #0 -> Use order field (default).
274 % { #1 } % Non-#0 -> not use order field.
275
276 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
277 %%% and
278
279 %%% String used to separate author names in references.
280 %
281 % String replaced with _ in "Mr. A _ Mr. B "
282 %
283 FUNCTION {bst.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 " } % (default)
306
307 %%% If you want to use random author order for some bibliography entries, set
308 % non-zero to this function.
309 %
310 FUNCTION {bst.use.nameorder}
311 { #1 } % Use random order (default)
312 % { #0 } % Not use random order
313
314 %%% String used to separate author names in references for the entry of random
315 % author order.
316 %
317 FUNCTION {bst.and.nameorder}
318 { " \textcircled{r} " } % (default)
319
320 %%% String used to separate author names in citation part for the entry of
321 % random author order
322 %
323 FUNCTION {bst.cite.and.nameorder}
324 { " \textcircled{r} " } % (default)
325
326
327 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
328
329 % Author names in the citation part are abbreviated by et al. if the number of
330 % authors is greater or equal to bst.and.others.num.
331 FUNCTION {bst.and.others.num}
332 { #3 } % If the number of authors is greater or equal to three (default).
333
334 % If the number of authors is greater than N1, only the first N2 authors are
335 % displayed in the reference part (and other authors' names are omitted by "et
336 % al".
337 %
338 % The following function determines the value of N1.
339 FUNCTION {bst.max.author.num}
340 { #8 } % (default).
341
342 % The following function determines the value of N2.
343 FUNCTION {bst.max.author.num.display}
344 { #3 } % (default).
345
346
347 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
348
349 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350
351 % Strings used when abbreviating multiple-authors in citation part.
352 FUNCTION {bst.and.others}
353 { " et~al." } % (default)
354
355 % Strings used when abbreviating multiple-authors in citation part for entries
356 % with random author order.
357 FUNCTION {bst.and.others.nameorder}
358 { " \textcircled{r}~al." } % (default)
359
360 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361 % author
362
363 % The string before author:
364 %
365 FUNCTION {bst.author.pre}
366 { "" } % (default)
367
368 % The string after author:
369 %
370 FUNCTION {bst.author.post}
371 { "" } % (default)
372
373 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
374 % year
375
376 % The string before year only for aritcle type entry.
377 %
378 FUNCTION {bst.year.pre}
379 { " (" } % (default)
380
381 % The string after year only for aritcle type entry.
382 %
383 FUNCTION {bst.year.post}
384 { ") " } % (default)
385
386 % The string after year for non-article type entry (book, incollection etc)
387 %
388 FUNCTION {bst.year.na.pre}
389 { " (" } % (default)
390
391 % The string after year for non-article type entry (book, incollection etc)
392 %
393 FUNCTION {bst.year.na.post}
394 { ") " } % (default)
395
396 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
397 % title (except for title in book)
398
399 % The string before title:
400 %
401 FUNCTION {bst.title.pre}
402 { "``" } % (default)
403
404 % The string after title:
405 %
406 FUNCTION {bst.title.post}
407 { ",''" } % (default)
408
409 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
410 % tile for book:
411
412 % The string before book title:
413 %
414 FUNCTION {bst.book.pre}
415 { " \textit{" } % (default)
416
417 % The string after book title:
418 %
419 FUNCTION {bst.book.post}
420 { "}," } % (default)
421
422 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
423 % booktitle
424
425 % The string before booktitle:
426 %
427 FUNCTION {bst.btitle.pre}
428 { " \textit{" } % (default)
429
430 % The string after booktitle:
431 %
432 FUNCTION {bst.btitle.post}
433 { "}," } % (default)
434
435 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
436 % journal name
437
438 % The string before journal name:
439 %
440 FUNCTION {bst.journal.pre}
441 { " \textit{" } % (default)
442
443 % The string after journal name:
444 %
445 FUNCTION {bst.journal.post}
446 { "}" } % (default)
447
448 % Use the abbreviated journal name
449 %
450 % If set to #0, do not use abbreviated journal name.
451 % If set to non-#0, use abbreviated journal name.
452 %
453 FUNCTION {bst.journal.name.abb}
454 { #0 } % (default)
455
456 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
457 % editor notation:
458
459 % The string that indicates multiple editors:
460 %
461 FUNCTION {bst.editors}
462 { " eds. " } % (default)
463
464 % The string that indicates single editor:
465 %
466 FUNCTION {bst.editor}
467 { " ed. " } % (default)
468
469 % Order of editor and booktitle in incollection and inproceedings entries.
470 %
471 % If set to #0: editors -> booktitle order
472 % If set to non-zero: booktitle -> editors order
473 %
474 FUNCTION {bst.editor.btitle.order}
475 { #0 } % (default)
476
477 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
478 % edition
479
480 % The string before edition:
481 %
482 FUNCTION {bst.edition.pre}
483 { ", " } % (default)
484
485 % The string after edition:
486 %
487 FUNCTION {bst.edition.post}
488 { " edition" } % (default)
489
490 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
491 % volume
492
493 % The string before volume:
494 %
495 FUNCTION {bst.volume.pre}
496 { ", " } % (default)
497
498 % The string after volume:
499 %
500 FUNCTION {bst.volume.post}
501 { "" } % (default)
502
503 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
504 % volume for book
505
506 % The string before volume in book:
507 %
508 FUNCTION {bst.bvolume.pre}
509 { ", Vol.~" } % (default)
510
511 % The string after volume in book
512 %
513 FUNCTION {bst.bvolume.post}
514 { "" } % (default)
515
516 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
517 % number
518
519 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520
521 % Hide number. If non-zero, number is suppressed.
522 FUNCTION {bst.hide.number}
523 { #0 } % #0 -> show number field (default)
524 % { #1 } % non-#0 -> Hide number field.
525
526 % The string before number:
527 %
528 FUNCTION {bst.number.pre}
529 { " (" } % (default)
530
531 % The string after number:
532 %
533 FUNCTION {bst.number.post}
534 { ")" } % (default)
535
536 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
537 % in
538
539 % In
540 %
541 FUNCTION {bst.in}
542 { " in " } % (default)
543
544 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
545 % page
546
547 % The string before page (multiple pages):
548 %
549 FUNCTION {bst.pages.pre}
550 { ", " } % (default)
551
552 % The string before page:
553 %
554 FUNCTION {bst.page.pre}
555 { ", " } % (default)
556
557 % The string after page (multiple pages):
558 %
559 FUNCTION {bst.pages.post}
560 { "" } % (default)
561
562 % The string after page:
563 %
564 FUNCTION {bst.page.post}
565 { "" } % (default)
566
567 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
568 % chapter
569
570 % The string before chapter:
571 %
572 FUNCTION {bst.chapter.pre}
573 { ", Chap." } % (default)
574
575 % The string after chapter:
576 %
577 FUNCTION {bst.chapter.post}
578 { "" } % (default)
579
580 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
581 % month
582
583 % The string before month:
584 %
585 FUNCTION {bst.month.pre}
586 { ", " } % (default)
587
588 % The string after month:
589 %
590 FUNCTION {bst.month.post}
591 { "" } % (default)
592
593 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
594 % address
595 % The string before address:
596 %
597 FUNCTION {bst.address.pre}
598 { ", " } % (default)
599
600 % The string after address:
601 %
602 FUNCTION {bst.address.post}
603 { "" } % (default)
604
605 % You can choose the order of address and publisher by this function.
606 %
607 % If #0, address -> publisher order (the default value).
608 % If non-zero, publisher -> address order.
609
610 FUNCTION {bst.address.position}
611 { #0 } % Address is placed before publisher (default)
612 % { #1 } % Address is placed after publisher
613
614 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
615 % publisher
616
617 % The string before publisher:
618 %
619 FUNCTION {bst.publisher.pre}
620 { ": " } % (default)
621
622 % The string after publisher:
623 %
624 FUNCTION {bst.publisher.post}
625 { "" } % (default)
626
627 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
628 % series
629
630 % The string before series:
631 %
632 FUNCTION {bst.series.pre}
633 { ", " } % (default)
634
635 % The string after series:
636 %
637 FUNCTION {bst.series.post}
638 { "" } % (default)
639
640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
641 % organization
642
643 % The string before organization:
644 %
645 FUNCTION {bst.organization.pre}
646 { ", " } % (default)
647
648 % The string after organization:
649 %
650 FUNCTION {bst.organization.post}
651 { "" } % (default)
652
653 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
654 % school
655
656 % The string before school:
657 %
658 FUNCTION {bst.school.pre}
659 { ", " } % (default)
660
661 % The string after school:
662 %
663 FUNCTION {bst.school.post}
664 { "" } % (default)
665
666 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
667 % institution
668
669 % The string before institution:
670 %
671 FUNCTION {bst.institution.pre}
672 { ", " } % (default)
673
674 % The string after institution:
675 %
676 FUNCTION {bst.institution.post}
677 { "" } % (default)
678
679 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
680 % howpublished
681
682 % The string before howpublished:
683 %
684 FUNCTION {bst.howpublished.pre}
685 { " " } % (default)
686
687 % The string after howpublished:
688 %
689 FUNCTION {bst.howpublished.post}
690 { "" } % (default)
691
692 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
693 % url
694
695 % Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed.
696 FUNCTION {bst.show.url}
697 { #1 } % non-#0 -> Show url field (default)
698 % { #0 } % #0 -> Not show url field.
699
700 % The string before url:
701 %
702 FUNCTION {bst.url.pre}
703 { ", \urlstyle{tt}\url{" } % (default)
704
705 % The string after url:
706 %
707 FUNCTION {bst.url.post}
708 { "}" } % (default)
709
710
711 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
712 % Access
713
714 % This setting is valid only if there are "access" field in bib
715 % files. The value of access field indicates accessed date for URL.
716
717 % The string before access.
718 FUNCTION {bst.access.pre}
719 { ", accessed on " } % (default)
720
721 % The string after access.
722 FUNCTION {bst.access.post}
723 { "" } % (default)
724
725 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
726 % DOI (digital object identifier)
727
728 % This setting is valid only if there are "doi" field in bib files.
729
730 % Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed.
731 FUNCTION {bst.show.doi}
732 { #1 } % non-#0 -> Show DOI field (default)
733 % { #0 } % #0 -> Not show DOI field.
734
735 % The string before DOI:
736 %
737 FUNCTION {bst.doi.pre}
738 { ", \href{https://doi.org/" doi * "}{\urlstyle{tt}\nolinkurl{" * } % (default)
739
740 % The string after DOI:
741 %
742 FUNCTION {bst.doi.post}
743 { "}}" } % (default)
744
745 % How to show URL and DOI fields when both fields exist.
746 %
747 % #0 -> Both fields are displayed
748 % #1 -> Only URL field is displayed
749 % #2 -> Only DOI field is displayed
750 %
751 FUNCTION {bst.url.doi}
752 % { #0 } % -> Both fields are displayed
753 % { #1 } % -> Only URL field is displayed
754 { #2 } % (default) --> Only DOI field is displayed
755
756 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
757 % Other functions:
758
759 % The string before note.
760 FUNCTION {bst.note.pre}
761 { ", " } % (default)
762
763 % The string after note.
764 FUNCTION {bst.note.post}
765 { "" } % (default)
766
767 % The string that represents Technical report:
768 %
769 FUNCTION {bst.techrep}
770 { ", Technical Report" } % (default)
771
772 % The string that represents master thesis:
773 %
774 FUNCTION {bst.mthesis}
775 { ", Master's thesis" } % (default)
776
777 % The string that represents phd thesis:
778 %
779 FUNCTION {bst.phdthesis}
780 { ", Ph.D. dissertation" } % (default)
781
782 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
783 %%
784 %% Functions for customization end here:
785 %%
786 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
787
788 FUNCTION {bst.first}
789 { "1st" }
790
791 FUNCTION {bst.second}
792 { "2nd" }
793
794 FUNCTION {bst.third}
795 { "3rd" }
796
797 FUNCTION {bst.fourth}
798 { "4th" }
799
800 FUNCTION {bst.fifth}
801 { "5th" }
802
803 FUNCTION {bst.st}
804 { "st" }
805
806 FUNCTION {bst.nd}
807 { "nd" }
808
809 FUNCTION {bst.rd}
810 { "rd" }
811
812 FUNCTION {bst.th}
813 { "th" }
814
815 %%%%% memo by Takeda
816
817 % "a" 'b := indicates substituting string "a" for variable b.
818
819 % Integer number #0, #1,...
820
821 %%% Function definition:
822 %
823 % FUNCTION {name}
824 % { 's :=
825 %
826 % }
827 %
828 % This is the definition of a function named "name". The function "name" is
829 % used in the following way
830 %
831 % "foo" name
832 % "foo" is an argument for the function "name".
833 %
834 % About the definition of a function with more than two arguments, see the
835 % definition of "chop.word".
836
837 %%% Declaration of variables:
838
839 %% String global variables:
840 STRINGS { s t tt }
841 STRINGS { year.num }
842 STRINGS { preone preten }
843 STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author }
844 STRINGS { hang }
845 STRINGS { item.type }
846 STRINGS { tempa tempb }
847
848 %% Integer global variables:
849 INTEGERS { nameptr namesleft numnames name.num numtrunc }
850 INTEGERS { multiresult }
851 INTEGERS { index }
852 INTEGERS { len }
853 INTEGERS { last.extra.num }
854 INTEGERS { output.state before.all mid.sentence after.sentence after.block }
855 INTEGERS { last.period.comma }
856 INTEGERS { len1.aer len2.aer i.aer }
857
858 % output.state
859 % -> This is a variable that holds which location in a single bibliography entry.
860 % -> before.all or mid.sentence
861
862 %%% Definition of functions:
863 FUNCTION {not}
864 { { #0 }
865 { #1 }
866 if$
867 }
868
869 FUNCTION {and}
870 { 'skip$
871 { pop$ #0 }
872 if$
873 }
874
875 FUNCTION {or}
876 { { pop$ #1 }
877 'skip$
878 if$
879 }
880
881 %%% Initialize variables:
882 FUNCTION {init.state.consts}
883 { #0 'before.all :=
884 #1 'mid.sentence :=
885 #2 'after.sentence :=
886 #3 'after.block :=
887 }
888
889 %%% Remove comma and add period:
890 %
891 FUNCTION {add.period.x}
892 { duplicate$ 't :=
893 t #-1 #1 substring$ "," =
894 { #-2 global.max$ substring$ "." * }
895 { t #-1 #2 substring$ ". " =
896 { #-3 global.max$ substring$ "." * }
897 { t #-1 #2 substring$ ", " =
898 { #-3 global.max$ substring$ "." * }
899 { t #-1 #2 substring$ ",'" =
900 { #-3 global.max$ substring$ ".'" * }
901 { t #-1 #2 substring$ ".'" =
902 { #-3 global.max$ substring$ ".'" * }
903 { t #-1 #2 substring$ ".~" =
904 { #-3 global.max$ substring$ ".~" * }
905 { t #-1 #2 substring$ ",~" =
906 { #-3 global.max$ substring$ ".~" * }
907 { t #-1 #3 substring$ ",''" =
908 { #-4 global.max$ substring$ ".''" * }
909 { t #-1 #3 substring$ ".''" =
910 { #-4 global.max$ substring$ ".''" * }
911 { t #-1 #2 substring$ ": " =
912 { #-3 global.max$ substring$ "." * }
913 { add.period$ }
914 if$
915 }
916 if$
917 }
918 if$
919 }
920 if$
921 }
922 if$
923 }
924 if$
925 }
926 if$
927 }
928 if$
929 }
930 if$
931 }
932 if$
933 }
934
935 %%% If the last character is period or comma, set non-zero to
936 %%% last.period.comma.
937 FUNCTION {last.period.comma.p}
938 { duplicate$ 't :=
939 t #-1 #1 substring$ "." =
940 t #-1 #1 substring$ "," = or
941 t #-1 #2 substring$ ". " = or
942 t #-1 #2 substring$ ", " = or
943 t #-1 #2 substring$ ".'" = or
944 t #-1 #2 substring$ ",'" = or
945 t #-1 #3 substring$ ".''" = or
946 t #-1 #3 substring$ ",''" = or
947 t #-1 #2 substring$ ".~" = or
948 t #-1 #2 substring$ ",~" = or
949 t #-1 #1 substring$ ":" = or
950 t #-1 #2 substring$ ": " = or
951 t #-1 #2 substring$ ".}" = or
952 t #-1 #2 substring$ ",}" = or
953 { #1 'last.period.comma := }
954 { #0 'last.period.comma := }
955 if$
956 }
957
958 %%% remove comma
959 % A function that removes the period or comma at the beginning of a field.
960 FUNCTION {remove.pre.comma}
961 { 's :=
962 s #1 #1 substring$ "," =
963 { s #2 global.max$ substring$ }
964 { s #1 #1 substring$ "." =
965 { s #2 global.max$ substring$ }
966 { s #1 #1 substring$ ":" =
967 { s #2 global.max$ substring$ }
968 's
969 if$
970 }
971 if$
972 }
973 if$
974 }
975
976 FUNCTION {output.field}
977 { 's :=
978 output.state mid.sentence =
979 % mid.sentence
980 { last.period.comma.p % Check whether the last of the previous field is
981 % period or comma -> Assign to the variable
982 % last.period.comma.
983 write$ } % Write the contents of the previous field.
984 % not mid.sentence
985 { output.state before.all =
986 % before.all
987 'write$ % Write the contents of the previous field.
988 % not before.all
989 'skip$ % This line is never executed.
990 if$
991 mid.sentence 'output.state :=
992 }
993 if$
994 last.period.comma #0 =
995 % The last character in the field before the one is not a period or comma.
996 { s }
997 % The last character in the field before the one is a period or comma.
998 { s remove.pre.comma }
999 if$
1000 }
1001
1002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1003 %%% Format in bbl file:
1004
1005 % \harvarditem[Brezis et~al.]{Brezis, Krugman and
1006 % Tsiddon}{1993}{brezis93:_leapf_inter_compet}
1007 % Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in
1008 % International Competition: A Theory of Cycles in National Technological
1009 % Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp.
1010 % 1211--1219.
1011
1012 % \harvarditem[abbreviated citation]{full citation}{year}{keyword} ...
1013
1014 %%% Add period and newline.
1015 FUNCTION {fin.entry}
1016 { add.period.x
1017 write$
1018 newline$
1019 }
1020
1021 FUNCTION {field.or.null}
1022 { duplicate$ empty$
1023 { pop$ "" }
1024 'skip$
1025 if$
1026 }
1027
1028 %%% booktitle
1029 FUNCTION {format.btitle}
1030 { booktitle empty$
1031 { "" }
1032 { bst.btitle.pre booktitle * bst.btitle.post * }
1033 if$
1034 }
1035
1036 FUNCTION {journal.name.sub}
1037 { 't :=
1038 t #1 #4 substring$ "The " =
1039 % Use #30 to handle with the long journal name.
1040 { t #5 #30 substring$ 't := }
1041 'skip$
1042 if$
1043 t
1044 }
1045
1046 FUNCTION {format.journal.name.abb}
1047 { journal 's :=
1048 journal 'jname :=
1049 s journal.name.sub 's :=
1050 bst.journal.name.abb #0 =
1051 'skip$
1052 {
1053 s "Academic Management Review" =
1054 { "Acad. Manage. J." 'jname := }
1055 'skip$
1056 if$
1057 }
1058 if$
1059 jname
1060 }
1061
1062 %%% Remove commas in the cases like "?." and "?,".
1063 FUNCTION {remove.irrelevant.period.comma}
1064 { 's :=
1065 s empty$
1066 { "" }
1067 { s #-1 #3 substring$ "?,'" =
1068 s #-1 #3 substring$ "?.'" = or
1069 { s #-3 global.max$ substring$ "'" * }
1070 { s #-1 #4 substring$ "?,''" =
1071 s #-1 #4 substring$ "?.''" = or
1072 { s #-4 global.max$ substring$ "''" * }
1073 { s #-1 #2 substring$ "?," =
1074 s #-1 #2 substring$ "?." = or
1075 { s #-2 global.max$ substring$ "" * }
1076 { s #-1 #3 substring$ "?,~" =
1077 s #-1 #3 substring$ "?.~" = or
1078 { s #-4 global.max$ substring$ "?~" * }
1079 { s #-1 #3 substring$ ".}." =
1080 { s #-3 global.max$ substring$ "}" * }
1081 's
1082 if$
1083 }
1084 if$
1085 }
1086 if$
1087 }
1088 if$
1089 }
1090 if$
1091 }
1092 if$
1093 }
1094
1095 %%% journal
1096 FUNCTION {format.output.journal}
1097 { journal empty$
1098 'skip$
1099 { bst.journal.pre format.journal.name.abb * bst.journal.post * 'jname :=
1100 jname remove.irrelevant.period.comma output.field }
1101 if$
1102 }
1103
1104 FUNCTION {format.output.book}
1105 { title empty$
1106 { "there's no title in " cite$ * warning$ }
1107 { bst.hide.title #0 = not
1108 'skip$
1109 { bst.book.pre title * bst.book.post * output.field }
1110 if$
1111 }
1112 if$
1113 }
1114
1115 FUNCTION {format.output.url}
1116 { type$ "online" = bst.show.url or
1117 { bst.url.pre url * bst.url.post *
1118 access empty$
1119 { "" * output.field }
1120 { bst.access.pre * access * bst.access.post * output.field }
1121 if$
1122 }
1123 'skip$
1124 if$
1125 }
1126
1127 FUNCTION {format.output.doi}
1128 { bst.show.doi
1129 { bst.doi.pre doi * bst.doi.post * output.field }
1130 'skip$
1131 if$
1132 }
1133
1134 FUNCTION {format.output.url.doi}
1135 { url empty$
1136 { doi empty$
1137 'skip$
1138 { format.output.doi }
1139 if$
1140 }
1141 { doi empty$
1142 { format.output.url }
1143 { bst.url.doi #0 =
1144 { format.output.url
1145 format.output.doi }
1146 { bst.url.doi #1 =
1147 { format.output.url }
1148 { format.output.doi }
1149 if$
1150 }
1151 if$
1152 }
1153 if$
1154 }
1155 if$
1156 }
1157
1158 %%% and others
1159 FUNCTION {bst.and.others.output}
1160 { nameorder.temp "random" =
1161 bst.use.nameorder #0 = not and
1162 { bst.and.others.nameorder }
1163 { bst.and.others }
1164 if$
1165 }
1166
1167 %%% author and editor
1168
1169 % nameptr: author number
1170 % numnames: the total number of authors
1171 % namesleft: the number of authors which have not been processed.
1172 % numtrunc: bst.max.author.num.display
1173
1174 %%% name
1175 FUNCTION {format.names}
1176 { 's :=
1177 % insert 1 to nameptr.
1178 #1 'nameptr :=
1179 % Set the number of authors to numnames.
1180 s num.names$ 'numnames :=
1181 numnames 'namesleft :=
1182
1183 numnames bst.max.author.num >
1184 % If numnames > bst.max.author.num
1185 { bst.max.author.num.display 'numtrunc := }
1186 { #0 'numtrunc := }
1187 if$
1188 % Repeat if namesleft > 0 ---- Repeat from here
1189 { namesleft #0 > }
1190 {
1191 % Block A starts
1192 nameptr #1 =
1193 % A-1: If the author is the 1st author
1194 { bst.author.name #0 =
1195 bst.author.name #1 = or
1196 { bst.first.name.initial #0 =
1197 { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := }
1198 { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := }
1199 if$
1200 }
1201 { bst.first.name.initial #0 =
1202 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
1203 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
1204 if$
1205 }
1206 if$
1207 }
1208 % A-2: If the author is the second or later authors (not the 1st author).
1209 { bst.author.name #0 =
1210 bst.author.name #2 =
1211 or
1212 { bst.first.name.initial #0 =
1213 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
1214 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
1215 if$
1216 }
1217 { bst.first.name.initial #0 =
1218 { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := }
1219 { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := }
1220 if$
1221 }
1222 if$
1223 }
1224 if$
1225 % Block A ends
1226
1227 % Block B starts
1228 nameptr #1 >
1229 % B-1: If the author is the second or later authors
1230 { nameptr #1 - numtrunc =
1231 % If nameptr - 1 = numtrunc
1232 { #1 'namesleft :=
1233 "others" 't := }
1234 'skip$
1235 if$
1236 % If numnames <= bst.max.author.num
1237 nameorder.temp "random" =
1238 bst.use.nameorder #0 = not and
1239 % If random ordering is used
1240 { bst.and.nameorder * t * }
1241 % If random ordering is not used
1242 { namesleft #1 >
1243 % If more than one authors are left
1244 { ", " * t * }
1245 % If the author is the last author.
1246 { t "others" =
1247 % If the name is "others"
1248 { bst.and.others.output * }
1249 % If the name is not "others"
1250 { numnames #2 =
1251 % If the entry have two authors
1252 { bst.and * t * }
1253 % If the entry have more than two authors
1254 { bst.ands * t * }
1255 if$
1256 }
1257 if$
1258 }
1259 if$
1260 }
1261 if$
1262 }
1263 % When the author is the first author.
1264 't
1265 if$
1266 % Block B ends
1267 nameptr #1 + 'nameptr :=
1268 namesleft #1 - 'namesleft :=
1269 }
1270 while$ % ---- Repeat until here
1271 }
1272
1273 %%% name
1274 FUNCTION {format.names.editors}
1275 { 's :=
1276 % insert 1 to nameptr.
1277 #1 'nameptr :=
1278 % Set the number of authors to numnames.
1279 s num.names$ 'numnames :=
1280 numnames 'namesleft :=
1281
1282 numnames bst.max.author.num >
1283 % If numnames > bst.max.author.num
1284 { bst.max.author.num.display 'numtrunc := }
1285 { #0 'numtrunc := }
1286 if$
1287 % Repeat if namesleft > 0 ---- Repeat from here
1288 { namesleft #0 > }
1289 {
1290 % Block A starts
1291 bst.first.name.initial #0 =
1292 { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := }
1293 { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := }
1294 if$
1295 % Block A ends
1296 % Block B starts
1297 nameptr #1 >
1298 % B-1: If the author is the second or later authors
1299 { nameptr #1 - numtrunc =
1300 % If nameptr - 1 = numtrunc
1301 { #1 'namesleft :=
1302 "others" 't := }
1303 'skip$
1304 if$
1305 namesleft #1 >
1306 % If more than one authors are left
1307 { ", " * t * }
1308 % If the author is the last author.
1309 { t "others" =
1310 % If the name is "others"
1311 { bst.and.others.output * }
1312 % If the name is not "others"
1313 { numnames #2 =
1314 % If the entry have two authors
1315 { bst.and * t * }
1316 % If the entry have more than two authors
1317 { bst.ands * t * }
1318 if$
1319 }
1320 if$
1321 }
1322 if$
1323 }
1324 % When the author is the first author.
1325 't
1326 if$
1327 % Block B ends
1328 nameptr #1 + 'nameptr :=
1329 namesleft #1 - 'namesleft :=
1330 }
1331 while$ % ---- Repeat until here
1332 }
1333
1334 % remove successive periods (commas) from author
1335 FUNCTION {remove.ss.period.auth}
1336 { 's :=
1337 s format.names 'tempa :=
1338 bst.author.post 'tempb :=
1339 tempb #1 #1 substring$ "}" =
1340 { tempa tempb * }
1341 { tempa #-1 #1 substring$ tempb #1 #1 substring$ =
1342 { tempa tempb #2 global.max$ substring$ * }
1343 { tempa tempb * }
1344 if$
1345 }
1346 if$
1347 }
1348
1349 % <prev name list> <new name list> compare.names <modified name list>
1350 FUNCTION {compare.names.aer}
1351 { 's :=
1352 'tempa :=
1353
1354 % "current.author = " s * "\\" * write$ newline$
1355 % "prev.author = " tempa * "\\" * write$ newline$
1356
1357 tempa num.names$ 'len1.aer := % len1 = the number of previous authors
1358 s num.names$ 'len2.aer := % len2 = the number of current authors
1359
1360 % len1.aer := min(len1.aer,len2.aer)
1361 % len1 -> min{ the number of previous authors, the number of current authors }
1362 len1.aer len2.aer >
1363 { len2.aer 'len1.aer := }
1364 { }
1365 if$
1366
1367 % start with an empty string, then while the components are the same
1368 % add "\bysame"
1369 ""
1370 #1 'i.aer :=
1371
1372 { i.aer len1.aer > not }
1373 { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$
1374 s i.aer "{ff }{vv }{ll}{ jj}" format.name$
1375 =
1376 { #1 i.aer <
1377 { " and " * }
1378 { }
1379 if$
1380 "\bysame{}" *
1381 i.aer #1 + 'i.aer := }
1382 { #-1 'len1.aer := }
1383 if$
1384 }
1385 while$
1386
1387 % add the rest of the second string
1388 { i.aer len2.aer > not }
1389 { #1 i.aer <
1390 { " and " * }
1391 { }
1392 if$
1393 s i.aer "{ff }{vv }{ll}{ jj}" format.name$ *
1394 i.aer #1 + 'i.aer :=
1395 }
1396 while$
1397 }
1398
1399 %%% author
1400 FUNCTION {format.output.authors}
1401 { author empty$
1402 'skip$
1403 { bst.use.bysame #2 =
1404 { prev.author.aer author compare.names.aer 's :=
1405 author 'prev.author.aer := }
1406 { author 's := }
1407 if$
1408 extra.label.bysame "bysame" =
1409 { "\bysame " }
1410 { bst.author.pre s remove.ss.period.auth * }
1411 if$
1412 output.field
1413 }
1414 if$
1415 }
1416
1417 %%% editor
1418 FUNCTION {format.output.editors}
1419 { editor empty$
1420 'skip$
1421 { bst.use.bysame #2 =
1422 { prev.author.aer editor compare.names.aer 's :=
1423 editor 'prev.author.aer := }
1424 { editor 's := }
1425 if$
1426 extra.label.bysame "bysame" =
1427 { "\bysame " }
1428 { bst.author.pre s remove.ss.period.auth * }
1429 if$
1430 s num.names$ #1 >
1431 { bst.editors * output.field }
1432 { bst.editor * output.field }
1433 if$
1434 }
1435 if$
1436 }
1437
1438 FUNCTION {format.authors.alt}
1439 { author empty$
1440 { "" }
1441 { extra.label.bysame "bysame" =
1442 {"\bysame "}
1443 { bst.author.pre author remove.ss.period.auth * }
1444 if$
1445 }
1446 if$
1447 }
1448
1449 %%% editor
1450 FUNCTION {format.editors.alt}
1451 { editor empty$
1452 { "" }
1453 { extra.label.bysame "bysame" =
1454 { "\bysame " }
1455 { bst.author.pre editor remove.ss.period.auth * }
1456 if$
1457 }
1458 if$
1459 }
1460
1461 FUNCTION {format.editors.x}
1462 { bst.editor.btitle.order #0 =
1463 { "" }
1464 { editor num.names$ #1 >
1465 { bst.editors " by " * }
1466 { bst.editor " by " * }
1467 if$
1468 }
1469 if$
1470 editor format.names.editors *
1471 bst.editor.btitle.order #0 =
1472 { editor num.names$ #1 >
1473 { bst.editors * }
1474 { bst.editor * }
1475 if$
1476 }
1477 { ", " * }
1478 if$
1479 }
1480
1481 %%% title
1482 FUNCTION {format.title}
1483 { bst.title.lower.case #0 =
1484 { bst.title.pre title * bst.title.post * }
1485 { bst.title.pre title "t" change.case$ * bst.title.post * }
1486 if$
1487 }
1488
1489 %%% title
1490 FUNCTION {format.output.title}
1491 { title empty$
1492 { "there's no title in " cite$ * warning$ }
1493 { bst.hide.title #0 = not
1494 'skip$
1495 { format.title remove.irrelevant.period.comma output.field }
1496 if$
1497 }
1498 if$
1499 }
1500
1501 % Convert "-" to "--" (for pages field)
1502 FUNCTION {n.dashify}
1503 { 't :=
1504 ""
1505 %% while$
1506 { t empty$ not }
1507 { t #1 #1 substring$ "-" =
1508 { t #1 #2 substring$ "--" = not
1509 { "--" *
1510 t #2 global.max$ substring$ 't :=
1511 }
1512 { { t #1 #1 substring$ "-" = }
1513 { "-" *
1514 t #2 global.max$ substring$ 't :=
1515 }
1516 while$
1517 }
1518 if$
1519 }
1520 { t #1 #1 substring$ *
1521 t #2 global.max$ substring$ 't :=
1522 }
1523 if$
1524 }
1525 while$
1526 }
1527
1528 %%% year
1529 FUNCTION {format.output.year}
1530 { year empty$
1531 { "there's no year in " cite$ * warning$ }
1532 { type$ "article" =
1533 { bst.year.pre year * extra.label * bst.year.post * }
1534 { bst.year.na.pre year * extra.label * bst.year.na.post * }
1535 if$
1536 output.field
1537 }
1538 if$
1539 }
1540
1541 %%% Attach tie for the string with two or less characters.
1542 FUNCTION {tie.or.space.connect}
1543 { duplicate$ text.length$ #3 <
1544 { "~" }
1545 { "" }
1546 if$
1547 swap$ * *
1548 }
1549
1550 FUNCTION {tie.or.space.connect.alt}
1551 { duplicate$ text.length$ #3 <
1552 { "~" }
1553 { " " }
1554 if$
1555 swap$ *
1556 }
1557
1558 FUNCTION {either.or.check}
1559 { empty$
1560 'pop$
1561 { "can't use both " swap$ * " fields in " * cite$ * warning$ }
1562 if$
1563 }
1564
1565 %%% page for book
1566 FUNCTION {format.output.book.pages}
1567 { pages empty$
1568 'skip$
1569 { bst.pages.pre pages n.dashify tie.or.space.connect.alt * bst.pages.post *
1570 output.field }
1571 if$
1572 }
1573
1574 %%% volume for book
1575 FUNCTION {format.output.bvolume}
1576 { volume empty$
1577 'skip$
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: