Debian Codegraph @

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