Debian Codegraph @

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

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