Debian Codegraph @

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