Debian Codegraph @

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