Debian Codegraph @

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

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