diff options
author | Karl Berry <karl@freefriends.org> | 2018-12-07 22:54:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-12-07 22:54:04 +0000 |
commit | 2e4171efd4e4cbac1653818d2ae27195018b440a (patch) | |
tree | d5918d9f5b1c983153dac664566bedab7d003e57 /Master/texmf-dist/doc/bibtex/econ-bst | |
parent | fbd93be1dd416ac755b8811c3b8a46ea3affe326 (diff) |
econ-bst (7dec18)
git-svn-id: svn://tug.org/texlive/trunk@49351 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/bibtex/econ-bst')
32 files changed, 27100 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/CHANGES.md b/Master/texmf-dist/doc/bibtex/econ-bst/CHANGES.md new file mode 100644 index 00000000000..3704d1fe743 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/CHANGES.md @@ -0,0 +1,284 @@ +<!-- +Author: Shiro Takeda +First-written: <2008/11/18> +Time-stamp: <2018-12-07 18:50:38 st> +--> + +Changelogs for econ.bst +============================== + +## Ver. 2.5 + +* Changed the license of `econ.bst` to the LaTeX Project Public License. + + +## Ver. 2.4 + +* Added the function to implement certificated random author ordering propsed by + the following article. + + Ray, Debraj ⓡ Arthur Robson (2018) "Certified Random: A New Order for + Coauthorship," American Economic Review, Vol. 108, No. 2, pp. 489–520, URL: + http://www.aeaweb.org/articles?id=10.1257/aer.20161492, DOI: + http://dx.doi.org/10.1257/aer.20161492. + + For this, the following functions are added: `bst.use.nameorder`, + `bst.and.nameorder`, `bst.cite.and.nameorder`, `bst.and.others.nameorder`. + + For the details, see the section "Certified random order" in econ-example.pdf. + +* Changed the default value of `bst.doi.pre`. + + +## Ver. 2.3 + +* Changed the default setting of `bst.hide.number`. + +* Modified the style for Ph.D. thesis (the title of Ph.D. thesis is treated as + book title). + +* Modified the style for editors to be similar to the style for authors. Now, + the setting of `bst.author.name` is applied to editors. + + +## Ver. 2.2 (2017-08-19) + +* Slightly changed the definition of `format.url`, `bst.url.pre` and + `bst.url.post`. + +* Changed `\it` command to `\textit` command. + +* Added the function `bst.url.doi` which determines the way for displaying URL + and DOI fields when both fields exist. You can choose three values for + `bst.url.doi`. + + + `#0` -> Both fields are displayed + + `#1` -> Only URL field is displayed + + `#2` -> Only DOI field is displayed + + +## Ver. 2.1 (2013-07-09) + +* URL field: In the new econ.bst, URL field can be displayed. If you set + non-zero to `bst.show.url`, url field is displayed before note field (this is + the default behavior). If you set zero to `bst.show.url`, url field is + suppressed. + +* Added the new function `bst.url.pre` and `bst.url.post`. These functions + specify the strings before and after url field. + +* access field: Added the new function `bst.access.pre` and + `bst.access.post`. These functions specify the strings before and after access + field. Note that access field is specific to econ.bst and not inherent in the + standard bib file. The value of access field is used for accessed date for + URL. For example, suppose that there are the following two settings in the bib + file + + url = {http://shirotakeda.org/en/tex/econ-bst.html}, + access = {4th July, 2013} + + In the default econ.bst, these settings generate the reference like + + URL: http://shirotakeda.org/en/tex/econ-bst.html, accessed on 4th July, 2013. + +* Added the new function `bst.show.doi`. If you set non-zero to `bst.show.doi`, + DOI field is displayed before note field. If you set zero to `bst.show.doi`, + DOI field is suppressed (this is the default behavior). Note that DOI field is + not inherent in the standard bib file. See econ-sample.pdf for an example. + +* Added the new function `bst.doi.pre` and `bst.doi.post`. These functions + specify the strings before and after DOI field. + +* Added the new function `bst.post.note`. This function specifies the strings + after note field. + +* Added new type "online". This is the document type for web page. Note that + this is not inherent in the standard bib file and it does not work for other + bst files. + + +## Ver. 2.0.1 (2011-12-05) + +* Fixed bugs for sorting entries. In version 2.0, entries of book and + incollection type are not sometimes sorted in alphabetical order. + +* The previous econ.bst always puts `period' before the content of note + field. The new econ.bst uses `comma' by default (but this depends on user + customization). + +* Added new function `bst.hide.title`. If you set non-zero to bst.hide.title, + title is not displayed. + + +## Ver. 2.0 (2011-11-10) + +* Added \bysame abbreviation of alternative style. + + Suppose that there are the following three entries: + + Mazda, A., Subaru, B., and Honda, C., (2011) "ABC" + Mazda, A., Subaru, B., and Honda, C., (2011) "DEF" + Mazda, A., Subaru, B., and Toyota, D., (2011) "GHI" + + When you set non-zero to `bst.use.bysame` in the previous econ.bst, + these entries are listed like + + [List 1] + Mazda, A., Subaru, B., and Honda, C., (2011) "ABC" + ----, (2011) "DEF" + Mazda, A., Subaru, B., and Toyota, D., (2011) "GHI" + + That is, the abbreviation of authors by \bysame is only applied to entries + with exactly the same name. + + In the new econ.bst, you can choose an alternative abbreviation style like + + [List 2] + Mazda, A., Subaru, B., Honda, C., (2011) "ABC" + ----, ----, and ----, (2011) "DEF" + ----, ----, and Toyota, D., (2011) "GHI" + + In the new econ.bst, you can choose three values for `bst.use.bysame`. + + + `#0`: Not use bysame command. + + `#1`: Use bysame command like List 1 (this is the default value). + + `#2`: Use bysame command like List 2. + + For the details, see econ-sample.pdf. + + +* Abolished `bst.year.backward` and added `bst.year.position`. + Now you can choose the position of year. + + If set to #0, year is always placed right after "author". + + If non-zero, year is placed at the end (before note field) except for aritcle + type entry. + + In article type entry, the position of year changes according to the following + rule: + + + `#1` -> year is placed at the end. + + `#2` -> year is placed after journal name in aritcle type entry. + + `#3` -> year is placed after volume in aritcle type entry. + +* Added `bst.year.na.pre` and `bst.year.na.post`. These functions are + `bst.year.pre` and `bst.year.post` for non-article type entry. In the new + econ.bst, `bst.year.pre` and `bst.year.post` are only applied to aritcle type + entry. + +* Added `bst.editor.btitle.order`. + + This determines the order of editor and booktitle in incollection and + inproceedings entry. + + If `#0`, editors - booktitle order (the default value). + If non-zero, booktitle - editors order. + +* Added `bst.address.position`. + + You can choose the order of address and publisher by this function. + + If `#0`, address -> publisher order (the default value). + If non-zero, publisher -> address order. + + +## Ver. 1.3.2 (2011-04-05) + +* Fixed a bug in `bst.hide.number`. + + +## Ver. 1.3.1 (2010-12-17) + +* Added the new function `bst.hide.number`. If you want to hide number filed, + set non-zero to this function. + + +## Ver. 1.3 (2010-12-04) + +* Fixed a bug in period-comma handling. + +* Changed the rule for sorting entries. + + In the previous rule, econ.bst use full author name for primary sorting + key. For example, suppose that there are references like + + Hatoyama, Fukuda, Abe (2009) "apple" + Hatoyama, Aso, Fukuda, Abe (2007) "orange." + Hatoyama, Abe, Fukuda, Koizumi (2009) "grape." + + In this case, econ.bst sorts references in the following order. + + Hatoyama, Abe, Fukuda, Koizumi (2009) "grape." + Hatoyama, Aso, Fukuda, Abe (2007) "orange." + Hatoyama, Fukuda, Abe (2009) "apple." + + In the new rule, econ.bst uses the abbreviated author name instead of the full + author name. That is, the econ.bst uses + + Hatoyama et al. (2009) "apple." + Hatoyama et al. (2007) "orange." + Hatoyama et al. (2009) "grape." + + for the sorting key. So three articles are sorted in the following order. + + Hatoyama, Aso, Fukuda, Abe (2007) "orange." + Hatoyama, Fukuda, Abe (2009) "apple." + Hatoyama, Abe, Fukuda, Koizumi (2009) "grape." + +* Changed the rule for attaching alphabetical index to year. + + In the previous rule, econ.bst does not attach alphabetical index to year in + the following two articles. + + Hatoyama, Abe, Fukuda, Koizumi (2009) "grape." + Hatoyama, Fukuda, Abe (2009) "apple." + + This means that two articles have the exactly same abbreated citation form + "Hatoyama et al.(2009)". + + In the new rule, econ.bst attaches alphabetical index to the above two + articles like + + Hatoyama, Fukuda, Abe (2009a) "apple." + Hatoyama, Abe, Fukuda, Koizumi (2009b) "grape." + + So the abbreated citation form for two articles are distinguished like + Hatoyama et al.(2009a) and Hatoyama et al.(2009b). + + +## Ver. 1.2 (2008-12-22) + +* When there are successive periods and commas (for example, ".,", "..", ",," + etc.), the second one is removed. In the previous econ.bst, it is difficult + to use period and comma as delimiters at the same time because it often causes + problems such as successive commas and periods. The new econ.bst removes the + second period or comma if there are successive periods and commas. + +* Added new function `bst.and.others.num`. Author names in the citation part + are abbreviated by et al. if the number of authors is greater or equal to + bst.and.others.num. + + +## Ver. 1.1 (2008-11-17) + +* Added new functions: `bst.sort.year`, `bst.and.others`, `bst.cite.and` and + `bst.cite.ands`. + +* Corrected typos. + + +## Ver. 1.0 (2007-11-20) + +* The initial release. + + +<!-- +-------------------- +Local Variables: +mode: markdown +fill-column: 80 +coding: utf-8-dos +End: +--> + diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/README.md b/Master/texmf-dist/doc/bibtex/econ-bst/README.md new file mode 100644 index 00000000000..c9a06fa57e5 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/README.md @@ -0,0 +1,43 @@ +<!-- +Filename: README.md +Author: Shiro Takeda +e-mail <shiro.takeda@gmail.com> +First-written: <2017-07-30> +Time-stamp: <2018-12-07 17:12:31 st> +--> + +econ.bst +============================== + +`econ.bst` is a BibTeX style file for economics. It provids the following +features: + +* The author-year type citation (you need `natbib.sty` as well). +* Reference style used in economics papers (`econ.bst` is not a BibTeX style for a specific journal). +* Highly customizable. You can easily customize reference style as you wish. +* You can use "certified random order" proposed by [Ray ⓡ Robson (2018), AER](http://dx.doi.org/10.1257/aer.20161492). + + +## Explanation of files + +| File | Explanation | +|:-----------------------------------------|:-------------------------------------------------------------| +| `econ.bst` | This is the main bst file. | +| `econ-example.tex` | This file explains how to use econ.bst. | +| [`econ-example.pdf`](econ-example.pdf) | A PDF file created fom `econ-example.tex`. | +| `econ-example.bib` | This is a bibliography database file. | +| `customization` | This folder contains customized bst files. | +| [`CHANGES.md`](CHANGES.md) | Changelog file. | +| `README.md` | This file. | + + +<!-- +-------------------- +Local Variables: +mode: markdown +fill-column: 80 +coding: utf-8-dos +End: +--> + + diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/README.md b/Master/texmf-dist/doc/bibtex/econ-bst/customization/README.md new file mode 100644 index 00000000000..aed7368f0ec --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/README.md @@ -0,0 +1,41 @@ +<!-- +Author: Shiro Takeda +e-mail <shiro.takeda@gmail.com> +First-written: <2016-03-16> +Time-stamp: <2018-11-09 11:54:42 st> +--> + +Contents of this folder +============================== + ++ This folders includes bst files created by customizing econ.bst. ++ If you want to customize econ.bst, see these files. + +| bst file | Explanation | +|:---------------------|:--------------------------------------------------------| +| `econ.bst` | The default econ.bst file. | +| `econ-a.bst` | A simple style. | +| `econ-b.bst` | A style with much decoration. | +| `econ-aer.bst` | A style like AER (American Economic Review). | +| `econ-jet.bst` | A style like JET (Journal of Economic Theoriy). | +| `econ-no-sort.bst` | This style lists entries in citation order. | +| `econ-econometrica.bst` | A style like Econometrica. | +| `econ-jie.bst` | A style like JIE (Journal of International Economics). | + +| PDF file | Explanation | +|:---------------------|:--------------------------------------------------------| +| `econ-default.pdf` | PDF file created from econ.bst file. | +| `econ-numbers.pdf` | PDF file which use numerical citation mode. | + +Other PDF files are created from the corresponding bst files above. + + +<!-- +-------------------- +Local Variables: +mode: markdown +fill-column: 90 +coding: utf-8-dos +End: +--> + diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/cited-part.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/cited-part.tex new file mode 100644 index 00000000000..1ff16c9b184 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/cited-part.tex @@ -0,0 +1,52 @@ + +\noindent Cited entries: \vspace{1em} \\ +\noindent +\citet{Ryza15:_advan_analy_spark_patter_learn_data_scale}, +\citet{yamazaki13:_japan}, +\citet{stakeda2013web}, +\citet{Takeda2012a}, +\citet{bergemann11:_ration}, +\citet{goldin:katz:2011}, +\citet{Takeda2011b}, +\citet{takeda2011c}, +\citet{takeda10:_cge_analy_welfar_effec_trade}, +\citet{2009yamasue502165}, +\citet{goldin:katz:2008}, +\citet{Biker-2007-unemployment}, +\citet{takeda06:_cge_analy_welfar_effec_trade}, +\citet{2007yamasue482353}, +\citet{Peri2007}, +\citet{BabikerRutherford-2005-EconomicEffectsof}, +\citet{ishikawa03:_green_gas_emiss_contr_open_econom}, +\citet{brooke03:_gams}, +\citet{DeGorter2002}, +\citet{Babiker2000525}, +\citet{goldin:katz:2000}, +\citet{rutherford00:_gtapin_gtap_eg}, +\citet{fujita99jp:_spatial_econom}, +\citet{Babiker-1999-KyotoProtocoland}, +\citet{Babiker-1999-JapaneseNuclearPower}, +\citet{Parry1997}, +\citet{borgers95:_note_implem_stron_domin}, +\citet{wong95:_inter_trade_goods_factor_mobil_}, +\citet{ishikawa94:_revis_stolp_samuel_rybcz_theor_produc_exter}, +\citet{brezis93:_leapf_inter_compet}, +\citet{krugman91:_geogr_trade}, +\citet{helpman91:_inter_trade_trade_polic}, +\citet{krugman91:_is_bilat_bad}, +\citet{wang89:_model_therm_hydrod_aspec_molten}, +\citet{lucas76:_econom_polic_evaluat}, +\citet{milne-thomson68:_theor_hydrod}. \\ + +\vspace*{1em} +\noindent +\citet{10.1257/aer.20161492}, +\citet{RePEc:hka:wpaper:2018-037}, +\citet{vohra18:_maxim_farsig_stabl_set}, +\citet{NBERw25205}. + +% -------------------- +% Local Variables: +% fill-column: 80 +% End: + diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.bst b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.bst new file mode 100644 index 00000000000..bea9f43e8c5 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.bst @@ -0,0 +1,3541 @@ +%% econ.bst: BibTeX style file for papers in economics. +% +% Author: Shiro Takeda +% Maintainer: Shiro Takeda +% Copyright (C) 2001-2018 Shiro Takeda +% First-written: <2007/07/28> +% Time-stamp: <2018-12-07 18:49:52 st> +% Version: 2.5 +% Keywords: TeX, BibTeX, bst +% URL: https://github.com/ShiroTakeda/econ-bst + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is Shiro Takeda. + +%% Main features of econ.bst. + +% "econ.bst" is a BibTeX style file for economics. It provids the following +% features: + +% 1) The author-year type citation (you need "natbib.sty" as well). +% 2) Reference style used in economics papers ("econ.bst" is not a BibTeX style +% for a specific journal). +% 3) Highly customizable. You can easily customize reference style as you wish. +% 4) You can use "certified random order" proposed by Ray ⓡ Robson (2018) +% (http://dx.doi.org/10.1257/aer.20161492). + +% Bug reports, requests and suggestions are welcome. + +% For changelogs, see CHANGES.txt file. + +% version number +FUNCTION {econ.version} { "2.5" } + +% Debug mode. Non-zero makes debug mode on. +FUNCTION {econ.debug} +{ #0 } % Debug mode off (default). +% { #1 } % Debug mode on. + +ENTRY + %%% Declaration of field + { access address author booktitle chapter doi edition editor howpublished + institution journal key month note number organization pages publisher + school series title type url volume year + % Fields specific to econ.bst + order absorder nameorder + } + + % Definition of entry variable. The entry variable is a variable which has + % different values according to different entries. + %% Integer entry variable: + { order.cited } + + %% String entry variable + { label cyear flabel alabel extra.label sort.label sort.label.abb + extra.label.bysame nameorder.temp } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Use \bysame or not. +% +% If set to #0, \bysame is not used. +% If set to #1, \bysame is used +% If set to #2, \bysame is used (alternative abbreviation style). +% +% Note that integer number is expressed as # + integer in bst file. +% \bysame is the function that abbreviates succession of the same authors' name by ---. +% +% See econ-sample.pdf for details. +% +FUNCTION {bst.use.bysame} +{ #0 } % Not use \bysame +% { #1 } % -> Use \bysame (default) +% { #2 } % -> Use \bysame of alternative style. + +% The definition of \bysame command. +% +FUNCTION {bst.bysame.definition} +{ "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default) +% { "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% The order of fist and last name. +% +FUNCTION {bst.author.name} +% { #0 } % (default) +{ #1 } +% { #2 } + +% Case of #0: First author -> last-first, other authors -> first-last. +% Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables. + +% Case of #1: All authors -> last-first +% Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J. + +% Case of #2: All authors -> first-last +% Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Abbreviate first name of authors (editors): +% +FUNCTION {bst.first.name.initial} +% { #0 } % #0 -> full letters (default). +{ #1 } % Non-zero -> initial letter only. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Decapitalize of strings in title field. +% +FUNCTION {bst.title.lower.case} +% { #0 } % If #0, not decapitalize title (default). +{ #1 } % If non-#0, decapitalize title + +% Hide title filed. +% +FUNCTION {bst.hide.title} +{ #0 } % #0 -> Title field is displayed (default) +% { #1 } % Non-zer -> Title field is hidden + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide month. +% +FUNCTION {bst.hide.month} +% { #0 } % #0 -> show month field (default). +{ #1 } % non-#0 -> hide month field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Attach number index like plain.bst. +% +FUNCTION {bst.use.number.index} +{ #0 } % Not use number index (default). +% { #1 } % Non-#0 -> Use number index + +% The string before number index: +% +FUNCTION {bst.number.index.pre} +{ "[" } % (default) + +% The string after number index. Adjustment is recommended. +% +FUNCTION {bst.number.index.post} +{ "]\hskip1.0em " } % (default) + +% Maximum digit of number index: +% If the number of reference items >= 100, set 3 to this function. +% If the number of reference items < 100, set 2 to this function. +% If the number of reference items < 10, set 1 to this function. +% +FUNCTION {bst.number.index.digit} +{ "2" } % (default) +% { "3" } + +% The functions below are used to adjust space and postion. If you use fonts +% other than computer modern fonts, you had better make adjustments. +% +% Setting for bst.number.index.digit = 1: +FUNCTION {bst.number.index.bibhang.one} +{ "2.05em" } % (default) +% Setting for bst.number.index.digit = 2: +FUNCTION {bst.number.index.bibhang.ten} +{ "2.55em" } % (default) +% Setting for bst.number.index.digit = 3: +FUNCTION {bst.number.index.bibhang.hund} +{ "3.05em" } % (default). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Position of "year": +% +% You can choose the position of year by this function. +% +% If set to #0, year is placed right after "author". +% If set to non-zero, year is placed at the end (before note field) except for +% aritcle type entry. +% +% In article type entry, the position of year changes according to the +% following rule: +% +% #1 -> year is placed at the end. +% #2 -> year is placed after journal name in aritcle type entry. +% #3 -> year is placed after volume in aritcle type entry. +% +FUNCTION {bst.year.position} +{ #0 } % (default). +% { #1 } % Last place before note. +% { #2 } % After journal name for aticle type entry. +% { #3 } % After volume for aticle type entry. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If 0, references are sorted by old documents -> recent documents. If +% non-zero, reverse order. +FUNCTION {bst.reverse.year} +{ #0 } % Normal order (old -> recent) (default). +% { #1 } % inverse order (recent -> old) + +% If non-zero, sort references by using year field as the primary key +% (chronological sorting). +FUNCTION {bst.sort.year} +{ #0 } % Normal case: year is used as the sorting key next to author (default). +% { #1 } % year is used as the primary sorting key. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If non-zero, references are listed in citation order. +% +FUNCTION {bst.no.sort} +{ #0 } % (default) +% { #1 } % listed in citation order. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Non-zero -> sort references by entry type (article, book, incollection etc.) +% +FUNCTION {bst.sort.entry.type} +{ #0 } % #0 -> Normal (not sort references by entry type) (default). +% { #1 } % Non-zero -> sort references by entry type. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use absorder field to sort items. Otherwise, ignore absorder field. +% +FUNCTION {bst.notuse.absorder.field} +{ #0 } % #0 -> Use absorder (default). +% { #1 } % Non-#0 -> Not use absorder. +% +% Order of priority to sort items +% +% absorder -> author -> year -> order -> month -> title +% +% wehre absorder and order fields are specific to econ.bst. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use order field to sort items. Otherwise, ignore order field. +% Note: order field is specific to econ.bst. +FUNCTION {bst.notuse.order.field} +{ #0 } % #0 -> Use order field (default). +% { #1 } % Non-#0 -> not use order field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% and + +%%% String used to separate author names in references. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.and} +{ ", " } +% { " and " } % (default) + +%%% String used to separate author names in references (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.ands} +{ ", " } +% { ", and " } % (default) + +%%% String used to separate author names in citation part. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.cite.and} +{ " and " } % (default) + +%%% String used to separate author names in citation part (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.cite.ands} +{ " and " } % (default) + +%%% If you want to use random author order for some bibliography entries, set +% non-zero to this function. +% +FUNCTION {bst.use.nameorder} +{ #1 } % Use random order (default) +% { #0 } % Not use random order + +%%% String used to separate author names in references for the entry of random +% author order. +% +FUNCTION {bst.and.nameorder} +{ " \textcircled{r} " } % (default) + +%%% String used to separate author names in citation part for the entry of +% random author order +% +FUNCTION {bst.cite.and.nameorder} +{ " \textcircled{r} " } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Author names in the citation part are abbreviated by et al. if the number of +% authors is greater or equal to bst.and.others.num. +FUNCTION {bst.and.others.num} +{ #3 } % If the number of authors is greater or equal to three (default). +% { #4 } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Strings used when abbreviating multiple-authors in citation part. +FUNCTION {bst.and.others} +{ " et~al." } % (default) + +% Strings used when abbreviating multiple-authors in citation part for entries +% with random author order. +FUNCTION {bst.and.others.nameorder} +{ " \textcircled{r}~al." } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% author + +% The string before author: +% +FUNCTION {bst.author.pre} +{ "" } % (default) + +% The string after author: +% +FUNCTION {bst.author.post} +{ "." } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% year + +% The string before year only for aritcle type entry. +% +FUNCTION {bst.year.pre} +{ " " } +% { " (" } % (default) + +% The string after year only for aritcle type entry. +% +FUNCTION {bst.year.post} +{ ". " } +% { ") " } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.pre} +{ " " } +% { " (" } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.post} +{ ". " } +% { ") " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% title (except for title in book) + +% The string before title: +% +FUNCTION {bst.title.pre} +{ "" } +% { "``" } % (default) + +% The string after title: +% +FUNCTION {bst.title.post} +{ "." } +% { ",''" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tile for book: + +% The string before book title: +% +FUNCTION {bst.book.pre} +{ " " } +% { " \textit{" } % (default) + +% The string after book title: +% +FUNCTION {bst.book.post} +{ "." } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booktitle + +% The string before booktitle: +% +FUNCTION {bst.btitle.pre} +{ " " } +% { " \textit{" } % (default) + +% The string after booktitle: +% +FUNCTION {bst.btitle.post} +{ "" } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% journal name + +% The string before journal name: +% +FUNCTION {bst.journal.pre} +{ " " } +% { " \textit{" } % (default) + +% The string after journal name: +% +FUNCTION {bst.journal.post} +{ "" } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% editor notation: + +% The string that indicates multiple editors: +% +FUNCTION {bst.editors} +{ " eds. " } % (default) + +% The string that indicates single editor: +% +FUNCTION {bst.editor} +{ " ed. " } % (default) + +% Order of editor and booktitle in incollection and inproceedings entries. +% +% If set to #0: editors -> booktitle order +% If set to non-zero: booktitle -> editors order +% +FUNCTION {bst.editor.btitle.order} +{ #0 } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% edition + +% The string before edition: +% +FUNCTION {bst.edition.pre} +{ ", " } % (default) + +% The string after edition: +% +FUNCTION {bst.edition.post} +{ " edition" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% volume + +% The string before volume: +% +FUNCTION {bst.volume.pre} +{ ", " } +% { ", Vol. " } % (default) + +% The string after volume: +% +FUNCTION {bst.volume.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% number + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide number. If non-zero, number is suppressed. +FUNCTION {bst.hide.number} +{ #0 } % #0 -> show number field (default) +% { #1 } % non-#0 -> Hide number field. + +% The string before number: +% +FUNCTION {bst.number.pre} +{ " (" } +% { ", No. " } % (default) + +% The string after number: +% +FUNCTION {bst.number.post} +{ ")" } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% in + +% In +% +FUNCTION {bst.in} +{ " In " } +% { " in " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% page + +% The string before page (multiple pages): +% +FUNCTION {bst.pages.pre} +{ ", " } +% { ", pp." } % (default) + +% The string before page: +% +FUNCTION {bst.page.pre} +{ ", p." } % (default) + +% The string after page (multiple pages): +% +FUNCTION {bst.pages.post} +{ "" } % (default) + +% The string after page: +% +FUNCTION {bst.page.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% chapter + +% The string before chapter: +% +FUNCTION {bst.chapter.pre} +{ ", Chap." } % (default) + +% The string after chapter: +% +FUNCTION {bst.chapter.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% month + +% The string before month: +% +FUNCTION {bst.month.pre} +{ ", " } % (default) + +% The string after month: +% +FUNCTION {bst.month.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% address +% The string before address: +% +FUNCTION {bst.address.pre} +{ ", " } % (default) + +% The string after address: +% +FUNCTION {bst.address.post} +{ "" } % (default) + +% You can choose the order of address and publisher by this function. +% +% If #0, address -> publisher order (the default value). +% If non-zero, publisher -> address order. + +FUNCTION {bst.address.position} +{ #0 } % Address is placed before publisher (default) +% { #1 } % Address is placed after publisher + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% publisher + +% The string before publisher: +% +FUNCTION {bst.publisher.pre} +{ ", " } +% { ": " } % (default) + +% The string after publisher: +% +FUNCTION {bst.publisher.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% series + +% The string before series: +% +FUNCTION {bst.series.pre} +{ ", " } % (default) + +% The string after series: +% +FUNCTION {bst.series.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% organization + +% The string before organization: +% +FUNCTION {bst.organization.pre} +{ ", " } % (default) + +% The string after organization: +% +FUNCTION {bst.organization.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% school + +% The string before school: +% +FUNCTION {bst.school.pre} +{ ", " } % (default) + +% The string after school: +% +FUNCTION {bst.school.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% institution + +% The string before institution: +% +FUNCTION {bst.institution.pre} +{ ", " } % (default) + +% The string after institution: +% +FUNCTION {bst.institution.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% howpublished + +% The string before howpublished: +% +FUNCTION {bst.howpublished.pre} +{ " " } % (default) + +% The string after howpublished: +% +FUNCTION {bst.howpublished.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% url + +% Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed. +FUNCTION {bst.show.url} +% { #1 } % non-#0 -> Show url field (default) +{ #0 } % #0 -> Not show url field. + +% The string before url: +% +FUNCTION {bst.url.pre} +{ ", URL: \url{" } % (default) + +% The string after url: +% +FUNCTION {bst.url.post} +{ "}" } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Access + +% This setting is valid only if there are "access" field in bib +% files. The value of access field indicates accessed date for URL. + +% The string before access. +FUNCTION {bst.access.pre} +{ ", accessed on " } % (default) + +% The string after access. +FUNCTION {bst.access.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DOI (digital object identifier) + +% This setting is valid only if there are "doi" field in bib files. + +% Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed. +FUNCTION {bst.show.doi} +% { #1 } % non-#0 -> Show DOI field (default) +{ #0 } % #0 -> Not show DOI field. + +% The string before DOI: +% +FUNCTION {bst.doi.pre} +{ ", DOI: \href{http://dx.doi.org/" doi * "}{" * } % (default) + +% The string after DOI: +% +FUNCTION {bst.doi.post} +{ "}" } % (default) + +% How to show URL and DOI fields when both fields exist. +% +% #0 -> Both fields are displayed +% #1 -> Only URL field is displayed +% #2 -> Only DOI field is displayed +% +FUNCTION {bst.url.doi} +% { #0 } % (default) -> Both fields are displayed +{ #1 } % -> Only URL field is displayed +% { #2 } % -> Only DOI field is displayed + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Other functions: + +% The string before note. +FUNCTION {bst.note.pre} +{ ", " } % (default) + +% The string after note. +FUNCTION {bst.note.post} +{ "" } % (default) + +% The string that represents Technical report: +% +FUNCTION {bst.techrep} +{ " Tech. Rep." } % (default) + +% The string that represents master thesis: +% +FUNCTION {bst.mthesis} +{ " Master's thesis" } % (default) + +% The string that represents phd thesis: +% +FUNCTION {bst.phdthesis} +{ " Ph.D. thesis" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization end here: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +FUNCTION {bst.first} +{ "1st" } + +FUNCTION {bst.second} +{ "2nd" } + +FUNCTION {bst.third} +{ "3rd" } + +FUNCTION {bst.fourth} +{ "4th" } + +FUNCTION {bst.fifth} +{ "5th" } + +FUNCTION {bst.st} +{ "st" } + +FUNCTION {bst.nd} +{ "nd" } + +FUNCTION {bst.rd} +{ "rd" } + +FUNCTION {bst.th} +{ "th" } + +%%%%% memo by Takeda + +% "a" 'b := indicates substituting string "a" for variable b. + +% Integer number #0, #1,... + +%%% Function definition: +% +% FUNCTION {name} +% { 's := +% +% } +% +% This is the definition of a function named "name". The function "name" is +% used in the following way +% +% "foo" name +% "foo" is an argument for the function "name". +% +% About the definition of a function with more than two arguments, see the +% definition of "chop.word". + +%%% Declaration of variables: + +%% String global variables: +STRINGS { s t tt } +STRINGS { year.num } +STRINGS { preone preten } +STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author } +STRINGS { hang } +STRINGS { item.type } +STRINGS { tempa tempb } + +%% Integer global variables: +INTEGERS { nameptr namesleft numnames name.num } +INTEGERS { multiresult } +INTEGERS { index } +INTEGERS { len } +INTEGERS { last.extra.num } +INTEGERS { output.state before.all mid.sentence after.sentence after.block } +INTEGERS { last.period.comma } +INTEGERS { len1.aer len2.aer i.aer } + +%%% Definition of functions: +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +%%% Initialize variables: +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +%%% Remove comma and add period: +% +%%% +FUNCTION {add.period.x} +{ duplicate$ + #-1 #1 substring$ "," = + { #-2 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ". " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ", " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ",'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #2 substring$ ",~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #3 substring$ ",''" = + { #-4 global.max$ substring$ ".''" * } + { duplicate$ + #-1 #3 substring$ ".''" = + { #-4 global.max$ substring$ ".''" * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {output.nonnull} +{ 's := + % mid.sentence + output.state mid.sentence = + { ", " * write$ } + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period.x " " * write$ } + if$ + } + if$ + % not mid.sentence, set to mid.sentence + mid.sentence 'output.state := + } + if$ + s +} + +%%% If the last character is period or comma, set non-zero to +%%% last.period.comma. +FUNCTION {period.comma.p} +{ duplicate$ 't := + t #-1 #1 substring$ "." = + t #-1 #1 substring$ "," = or + t #-1 #1 substring$ ":" = or + t #-1 #2 substring$ ".'" = or + t #-1 #2 substring$ ",'" = or + t #-1 #3 substring$ ".''" = or + t #-1 #3 substring$ ",''" = or + t #-1 #2 substring$ ".~" = or + t #-1 #2 substring$ ",~" = or + { #1 'last.period.comma := } + { #0 'last.period.comma := } + if$ +} + +%%% remove unnecessary comma. +FUNCTION {remove.pre.comma} +{ 's := + s empty$ + { "" } + { s #1 #1 substring$ "," = + { s #2 global.max$ substring$ } + { s #1 #1 substring$ "." = + { s #2 global.max$ substring$ } + 's + if$ + } + if$ + } + if$ +} + +%%% output.nonnull.nocomma is the same as output.nonnull except that it does +%%% not add commas even in mid.sentence. +FUNCTION {output.nonnull.nocomma} +{ 's := + output.state mid.sentence = + % mid.sentence + { period.comma.p "" * write$ } + + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + last.period.comma #0 = + { s } + { s remove.pre.comma } + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output} +% { duplicate$ empty$ +% 'pop$ +% 'output.nonnull +% if$ +% } + +FUNCTION {output.nocomma} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.nocomma + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output.check} +% { 't := +% duplicate$ empty$ +% { pop$ "empty " t * " in " * cite$ * warning$ } +% 'output.nonnull +% if$ +% } + +FUNCTION {output.check.nocomma} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull.nocomma + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Format in bbl file: + +% \harvarditem[Brezis et~al.]{Brezis, Krugman and +% Tsiddon}{1993}{brezis93:_leapf_inter_compet} +% Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in +% International Competition: A Theory of Cycles in National Technological +% Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp. +% 1211--1219. + +% \harvarditem[abbreviated citation]{full citation}{year}{keyword} ... + +%%% Add period and newline. +FUNCTION {fin.entry} +{ add.period.x + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.check} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +%%% booktitle +FUNCTION {format.btitle} +{ booktitle empty$ + { "" } + { bst.btitle.pre booktitle * bst.btitle.post * } + if$ +} + +%%% journal +FUNCTION {format.journal} +{ journal empty$ + { "" } + { bst.journal.pre journal * bst.journal.post * } + if$ +} + +%%% title for book +FUNCTION {format.book} +{ title empty$ + { "" } + { bst.book.pre title * bst.book.post * } + if$ +} + +FUNCTION {format.url} +{ url empty$ + { "" } + { type$ "online" = bst.show.url or + { bst.url.pre url * bst.url.post * + access empty$ + { "" * } + { bst.access.pre * access * bst.access.post * } + if$ + } + { "" } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ bst.show.doi not or + { "" } + { bst.doi.pre doi * bst.doi.post * } + if$ +} + +FUNCTION {format.url.doi} +{ url empty$ + { format.doi } + { doi empty$ + { format.url } + { bst.url.doi #0 = + { format.url output.nocomma + format.doi } + { bst.url.doi #1 = + { format.url } + { format.doi } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% and others +FUNCTION {bst.and.others.output} +{ nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.others.nameorder } + { bst.and.others } + if$ +} + +%%% author and editor + +%%% name +FUNCTION {format.names} +{ 's := + % insert 1 to nameptr. + #1 'nameptr := + % Set the number of authors to numnames. + s num.names$ 'numnames := + numnames 'namesleft := + % Repeat if namesleft > 0 + { namesleft #0 > } + { nameptr #1 = + % First author + { bst.author.name #0 = + bst.author.name #1 = + or + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + if$ + } + % The second or later authors + { bst.author.name #0 = + bst.author.name #2 = + or + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + if$ + } + if$ + + nameptr #1 > + % The second or later authors + { nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { namesleft #1 > + % More than one authors left + { ", " * t * } + % Only one author left + { t "others" = + { bst.and.others.output * } + { numnames #2 = + % Entry with two authors + { bst.and * t * } + { bst.ands * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +% remove successive periods (commas) from author +FUNCTION {remove.ss.period.auth} +{ 's := + s format.names 'tempa := + bst.author.post 'tempb := + tempb #1 #1 substring$ "}" = + { tempa tempb * } + { tempa #-1 #1 substring$ tempb #1 #1 substring$ = + { tempa tempb #2 global.max$ substring$ * } + { tempa tempb * } + if$ + } + if$ +} + +% <prev name list> <new name list> compare.names <modified name list> +FUNCTION {compare.names.aer} +{ 's := + 'tempa := + +% "current.author = " s * "\\" * write$ newline$ +% "prev.author = " tempa * "\\" * write$ newline$ + + tempa num.names$ 'len1.aer := % len1 = the number of previous authors + s num.names$ 'len2.aer := % len2 = the number of current authors + +% len1.aer := min(len1.aer,len2.aer) +% len1 -> min{ the number of previous authors, the number of current authors } + len1.aer len2.aer > + { len2.aer 'len1.aer := } + { } + if$ + +% start with an empty string, then while the components are the same +% add "\bysame" + "" + #1 'i.aer := + + { i.aer len1.aer > not } + { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ + = + { #1 i.aer < + { " and " * } % \bysame で省略する著者の前につく and + { } + if$ + "\bysame{}" * + i.aer #1 + 'i.aer := } + { #-1 'len1.aer := } + if$ + } + while$ + +% add the rest of the second string + { i.aer len2.aer > not } + { #1 i.aer < + { " and " * } + { } + if$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ * + i.aer #1 + 'i.aer := + } + while$ +} + +%%% author +FUNCTION {format.authors} +{ author empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer author compare.names.aer 's := + author 'prev.author.aer := } + { author 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors} +{ editor empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer editor compare.names.aer 's := + editor 'prev.author.aer := } + { editor 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + s num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +FUNCTION {format.authors.alt} +{ author empty$ + { "" } + { extra.label.bysame "bysame" = + {"\bysame "} + { bst.author.pre author remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors.alt} +{ editor empty$ + { "" } + { extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre editor remove.ss.period.auth * } + if$ + editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +%%% format.in.ed.booktitle +FUNCTION {format.editors.x} +{ editor empty$ + { "" } + { bst.editor.btitle.order #0 = + { "" } + { editor num.names$ #1 > + { bst.editors " by " * } + { bst.editor " by " * } + if$ + } + if$ + editor format.names * + bst.editor.btitle.order #0 = + { editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + { "" * } + if$ + } + if$ +} + +%%% Remove commas in the cases like "?." and "?,". +FUNCTION {remove.irrelevant.period.comma} +{ 's := + s empty$ + { "" } + { s #-1 #3 substring$ "?,'" = + s #-1 #3 substring$ "?.'" = or + { s #-3 global.max$ substring$ "'" * } + { s #-1 #4 substring$ "?,''" = + s #-1 #4 substring$ "?.''" = or + { s #-4 global.max$ substring$ "''" * } + { s #-1 #2 substring$ "?," = + s #-1 #2 substring$ "?." = or + { s #-2 global.max$ substring$ "" * } + { s #-1 #3 substring$ "?,~" = + s #-1 #3 substring$ "?.~" = or + { s #-4 global.max$ substring$ "?~" * } + 's + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% title +FUNCTION {format.title.sub} +{ bst.title.lower.case #0 = + { bst.title.pre title * bst.title.post * } + { bst.title.pre title "t" change.case$ * bst.title.post * } + if$ +} + +%%% title +FUNCTION {format.title} +{ title empty$ + bst.hide.title #0 = not or + { "" } + { format.title.sub remove.irrelevant.period.comma } + if$ +} + +%%% title for misc. +FUNCTION {format.misc.title} +{ title empty$ + { "" } + { bst.title.pre title * bst.title.post * } + if$ +} + +% Convert "-" to "--" (for pages field) +FUNCTION {n.dashify} +{ 't := + "" + %% while$ + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +%%% year +FUNCTION {format.year} +{ year empty$ + { "there's no year in " cite$ * warning$ + ", " } + { type$ "article" = + { bst.year.pre year * extra.label * bst.year.post * } + { bst.year.na.pre year * extra.label * bst.year.na.post * } + if$ + } + if$ +} + +%%% page for book +FUNCTION {format.book.pages} +{ pages empty$ + { "" } + { bst.pages.pre pages * bst.pages.post * } + if$ +} + +%%% Attach tie for the string with two or less characters. +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +%%% volume for book +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { bst.volume.pre volume * bst.volume.post * + series empty$ + 'skip$ + %% If there is series field + { " of " * series * bst.series.post * } + if$ +% "volume and number" number either.or.check + } + if$ +} + +%%% series +FUNCTION {output.series} +{ series empty$ + { "" } + { bst.series.pre series * bst.series.post * } + if$ +} + +%%% number and series +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + bst.hide.month #0 = not or + % number is empty + { series empty$ + { "" } + % series is not empty. + { output.series } + if$ + } + % number is not empty$ + { series empty$ + { bst.number.pre number * bst.number.post * } + % series is not empty. + { bst.in bst.series.pre * series * bst.series.post * + bst.number.pre * number * bst.number.post * } + if$ + } + if$ + } + { "" } + if$ +} + +%%% Number or not. +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ + } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% edition + +% Convert edition to 1st, 2nd, 3rd, 4th etc +FUNCTION {eng.ord} +{ duplicate$ "1" swap$ * + #-2 #1 substring$ "1" = + { bst.th * } + { duplicate$ #-1 #1 substring$ + duplicate$ "1" = + { pop$ bst.st * } + { duplicate$ "2" = + { pop$ bst.nd * } + { "3" = + { bst.rd * } + { bst.th * } + if$ + } + if$ + } + if$ + } + if$ +} + +% Convert first, second etc in edition field to 1st, 2nd (from jfm.bst) +FUNCTION {convert.edition} +{ edition extract.num "l" change.case$ 's := + s "first" = s "1" = or + { bst.first } + { s "second" = s "2" = or + { bst.second } + { s "third" = s "3" = or + { bst.third } + { s "fourth" = s "4" = or + { bst.fourth } + { s "fifth" = s "5" = or + { bst.fifth } + { s #1 #1 substring$ is.num + { s eng.ord } + { edition } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% edition +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { bst.edition.pre convert.edition "l" change.case$ * bst.edition.post * } + { bst.edition.pre convert.edition "t" change.case$ * bst.edition.post * } + if$ + } + if$ +} + +%%% month +FUNCTION {format.month} +{ month empty$ + bst.hide.month #0 = not or + { "" } + { bst.month.pre month * bst.month.post * } + if$ +} + +%%% year and month +FUNCTION {format.date} +{ format.month format.year * +} + +%%% Is multiple pages like 1-100? +FUNCTION { multi.page.check } +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +%%% pages +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { bst.pages.pre pages n.dashify tie.or.space.connect * bst.pages.post } + { bst.page.pre pages tie.or.space.connect * bst.page.post } + if$ + } + if$ +} + +%%% number +FUNCTION {format.number} +{ number empty$ + bst.hide.number #0 = not or + { "" } + { bst.number.pre number * bst.number.post * } + if$ +} + +%%% volume +FUNCTION {format.volume} +{ volume empty$ + 'skip$ + { bst.volume.pre volume * bst.volume.post * + bst.year.position #3 = + { format.year * } + 'skip$ + if$ + } + if$ +} + +%%% number, page +FUNCTION {format.number.pages} +{ number empty$ + { format.pages } + { format.number format.pages * } + if$ +} + +%%% volume, page +FUNCTION {format.volume.pages} +{ volume empty$ + { format.pages } + { format.volume format.pages * } + if$ +} + +%%% volume, number, page +FUNCTION {format.volume.number.pages} +{ volume empty$ + { number empty$ + { format.pages } + { format.number format.pages * } + if$ + } + { number empty$ + { format.volume format.pages * } + { format.volume format.number * format.pages * } + if$ + } + if$ +} + +% volume, number, page +FUNCTION {format.vol.num.pages} +{ volume empty$ + %% volume is empty. + { number empty$ + %% number is empty. + { pages empty$ + % warning + { "there is no volume, number, and pages in " cite$ * warning$ "" } + { "" format.pages * } + if$ + } + %% number is not empty. + % warning + { "there's a number but no volume in " cite$ * warning$ + format.number.pages } + if$ + } + %% volume is not empty. + { number empty$ + %% number is empty. + { format.volume.pages } + %% number is not empty. + { format.volume.number.pages } + if$ + } + if$ +} + +%%% chapter +FUNCTION {format.chapter} +{ chapter empty$ + { "" } + { type empty$ + { bst.chapter.pre chapter tie.or.space.connect * bst.chapter.post } + { ", " * type " " * chapter * } + if$ + } + if$ +} + +%%% chapter, pages +FUNCTION {format.chapter.pages} +{ chapter empty$ + { pages empty$ + { "" } + { "" format.pages * } + if$ + } + { pages empty$ + { "" format.chapter * } + { "" format.chapter * format.pages * } + if$ + } + if$ +} + +%%% editor and booktitle +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { bst.in format.btitle * } + { bst.editor.btitle.order #0 = + { bst.in format.editors.x * " " * format.btitle * } + { bst.in format.btitle * " " * format.editors.x * } + if$ + } + if$ + } + if$ +} + +%%% howpublished +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { bst.howpublished.pre howpublished * bst.howpublished.post * } + if$ +} + +%%% address +FUNCTION {format.address} +{ address empty$ + { "" } + { bst.address.pre address * bst.address.post * } + if$ +} + +%%% publisher +FUNCTION {format.publisher} +{ publisher empty$ + { "" } + { bst.publisher.pre publisher * bst.publisher.post * } + if$ +} + +%%% organization +FUNCTION {format.organization} +{ organization empty$ + { "" } + { bst.organization.pre organization * bst.organization.post * } + if$ +} + +%% publisher and address +FUNCTION {output.publisher.address} +{ address empty$ + { format.publisher "publisher" output.check.nocomma } + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ +} + +%% address, organization, publisher +FUNCTION {output.address.organization.publisher} +{ address empty$ + %% address is empty + { organization empty$ + %% organization is empty + { publisher empty$ + 'skip$ + { format.publisher "publisher" output.check.nocomma } + if$ + } + %% organization is not empty + { publisher empty$ + { format.organization "organization" output.check.nocomma } + { format.organization "organization" output.check.nocomma + format.publisher "publisher" output.check.nocomma } + if$ + } + if$ + } + %% address is not empty + { organization empty$ + %% organization is empty + { publisher empty$ + %% publisher is empty + { format.address output.nocomma } + %% publisher is not empty + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + %% organization is not empty + { publisher empty$ + %% publisher is empty + { format.organization "organization" output.check.nocomma + format.address output.nocomma } + %% publisher is not empty + { format.organization "organization" output.check.nocomma + bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% misc +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ " " type * } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + { " " type * } + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +%%% phdthesis +FUNCTION {format.phd} +{ bst.phdthesis } + +%%% mastersthesis +FUNCTION {format.mthesis} +{ bst.mthesis } + +%%% school +FUNCTION {format.school} +{ school empty$ + { "" } + { bst.school.pre school * bst.school.post * } + if$ +} + +%%% institution +FUNCTION {format.institution} +{ institution empty$ + { "" } + { bst.institution.pre institution * bst.institution.post * } + if$ +} + +%%% remove first ? characters. +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { bst.note.pre note * bst.note.post * } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \havarditem + +FUNCTION {output.bibitem} +{ newline$ + "\harvarditem[" write$ + alabel write$ % alabel <- abbreviated citation + "]{" write$ + flabel write$ % flabel <- full citation + "}{" write$ + cyear write$ + % cyear = year + "}{" write$ + cite$ write$ % cite$ -> pusch keyword + "}" write$ + % If number index is on + bst.use.number.index #0 = + 'skip$ + { index #1 + 'index := + "" 'preone := + "" 'preten := + bst.number.index.digit "1" = + 'skip$ + { bst.number.index.digit "2" = + { "\hskip0.5em" 'preone := } + { bst.number.index.digit "3" = + { "\hskip1em" 'preone := + "\hskip0.5em" 'preten := } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + newline$ + before.all 'output.state := + "" + % number index + bst.use.number.index #0 = + 'skip$ + { index #10 < + % Insert spaces according to digit of number index. + { preone } + { index #100 < + { preten } + { "" } + if$ + } + if$ + bst.number.index.pre * index int.to.str$ * bst.number.index.post * write$ + } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% article + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.journal "journal" output.check.nocomma + bst.year.position #2 = + { format.date output.nocomma } + 'skip$ + if$ + format.vol.num.pages output.nocomma + + bst.year.position #1 = + { format.date output.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% book + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + + format.bvolume output.nocomma + format.number.series output.nocomma + output.publisher.address + + format.edition output.nocomma + format.book.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booklet + +FUNCTION {booklet} +{ output.bibitem + format.authors output.nocomma + format.year output.nocomma + format.misc.title "title" output.check.nocomma + format.howpublished output.nocomma + format.address output.nocomma + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inbook + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ +% format.book remove.pre.comma "title" output.check.nocomma + format.book "title" output.check.nocomma + format.edition output.nocomma + + format.bvolume output.nocomma + format.chapter.pages "chapter and pages" output.check.nocomma + format.number.series output.nocomma + output.publisher.address + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% incollection + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + output.address.organization.publisher + format.edition output.nocomma + format.chapter.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inproceedings + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + format.pages output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% conference + +FUNCTION {conference} +{ inproceedings } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% manual +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull.nocomma + address output.nocomma + } + if$ + } + { format.authors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + author empty$ + { organization empty$ + { format.address new.block.check + format.address output.nocomma + } + 'skip$ + if$ + } + { output.address.organization.publisher } + if$ + format.edition output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% mastersthesis + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.mthesis format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% misc + +FUNCTION {misc} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Online + +FUNCTION {online} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% phdthesis + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + format.phd + format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + address empty$ + 'skip$ + { format.address output.nocomma } + if$ + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% proceedings + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output.nocomma } + { format.editors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.btitle remove.pre.comma "title" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% techreport + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.tr.number output.nonnull.nocomma + format.institution "institution" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% unpublished + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + bst.year.position #0 = not + { format.date remove.pre.comma output.nocomma } + { month empty$ + 'skip$ + { format.month remove.pre.comma output.nocomma } + if$ + } + if$ + + format.url.doi output.nocomma + + format.note "note" output.check.nocomma + fin.entry +} + +FUNCTION {default.type} +{ misc } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Alias for month names: + +MACRO {jan} {"January"} +MACRO {feb} {"February"} +MACRO {mar} {"March"} +MACRO {apr} {"April"} +MACRO {may} {"May"} +MACRO {jun} {"June"} +MACRO {jul} {"July"} +MACRO {aug} {"August"} +MACRO {sep} {"September"} +MACRO {oct} {"October"} +MACRO {nov} {"November"} +MACRO {dec} {"December"} + +%%% Read entries: +READ + +%%% Variable for remembering the order of citation. +INTEGERS { order.num } +FUNCTION {initialize.order.num} +{ + #1 'order.num := +} +%%% Initialize a variables +EXECUTE {initialize.order.num} + +%%% Variable for remembering the order of citation. +FUNCTION {set.order.cited} +{ + order.num 'order.cited := + #1 order.num + 'order.num := +} +%%% Iterate for all entries: +ITERATE {set.order.cited} + +%%% check the value of nameorder field. +FUNCTION {set.nameorder} +{ nameorder empty$ + { "" 'nameorder.temp := } + { nameorder 'nameorder.temp := } + if$ +} +%%% Iterate for all entries: +ITERATE {set.nameorder} + +%%% Remove symbols and convert to lowercase. +FUNCTION {sortify} +{ purify$ "l" change.case$ } + +%%% names for sorting +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { ", " * } + 'skip$ + if$ + s nameptr "{ll}{ f}{ j}" format.name$ 't := + nameptr numnames = t "others" = and + { bst.and.others.output *} + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + { s sort.format.names } + { s #1 "{ll}{ f}{ j}" format.name$ " zz " * } + if$ +} + +%%% Label for full author name. +FUNCTION {format.lab.names.full} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { ", " * t * } + if$ + } + { t "others" = + { bst.and.others.output * } + { numnames #2 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.ands * t * } + if$ + } + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.and * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + numnames #1 > #1 #2 = and {", eds" *} {} if$ + numnames #1 = #1 #2 = and {", ed" *} {} if$ +} + +%%% laberl for abbreviated author name. +FUNCTION {format.lab.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + % if the number of authors is less than bst.and.others.num, full name. + { s format.lab.names.full } + % if the number of authors is equal or more than bst.and.others.num, abbreviated name. + { s #1 "{ll}" format.name$ bst.and.others.output * } + if$ +} + +%%% abbreviated author +FUNCTION {author.key.label.abb} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.key.label.full} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {format.names.full.wo.and} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ll}{, ff}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { " " * t * } + { t "others" = + { " " * } + { numnames #2 > + { " " * t * } + { " " * t * } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.full.wo.and} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {author.editor.key.full.wo.and} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {editor.key.organization.key.full.wo.and} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ +} + +FUNCTION {author.key.organization.key.full.wo.and} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +%%% abbreviated author +FUNCTION {author.editor.key.label.abb} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.editor.key.label.full} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.full} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.abb} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +FUNCTION {editor.key.organization.label.full} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ +} + +FUNCTION {editor.key.organization.label.abb} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ +} + +%%% Convert numbers: 0->9, 1->8, 2->7,..., 9->0 +FUNCTION {reverse.num} +{ 's := + s "1" = + { "8" 'year.num := } + { s "2" = + { "7" 'year.num := } + { s "3" = + { "6" 'year.num := } + { s "4" = + { "5" 'year.num := } + { s "5" = + { "4" 'year.num := } + { s "6" = + { "3" 'year.num := } + { s "7" = + { "2" 'year.num := } + { s "8" = + { "1" 'year.num := } + { s "9" = + { "0" 'year.num := } + { s "0" = + { "9" 'year.num := } + { "9" 'year.num := } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + year.num +} + +%%% Convert year (large number -> small number) +FUNCTION {convert.year} +{ 't := + bst.reverse.year #0 = + { t 'tt := } + { t #1 #1 substring$ reverse.num + t #2 #1 substring$ reverse.num * + t #3 #1 substring$ reverse.num * + t #4 #1 substring$ reverse.num * 'tt := } + if$ + tt +} + +%%% cyear +FUNCTION {calc.cyear} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.full.wo.and + { type$ "proceedings" = + 'editor.key.organization.key.full.wo.and + { type$ "manual" = + 'author.key.organization.key.full.wo.and + 'author.key.full.wo.and + if$ + } + if$ + } + if$ + duplicate$ + year empty$ + { "2199" 'cyear := } + { year 'cyear := } + if$ + year empty$ + { " " "2199" convert.year * field.or.null * } + { " " year convert.year * field.or.null * } + if$ + sortify 'sort.label := + % For debug + econ.debug #0 = not + { "sort.label = ``\texttt{" write$ + sort.label write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ + pop$ +} + +FUNCTION {calc.sort.label.abb} +{ author empty$ + { editor empty$ + { "" } + { editor 's := } + if$ + } + { author 's := } + if$ + s sort.format.names.abb 't := + year empty$ + { t sortify " " * "2199" convert.year * 'sort.label.abb := } + { t sortify " " * year convert.year * 'sort.label.abb := } + if$ + econ.debug #0 = not + { "sort.label.abb = ``\texttt{" write$ + sort.label.abb write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% flabel +FUNCTION {calc.flabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.full + { type$ "proceedings" = + 'editor.key.organization.label.full + { type$ "manual" = + 'author.key.organization.label.full + 'author.key.label.full + if$ + } + if$ + } + if$ + 'flabel := + % For debug + econ.debug #0 = not + { "flabel = ``\texttt{" write$ + flabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% alabel +FUNCTION {calc.alabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.abb + { type$ "proceedings" = + 'editor.key.organization.label.abb + { type$ "manual" = + 'author.key.organization.label.abb + 'author.key.label.abb + if$ + } + if$ + } + if$ + 'alabel := + % For debug + econ.debug #0 = not + { "alabel = ``\texttt{" write$ + alabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% title for sorting +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +%%% author for sorting +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +%%% editor for sorting +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +%%% 1,...,9 -> 001,...,009 +%%% 10,...,99 -> 010,...,099 +FUNCTION {add.zero.to.number} +{ 's := + s text.length$ #1 = + { "00" s * } + { s text.length$ #2 = + { "0" s * } + { s } + if$ + } + if$ +} + +%% entry type +FUNCTION {bst.sort.entry.type.order} +{ 'item.type := + item.type "article" = + { "01" } + { item.type "book" = + { "02" } + { item.type "booklet" = + { "03" } + { item.type "comment" = + { "04" } + { item.type "conference" = + { "05" } + { item.type "inbook" = + { "06" } + { item.type "incollection" = + { "07" } + { item.type "inproceedings" = + { "08" } + { item.type "manual" = + { "09" } + { item.type "masterthesis" = + { "10" } + { item.type "misc" = + { "11" } + { item.type "phdthesis" = + { "12" } + { item.type "proceedings" = + { "13" } + { item.type "techreport" = + { "14" } + { item.type "unpublished" = + { "15" } + { "16" } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% Create sort.key$: absorder -> author -> year -> order -> month -> title. +FUNCTION {presort.one} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * + sort.label.abb * + " " * + type$ "book" = type$ "inbook" = or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + * " " * + " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +FUNCTION {presort.two} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * sort.label * " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% Codes for debugging +FUNCTION {calc.alabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.alabel: alabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {calc.flabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.flabel: flabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {presort.one.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (1st time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {presort.two.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (2nd time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.cyear.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.cyear: sort.label = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.sort.label.abb.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.sort.label.abb: sort.label.abb = }\\" write$ + newline$ } + 'skip$ + if$ +} + +%%% alabel +EXECUTE {calc.alabel.mess} +ITERATE {calc.alabel} + +%%% flabel +EXECUTE {calc.flabel.mess} +ITERATE {calc.flabel} + +%%% cyear and sort.label +EXECUTE {calc.cyear.mess} +ITERATE {calc.cyear} + +%%% +EXECUTE {calc.sort.label.abb.mess} +ITERATE {calc.sort.label.abb} + +%%% Sorting by $sort.key (first time) +% +% Sorting is done in two times. This is the first time. +% +EXECUTE {presort.one.mess} +ITERATE {presort.one} +SORT + +FUNCTION {forward.pass} +{ bst.use.bysame #0 = bst.use.bysame #2 = or + % Not use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + } + % Use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + % format.names 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label empty$ not + { cyear extra.label * } + { cyear "" * } + if$ + "" field.or.null * + 'cyear := + extra.label 'next.extra := +} + +%%% \bysame +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +%%% Sorting by sort.key$ (second time) +EXECUTE {presort.two.mess} +ITERATE {presort.two} +SORT + +FUNCTION {reset.prev.author} +{ "xxyyzz" 'prev.author := } + +EXECUTE {reset.prev.author} + +FUNCTION {forward.pass.two} +{ bst.use.bysame #1 = + { author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + 'skip$ + if$ +} + +ITERATE {forward.pass.two} + +FUNCTION{punctuation} +{ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ + "% This bbl file is created by econ.bst ver." econ.version * write$ newline$ + "% The latest econ.bst is available at" write$ newline$ + "% <https://github.com/ShiroTakeda/econ-bst>" write$ newline$ newline$ +} + +EXECUTE {punctuation} + +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + bst.use.bysame #0 = + % Not use \bysame. + 'skip$ + % Use \bysame. + { "%%% Definition of \bysame" write$ newline$ + "\ifx\undefined\bysame" write$ newline$ + "\newcommand{\bysame}{" bst.bysame.definition * "}" * + write$ newline$ + "\fi" write$ newline$ newline$ } + if$ + %% When number index is attached to the beginning of each item. + bst.use.number.index #0 = + 'skip$ + { bst.number.index.digit "1" = + % one digit. + { bst.number.index.bibhang.one } + { bst.number.index.digit "2" = + % two digits. + { bst.number.index.bibhang.ten } + % three or more digits. + { bst.number.index.bibhang.hund } + if$ + } + if$ + 'hang := + "%%% Redefinition of \bibhang" write$ newline$ + "\ifx\undefined\bibhang" write$ newline$ + "\relax" write$ newline$ + "\else" write$ newline$ + "\setlength{\bibhang}{" + hang * "}" * write$ newline$ + "\fi" write$ newline$ newline$ + } + if$ + "\begin{thebibliography}{xxx}" write$ newline$ + + %% Initialize the variable `index'. + #0 'index := +} + +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ } + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +EXECUTE {end.bib} + +% -------------------- +% Local Variables: +% fill-column: 78 +% mode: bst +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.pdf Binary files differnew file mode 100644 index 00000000000..087a7050828 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.tex new file mode 100644 index 00000000000..71051674e58 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-a.tex @@ -0,0 +1,55 @@ +%#!pdflatex +%#BIBTEX bibtex econ-a + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +This document uses ``\verb|econ-a.bst|''. + +\vspace{1em} + +\input{cited-part} +\nocite{*} + +%% bst file: +\bibliographystyle{econ-a} +\bibliography{../econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.bst b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.bst new file mode 100644 index 00000000000..d570b82a67d --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.bst @@ -0,0 +1,3538 @@ +%% econ.bst: BibTeX style file for papers in economics. +% +% Author: Shiro Takeda +% Maintainer: Shiro Takeda +% Copyright (C) 2001-2018 Shiro Takeda +% First-written: <2007/07/28> +% Time-stamp: <2018-12-07 18:49:31 st> +% Version: 2.5 +% Keywords: TeX, BibTeX, bst +% URL: https://github.com/ShiroTakeda/econ-bst + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is Shiro Takeda. + +%% Main features of econ.bst. + +% "econ.bst" is a BibTeX style file for economics. It provids the following +% features: + +% 1) The author-year type citation (you need "natbib.sty" as well). +% 2) Reference style used in economics papers ("econ.bst" is not a BibTeX style +% for a specific journal). +% 3) Highly customizable. You can easily customize reference style as you wish. +% 4) You can use "certified random order" proposed by Ray ⓡ Robson (2018) +% (http://dx.doi.org/10.1257/aer.20161492). + +% Bug reports, requests and suggestions are welcome. + +% For changelogs, see CHANGES.txt file. + +% version number +FUNCTION {econ.version} { "2.5" } + +% Debug mode. Non-zero makes debug mode on. +FUNCTION {econ.debug} +{ #0 } % Debug mode off (default). +% { #1 } % Debug mode on. + +ENTRY + %%% Declaration of field + { access address author booktitle chapter doi edition editor howpublished + institution journal key month note number organization pages publisher + school series title type url volume year + % Fields specific to econ.bst + order absorder nameorder + } + + % Definition of entry variable. The entry variable is a variable which has + % different values according to different entries. + %% Integer entry variable: + { order.cited } + + %% String entry variable + { label cyear flabel alabel extra.label sort.label sort.label.abb + extra.label.bysame nameorder.temp } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Use \bysame or not. +% +% If set to #0, \bysame is not used. +% If set to #1, \bysame is used +% If set to #2, \bysame is used (alternative abbreviation style). +% +% Note that integer number is expressed as # + integer in bst file. +% \bysame is the function that abbreviates succession of the same authors' name by ---. +% +% See econ-sample.pdf for details. +% +FUNCTION {bst.use.bysame} +{ #0 } % Not use \bysame +% { #1 } % -> Use \bysame (default) +% { #2 } % -> Use \bysame of alternative style. + +% The definition of \bysame command. +% +FUNCTION {bst.bysame.definition} +{ "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default) +% { "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% The order of fist and last name. +% +FUNCTION {bst.author.name} +{ #0 } % (default) +% { #1 } +% { #2 } + +% Case of #0: First author -> last-first, other authors -> first-last. +% Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables. + +% Case of #1: All authors -> last-first +% Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J. + +% Case of #2: All authors -> first-last +% Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Abbreviate first name of authors (editors): +% +FUNCTION {bst.first.name.initial} +{ #0 } % #0 -> full letters (default). +% { #1 } % Non-zero -> initial letter only. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Decapitalize of strings in title field. +% +FUNCTION {bst.title.lower.case} +{ #0 } % If #0, not decapitalize title (default). +% { #1 } % If non-#0, decapitalize title + +% Hide title filed. +% +FUNCTION {bst.hide.title} +{ #0 } % #0 -> Title field is displayed (default) +% { #1 } % Non-zer -> Title field is hidden + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide month. +% +FUNCTION {bst.hide.month} +{ #0 } % #0 -> show month field (default). +% { #1 } % non-#0 -> hide month field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Attach number index like plain.bst. +% +FUNCTION {bst.use.number.index} +{ #0 } % Not use number index (default). +% { #1 } % Non-#0 -> Use number index + +% The string before number index: +% +FUNCTION {bst.number.index.pre} +{ "[" } % (default) + +% The string after number index. Adjustment is recommended. +% +FUNCTION {bst.number.index.post} +{ "]\hskip1.0em " } % (default) + +% Maximum digit of number index: +% If the number of reference items >= 100, set 3 to this function. +% If the number of reference items < 100, set 2 to this function. +% If the number of reference items < 10, set 1 to this function. +% +FUNCTION {bst.number.index.digit} +{ "2" } % (default) +% { "3" } + +% The functions below are used to adjust space and postion. If you use fonts +% other than computer modern fonts, you had better make adjustments. +% +% Setting for bst.number.index.digit = 1: +FUNCTION {bst.number.index.bibhang.one} +{ "2.05em" } % (default) +% Setting for bst.number.index.digit = 2: +FUNCTION {bst.number.index.bibhang.ten} +{ "2.55em" } % (default) +% Setting for bst.number.index.digit = 3: +FUNCTION {bst.number.index.bibhang.hund} +{ "3.05em" } % (default). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Position of "year": +% +% You can choose the position of year by this function. +% +% If set to #0, year is placed right after "author". +% If set to non-zero, year is placed at the end (before note field) except for +% aritcle type entry. +% +% In article type entry, the position of year changes according to the +% following rule: +% +% #1 -> year is placed at the end. +% #2 -> year is placed after journal name in aritcle type entry. +% #3 -> year is placed after volume in aritcle type entry. +% +FUNCTION {bst.year.position} +{ #0 } % (default). +% { #1 } % Last place before note. +% { #2 } % After journal name for aticle type entry. +% { #3 } % After volume for aticle type entry. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If 0, references are sorted by old documents -> recent documents. If +% non-zero, reverse order. +FUNCTION {bst.reverse.year} +{ #0 } % Normal order (old -> recent) (default). +% { #1 } % inverse order (recent -> old) + +% If non-zero, sort references by using year field as the primary key +% (chronological sorting). +FUNCTION {bst.sort.year} +{ #0 } % Normal case: year is used as the sorting key next to author (default). +% { #1 } % year is used as the primary sorting key. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If non-zero, references are listed in citation order. +% +FUNCTION {bst.no.sort} +{ #0 } % (default) +% { #1 } % listed in citation order. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Non-zero -> sort references by entry type (article, book, incollection etc.) +% +FUNCTION {bst.sort.entry.type} +{ #0 } % #0 -> Normal (not sort references by entry type) (default). +% { #1 } % Non-zero -> sort references by entry type. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use absorder field to sort items. Otherwise, ignore absorder field. +% +FUNCTION {bst.notuse.absorder.field} +{ #0 } % #0 -> Use absorder (default). +% { #1 } % Non-#0 -> Not use absorder. +% +% Order of priority to sort items +% +% absorder -> author -> year -> order -> month -> title +% +% wehre absorder and order fields are specific to econ.bst. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use order field to sort items. Otherwise, ignore order field. +% Note: order field is specific to econ.bst. +FUNCTION {bst.notuse.order.field} +{ #0 } % #0 -> Use order field (default). +% { #1 } % Non-#0 -> not use order field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% and + +%%% String used to separate author names in references. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.and} +{ ", and " } +% { " and " } % (default) + +%%% String used to separate author names in references (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.ands} +{ ", and " } % (default) + +%%% String used to separate author names in citation part. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.cite.and} +{ " and " } % (default) + +%%% String used to separate author names in citation part (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.cite.ands} +{ " and " } % (default) + +%%% If you want to use random author order for some bibliography entries, set +% non-zero to this function. +% +FUNCTION {bst.use.nameorder} +{ #1 } % Use random order (default) +% { #0 } % Not use random order + +%%% String used to separate author names in references for the entry of random +% author order. +% +FUNCTION {bst.and.nameorder} +{ " \textcircled{r} " } % (default) + +%%% String used to separate author names in citation part for the entry of +% random author order +% +FUNCTION {bst.cite.and.nameorder} +{ " \textcircled{r} " } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Author names in the citation part are abbreviated by et al. if the number of +% authors is greater or equal to bst.and.others.num. +FUNCTION {bst.and.others.num} +{ #3 } % If the number of authors is greater or equal to three (default). +% { #4 } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Strings used when abbreviating multiple-authors in citation part. +FUNCTION {bst.and.others} +{ " et~al." } % (default) + +% Strings used when abbreviating multiple-authors in citation part for entries +% with random author order. +FUNCTION {bst.and.others.nameorder} +{ " \textcircled{r}~al." } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% author + +% The string before author: +% +FUNCTION {bst.author.pre} +{ "\textbf{" } +% { "" } % (default) + +% The string after author: +% +FUNCTION {bst.author.post} +{ ".}" } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% year + +% The string before year only for aritcle type entry. +% +FUNCTION {bst.year.pre} +{ " " } +% { " (" } % (default) + +% The string after year only for aritcle type entry. +% +FUNCTION {bst.year.post} +{ ". " } +% { ") " } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.pre} +{ " " } +% { " (" } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.post} +{ ". " } +% { ") " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% title (except for title in book) + +% The string before title: +% +FUNCTION {bst.title.pre} +{ "``" } % (default) + +% The string after title: +% +FUNCTION {bst.title.post} +{ ".''" } +% { ",''" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tile for book: + +% The string before book title: +% +FUNCTION {bst.book.pre} +{ " \textit{" } % (default) + +% The string after book title: +% +FUNCTION {bst.book.post} +{ "}." } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booktitle + +% The string before booktitle: +% +FUNCTION {bst.btitle.pre} +{ " \textit{" } % (default) + +% The string after booktitle: +% +FUNCTION {bst.btitle.post} +{ "}." } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% journal name + +% The string before journal name: +% +FUNCTION {bst.journal.pre} +{ " \textit{" } % (default) + +% The string after journal name: +% +FUNCTION {bst.journal.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% editor notation: + +% The string that indicates multiple editors: +% +FUNCTION {bst.editors} +{ " eds. " } % (default) + +% The string that indicates single editor: +% +FUNCTION {bst.editor} +{ " ed. " } % (default) + +% Order of editor and booktitle in incollection and inproceedings entries. +% +% If set to #0: editors -> booktitle order +% If set to non-zero: booktitle -> editors order +% +FUNCTION {bst.editor.btitle.order} +{ #1 } +% { #0 } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% edition + +% The string before edition: +% +FUNCTION {bst.edition.pre} +{ ", " } % (default) + +% The string after edition: +% +FUNCTION {bst.edition.post} +{ " edition" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% volume + +% The string before volume: +% +FUNCTION {bst.volume.pre} +{ ", " } +% { ", Vol. " } % (default) + +% The string after volume: +% +FUNCTION {bst.volume.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% number + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide number. If non-zero, number is suppressed. +FUNCTION {bst.hide.number} +{ #0 } % #0 -> show number field (default) +% { #1 } % non-#0 -> Hide number field. + +% The string before number: +% +FUNCTION {bst.number.pre} +{ "(" } +% { ", No. " } % (default) + +% The string after number: +% +FUNCTION {bst.number.post} +{ "): " } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% in + +% In +% +FUNCTION {bst.in} +{ " In " } +% { " in " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% page + +% The string before page (multiple pages): +% +FUNCTION {bst.pages.pre} +{ " " } +% { ", pp." } % (default) + +% The string before page: +% +FUNCTION {bst.page.pre} +{ ", p." } % (default) + +% The string after page (multiple pages): +% +FUNCTION {bst.pages.post} +{ "" } % (default) + +% The string after page: +% +FUNCTION {bst.page.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% chapter + +% The string before chapter: +% +FUNCTION {bst.chapter.pre} +{ ", Chap." } % (default) + +% The string after chapter: +% +FUNCTION {bst.chapter.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% month + +% The string before month: +% +FUNCTION {bst.month.pre} +{ ", " } % (default) + +% The string after month: +% +FUNCTION {bst.month.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% address +% The string before address: +% +FUNCTION {bst.address.pre} +{ ", " } % (default) + +% The string after address: +% +FUNCTION {bst.address.post} +{ "" } % (default) + +% You can choose the order of address and publisher by this function. +% +% If #0, address -> publisher order (the default value). +% If non-zero, publisher -> address order. + +FUNCTION {bst.address.position} +{ #0 } % Address is placed before publisher (default) +% { #1 } % Address is placed after publisher + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% publisher + +% The string before publisher: +% +FUNCTION {bst.publisher.pre} +{ ": " } % (default) + +% The string after publisher: +% +FUNCTION {bst.publisher.post} +{ ", " } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% series + +% The string before series: +% +FUNCTION {bst.series.pre} +{ ", " } % (default) + +% The string after series: +% +FUNCTION {bst.series.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% organization + +% The string before organization: +% +FUNCTION {bst.organization.pre} +{ ", " } % (default) + +% The string after organization: +% +FUNCTION {bst.organization.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% school + +% The string before school: +% +FUNCTION {bst.school.pre} +{ ", " } % (default) + +% The string after school: +% +FUNCTION {bst.school.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% institution + +% The string before institution: +% +FUNCTION {bst.institution.pre} +{ ", " } % (default) + +% The string after institution: +% +FUNCTION {bst.institution.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% howpublished + +% The string before howpublished: +% +FUNCTION {bst.howpublished.pre} +{ " " } % (default) + +% The string after howpublished: +% +FUNCTION {bst.howpublished.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% url + +% Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed. +FUNCTION {bst.show.url} +{ #1 } % non-#0 -> Show url field (default) +% { #0 } % #0 -> Not show url field. + +% The string before url: +% +FUNCTION {bst.url.pre} +{ ", URL: \url{" } % (default) + +% The string after url: +% +FUNCTION {bst.url.post} +{ "}" } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Access + +% This setting is valid only if there are "access" field in bib +% files. The value of access field indicates accessed date for URL. + +% The string before access. +FUNCTION {bst.access.pre} +{ ", accessed on " } % (default) + +% The string after access. +FUNCTION {bst.access.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DOI (digital object identifier) + +% This setting is valid only if there are "doi" field in bib files. + +% Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed. +FUNCTION {bst.show.doi} +{ #1 } % non-#0 -> Show DOI field (default) +% { #0 } % #0 -> Not show DOI field. + +% The string before DOI: +% +FUNCTION {bst.doi.pre} +{ ", DOI: \href{http://dx.doi.org/" doi * "}{" * } % (default) + +% The string after DOI: +% +FUNCTION {bst.doi.post} +{ "}" } % (default) + +% How to show URL and DOI fields when both fields exist. +% +% #0 -> Both fields are displayed +% #1 -> Only URL field is displayed +% #2 -> Only DOI field is displayed +% +FUNCTION {bst.url.doi} +% { #0 } % (default) -> Both fields are displayed +% { #1 } % -> Only URL field is displayed +{ #2 } % -> Only DOI field is displayed + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Other functions: + +% The string before note. +FUNCTION {bst.note.pre} +{ ", " } % (default) + +% The string after note. +FUNCTION {bst.note.post} +{ "" } % (default) + +% The string that represents Technical report: +% +FUNCTION {bst.techrep} +{ " Tech. Rep." } % (default) + +% The string that represents master thesis: +% +FUNCTION {bst.mthesis} +{ " Master's thesis" } % (default) + +% The string that represents phd thesis: +% +FUNCTION {bst.phdthesis} +{ " Ph.D. dissertation" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization end here: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +FUNCTION {bst.first} +{ "1st" } + +FUNCTION {bst.second} +{ "2nd" } + +FUNCTION {bst.third} +{ "3rd" } + +FUNCTION {bst.fourth} +{ "4th" } + +FUNCTION {bst.fifth} +{ "5th" } + +FUNCTION {bst.st} +{ "st" } + +FUNCTION {bst.nd} +{ "nd" } + +FUNCTION {bst.rd} +{ "rd" } + +FUNCTION {bst.th} +{ "th" } + +%%%%% memo by Takeda + +% "a" 'b := indicates substituting string "a" for variable b. + +% Integer number #0, #1,... + +%%% Function definition: +% +% FUNCTION {name} +% { 's := +% +% } +% +% This is the definition of a function named "name". The function "name" is +% used in the following way +% +% "foo" name +% "foo" is an argument for the function "name". +% +% About the definition of a function with more than two arguments, see the +% definition of "chop.word". + +%%% Declaration of variables: + +%% String global variables: +STRINGS { s t tt } +STRINGS { year.num } +STRINGS { preone preten } +STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author } +STRINGS { hang } +STRINGS { item.type } +STRINGS { tempa tempb } + +%% Integer global variables: +INTEGERS { nameptr namesleft numnames name.num } +INTEGERS { multiresult } +INTEGERS { index } +INTEGERS { len } +INTEGERS { last.extra.num } +INTEGERS { output.state before.all mid.sentence after.sentence after.block } +INTEGERS { last.period.comma } +INTEGERS { len1.aer len2.aer i.aer } + +%%% Definition of functions: +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +%%% Initialize variables: +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +%%% Remove comma and add period: +% +%%% +FUNCTION {add.period.x} +{ duplicate$ + #-1 #1 substring$ "," = + { #-2 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ". " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ", " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ",'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #2 substring$ ",~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #3 substring$ ",''" = + { #-4 global.max$ substring$ ".''" * } + { duplicate$ + #-1 #3 substring$ ".''" = + { #-4 global.max$ substring$ ".''" * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {output.nonnull} +{ 's := + % mid.sentence + output.state mid.sentence = + { ", " * write$ } + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period.x " " * write$ } + if$ + } + if$ + % not mid.sentence, set to mid.sentence + mid.sentence 'output.state := + } + if$ + s +} + +%%% If the last character is period or comma, set non-zero to +%%% last.period.comma. +FUNCTION {period.comma.p} +{ duplicate$ 't := + t #-1 #1 substring$ "." = + t #-1 #1 substring$ "," = or + t #-1 #1 substring$ ":" = or + t #-1 #2 substring$ ".'" = or + t #-1 #2 substring$ ",'" = or + t #-1 #3 substring$ ".''" = or + t #-1 #3 substring$ ",''" = or + t #-1 #2 substring$ ".~" = or + t #-1 #2 substring$ ",~" = or + { #1 'last.period.comma := } + { #0 'last.period.comma := } + if$ +} + +%%% remove unnecessary comma. +FUNCTION {remove.pre.comma} +{ 's := + s empty$ + { "" } + { s #1 #1 substring$ "," = + { s #2 global.max$ substring$ } + { s #1 #1 substring$ "." = + { s #2 global.max$ substring$ } + 's + if$ + } + if$ + } + if$ +} + +%%% output.nonnull.nocomma is the same as output.nonnull except that it does +%%% not add commas even in mid.sentence. +FUNCTION {output.nonnull.nocomma} +{ 's := + output.state mid.sentence = + % mid.sentence + { period.comma.p "" * write$ } + + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + last.period.comma #0 = + { s } + { s remove.pre.comma } + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output} +% { duplicate$ empty$ +% 'pop$ +% 'output.nonnull +% if$ +% } + +FUNCTION {output.nocomma} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.nocomma + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output.check} +% { 't := +% duplicate$ empty$ +% { pop$ "empty " t * " in " * cite$ * warning$ } +% 'output.nonnull +% if$ +% } + +FUNCTION {output.check.nocomma} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull.nocomma + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Format in bbl file: + +% \harvarditem[Brezis et~al.]{Brezis, Krugman and +% Tsiddon}{1993}{brezis93:_leapf_inter_compet} +% Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in +% International Competition: A Theory of Cycles in National Technological +% Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp. +% 1211--1219. + +% \harvarditem[abbreviated citation]{full citation}{year}{keyword} ... + +%%% Add period and newline. +FUNCTION {fin.entry} +{ add.period.x + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.check} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +%%% booktitle +FUNCTION {format.btitle} +{ booktitle empty$ + { "" } + { bst.btitle.pre booktitle * bst.btitle.post * } + if$ +} + +%%% journal +FUNCTION {format.journal} +{ journal empty$ + { "" } + { bst.journal.pre journal * bst.journal.post * } + if$ +} + +%%% title for book +FUNCTION {format.book} +{ title empty$ + { "" } + { bst.book.pre title * bst.book.post * } + if$ +} + +FUNCTION {format.url} +{ url empty$ + { "" } + { type$ "online" = bst.show.url or + { bst.url.pre url * bst.url.post * + access empty$ + { "" * } + { bst.access.pre * access * bst.access.post * } + if$ + } + { "" } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ bst.show.doi not or + { "" } + { bst.doi.pre doi * bst.doi.post * } + if$ +} + +FUNCTION {format.url.doi} +{ url empty$ + { format.doi } + { doi empty$ + { format.url } + { bst.url.doi #0 = + { format.url output.nocomma + format.doi } + { bst.url.doi #1 = + { format.url } + { format.doi } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% and others +FUNCTION {bst.and.others.output} +{ nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.others.nameorder } + { bst.and.others } + if$ +} + +%%% author and editor + +%%% name +FUNCTION {format.names} +{ 's := + % insert 1 to nameptr. + #1 'nameptr := + % Set the number of authors to numnames. + s num.names$ 'numnames := + numnames 'namesleft := + % Repeat if namesleft > 0 + { namesleft #0 > } + { nameptr #1 = + % First author + { bst.author.name #0 = + bst.author.name #1 = + or + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + if$ + } + % The second or later authors + { bst.author.name #0 = + bst.author.name #2 = + or + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + if$ + } + if$ + + nameptr #1 > + % The second or later authors + { nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { namesleft #1 > + % More than one authors left + { ", " * t * } + % Only one author left + { t "others" = + { bst.and.others.output * } + { numnames #2 = + % Entry with two authors + { bst.and * t * } + { bst.ands * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +% remove successive periods (commas) from author +FUNCTION {remove.ss.period.auth} +{ 's := + s format.names 'tempa := + bst.author.post 'tempb := + tempb #1 #1 substring$ "}" = + { tempa tempb * } + { tempa #-1 #1 substring$ tempb #1 #1 substring$ = + { tempa tempb #2 global.max$ substring$ * } + { tempa tempb * } + if$ + } + if$ +} + +% <prev name list> <new name list> compare.names <modified name list> +FUNCTION {compare.names.aer} +{ 's := + 'tempa := + +% "current.author = " s * "\\" * write$ newline$ +% "prev.author = " tempa * "\\" * write$ newline$ + + tempa num.names$ 'len1.aer := % len1 = the number of previous authors + s num.names$ 'len2.aer := % len2 = the number of current authors + +% len1.aer := min(len1.aer,len2.aer) +% len1 -> min{ the number of previous authors, the number of current authors } + len1.aer len2.aer > + { len2.aer 'len1.aer := } + { } + if$ + +% start with an empty string, then while the components are the same +% add "\bysame" + "" + #1 'i.aer := + + { i.aer len1.aer > not } + { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ + = + { #1 i.aer < + { " and " * } % \bysame で省略する著者の前につく and + { } + if$ + "\bysame{}" * + i.aer #1 + 'i.aer := } + { #-1 'len1.aer := } + if$ + } + while$ + +% add the rest of the second string + { i.aer len2.aer > not } + { #1 i.aer < + { " and " * } + { } + if$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ * + i.aer #1 + 'i.aer := + } + while$ +} + +%%% author +FUNCTION {format.authors} +{ author empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer author compare.names.aer 's := + author 'prev.author.aer := } + { author 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors} +{ editor empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer editor compare.names.aer 's := + editor 'prev.author.aer := } + { editor 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + s num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +FUNCTION {format.authors.alt} +{ author empty$ + { "" } + { extra.label.bysame "bysame" = + {"\bysame "} + { bst.author.pre author remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors.alt} +{ editor empty$ + { "" } + { extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre editor remove.ss.period.auth * } + if$ + editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +%%% format.in.ed.booktitle +FUNCTION {format.editors.x} +{ editor empty$ + { "" } + { bst.editor.btitle.order #0 = + { "" } + { editor num.names$ #1 > + { bst.editors " by " * } + { bst.editor " by " * } + if$ + } + if$ + editor format.names * + bst.editor.btitle.order #0 = + { editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + { "" * } + if$ + } + if$ +} + +%%% Remove commas in the cases like "?." and "?,". +FUNCTION {remove.irrelevant.period.comma} +{ 's := + s empty$ + { "" } + { s #-1 #3 substring$ "?,'" = + s #-1 #3 substring$ "?.'" = or + { s #-3 global.max$ substring$ "'" * } + { s #-1 #4 substring$ "?,''" = + s #-1 #4 substring$ "?.''" = or + { s #-4 global.max$ substring$ "''" * } + { s #-1 #2 substring$ "?," = + s #-1 #2 substring$ "?." = or + { s #-2 global.max$ substring$ "" * } + { s #-1 #3 substring$ "?,~" = + s #-1 #3 substring$ "?.~" = or + { s #-4 global.max$ substring$ "?~" * } + 's + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% title +FUNCTION {format.title.sub} +{ bst.title.lower.case #0 = + { bst.title.pre title * bst.title.post * } + { bst.title.pre title "t" change.case$ * bst.title.post * } + if$ +} + +%%% title +FUNCTION {format.title} +{ title empty$ + bst.hide.title #0 = not or + { "" } + { format.title.sub remove.irrelevant.period.comma } + if$ +} + +%%% title for misc. +FUNCTION {format.misc.title} +{ title empty$ + { "" } + { bst.title.pre title * bst.title.post * } + if$ +} + +% Convert "-" to "--" (for pages field) +FUNCTION {n.dashify} +{ 't := + "" + %% while$ + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +%%% year +FUNCTION {format.year} +{ year empty$ + { "there's no year in " cite$ * warning$ + ", " } + { type$ "article" = + { bst.year.pre year * extra.label * bst.year.post * } + { bst.year.na.pre year * extra.label * bst.year.na.post * } + if$ + } + if$ +} + +%%% page for book +FUNCTION {format.book.pages} +{ pages empty$ + { "" } + { bst.pages.pre pages * bst.pages.post * } + if$ +} + +%%% Attach tie for the string with two or less characters. +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +%%% volume for book +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { bst.volume.pre volume * bst.volume.post * + series empty$ + 'skip$ + %% If there is series field + { " of " * series * bst.series.post * } + if$ +% "volume and number" number either.or.check + } + if$ +} + +%%% series +FUNCTION {output.series} +{ series empty$ + { "" } + { bst.series.pre series * bst.series.post * } + if$ +} + +%%% number and series +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + bst.hide.month #0 = not or + % number is empty + { series empty$ + { "" } + % series is not empty. + { output.series } + if$ + } + % number is not empty$ + { series empty$ + { bst.number.pre number * bst.number.post * } + % series is not empty. + { bst.in bst.series.pre * series * bst.series.post * + bst.number.pre * number * bst.number.post * } + if$ + } + if$ + } + { "" } + if$ +} + +%%% Number or not. +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ + } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% edition + +% Convert edition to 1st, 2nd, 3rd, 4th etc +FUNCTION {eng.ord} +{ duplicate$ "1" swap$ * + #-2 #1 substring$ "1" = + { bst.th * } + { duplicate$ #-1 #1 substring$ + duplicate$ "1" = + { pop$ bst.st * } + { duplicate$ "2" = + { pop$ bst.nd * } + { "3" = + { bst.rd * } + { bst.th * } + if$ + } + if$ + } + if$ + } + if$ +} + +% Convert first, second etc in edition field to 1st, 2nd (from jfm.bst) +FUNCTION {convert.edition} +{ edition extract.num "l" change.case$ 's := + s "first" = s "1" = or + { bst.first } + { s "second" = s "2" = or + { bst.second } + { s "third" = s "3" = or + { bst.third } + { s "fourth" = s "4" = or + { bst.fourth } + { s "fifth" = s "5" = or + { bst.fifth } + { s #1 #1 substring$ is.num + { s eng.ord } + { edition } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% edition +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { bst.edition.pre convert.edition "l" change.case$ * bst.edition.post * } + { bst.edition.pre convert.edition "t" change.case$ * bst.edition.post * } + if$ + } + if$ +} + +%%% month +FUNCTION {format.month} +{ month empty$ + bst.hide.month #0 = not or + { "" } + { bst.month.pre month * bst.month.post * } + if$ +} + +%%% year and month +FUNCTION {format.date} +{ format.month format.year * +} + +%%% Is multiple pages like 1-100? +FUNCTION { multi.page.check } +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +%%% pages +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { bst.pages.pre pages n.dashify tie.or.space.connect * bst.pages.post } + { bst.page.pre pages tie.or.space.connect * bst.page.post } + if$ + } + if$ +} + +%%% number +FUNCTION {format.number} +{ number empty$ + bst.hide.number #0 = not or + { "" } + { bst.number.pre number * bst.number.post * } + if$ +} + +%%% volume +FUNCTION {format.volume} +{ volume empty$ + 'skip$ + { bst.volume.pre volume * bst.volume.post * + bst.year.position #3 = + { format.year * } + 'skip$ + if$ + } + if$ +} + +%%% number, page +FUNCTION {format.number.pages} +{ number empty$ + { format.pages } + { format.number format.pages * } + if$ +} + +%%% volume, page +FUNCTION {format.volume.pages} +{ volume empty$ + { format.pages } + { format.volume format.pages * } + if$ +} + +%%% volume, number, page +FUNCTION {format.volume.number.pages} +{ volume empty$ + { number empty$ + { format.pages } + { format.number format.pages * } + if$ + } + { number empty$ + { format.volume format.pages * } + { format.volume format.number * format.pages * } + if$ + } + if$ +} + +% volume, number, page +FUNCTION {format.vol.num.pages} +{ volume empty$ + %% volume is empty. + { number empty$ + %% number is empty. + { pages empty$ + % warning + { "there is no volume, number, and pages in " cite$ * warning$ "" } + { "" format.pages * } + if$ + } + %% number is not empty. + % warning + { "there's a number but no volume in " cite$ * warning$ + format.number.pages } + if$ + } + %% volume is not empty. + { number empty$ + %% number is empty. + { format.volume.pages } + %% number is not empty. + { format.volume.number.pages } + if$ + } + if$ +} + +%%% chapter +FUNCTION {format.chapter} +{ chapter empty$ + { "" } + { type empty$ + { bst.chapter.pre chapter tie.or.space.connect * bst.chapter.post } + { ", " * type " " * chapter * } + if$ + } + if$ +} + +%%% chapter, pages +FUNCTION {format.chapter.pages} +{ chapter empty$ + { pages empty$ + { "" } + { "" format.pages * } + if$ + } + { pages empty$ + { "" format.chapter * } + { "" format.chapter * format.pages * } + if$ + } + if$ +} + +%%% editor and booktitle +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { bst.in format.btitle * } + { bst.editor.btitle.order #0 = + { bst.in format.editors.x * " " * format.btitle * } + { bst.in format.btitle * " " * format.editors.x * } + if$ + } + if$ + } + if$ +} + +%%% howpublished +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { bst.howpublished.pre howpublished * bst.howpublished.post * } + if$ +} + +%%% address +FUNCTION {format.address} +{ address empty$ + { "" } + { bst.address.pre address * bst.address.post * } + if$ +} + +%%% publisher +FUNCTION {format.publisher} +{ publisher empty$ + { "" } + { bst.publisher.pre publisher * bst.publisher.post * } + if$ +} + +%%% organization +FUNCTION {format.organization} +{ organization empty$ + { "" } + { bst.organization.pre organization * bst.organization.post * } + if$ +} + +%% publisher and address +FUNCTION {output.publisher.address} +{ address empty$ + { format.publisher "publisher" output.check.nocomma } + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ +} + +%% address, organization, publisher +FUNCTION {output.address.organization.publisher} +{ address empty$ + %% address is empty + { organization empty$ + %% organization is empty + { publisher empty$ + 'skip$ + { format.publisher "publisher" output.check.nocomma } + if$ + } + %% organization is not empty + { publisher empty$ + { format.organization "organization" output.check.nocomma } + { format.organization "organization" output.check.nocomma + format.publisher "publisher" output.check.nocomma } + if$ + } + if$ + } + %% address is not empty + { organization empty$ + %% organization is empty + { publisher empty$ + %% publisher is empty + { format.address output.nocomma } + %% publisher is not empty + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + %% organization is not empty + { publisher empty$ + %% publisher is empty + { format.organization "organization" output.check.nocomma + format.address output.nocomma } + %% publisher is not empty + { format.organization "organization" output.check.nocomma + bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% misc +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ " " type * } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + { " " type * } + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +%%% phdthesis +FUNCTION {format.phd} +{ bst.phdthesis } + +%%% mastersthesis +FUNCTION {format.mthesis} +{ bst.mthesis } + +%%% school +FUNCTION {format.school} +{ school empty$ + { "" } + { bst.school.pre school * bst.school.post * } + if$ +} + +%%% institution +FUNCTION {format.institution} +{ institution empty$ + { "" } + { bst.institution.pre institution * bst.institution.post * } + if$ +} + +%%% remove first ? characters. +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { bst.note.pre note * bst.note.post * } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \havarditem + +FUNCTION {output.bibitem} +{ newline$ + "\harvarditem[" write$ + alabel write$ % alabel <- abbreviated citation + "]{" write$ + flabel write$ % flabel <- full citation + "}{" write$ + cyear write$ + % cyear = year + "}{" write$ + cite$ write$ % cite$ -> pusch keyword + "}" write$ + % If number index is on + bst.use.number.index #0 = + 'skip$ + { index #1 + 'index := + "" 'preone := + "" 'preten := + bst.number.index.digit "1" = + 'skip$ + { bst.number.index.digit "2" = + { "\hskip0.5em" 'preone := } + { bst.number.index.digit "3" = + { "\hskip1em" 'preone := + "\hskip0.5em" 'preten := } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + newline$ + before.all 'output.state := + "" + % number index + bst.use.number.index #0 = + 'skip$ + { index #10 < + % Insert spaces according to digit of number index. + { preone } + { index #100 < + { preten } + { "" } + if$ + } + if$ + bst.number.index.pre * index int.to.str$ * bst.number.index.post * write$ + } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% article + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.journal "journal" output.check.nocomma + bst.year.position #2 = + { format.date output.nocomma } + 'skip$ + if$ + format.vol.num.pages output.nocomma + + bst.year.position #1 = + { format.date output.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% book + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + + format.bvolume output.nocomma + format.number.series output.nocomma + output.publisher.address + + format.edition output.nocomma + format.book.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booklet + +FUNCTION {booklet} +{ output.bibitem + format.authors output.nocomma + format.year output.nocomma + format.misc.title "title" output.check.nocomma + format.howpublished output.nocomma + format.address output.nocomma + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inbook + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ +% format.book remove.pre.comma "title" output.check.nocomma + format.book "title" output.check.nocomma + format.edition output.nocomma + + format.bvolume output.nocomma + format.chapter.pages "chapter and pages" output.check.nocomma + format.number.series output.nocomma + output.publisher.address + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% incollection + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + output.address.organization.publisher + format.edition output.nocomma + format.chapter.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inproceedings + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + format.pages output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% conference + +FUNCTION {conference} +{ inproceedings } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% manual +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull.nocomma + address output.nocomma + } + if$ + } + { format.authors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + author empty$ + { organization empty$ + { format.address new.block.check + format.address output.nocomma + } + 'skip$ + if$ + } + { output.address.organization.publisher } + if$ + format.edition output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% mastersthesis + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.mthesis format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% misc + +FUNCTION {misc} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Online + +FUNCTION {online} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% phdthesis + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + format.phd + format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + address empty$ + 'skip$ + { format.address output.nocomma } + if$ + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% proceedings + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output.nocomma } + { format.editors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.btitle remove.pre.comma "title" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% techreport + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.tr.number output.nonnull.nocomma + format.institution "institution" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% unpublished + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + bst.year.position #0 = not + { format.date remove.pre.comma output.nocomma } + { month empty$ + 'skip$ + { format.month remove.pre.comma output.nocomma } + if$ + } + if$ + + format.url.doi output.nocomma + + format.note "note" output.check.nocomma + fin.entry +} + +FUNCTION {default.type} +{ misc } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Alias for month names: + +MACRO {jan} {"January"} +MACRO {feb} {"February"} +MACRO {mar} {"March"} +MACRO {apr} {"April"} +MACRO {may} {"May"} +MACRO {jun} {"June"} +MACRO {jul} {"July"} +MACRO {aug} {"August"} +MACRO {sep} {"September"} +MACRO {oct} {"October"} +MACRO {nov} {"November"} +MACRO {dec} {"December"} + +%%% Read entries: +READ + +%%% Variable for remembering the order of citation. +INTEGERS { order.num } +FUNCTION {initialize.order.num} +{ + #1 'order.num := +} +%%% Initialize a variables +EXECUTE {initialize.order.num} + +%%% Variable for remembering the order of citation. +FUNCTION {set.order.cited} +{ + order.num 'order.cited := + #1 order.num + 'order.num := +} +%%% Iterate for all entries: +ITERATE {set.order.cited} + +%%% check the value of nameorder field. +FUNCTION {set.nameorder} +{ nameorder empty$ + { "" 'nameorder.temp := } + { nameorder 'nameorder.temp := } + if$ +} +%%% Iterate for all entries: +ITERATE {set.nameorder} + +%%% Remove symbols and convert to lowercase. +FUNCTION {sortify} +{ purify$ "l" change.case$ } + +%%% names for sorting +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { ", " * } + 'skip$ + if$ + s nameptr "{ll}{ f}{ j}" format.name$ 't := + nameptr numnames = t "others" = and + { bst.and.others.output *} + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + { s sort.format.names } + { s #1 "{ll}{ f}{ j}" format.name$ " zz " * } + if$ +} + +%%% Label for full author name. +FUNCTION {format.lab.names.full} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { ", " * t * } + if$ + } + { t "others" = + { bst.and.others.output * } + { numnames #2 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.ands * t * } + if$ + } + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.and * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + numnames #1 > #1 #2 = and {", eds" *} {} if$ + numnames #1 = #1 #2 = and {", ed" *} {} if$ +} + +%%% laberl for abbreviated author name. +FUNCTION {format.lab.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + % if the number of authors is less than bst.and.others.num, full name. + { s format.lab.names.full } + % if the number of authors is equal or more than bst.and.others.num, abbreviated name. + { s #1 "{ll}" format.name$ bst.and.others.output * } + if$ +} + +%%% abbreviated author +FUNCTION {author.key.label.abb} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.key.label.full} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {format.names.full.wo.and} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ll}{, ff}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { " " * t * } + { t "others" = + { " " * } + { numnames #2 > + { " " * t * } + { " " * t * } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.full.wo.and} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {author.editor.key.full.wo.and} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {editor.key.organization.key.full.wo.and} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ +} + +FUNCTION {author.key.organization.key.full.wo.and} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +%%% abbreviated author +FUNCTION {author.editor.key.label.abb} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.editor.key.label.full} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.full} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.abb} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +FUNCTION {editor.key.organization.label.full} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ +} + +FUNCTION {editor.key.organization.label.abb} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ +} + +%%% Convert numbers: 0->9, 1->8, 2->7,..., 9->0 +FUNCTION {reverse.num} +{ 's := + s "1" = + { "8" 'year.num := } + { s "2" = + { "7" 'year.num := } + { s "3" = + { "6" 'year.num := } + { s "4" = + { "5" 'year.num := } + { s "5" = + { "4" 'year.num := } + { s "6" = + { "3" 'year.num := } + { s "7" = + { "2" 'year.num := } + { s "8" = + { "1" 'year.num := } + { s "9" = + { "0" 'year.num := } + { s "0" = + { "9" 'year.num := } + { "9" 'year.num := } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + year.num +} + +%%% Convert year (large number -> small number) +FUNCTION {convert.year} +{ 't := + bst.reverse.year #0 = + { t 'tt := } + { t #1 #1 substring$ reverse.num + t #2 #1 substring$ reverse.num * + t #3 #1 substring$ reverse.num * + t #4 #1 substring$ reverse.num * 'tt := } + if$ + tt +} + +%%% cyear +FUNCTION {calc.cyear} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.full.wo.and + { type$ "proceedings" = + 'editor.key.organization.key.full.wo.and + { type$ "manual" = + 'author.key.organization.key.full.wo.and + 'author.key.full.wo.and + if$ + } + if$ + } + if$ + duplicate$ + year empty$ + { "2199" 'cyear := } + { year 'cyear := } + if$ + year empty$ + { " " "2199" convert.year * field.or.null * } + { " " year convert.year * field.or.null * } + if$ + sortify 'sort.label := + % For debug + econ.debug #0 = not + { "sort.label = ``\texttt{" write$ + sort.label write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ + pop$ +} + +FUNCTION {calc.sort.label.abb} +{ author empty$ + { editor empty$ + { "" } + { editor 's := } + if$ + } + { author 's := } + if$ + s sort.format.names.abb 't := + year empty$ + { t sortify " " * "2199" convert.year * 'sort.label.abb := } + { t sortify " " * year convert.year * 'sort.label.abb := } + if$ + econ.debug #0 = not + { "sort.label.abb = ``\texttt{" write$ + sort.label.abb write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% flabel +FUNCTION {calc.flabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.full + { type$ "proceedings" = + 'editor.key.organization.label.full + { type$ "manual" = + 'author.key.organization.label.full + 'author.key.label.full + if$ + } + if$ + } + if$ + 'flabel := + % For debug + econ.debug #0 = not + { "flabel = ``\texttt{" write$ + flabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% alabel +FUNCTION {calc.alabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.abb + { type$ "proceedings" = + 'editor.key.organization.label.abb + { type$ "manual" = + 'author.key.organization.label.abb + 'author.key.label.abb + if$ + } + if$ + } + if$ + 'alabel := + % For debug + econ.debug #0 = not + { "alabel = ``\texttt{" write$ + alabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% title for sorting +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +%%% author for sorting +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +%%% editor for sorting +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +%%% 1,...,9 -> 001,...,009 +%%% 10,...,99 -> 010,...,099 +FUNCTION {add.zero.to.number} +{ 's := + s text.length$ #1 = + { "00" s * } + { s text.length$ #2 = + { "0" s * } + { s } + if$ + } + if$ +} + +%% entry type +FUNCTION {bst.sort.entry.type.order} +{ 'item.type := + item.type "article" = + { "01" } + { item.type "book" = + { "02" } + { item.type "booklet" = + { "03" } + { item.type "comment" = + { "04" } + { item.type "conference" = + { "05" } + { item.type "inbook" = + { "06" } + { item.type "incollection" = + { "07" } + { item.type "inproceedings" = + { "08" } + { item.type "manual" = + { "09" } + { item.type "masterthesis" = + { "10" } + { item.type "misc" = + { "11" } + { item.type "phdthesis" = + { "12" } + { item.type "proceedings" = + { "13" } + { item.type "techreport" = + { "14" } + { item.type "unpublished" = + { "15" } + { "16" } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% Create sort.key$: absorder -> author -> year -> order -> month -> title. +FUNCTION {presort.one} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * + sort.label.abb * + " " * + type$ "book" = type$ "inbook" = or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + * " " * + " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +FUNCTION {presort.two} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * sort.label * " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% Codes for debugging +FUNCTION {calc.alabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.alabel: alabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {calc.flabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.flabel: flabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {presort.one.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (1st time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {presort.two.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (2nd time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.cyear.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.cyear: sort.label = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.sort.label.abb.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.sort.label.abb: sort.label.abb = }\\" write$ + newline$ } + 'skip$ + if$ +} + +%%% alabel +EXECUTE {calc.alabel.mess} +ITERATE {calc.alabel} + +%%% flabel +EXECUTE {calc.flabel.mess} +ITERATE {calc.flabel} + +%%% cyear and sort.label +EXECUTE {calc.cyear.mess} +ITERATE {calc.cyear} + +%%% +EXECUTE {calc.sort.label.abb.mess} +ITERATE {calc.sort.label.abb} + +%%% Sorting by $sort.key (first time) +% +% Sorting is done in two times. This is the first time. +% +EXECUTE {presort.one.mess} +ITERATE {presort.one} +SORT + +FUNCTION {forward.pass} +{ bst.use.bysame #0 = bst.use.bysame #2 = or + % Not use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + } + % Use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + % format.names 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label empty$ not + { cyear extra.label * } + { cyear "" * } + if$ + "" field.or.null * + 'cyear := + extra.label 'next.extra := +} + +%%% \bysame +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +%%% Sorting by sort.key$ (second time) +EXECUTE {presort.two.mess} +ITERATE {presort.two} +SORT + +FUNCTION {reset.prev.author} +{ "xxyyzz" 'prev.author := } + +EXECUTE {reset.prev.author} + +FUNCTION {forward.pass.two} +{ bst.use.bysame #1 = + { author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + 'skip$ + if$ +} + +ITERATE {forward.pass.two} + +FUNCTION{punctuation} +{ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ + "% This bbl file is created by econ.bst ver." econ.version * write$ newline$ + "% The latest econ.bst is available at" write$ newline$ + "% <https://github.com/ShiroTakeda/econ-bst>" write$ newline$ newline$ +} + +EXECUTE {punctuation} + +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + bst.use.bysame #0 = + % Not use \bysame. + 'skip$ + % Use \bysame. + { "%%% Definition of \bysame" write$ newline$ + "\ifx\undefined\bysame" write$ newline$ + "\newcommand{\bysame}{" bst.bysame.definition * "}" * + write$ newline$ + "\fi" write$ newline$ newline$ } + if$ + %% When number index is attached to the beginning of each item. + bst.use.number.index #0 = + 'skip$ + { bst.number.index.digit "1" = + % one digit. + { bst.number.index.bibhang.one } + { bst.number.index.digit "2" = + % two digits. + { bst.number.index.bibhang.ten } + % three or more digits. + { bst.number.index.bibhang.hund } + if$ + } + if$ + 'hang := + "%%% Redefinition of \bibhang" write$ newline$ + "\ifx\undefined\bibhang" write$ newline$ + "\relax" write$ newline$ + "\else" write$ newline$ + "\setlength{\bibhang}{" + hang * "}" * write$ newline$ + "\fi" write$ newline$ newline$ + } + if$ + "\begin{thebibliography}{xxx}" write$ newline$ + + %% Initialize the variable `index'. + #0 'index := +} + +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ } + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +EXECUTE {end.bib} + +% -------------------- +% Local Variables: +% fill-column: 78 +% mode: bst +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.pdf Binary files differnew file mode 100644 index 00000000000..6bd2af9835a --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.tex new file mode 100644 index 00000000000..00ba236e952 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-aer.tex @@ -0,0 +1,55 @@ +%#!pdflatex +%#BIBTEX bibtex econ-aer + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +This document uses ``\verb|econ-aer.bst|''. The style like AER ({\itshape American Economic Review}). + +\vspace{1em} + +\input{cited-part} +\nocite{*} + +%% bst file: +\bibliographystyle{econ-aer} +\bibliography{../econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.bst b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.bst new file mode 100644 index 00000000000..bba236ac1dd --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.bst @@ -0,0 +1,3544 @@ +%% econ.bst: BibTeX style file for papers in economics. +% +% Author: Shiro Takeda +% Maintainer: Shiro Takeda +% Copyright (C) 2001-2018 Shiro Takeda +% First-written: <2007/07/28> +% Time-stamp: <2018-12-07 18:49:15 st> +% Version: 2.5 +% Keywords: TeX, BibTeX, bst +% URL: https://github.com/ShiroTakeda/econ-bst + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is Shiro Takeda. + +%% Main features of econ.bst. + +% "econ.bst" is a BibTeX style file for economics. It provids the following +% features: + +% 1) The author-year type citation (you need "natbib.sty" as well). +% 2) Reference style used in economics papers ("econ.bst" is not a BibTeX style +% for a specific journal). +% 3) Highly customizable. You can easily customize reference style as you wish. +% 4) You can use "certified random order" proposed by Ray ⓡ Robson (2018) +% (http://dx.doi.org/10.1257/aer.20161492). + +% Bug reports, requests and suggestions are welcome. + +% For changelogs, see CHANGES.txt file. + +% version number +FUNCTION {econ.version} { "2.5" } + +% Debug mode. Non-zero makes debug mode on. +FUNCTION {econ.debug} +{ #0 } % Debug mode off (default). +% { #1 } % Debug mode on. + +ENTRY + %%% Declaration of field + { access address author booktitle chapter doi edition editor howpublished + institution journal key month note number organization pages publisher + school series title type url volume year + % Fields specific to econ.bst + order absorder nameorder + } + + % Definition of entry variable. The entry variable is a variable which has + % different values according to different entries. + %% Integer entry variable: + { order.cited } + + %% String entry variable + { label cyear flabel alabel extra.label sort.label sort.label.abb + extra.label.bysame nameorder.temp } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Use \bysame or not. +% +% If set to #0, \bysame is not used. +% If set to #1, \bysame is used +% If set to #2, \bysame is used (alternative abbreviation style). +% +% Note that integer number is expressed as # + integer in bst file. +% \bysame is the function that abbreviates succession of the same authors' name by ---. +% +% See econ-sample.pdf for details. +% +FUNCTION {bst.use.bysame} +% { #0 } % Not use \bysame +% { #1 } % -> Use \bysame (default) +{ #2 } % -> Use \bysame of alternative style. + +% The definition of \bysame command. +% +FUNCTION {bst.bysame.definition} +% { "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default) +{ "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% The order of fist and last name. +% +FUNCTION {bst.author.name} +{ #0 } % (default) +% { #1 } +% { #2 } + +% Case of #0: First author -> last-first, other authors -> first-last. +% Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables. + +% Case of #1: All authors -> last-first +% Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J. + +% Case of #2: All authors -> first-last +% Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Abbreviate first name of authors (editors): +% +FUNCTION {bst.first.name.initial} +{ #0 } % #0 -> full letters (default). +% { #1 } % Non-zero -> initial letter only. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Decapitalize of strings in title field. +% +FUNCTION {bst.title.lower.case} +{ #0 } % If #0, not decapitalize title (default). +% { #1 } % If non-#0, decapitalize title + +% Hide title filed. +% +FUNCTION {bst.hide.title} +{ #0 } % #0 -> Title field is displayed (default) +% { #1 } % Non-zer -> Title field is hidden + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide month. +% +FUNCTION {bst.hide.month} +{ #0 } % #0 -> show month field (default). +% { #1 } % non-#0 -> hide month field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Attach number index like plain.bst. +% +FUNCTION {bst.use.number.index} +% { #0 } % Not use number index (default). +{ #1 } % Non-#0 -> Use number index + +% The string before number index: +% +FUNCTION {bst.number.index.pre} +{ "[" } % (default) + +% The string after number index. Adjustment is recommended. +% +FUNCTION {bst.number.index.post} +{ "]\hskip1.0em " } % (default) + +% Maximum digit of number index: +% If the number of reference items >= 100, set 3 to this function. +% If the number of reference items < 100, set 2 to this function. +% If the number of reference items < 10, set 1 to this function. +% +FUNCTION {bst.number.index.digit} +{ "2" } % (default) +% { "3" } + +% The functions below are used to adjust space and postion. If you use fonts +% other than computer modern fonts, you had better make adjustments. +% +% Setting for bst.number.index.digit = 1: +FUNCTION {bst.number.index.bibhang.one} +{ "2.19em" } +% { "2.05em" } % (default) +% Setting for bst.number.index.digit = 2: +FUNCTION {bst.number.index.bibhang.ten} +{ "2.69em" } +% { "2.55em" } % (default) +% Setting for bst.number.index.digit = 3: +FUNCTION {bst.number.index.bibhang.hund} +{ "3.19em" } +% { "3.05em" } % (default). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Position of "year": +% +% You can choose the position of year by this function. +% +% If set to #0, year is placed right after "author". +% If set to non-zero, year is placed at the end (before note field) except for +% aritcle type entry. +% +% In article type entry, the position of year changes according to the +% following rule: +% +% #1 -> year is placed at the end. +% #2 -> year is placed after journal name in aritcle type entry. +% #3 -> year is placed after volume in aritcle type entry. +% +FUNCTION {bst.year.position} +% { #0 } % (default). +{ #1 } % Last place before note. +% { #2 } % After journal name for aticle type entry. +% { #3 } % After volume for aticle type entry. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If 0, references are sorted by old documents -> recent documents. If +% non-zero, reverse order. +FUNCTION {bst.reverse.year} +{ #0 } % Normal order (old -> recent) (default). +% { #1 } % inverse order (recent -> old) + +% If non-zero, sort references by using year field as the primary key +% (chronological sorting). +FUNCTION {bst.sort.year} +{ #0 } % Normal case: year is used as the sorting key next to author (default). +% { #1 } % year is used as the primary sorting key. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If non-zero, references are listed in citation order. +% +FUNCTION {bst.no.sort} +{ #0 } % (default) +% { #1 } % listed in citation order. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Non-zero -> sort references by entry type (article, book, incollection etc.) +% +FUNCTION {bst.sort.entry.type} +{ #0 } % #0 -> Normal (not sort references by entry type) (default). +% { #1 } % Non-zero -> sort references by entry type. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use absorder field to sort items. Otherwise, ignore absorder field. +% +FUNCTION {bst.notuse.absorder.field} +{ #0 } % #0 -> Use absorder (default). +% { #1 } % Non-#0 -> Not use absorder. +% +% Order of priority to sort items +% +% absorder -> author -> year -> order -> month -> title +% +% wehre absorder and order fields are specific to econ.bst. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use order field to sort items. Otherwise, ignore order field. +% Note: order field is specific to econ.bst. +FUNCTION {bst.notuse.order.field} +{ #0 } % #0 -> Use order field (default). +% { #1 } % Non-#0 -> not use order field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% and + +%%% String used to separate author names in references. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.and} +{ " \& " } +% { " and " } % (default) + +%%% String used to separate author names in references (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.ands} +{ ", \& " } +% { ", and " } % (default) + +%%% String used to separate author names in citation part. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.cite.and} +{ " \& " } +% { " and " } % (default) + +%%% String used to separate author names in citation part (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.cite.ands} +{ " and " } % (default) + +%%% If you want to use random author order for some bibliography entries, set +% non-zero to this function. +% +FUNCTION {bst.use.nameorder} +{ #1 } % Use random order (default) +% { #0 } % Not use random order + +%%% String used to separate author names in references for the entry of random +% author order. +% +FUNCTION {bst.and.nameorder} +{ " \textcircled{r} " } % (default) + +%%% String used to separate author names in citation part for the entry of +% random author order +% +FUNCTION {bst.cite.and.nameorder} +{ " \textcircled{r} " } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Author names in the citation part are abbreviated by et al. if the number of +% authors is greater or equal to bst.and.others.num. +FUNCTION {bst.and.others.num} +% { #3 } % If the number of authors is greater or equal to three (default). +{ #4 } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Strings used when abbreviating multiple-authors in citation part. +FUNCTION {bst.and.others} +{ " et~al." } % (default) + +% Strings used when abbreviating multiple-authors in citation part for entries +% with random author order. +FUNCTION {bst.and.others.nameorder} +{ " \textcircled{r}~al." } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% author + +% The string before author: +% +FUNCTION {bst.author.pre} +{ "\textsc{" } +% { "" } % (default) + +% The string after author: +% +FUNCTION {bst.author.post} +{ "}, " } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% year + +% The string before year only for aritcle type entry. +% +FUNCTION {bst.year.pre} +{ ", \textit{" } +% { " (" } % (default) + +% The string after year only for aritcle type entry. +% +FUNCTION {bst.year.post} +{ "}" } +% { ") " } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.pre} +{ ", \textit{" } +% { " (" } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.post} +{ "}" } +% { ") " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% title (except for title in book) + +% The string before title: +% +FUNCTION {bst.title.pre} +{ "`" } +% { "``" } % (default) + +% The string after title: +% +FUNCTION {bst.title.post} +{ ".'" } +% { ",''" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tile for book: + +% The string before book title: +% +FUNCTION {bst.book.pre} +{ " \textit{" } % (default) + +% The string after book title: +% +FUNCTION {bst.book.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booktitle + +% The string before booktitle: +% +FUNCTION {bst.btitle.pre} +{ " \textit{" } % (default) + +% The string after booktitle: +% +FUNCTION {bst.btitle.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% journal name + +% The string before journal name: +% +FUNCTION {bst.journal.pre} +{ " \textit{" } % (default) + +% The string after journal name: +% +FUNCTION {bst.journal.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% editor notation: + +% The string that indicates multiple editors: +% +FUNCTION {bst.editors} +{ " (eds.) " } +% { " eds. " } % (default) + +% The string that indicates single editor: +% +FUNCTION {bst.editor} +{ " ed. " } % (default) + +% Order of editor and booktitle in incollection and inproceedings entries. +% +% If set to #0: editors -> booktitle order +% If set to non-zero: booktitle -> editors order +% +FUNCTION {bst.editor.btitle.order} +{ #0 } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% edition + +% The string before edition: +% +FUNCTION {bst.edition.pre} +{ ", " } % (default) + +% The string after edition: +% +FUNCTION {bst.edition.post} +{ " edition" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% volume + +% The string before volume: +% +FUNCTION {bst.volume.pre} +{ ", \textbf{" } +% { ", Vol. " } % (default) + +% The string after volume: +% +FUNCTION {bst.volume.post} +{ "}" } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% number + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide number. If non-zero, number is suppressed. +FUNCTION {bst.hide.number} +{ #0 } % #0 -> show number field (default) +% { #1 } % non-#0 -> Hide number field. + +% The string before number: +% +FUNCTION {bst.number.pre} +{ " (" } +% { ", No. " } % (default) + +% The string after number: +% +FUNCTION {bst.number.post} +{ ")" } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% in + +% In +% +FUNCTION {bst.in} +{ " In " } +% { " in " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% page + +% The string before page (multiple pages): +% +FUNCTION {bst.pages.pre} +{ ", pp." } % (default) + +% The string before page: +% +FUNCTION {bst.page.pre} +{ ", p." } % (default) + +% The string after page (multiple pages): +% +FUNCTION {bst.pages.post} +{ "" } % (default) + +% The string after page: +% +FUNCTION {bst.page.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% chapter + +% The string before chapter: +% +FUNCTION {bst.chapter.pre} +{ ", Chapter" } +% { ", Chap." } % (default) + +% The string after chapter: +% +FUNCTION {bst.chapter.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% month + +% The string before month: +% +FUNCTION {bst.month.pre} +{ ", " } % (default) + +% The string after month: +% +FUNCTION {bst.month.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% address +% The string before address: +% +FUNCTION {bst.address.pre} +{ ", " } % (default) + +% The string after address: +% +FUNCTION {bst.address.post} +{ "" } % (default) + +% You can choose the order of address and publisher by this function. +% +% If #0, address -> publisher order (the default value). +% If non-zero, publisher -> address order. + +FUNCTION {bst.address.position} +{ #0 } % Address is placed before publisher (default) +% { #1 } % Address is placed after publisher + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% publisher + +% The string before publisher: +% +FUNCTION {bst.publisher.pre} +{ ": " } % (default) + +% The string after publisher: +% +FUNCTION {bst.publisher.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% series + +% The string before series: +% +FUNCTION {bst.series.pre} +{ ", " } % (default) + +% The string after series: +% +FUNCTION {bst.series.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% organization + +% The string before organization: +% +FUNCTION {bst.organization.pre} +{ ", " } % (default) + +% The string after organization: +% +FUNCTION {bst.organization.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% school + +% The string before school: +% +FUNCTION {bst.school.pre} +{ ", " } % (default) + +% The string after school: +% +FUNCTION {bst.school.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% institution + +% The string before institution: +% +FUNCTION {bst.institution.pre} +{ ", " } % (default) + +% The string after institution: +% +FUNCTION {bst.institution.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% howpublished + +% The string before howpublished: +% +FUNCTION {bst.howpublished.pre} +{ " " } % (default) + +% The string after howpublished: +% +FUNCTION {bst.howpublished.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% url + +% Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed. +FUNCTION {bst.show.url} +{ #1 } % non-#0 -> Show url field (default) +% { #0 } % #0 -> Not show url field. + +% The string before url: +% +FUNCTION {bst.url.pre} +{ ", URL: \url{" } % (default) + +% The string after url: +% +FUNCTION {bst.url.post} +{ "}" } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Access + +% This setting is valid only if there are "access" field in bib +% files. The value of access field indicates accessed date for URL. + +% The string before access. +FUNCTION {bst.access.pre} +% { ", accessed on " } % (default) +{ " (accessed on " } + +% The string after access. +FUNCTION {bst.access.post} +% { "" } % (default) +{ ")" } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DOI (digital object identifier) + +% This setting is valid only if there are "doi" field in bib files. + +% Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed. +FUNCTION {bst.show.doi} +{ #1 } % non-#0 -> Show DOI field (default) +% { #0 } % #0 -> Not show DOI field. + +% The string before DOI: +% +FUNCTION {bst.doi.pre} +{ ", DOI: \href{http://dx.doi.org/" doi * "}{" * } % (default) + +% The string after DOI: +% +FUNCTION {bst.doi.post} +{ "}" } % (default) + +% How to show URL and DOI fields when both fields exist. +% +% #0 -> Both fields are displayed +% #1 -> Only URL field is displayed +% #2 -> Only DOI field is displayed +% +FUNCTION {bst.url.doi} +% { #0 } % (default) -> Both fields are displayed +% { #1 } % -> Only URL field is displayed +{ #2 } % -> Only DOI field is displayed + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Other functions: + +% The string before note. +FUNCTION {bst.note.pre} +{ ", " } % (default) + +% The string after note. +FUNCTION {bst.note.post} +{ "" } % (default) + +% The string that represents Technical report: +% +FUNCTION {bst.techrep} +{ " Tech. Rep." } % (default) + +% The string that represents master thesis: +% +FUNCTION {bst.mthesis} +{ " Master's thesis" } % (default) + +% The string that represents phd thesis: +% +FUNCTION {bst.phdthesis} +{ " Ph.D. dissertation" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization end here: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +FUNCTION {bst.first} +{ "1st" } + +FUNCTION {bst.second} +{ "2nd" } + +FUNCTION {bst.third} +{ "3rd" } + +FUNCTION {bst.fourth} +{ "4th" } + +FUNCTION {bst.fifth} +{ "5th" } + +FUNCTION {bst.st} +{ "st" } + +FUNCTION {bst.nd} +{ "nd" } + +FUNCTION {bst.rd} +{ "rd" } + +FUNCTION {bst.th} +{ "th" } + +%%%%% memo by Takeda + +% "a" 'b := indicates substituting string "a" for variable b. + +% Integer number #0, #1,... + +%%% Function definition: +% +% FUNCTION {name} +% { 's := +% +% } +% +% This is the definition of a function named "name". The function "name" is +% used in the following way +% +% "foo" name +% "foo" is an argument for the function "name". +% +% About the definition of a function with more than two arguments, see the +% definition of "chop.word". + +%%% Declaration of variables: + +%% String global variables: +STRINGS { s t tt } +STRINGS { year.num } +STRINGS { preone preten } +STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author } +STRINGS { hang } +STRINGS { item.type } +STRINGS { tempa tempb } + +%% Integer global variables: +INTEGERS { nameptr namesleft numnames name.num } +INTEGERS { multiresult } +INTEGERS { index } +INTEGERS { len } +INTEGERS { last.extra.num } +INTEGERS { output.state before.all mid.sentence after.sentence after.block } +INTEGERS { last.period.comma } +INTEGERS { len1.aer len2.aer i.aer } + +%%% Definition of functions: +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +%%% Initialize variables: +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +%%% Remove comma and add period: +% +%%% +FUNCTION {add.period.x} +{ duplicate$ + #-1 #1 substring$ "," = + { #-2 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ". " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ", " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ",'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #2 substring$ ",~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #3 substring$ ",''" = + { #-4 global.max$ substring$ ".''" * } + { duplicate$ + #-1 #3 substring$ ".''" = + { #-4 global.max$ substring$ ".''" * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {output.nonnull} +{ 's := + % mid.sentence + output.state mid.sentence = + { ", " * write$ } + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period.x " " * write$ } + if$ + } + if$ + % not mid.sentence, set to mid.sentence + mid.sentence 'output.state := + } + if$ + s +} + +%%% If the last character is period or comma, set non-zero to +%%% last.period.comma. +FUNCTION {period.comma.p} +{ duplicate$ 't := + t #-1 #1 substring$ "." = + t #-1 #1 substring$ "," = or + t #-1 #1 substring$ ":" = or + t #-1 #2 substring$ ".'" = or + t #-1 #2 substring$ ",'" = or + t #-1 #3 substring$ ".''" = or + t #-1 #3 substring$ ",''" = or + t #-1 #2 substring$ ".~" = or + t #-1 #2 substring$ ",~" = or + { #1 'last.period.comma := } + { #0 'last.period.comma := } + if$ +} + +%%% remove unnecessary comma. +FUNCTION {remove.pre.comma} +{ 's := + s empty$ + { "" } + { s #1 #1 substring$ "," = + { s #2 global.max$ substring$ } + { s #1 #1 substring$ "." = + { s #2 global.max$ substring$ } + 's + if$ + } + if$ + } + if$ +} + +%%% output.nonnull.nocomma is the same as output.nonnull except that it does +%%% not add commas even in mid.sentence. +FUNCTION {output.nonnull.nocomma} +{ 's := + output.state mid.sentence = + % mid.sentence + { period.comma.p "" * write$ } + + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + last.period.comma #0 = + { s } + { s remove.pre.comma } + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output} +% { duplicate$ empty$ +% 'pop$ +% 'output.nonnull +% if$ +% } + +FUNCTION {output.nocomma} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.nocomma + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output.check} +% { 't := +% duplicate$ empty$ +% { pop$ "empty " t * " in " * cite$ * warning$ } +% 'output.nonnull +% if$ +% } + +FUNCTION {output.check.nocomma} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull.nocomma + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Format in bbl file: + +% \harvarditem[Brezis et~al.]{Brezis, Krugman and +% Tsiddon}{1993}{brezis93:_leapf_inter_compet} +% Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in +% International Competition: A Theory of Cycles in National Technological +% Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp. +% 1211--1219. + +% \harvarditem[abbreviated citation]{full citation}{year}{keyword} ... + +%%% Add period and newline. +FUNCTION {fin.entry} +{ add.period.x + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.check} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +%%% booktitle +FUNCTION {format.btitle} +{ booktitle empty$ + { "" } + { bst.btitle.pre booktitle * bst.btitle.post * } + if$ +} + +%%% journal +FUNCTION {format.journal} +{ journal empty$ + { "" } + { bst.journal.pre journal * bst.journal.post * } + if$ +} + +%%% title for book +FUNCTION {format.book} +{ title empty$ + { "" } + { bst.book.pre title * bst.book.post * } + if$ +} + +FUNCTION {format.url} +{ url empty$ + { "" } + { type$ "online" = bst.show.url or + { bst.url.pre url * bst.url.post * + access empty$ + { "" * } + { bst.access.pre * access * bst.access.post * } + if$ + } + { "" } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ bst.show.doi not or + { "" } + { bst.doi.pre doi * bst.doi.post * } + if$ +} + +FUNCTION {format.url.doi} +{ url empty$ + { format.doi } + { doi empty$ + { format.url } + { bst.url.doi #0 = + { format.url output.nocomma + format.doi } + { bst.url.doi #1 = + { format.url } + { format.doi } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% and others +FUNCTION {bst.and.others.output} +{ nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.others.nameorder } + { bst.and.others } + if$ +} + +%%% author and editor + +%%% name +FUNCTION {format.names} +{ 's := + % insert 1 to nameptr. + #1 'nameptr := + % Set the number of authors to numnames. + s num.names$ 'numnames := + numnames 'namesleft := + % Repeat if namesleft > 0 + { namesleft #0 > } + { nameptr #1 = + % First author + { bst.author.name #0 = + bst.author.name #1 = + or + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + if$ + } + % The second or later authors + { bst.author.name #0 = + bst.author.name #2 = + or + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + if$ + } + if$ + + nameptr #1 > + % The second or later authors + { nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { namesleft #1 > + % More than one authors left + { ", " * t * } + % Only one author left + { t "others" = + { bst.and.others.output * } + { numnames #2 = + % Entry with two authors + { bst.and * t * } + { bst.ands * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +% remove successive periods (commas) from author +FUNCTION {remove.ss.period.auth} +{ 's := + s format.names 'tempa := + bst.author.post 'tempb := + tempb #1 #1 substring$ "}" = + { tempa tempb * } + { tempa #-1 #1 substring$ tempb #1 #1 substring$ = + { tempa tempb #2 global.max$ substring$ * } + { tempa tempb * } + if$ + } + if$ +} + +% <prev name list> <new name list> compare.names <modified name list> +FUNCTION {compare.names.aer} +{ 's := + 'tempa := + +% "current.author = " s * "\\" * write$ newline$ +% "prev.author = " tempa * "\\" * write$ newline$ + + tempa num.names$ 'len1.aer := % len1 = the number of previous authors + s num.names$ 'len2.aer := % len2 = the number of current authors + +% len1.aer := min(len1.aer,len2.aer) +% len1 -> min{ the number of previous authors, the number of current authors } + len1.aer len2.aer > + { len2.aer 'len1.aer := } + { } + if$ + +% start with an empty string, then while the components are the same +% add "\bysame" + "" + #1 'i.aer := + + { i.aer len1.aer > not } + { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ + = + { #1 i.aer < + { " and " * } % \bysame で省略する著者の前につく and + { } + if$ + "\bysame{}" * + i.aer #1 + 'i.aer := } + { #-1 'len1.aer := } + if$ + } + while$ + +% add the rest of the second string + { i.aer len2.aer > not } + { #1 i.aer < + { " and " * } + { } + if$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ * + i.aer #1 + 'i.aer := + } + while$ +} + +%%% author +FUNCTION {format.authors} +{ author empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer author compare.names.aer 's := + author 'prev.author.aer := } + { author 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors} +{ editor empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer editor compare.names.aer 's := + editor 'prev.author.aer := } + { editor 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + s num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +FUNCTION {format.authors.alt} +{ author empty$ + { "" } + { extra.label.bysame "bysame" = + {"\bysame "} + { bst.author.pre author remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors.alt} +{ editor empty$ + { "" } + { extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre editor remove.ss.period.auth * } + if$ + editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +%%% format.in.ed.booktitle +FUNCTION {format.editors.x} +{ editor empty$ + { "" } + { bst.editor.btitle.order #0 = + { "" } + { editor num.names$ #1 > + { bst.editors " by " * } + { bst.editor " by " * } + if$ + } + if$ + editor format.names * + bst.editor.btitle.order #0 = + { editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + { "" * } + if$ + } + if$ +} + +%%% Remove commas in the cases like "?." and "?,". +FUNCTION {remove.irrelevant.period.comma} +{ 's := + s empty$ + { "" } + { s #-1 #3 substring$ "?,'" = + s #-1 #3 substring$ "?.'" = or + { s #-3 global.max$ substring$ "'" * } + { s #-1 #4 substring$ "?,''" = + s #-1 #4 substring$ "?.''" = or + { s #-4 global.max$ substring$ "''" * } + { s #-1 #2 substring$ "?," = + s #-1 #2 substring$ "?." = or + { s #-2 global.max$ substring$ "" * } + { s #-1 #3 substring$ "?,~" = + s #-1 #3 substring$ "?.~" = or + { s #-4 global.max$ substring$ "?~" * } + 's + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% title +FUNCTION {format.title.sub} +{ bst.title.lower.case #0 = + { bst.title.pre title * bst.title.post * } + { bst.title.pre title "t" change.case$ * bst.title.post * } + if$ +} + +%%% title +FUNCTION {format.title} +{ title empty$ + bst.hide.title #0 = not or + { "" } + { format.title.sub remove.irrelevant.period.comma } + if$ +} + +%%% title for misc. +FUNCTION {format.misc.title} +{ title empty$ + { "" } + { bst.title.pre title * bst.title.post * } + if$ +} + +% Convert "-" to "--" (for pages field) +FUNCTION {n.dashify} +{ 't := + "" + %% while$ + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +%%% year +FUNCTION {format.year} +{ year empty$ + { "there's no year in " cite$ * warning$ + ", " } + { type$ "article" = + { bst.year.pre year * extra.label * bst.year.post * } + { bst.year.na.pre year * extra.label * bst.year.na.post * } + if$ + } + if$ +} + +%%% page for book +FUNCTION {format.book.pages} +{ pages empty$ + { "" } + { bst.pages.pre pages * bst.pages.post * } + if$ +} + +%%% Attach tie for the string with two or less characters. +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +%%% volume for book +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { bst.volume.pre volume * bst.volume.post * + series empty$ + 'skip$ + %% If there is series field + { " of " * series * bst.series.post * } + if$ +% "volume and number" number either.or.check + } + if$ +} + +%%% series +FUNCTION {output.series} +{ series empty$ + { "" } + { bst.series.pre series * bst.series.post * } + if$ +} + +%%% number and series +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + bst.hide.month #0 = not or + % number is empty + { series empty$ + { "" } + % series is not empty. + { output.series } + if$ + } + % number is not empty$ + { series empty$ + { bst.number.pre number * bst.number.post * } + % series is not empty. + { bst.in bst.series.pre * series * bst.series.post * + bst.number.pre * number * bst.number.post * } + if$ + } + if$ + } + { "" } + if$ +} + +%%% Number or not. +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ + } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% edition + +% Convert edition to 1st, 2nd, 3rd, 4th etc +FUNCTION {eng.ord} +{ duplicate$ "1" swap$ * + #-2 #1 substring$ "1" = + { bst.th * } + { duplicate$ #-1 #1 substring$ + duplicate$ "1" = + { pop$ bst.st * } + { duplicate$ "2" = + { pop$ bst.nd * } + { "3" = + { bst.rd * } + { bst.th * } + if$ + } + if$ + } + if$ + } + if$ +} + +% Convert first, second etc in edition field to 1st, 2nd (from jfm.bst) +FUNCTION {convert.edition} +{ edition extract.num "l" change.case$ 's := + s "first" = s "1" = or + { bst.first } + { s "second" = s "2" = or + { bst.second } + { s "third" = s "3" = or + { bst.third } + { s "fourth" = s "4" = or + { bst.fourth } + { s "fifth" = s "5" = or + { bst.fifth } + { s #1 #1 substring$ is.num + { s eng.ord } + { edition } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% edition +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { bst.edition.pre convert.edition "l" change.case$ * bst.edition.post * } + { bst.edition.pre convert.edition "t" change.case$ * bst.edition.post * } + if$ + } + if$ +} + +%%% month +FUNCTION {format.month} +{ month empty$ + bst.hide.month #0 = not or + { "" } + { bst.month.pre month * bst.month.post * } + if$ +} + +%%% year and month +FUNCTION {format.date} +{ format.month format.year * +} + +%%% Is multiple pages like 1-100? +FUNCTION { multi.page.check } +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +%%% pages +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { bst.pages.pre pages n.dashify tie.or.space.connect * bst.pages.post } + { bst.page.pre pages tie.or.space.connect * bst.page.post } + if$ + } + if$ +} + +%%% number +FUNCTION {format.number} +{ number empty$ + bst.hide.number #0 = not or + { "" } + { bst.number.pre number * bst.number.post * } + if$ +} + +%%% volume +FUNCTION {format.volume} +{ volume empty$ + 'skip$ + { bst.volume.pre volume * bst.volume.post * + bst.year.position #3 = + { format.year * } + 'skip$ + if$ + } + if$ +} + +%%% number, page +FUNCTION {format.number.pages} +{ number empty$ + { format.pages } + { format.number format.pages * } + if$ +} + +%%% volume, page +FUNCTION {format.volume.pages} +{ volume empty$ + { format.pages } + { format.volume format.pages * } + if$ +} + +%%% volume, number, page +FUNCTION {format.volume.number.pages} +{ volume empty$ + { number empty$ + { format.pages } + { format.number format.pages * } + if$ + } + { number empty$ + { format.volume format.pages * } + { format.volume format.number * format.pages * } + if$ + } + if$ +} + +% volume, number, page +FUNCTION {format.vol.num.pages} +{ volume empty$ + %% volume is empty. + { number empty$ + %% number is empty. + { pages empty$ + % warning + { "there is no volume, number, and pages in " cite$ * warning$ "" } + { "" format.pages * } + if$ + } + %% number is not empty. + % warning + { "there's a number but no volume in " cite$ * warning$ + format.number.pages } + if$ + } + %% volume is not empty. + { number empty$ + %% number is empty. + { format.volume.pages } + %% number is not empty. + { format.volume.number.pages } + if$ + } + if$ +} + +%%% chapter +FUNCTION {format.chapter} +{ chapter empty$ + { "" } + { type empty$ + { bst.chapter.pre chapter tie.or.space.connect * bst.chapter.post } + { ", " * type " " * chapter * } + if$ + } + if$ +} + +%%% chapter, pages +FUNCTION {format.chapter.pages} +{ chapter empty$ + { pages empty$ + { "" } + { "" format.pages * } + if$ + } + { pages empty$ + { "" format.chapter * } + { "" format.chapter * format.pages * } + if$ + } + if$ +} + +%%% editor and booktitle +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { bst.in format.btitle * } + { bst.editor.btitle.order #0 = + { bst.in format.editors.x * " " * format.btitle * } + { bst.in format.btitle * " " * format.editors.x * } + if$ + } + if$ + } + if$ +} + +%%% howpublished +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { bst.howpublished.pre howpublished * bst.howpublished.post * } + if$ +} + +%%% address +FUNCTION {format.address} +{ address empty$ + { "" } + { bst.address.pre address * bst.address.post * } + if$ +} + +%%% publisher +FUNCTION {format.publisher} +{ publisher empty$ + { "" } + { bst.publisher.pre publisher * bst.publisher.post * } + if$ +} + +%%% organization +FUNCTION {format.organization} +{ organization empty$ + { "" } + { bst.organization.pre organization * bst.organization.post * } + if$ +} + +%% publisher and address +FUNCTION {output.publisher.address} +{ address empty$ + { format.publisher "publisher" output.check.nocomma } + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ +} + +%% address, organization, publisher +FUNCTION {output.address.organization.publisher} +{ address empty$ + %% address is empty + { organization empty$ + %% organization is empty + { publisher empty$ + 'skip$ + { format.publisher "publisher" output.check.nocomma } + if$ + } + %% organization is not empty + { publisher empty$ + { format.organization "organization" output.check.nocomma } + { format.organization "organization" output.check.nocomma + format.publisher "publisher" output.check.nocomma } + if$ + } + if$ + } + %% address is not empty + { organization empty$ + %% organization is empty + { publisher empty$ + %% publisher is empty + { format.address output.nocomma } + %% publisher is not empty + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + %% organization is not empty + { publisher empty$ + %% publisher is empty + { format.organization "organization" output.check.nocomma + format.address output.nocomma } + %% publisher is not empty + { format.organization "organization" output.check.nocomma + bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% misc +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ " " type * } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + { " " type * } + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +%%% phdthesis +FUNCTION {format.phd} +{ bst.phdthesis } + +%%% mastersthesis +FUNCTION {format.mthesis} +{ bst.mthesis } + +%%% school +FUNCTION {format.school} +{ school empty$ + { "" } + { bst.school.pre school * bst.school.post * } + if$ +} + +%%% institution +FUNCTION {format.institution} +{ institution empty$ + { "" } + { bst.institution.pre institution * bst.institution.post * } + if$ +} + +%%% remove first ? characters. +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { bst.note.pre note * bst.note.post * } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \havarditem + +FUNCTION {output.bibitem} +{ newline$ + "\harvarditem[" write$ + alabel write$ % alabel <- abbreviated citation + "]{" write$ + flabel write$ % flabel <- full citation + "}{" write$ + cyear write$ + % cyear = year + "}{" write$ + cite$ write$ % cite$ -> pusch keyword + "}" write$ + % If number index is on + bst.use.number.index #0 = + 'skip$ + { index #1 + 'index := + "" 'preone := + "" 'preten := + bst.number.index.digit "1" = + 'skip$ + { bst.number.index.digit "2" = + { "\hskip0.5em" 'preone := } + { bst.number.index.digit "3" = + { "\hskip1em" 'preone := + "\hskip0.5em" 'preten := } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + newline$ + before.all 'output.state := + "" + % number index + bst.use.number.index #0 = + 'skip$ + { index #10 < + % Insert spaces according to digit of number index. + { preone } + { index #100 < + { preten } + { "" } + if$ + } + if$ + bst.number.index.pre * index int.to.str$ * bst.number.index.post * write$ + } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% article + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.journal "journal" output.check.nocomma + bst.year.position #2 = + { format.date output.nocomma } + 'skip$ + if$ + format.vol.num.pages output.nocomma + + bst.year.position #1 = + { format.date output.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% book + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + + format.bvolume output.nocomma + format.number.series output.nocomma + output.publisher.address + + format.edition output.nocomma + format.book.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booklet + +FUNCTION {booklet} +{ output.bibitem + format.authors output.nocomma + format.year output.nocomma + format.misc.title "title" output.check.nocomma + format.howpublished output.nocomma + format.address output.nocomma + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inbook + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ +% format.book remove.pre.comma "title" output.check.nocomma + format.book "title" output.check.nocomma + format.edition output.nocomma + + format.bvolume output.nocomma + format.chapter.pages "chapter and pages" output.check.nocomma + format.number.series output.nocomma + output.publisher.address + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% incollection + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + output.address.organization.publisher + format.edition output.nocomma + format.chapter.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inproceedings + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + format.pages output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% conference + +FUNCTION {conference} +{ inproceedings } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% manual +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull.nocomma + address output.nocomma + } + if$ + } + { format.authors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + author empty$ + { organization empty$ + { format.address new.block.check + format.address output.nocomma + } + 'skip$ + if$ + } + { output.address.organization.publisher } + if$ + format.edition output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% mastersthesis + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.mthesis format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% misc + +FUNCTION {misc} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Online + +FUNCTION {online} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% phdthesis + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + format.phd + format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + address empty$ + 'skip$ + { format.address output.nocomma } + if$ + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% proceedings + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output.nocomma } + { format.editors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.btitle remove.pre.comma "title" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% techreport + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.tr.number output.nonnull.nocomma + format.institution "institution" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% unpublished + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + bst.year.position #0 = not + { format.date remove.pre.comma output.nocomma } + { month empty$ + 'skip$ + { format.month remove.pre.comma output.nocomma } + if$ + } + if$ + + format.url.doi output.nocomma + + format.note "note" output.check.nocomma + fin.entry +} + +FUNCTION {default.type} +{ misc } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Alias for month names: + +MACRO {jan} {"January"} +MACRO {feb} {"February"} +MACRO {mar} {"March"} +MACRO {apr} {"April"} +MACRO {may} {"May"} +MACRO {jun} {"June"} +MACRO {jul} {"July"} +MACRO {aug} {"August"} +MACRO {sep} {"September"} +MACRO {oct} {"October"} +MACRO {nov} {"November"} +MACRO {dec} {"December"} + +%%% Read entries: +READ + +%%% Variable for remembering the order of citation. +INTEGERS { order.num } +FUNCTION {initialize.order.num} +{ + #1 'order.num := +} +%%% Initialize a variables +EXECUTE {initialize.order.num} + +%%% Variable for remembering the order of citation. +FUNCTION {set.order.cited} +{ + order.num 'order.cited := + #1 order.num + 'order.num := +} +%%% Iterate for all entries: +ITERATE {set.order.cited} + +%%% check the value of nameorder field. +FUNCTION {set.nameorder} +{ nameorder empty$ + { "" 'nameorder.temp := } + { nameorder 'nameorder.temp := } + if$ +} +%%% Iterate for all entries: +ITERATE {set.nameorder} + +%%% Remove symbols and convert to lowercase. +FUNCTION {sortify} +{ purify$ "l" change.case$ } + +%%% names for sorting +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { ", " * } + 'skip$ + if$ + s nameptr "{ll}{ f}{ j}" format.name$ 't := + nameptr numnames = t "others" = and + { bst.and.others.output *} + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + { s sort.format.names } + { s #1 "{ll}{ f}{ j}" format.name$ " zz " * } + if$ +} + +%%% Label for full author name. +FUNCTION {format.lab.names.full} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { ", " * t * } + if$ + } + { t "others" = + { bst.and.others.output * } + { numnames #2 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.ands * t * } + if$ + } + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.and * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + numnames #1 > #1 #2 = and {", eds" *} {} if$ + numnames #1 = #1 #2 = and {", ed" *} {} if$ +} + +%%% laberl for abbreviated author name. +FUNCTION {format.lab.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + % if the number of authors is less than bst.and.others.num, full name. + { s format.lab.names.full } + % if the number of authors is equal or more than bst.and.others.num, abbreviated name. + { s #1 "{ll}" format.name$ bst.and.others.output * } + if$ +} + +%%% abbreviated author +FUNCTION {author.key.label.abb} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.key.label.full} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {format.names.full.wo.and} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ll}{, ff}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { " " * t * } + { t "others" = + { " " * } + { numnames #2 > + { " " * t * } + { " " * t * } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.full.wo.and} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {author.editor.key.full.wo.and} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {editor.key.organization.key.full.wo.and} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ +} + +FUNCTION {author.key.organization.key.full.wo.and} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +%%% abbreviated author +FUNCTION {author.editor.key.label.abb} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.editor.key.label.full} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.full} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.abb} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +FUNCTION {editor.key.organization.label.full} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ +} + +FUNCTION {editor.key.organization.label.abb} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ +} + +%%% Convert numbers: 0->9, 1->8, 2->7,..., 9->0 +FUNCTION {reverse.num} +{ 's := + s "1" = + { "8" 'year.num := } + { s "2" = + { "7" 'year.num := } + { s "3" = + { "6" 'year.num := } + { s "4" = + { "5" 'year.num := } + { s "5" = + { "4" 'year.num := } + { s "6" = + { "3" 'year.num := } + { s "7" = + { "2" 'year.num := } + { s "8" = + { "1" 'year.num := } + { s "9" = + { "0" 'year.num := } + { s "0" = + { "9" 'year.num := } + { "9" 'year.num := } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + year.num +} + +%%% Convert year (large number -> small number) +FUNCTION {convert.year} +{ 't := + bst.reverse.year #0 = + { t 'tt := } + { t #1 #1 substring$ reverse.num + t #2 #1 substring$ reverse.num * + t #3 #1 substring$ reverse.num * + t #4 #1 substring$ reverse.num * 'tt := } + if$ + tt +} + +%%% cyear +FUNCTION {calc.cyear} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.full.wo.and + { type$ "proceedings" = + 'editor.key.organization.key.full.wo.and + { type$ "manual" = + 'author.key.organization.key.full.wo.and + 'author.key.full.wo.and + if$ + } + if$ + } + if$ + duplicate$ + year empty$ + { "2199" 'cyear := } + { year 'cyear := } + if$ + year empty$ + { " " "2199" convert.year * field.or.null * } + { " " year convert.year * field.or.null * } + if$ + sortify 'sort.label := + % For debug + econ.debug #0 = not + { "sort.label = ``\texttt{" write$ + sort.label write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ + pop$ +} + +FUNCTION {calc.sort.label.abb} +{ author empty$ + { editor empty$ + { "" } + { editor 's := } + if$ + } + { author 's := } + if$ + s sort.format.names.abb 't := + year empty$ + { t sortify " " * "2199" convert.year * 'sort.label.abb := } + { t sortify " " * year convert.year * 'sort.label.abb := } + if$ + econ.debug #0 = not + { "sort.label.abb = ``\texttt{" write$ + sort.label.abb write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% flabel +FUNCTION {calc.flabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.full + { type$ "proceedings" = + 'editor.key.organization.label.full + { type$ "manual" = + 'author.key.organization.label.full + 'author.key.label.full + if$ + } + if$ + } + if$ + 'flabel := + % For debug + econ.debug #0 = not + { "flabel = ``\texttt{" write$ + flabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% alabel +FUNCTION {calc.alabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.abb + { type$ "proceedings" = + 'editor.key.organization.label.abb + { type$ "manual" = + 'author.key.organization.label.abb + 'author.key.label.abb + if$ + } + if$ + } + if$ + 'alabel := + % For debug + econ.debug #0 = not + { "alabel = ``\texttt{" write$ + alabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% title for sorting +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +%%% author for sorting +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +%%% editor for sorting +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +%%% 1,...,9 -> 001,...,009 +%%% 10,...,99 -> 010,...,099 +FUNCTION {add.zero.to.number} +{ 's := + s text.length$ #1 = + { "00" s * } + { s text.length$ #2 = + { "0" s * } + { s } + if$ + } + if$ +} + +%% entry type +FUNCTION {bst.sort.entry.type.order} +{ 'item.type := + item.type "article" = + { "01" } + { item.type "book" = + { "02" } + { item.type "booklet" = + { "03" } + { item.type "comment" = + { "04" } + { item.type "conference" = + { "05" } + { item.type "inbook" = + { "06" } + { item.type "incollection" = + { "07" } + { item.type "inproceedings" = + { "08" } + { item.type "manual" = + { "09" } + { item.type "masterthesis" = + { "10" } + { item.type "misc" = + { "11" } + { item.type "phdthesis" = + { "12" } + { item.type "proceedings" = + { "13" } + { item.type "techreport" = + { "14" } + { item.type "unpublished" = + { "15" } + { "16" } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% Create sort.key$: absorder -> author -> year -> order -> month -> title. +FUNCTION {presort.one} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * + sort.label.abb * + " " * + type$ "book" = type$ "inbook" = or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + * " " * + " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +FUNCTION {presort.two} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * sort.label * " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% Codes for debugging +FUNCTION {calc.alabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.alabel: alabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {calc.flabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.flabel: flabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {presort.one.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (1st time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {presort.two.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (2nd time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.cyear.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.cyear: sort.label = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.sort.label.abb.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.sort.label.abb: sort.label.abb = }\\" write$ + newline$ } + 'skip$ + if$ +} + +%%% alabel +EXECUTE {calc.alabel.mess} +ITERATE {calc.alabel} + +%%% flabel +EXECUTE {calc.flabel.mess} +ITERATE {calc.flabel} + +%%% cyear and sort.label +EXECUTE {calc.cyear.mess} +ITERATE {calc.cyear} + +%%% +EXECUTE {calc.sort.label.abb.mess} +ITERATE {calc.sort.label.abb} + +%%% Sorting by $sort.key (first time) +% +% Sorting is done in two times. This is the first time. +% +EXECUTE {presort.one.mess} +ITERATE {presort.one} +SORT + +FUNCTION {forward.pass} +{ bst.use.bysame #0 = bst.use.bysame #2 = or + % Not use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + } + % Use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + % format.names 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label empty$ not + { cyear extra.label * } + { cyear "" * } + if$ + "" field.or.null * + 'cyear := + extra.label 'next.extra := +} + +%%% \bysame +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +%%% Sorting by sort.key$ (second time) +EXECUTE {presort.two.mess} +ITERATE {presort.two} +SORT + +FUNCTION {reset.prev.author} +{ "xxyyzz" 'prev.author := } + +EXECUTE {reset.prev.author} + +FUNCTION {forward.pass.two} +{ bst.use.bysame #1 = + { author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + 'skip$ + if$ +} + +ITERATE {forward.pass.two} + +FUNCTION{punctuation} +{ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ + "% This bbl file is created by econ.bst ver." econ.version * write$ newline$ + "% The latest econ.bst is available at" write$ newline$ + "% <https://github.com/ShiroTakeda/econ-bst>" write$ newline$ newline$ +} + +EXECUTE {punctuation} + +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + bst.use.bysame #0 = + % Not use \bysame. + 'skip$ + % Use \bysame. + { "%%% Definition of \bysame" write$ newline$ + "\ifx\undefined\bysame" write$ newline$ + "\newcommand{\bysame}{" bst.bysame.definition * "}" * + write$ newline$ + "\fi" write$ newline$ newline$ } + if$ + %% When number index is attached to the beginning of each item. + bst.use.number.index #0 = + 'skip$ + { bst.number.index.digit "1" = + % one digit. + { bst.number.index.bibhang.one } + { bst.number.index.digit "2" = + % two digits. + { bst.number.index.bibhang.ten } + % three or more digits. + { bst.number.index.bibhang.hund } + if$ + } + if$ + 'hang := + "%%% Redefinition of \bibhang" write$ newline$ + "\ifx\undefined\bibhang" write$ newline$ + "\relax" write$ newline$ + "\else" write$ newline$ + "\setlength{\bibhang}{" + hang * "}" * write$ newline$ + "\fi" write$ newline$ newline$ + } + if$ + "\begin{thebibliography}{xxx}" write$ newline$ + + %% Initialize the variable `index'. + #0 'index := +} + +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ } + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +EXECUTE {end.bib} + +% -------------------- +% Local Variables: +% fill-column: 78 +% mode: bst +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.pdf Binary files differnew file mode 100644 index 00000000000..e0ebbf31395 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.tex new file mode 100644 index 00000000000..8023ef3ccde --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-b.tex @@ -0,0 +1,55 @@ +%#!pdflatex +%#BIBTEX bibtex econ-b + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +This document uses ``\verb|econ-b.bst|''. + +\vspace{1em} + +\input{cited-part} +\nocite{*} + +%% bst file: +\bibliographystyle{econ-b} +\bibliography{../econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-default.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-default.pdf Binary files differnew file mode 100644 index 00000000000..9c740aad58f --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-default.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-default.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-default.tex new file mode 100644 index 00000000000..43dbe40588c --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-default.tex @@ -0,0 +1,58 @@ +%#!pdflatex +%#BIBTEX bibtex econ-default + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage[longnamesfirst]{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +pagecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +This document uses ``\verb|econ.bst|''. + +\vspace{1em} + +\input{cited-part} +\nocite{*} + +%% bst file: +\bibliographystyle{../econ} +\bibliography{../econ-example} + + +\end{document} + + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.bst b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.bst new file mode 100644 index 00000000000..89e5c51528e --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.bst @@ -0,0 +1,3530 @@ +%% econ.bst: BibTeX style file for papers in economics. +% +% Author: Shiro Takeda +% Maintainer: Shiro Takeda +% Copyright (C) 2001-2018 Shiro Takeda +% First-written: <2007/07/28> +% Time-stamp: <2018-12-07 18:48:59 st> +% Version: 2.4 +% Keywords: TeX, BibTeX, bst +% URL: https://github.com/ShiroTakeda/econ-bst + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is Shiro Takeda. + +%% Main features of econ.bst. + +% "econ.bst" is a BibTeX style file for economics. It provids the following +% features: + +% 1) The author-year type citation (you need "natbib.sty" as well). +% 2) Reference style used in economics papers ("econ.bst" is not a BibTeX style +% for a specific journal). +% 3) Highly customizable. You can easily customize reference style as you wish. +% 4) You can use "certified random order" proposed by Ray ⓡ Robson (2018) +% (http://dx.doi.org/10.1257/aer.20161492). + +% Bug reports, requests and suggestions are welcome. + +% For changelogs, see CHANGES.txt file. + +% version number +FUNCTION {econ.version} { "2.5" } + +% Debug mode. Non-zero makes debug mode on. +FUNCTION {econ.debug} +{ #0 } % Debug mode off (default). +% { #1 } % Debug mode on. + +ENTRY + %%% Declaration of field + { access address author booktitle chapter doi edition editor howpublished + institution journal key month note number organization pages publisher + school series title type url volume year + % Fields specific to econ.bst + order absorder nameorder + } + + % Definition of entry variable. The entry variable is a variable which has + % different values according to different entries. + %% Integer entry variable: + { order.cited } + + %% String entry variable + { label cyear flabel alabel extra.label sort.label sort.label.abb + extra.label.bysame nameorder.temp } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Use \bysame or not. +% +% If set to #0, \bysame is not used. +% If set to #1, \bysame is used +% If set to #2, \bysame is used (alternative abbreviation style). +% +% Note that integer number is expressed as # + integer in bst file. +% \bysame is the function that abbreviates succession of the same authors' name by ---. +% +% See econ-sample.pdf for details. +% +FUNCTION {bst.use.bysame} +% { #0 } % Not use \bysame +{ #1 } % -> Use \bysame (default) +% { #2 } % -> Use \bysame of alternative style. + +% The definition of \bysame command. +% +FUNCTION {bst.bysame.definition} +{ "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default) +% { "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% The order of fist and last name. +% +FUNCTION {bst.author.name} +{ #0 } % (default) +% { #1 } +% { #2 } + +% Case of #0: First author -> last-first, other authors -> first-last. +% Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables. + +% Case of #1: All authors -> last-first +% Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J. + +% Case of #2: All authors -> first-last +% Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Abbreviate first name of authors (editors): +% +FUNCTION {bst.first.name.initial} +% { #0 } % #0 -> full letters (default). +{ #1 } % Non-zero -> initial letter only. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Decapitalize of strings in title field. +% +FUNCTION {bst.title.lower.case} +{ #0 } % If #0, not decapitalize title (default). +% { #1 } % If non-#0, decapitalize title + +% Hide title filed. +% +FUNCTION {bst.hide.title} +{ #0 } % #0 -> Title field is displayed (default) +% { #1 } % Non-zer -> Title field is hidden + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide month. +% +FUNCTION {bst.hide.month} +{ #0 } % #0 -> show month field (default). +% { #1 } % non-#0 -> hide month field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Attach number index like plain.bst. +% +FUNCTION {bst.use.number.index} +{ #0 } % Not use number index (default). +% { #1 } % Non-#0 -> Use number index + +% The string before number index: +% +FUNCTION {bst.number.index.pre} +{ "[" } % (default) + +% The string after number index. Adjustment is recommended. +% +FUNCTION {bst.number.index.post} +{ "]\hskip1.0em " } % (default) + +% Maximum digit of number index: +% If the number of reference items >= 100, set 3 to this function. +% If the number of reference items < 100, set 2 to this function. +% If the number of reference items < 10, set 1 to this function. +% +FUNCTION {bst.number.index.digit} +{ "2" } % (default) +% { "3" } + +% The functions below are used to adjust space and postion. If you use fonts +% other than computer modern fonts, you had better make adjustments. +% +% Setting for bst.number.index.digit = 1: +FUNCTION {bst.number.index.bibhang.one} +{ "2.05em" } % (default) +% Setting for bst.number.index.digit = 2: +FUNCTION {bst.number.index.bibhang.ten} +{ "2.55em" } % (default) +% Setting for bst.number.index.digit = 3: +FUNCTION {bst.number.index.bibhang.hund} +{ "3.05em" } % (default). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Position of "year": +% +% You can choose the position of year by this function. +% +% If set to #0, year is placed right after "author". +% If set to non-zero, year is placed at the end (before note field) except for +% aritcle type entry. +% +% In article type entry, the position of year changes according to the +% following rule: +% +% #1 -> year is placed at the end. +% #2 -> year is placed after journal name in aritcle type entry. +% #3 -> year is placed after volume in aritcle type entry. +% +FUNCTION {bst.year.position} +{ #0 } % (default). +% { #1 } % Last place before note. +% { #2 } % After journal name for aticle type entry. +% { #3 } % After volume for aticle type entry. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If 0, references are sorted by old documents -> recent documents. If +% non-zero, reverse order. +FUNCTION {bst.reverse.year} +{ #0 } % Normal order (old -> recent) (default). +% { #1 } % inverse order (recent -> old) + +% If non-zero, sort references by using year field as the primary key +% (chronological sorting). +FUNCTION {bst.sort.year} +{ #0 } % Normal case: year is used as the sorting key next to author (default). +% { #1 } % year is used as the primary sorting key. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If non-zero, references are listed in citation order. +% +FUNCTION {bst.no.sort} +{ #0 } % (default) +% { #1 } % listed in citation order. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Non-zero -> sort references by entry type (article, book, incollection etc.) +% +FUNCTION {bst.sort.entry.type} +{ #0 } % #0 -> Normal (not sort references by entry type) (default). +% { #1 } % Non-zero -> sort references by entry type. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use absorder field to sort items. Otherwise, ignore absorder field. +% +FUNCTION {bst.notuse.absorder.field} +{ #0 } % #0 -> Use absorder (default). +% { #1 } % Non-#0 -> Not use absorder. +% +% Order of priority to sort items +% +% absorder -> author -> year -> order -> month -> title +% +% wehre absorder and order fields are specific to econ.bst. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use order field to sort items. Otherwise, ignore order field. +% Note: order field is specific to econ.bst. +FUNCTION {bst.notuse.order.field} +{ #0 } % #0 -> Use order field (default). +% { #1 } % Non-#0 -> not use order field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% and + +%%% String used to separate author names in references. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.and} +{ " and " } % (default) + +%%% String used to separate author names in references (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.ands} +{ ", and " } % (default) + +%%% String used to separate author names in citation part. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.cite.and} +{ " and " } % (default) + +%%% String used to separate author names in citation part (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.cite.ands} +{ " and " } % (default) + +%%% If you want to use random author order for some bibliography entries, set +% non-zero to this function. +% +FUNCTION {bst.use.nameorder} +{ #1 } % Use random order (default) +% { #0 } % Not use random order + +%%% String used to separate author names in references for the entry of random +% author order. +% +FUNCTION {bst.and.nameorder} +{ " \textcircled{r} " } % (default) + +%%% String used to separate author names in citation part for the entry of +% random author order +% +FUNCTION {bst.cite.and.nameorder} +{ " \textcircled{r} " } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Author names in the citation part are abbreviated by et al. if the number of +% authors is greater or equal to bst.and.others.num. +FUNCTION {bst.and.others.num} +{ #3 } % If the number of authors is greater or equal to three (default). +% { #4 } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Strings used when abbreviating multiple-authors in citation part. +FUNCTION {bst.and.others} +{ " et~al." } % (default) + +% Strings used when abbreviating multiple-authors in citation part for entries +% with random author order. +FUNCTION {bst.and.others.nameorder} +{ " \textcircled{r}~al." } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% author + +% The string before author: +% +FUNCTION {bst.author.pre} +{ "\textsc{" } +% { "" } % (default) + +% The string after author: +% +FUNCTION {bst.author.post} +{ "}" } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% year + +% The string before year only for aritcle type entry. +% +FUNCTION {bst.year.pre} +{ " (" } % (default) + +% The string after year only for aritcle type entry. +% +FUNCTION {bst.year.post} +{ "): " } +% { ") " } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.pre} +{ " (" } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.post} +{ "): " } +% { ") " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% title (except for title in book) + +% The string before title: +% +FUNCTION {bst.title.pre} +{ "``" } % (default) + +% The string after title: +% +FUNCTION {bst.title.post} +{ ",''" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tile for book: + +% The string before book title: +% +FUNCTION {bst.book.pre} +{ " \textit{" } % (default) + +% The string after book title: +% +FUNCTION {bst.book.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booktitle + +% The string before booktitle: +% +FUNCTION {bst.btitle.pre} +{ " \textit{" } % (default) + +% The string after booktitle: +% +FUNCTION {bst.btitle.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% journal name + +% The string before journal name: +% +FUNCTION {bst.journal.pre} +{ " \textit{" } % (default) + +% The string after journal name: +% +FUNCTION {bst.journal.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% editor notation: + +% The string that indicates multiple editors: +% +FUNCTION {bst.editors} +{ " eds. " } % (default) + +% The string that indicates single editor: +% +FUNCTION {bst.editor} +{ " ed. " } % (default) + +% Order of editor and booktitle in incollection and inproceedings entries. +% +% If set to #0: editors -> booktitle order +% If set to non-zero: booktitle -> editors order +% +FUNCTION {bst.editor.btitle.order} +{ #0 } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% edition + +% The string before edition: +% +FUNCTION {bst.edition.pre} +{ ", " } % (default) + +% The string after edition: +% +FUNCTION {bst.edition.post} +{ " edition" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% volume + +% The string before volume: +% +FUNCTION {bst.volume.pre} +{ ", " } +% { ", Vol. " } % (default) + +% The string after volume: +% +FUNCTION {bst.volume.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% number + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide number. If non-zero, number is suppressed. +FUNCTION {bst.hide.number} +{ #0 } % #0 -> show number field (default) +% { #1 } % non-#0 -> Hide number field. + +% The string before number: +% +FUNCTION {bst.number.pre} +{ " (" } +% { ", No. " } % (default) + +% The string after number: +% +FUNCTION {bst.number.post} +{ ")" } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% in + +% In +% +FUNCTION {bst.in} +{ " in " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% page + +% The string before page (multiple pages): +% +FUNCTION {bst.pages.pre} +{ ", " } +% { ", pp." } % (default) + +% The string before page: +% +FUNCTION {bst.page.pre} +{ ", " } +% { ", p." } % (default) + +% The string after page (multiple pages): +% +FUNCTION {bst.pages.post} +{ "" } % (default) + +% The string after page: +% +FUNCTION {bst.page.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% chapter + +% The string before chapter: +% +FUNCTION {bst.chapter.pre} +{ ", Chap." } % (default) + +% The string after chapter: +% +FUNCTION {bst.chapter.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% month + +% The string before month: +% +FUNCTION {bst.month.pre} +{ ", " } % (default) + +% The string after month: +% +FUNCTION {bst.month.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% address +% The string before address: +% +FUNCTION {bst.address.pre} +{ ", " } % (default) + +% The string after address: +% +FUNCTION {bst.address.post} +{ "" } % (default) + +% You can choose the order of address and publisher by this function. +% +% If #0, address -> publisher order (the default value). +% If non-zero, publisher -> address order. + +FUNCTION {bst.address.position} +{ #0 } % Address is placed before publisher (default) +% { #1 } % Address is placed after publisher + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% publisher + +% The string before publisher: +% +FUNCTION {bst.publisher.pre} +{ ": " } % (default) + +% The string after publisher: +% +FUNCTION {bst.publisher.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% series + +% The string before series: +% +FUNCTION {bst.series.pre} +{ ", " } % (default) + +% The string after series: +% +FUNCTION {bst.series.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% organization + +% The string before organization: +% +FUNCTION {bst.organization.pre} +{ ", " } % (default) + +% The string after organization: +% +FUNCTION {bst.organization.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% school + +% The string before school: +% +FUNCTION {bst.school.pre} +{ ", " } % (default) + +% The string after school: +% +FUNCTION {bst.school.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% institution + +% The string before institution: +% +FUNCTION {bst.institution.pre} +{ ", " } % (default) + +% The string after institution: +% +FUNCTION {bst.institution.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% howpublished + +% The string before howpublished: +% +FUNCTION {bst.howpublished.pre} +{ " " } % (default) + +% The string after howpublished: +% +FUNCTION {bst.howpublished.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% url + +% Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed. +FUNCTION {bst.show.url} +{ #1 } % non-#0 -> Show url field (default) +% { #0 } % #0 -> Not show url field. + +% The string before url: +% +FUNCTION {bst.url.pre} +{ ", URL: \url{" } % (default) + +% The string after url: +% +FUNCTION {bst.url.post} +{ "}" } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Access + +% This setting is valid only if there are "access" field in bib +% files. The value of access field indicates accessed date for URL. + +% The string before access. +FUNCTION {bst.access.pre} +{ ", accessed on " } % (default) + +% The string after access. +FUNCTION {bst.access.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DOI (digital object identifier) + +% This setting is valid only if there are "doi" field in bib files. + +% Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed. +FUNCTION {bst.show.doi} +{ #1 } % non-#0 -> Show DOI field (default) +% { #0 } % #0 -> Not show DOI field. + +% The string before DOI: +% +FUNCTION {bst.doi.pre} +{ ", DOI: \href{http://dx.doi.org/" doi * "}{" * } % (default) + +% The string after DOI: +% +FUNCTION {bst.doi.post} +{ "}" } % (default) + +% How to show URL and DOI fields when both fields exist. +% +% #0 -> Both fields are displayed +% #1 -> Only URL field is displayed +% #2 -> Only DOI field is displayed +% +FUNCTION {bst.url.doi} +% { #0 } % (default) -> Both fields are displayed +% { #1 } % -> Only URL field is displayed +{ #2 } % -> Only DOI field is displayed + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Other functions: + +% The string before note. +FUNCTION {bst.note.pre} +{ ", " } % (default) + +% The string after note. +FUNCTION {bst.note.post} +{ "" } % (default) + +% The string that represents Technical report: +% +FUNCTION {bst.techrep} +{ " Tech. Rep." } % (default) + +% The string that represents master thesis: +% +FUNCTION {bst.mthesis} +{ " Master's thesis" } % (default) + +% The string that represents phd thesis: +% +FUNCTION {bst.phdthesis} +{ " Ph.D. dissertation" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization end here: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +FUNCTION {bst.first} +{ "1st" } + +FUNCTION {bst.second} +{ "2nd" } + +FUNCTION {bst.third} +{ "3rd" } + +FUNCTION {bst.fourth} +{ "4th" } + +FUNCTION {bst.fifth} +{ "5th" } + +FUNCTION {bst.st} +{ "st" } + +FUNCTION {bst.nd} +{ "nd" } + +FUNCTION {bst.rd} +{ "rd" } + +FUNCTION {bst.th} +{ "th" } + +%%%%% memo by Takeda + +% "a" 'b := indicates substituting string "a" for variable b. + +% Integer number #0, #1,... + +%%% Function definition: +% +% FUNCTION {name} +% { 's := +% +% } +% +% This is the definition of a function named "name". The function "name" is +% used in the following way +% +% "foo" name +% "foo" is an argument for the function "name". +% +% About the definition of a function with more than two arguments, see the +% definition of "chop.word". + +%%% Declaration of variables: + +%% String global variables: +STRINGS { s t tt } +STRINGS { year.num } +STRINGS { preone preten } +STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author } +STRINGS { hang } +STRINGS { item.type } +STRINGS { tempa tempb } + +%% Integer global variables: +INTEGERS { nameptr namesleft numnames name.num } +INTEGERS { multiresult } +INTEGERS { index } +INTEGERS { len } +INTEGERS { last.extra.num } +INTEGERS { output.state before.all mid.sentence after.sentence after.block } +INTEGERS { last.period.comma } +INTEGERS { len1.aer len2.aer i.aer } + +%%% Definition of functions: +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +%%% Initialize variables: +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +%%% Remove comma and add period: +% +%%% +FUNCTION {add.period.x} +{ duplicate$ + #-1 #1 substring$ "," = + { #-2 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ". " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ", " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ",'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #2 substring$ ",~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #3 substring$ ",''" = + { #-4 global.max$ substring$ ".''" * } + { duplicate$ + #-1 #3 substring$ ".''" = + { #-4 global.max$ substring$ ".''" * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {output.nonnull} +{ 's := + % mid.sentence + output.state mid.sentence = + { ", " * write$ } + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period.x " " * write$ } + if$ + } + if$ + % not mid.sentence, set to mid.sentence + mid.sentence 'output.state := + } + if$ + s +} + +%%% If the last character is period or comma, set non-zero to +%%% last.period.comma. +FUNCTION {period.comma.p} +{ duplicate$ 't := + t #-1 #1 substring$ "." = + t #-1 #1 substring$ "," = or + t #-1 #1 substring$ ":" = or + t #-1 #2 substring$ ".'" = or + t #-1 #2 substring$ ",'" = or + t #-1 #3 substring$ ".''" = or + t #-1 #3 substring$ ",''" = or + t #-1 #2 substring$ ".~" = or + t #-1 #2 substring$ ",~" = or + { #1 'last.period.comma := } + { #0 'last.period.comma := } + if$ +} + +%%% remove unnecessary comma. +FUNCTION {remove.pre.comma} +{ 's := + s empty$ + { "" } + { s #1 #1 substring$ "," = + { s #2 global.max$ substring$ } + { s #1 #1 substring$ "." = + { s #2 global.max$ substring$ } + 's + if$ + } + if$ + } + if$ +} + +%%% output.nonnull.nocomma is the same as output.nonnull except that it does +%%% not add commas even in mid.sentence. +FUNCTION {output.nonnull.nocomma} +{ 's := + output.state mid.sentence = + % mid.sentence + { period.comma.p "" * write$ } + + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + last.period.comma #0 = + { s } + { s remove.pre.comma } + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output} +% { duplicate$ empty$ +% 'pop$ +% 'output.nonnull +% if$ +% } + +FUNCTION {output.nocomma} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.nocomma + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output.check} +% { 't := +% duplicate$ empty$ +% { pop$ "empty " t * " in " * cite$ * warning$ } +% 'output.nonnull +% if$ +% } + +FUNCTION {output.check.nocomma} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull.nocomma + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Format in bbl file: + +% \harvarditem[Brezis et~al.]{Brezis, Krugman and +% Tsiddon}{1993}{brezis93:_leapf_inter_compet} +% Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in +% International Competition: A Theory of Cycles in National Technological +% Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp. +% 1211--1219. + +% \harvarditem[abbreviated citation]{full citation}{year}{keyword} ... + +%%% Add period and newline. +FUNCTION {fin.entry} +{ add.period.x + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.check} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +%%% booktitle +FUNCTION {format.btitle} +{ booktitle empty$ + { "" } + { bst.btitle.pre booktitle * bst.btitle.post * } + if$ +} + +%%% journal +FUNCTION {format.journal} +{ journal empty$ + { "" } + { bst.journal.pre journal * bst.journal.post * } + if$ +} + +%%% title for book +FUNCTION {format.book} +{ title empty$ + { "" } + { bst.book.pre title * bst.book.post * } + if$ +} + +FUNCTION {format.url} +{ url empty$ + { "" } + { type$ "online" = bst.show.url or + { bst.url.pre url * bst.url.post * + access empty$ + { "" * } + { bst.access.pre * access * bst.access.post * } + if$ + } + { "" } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ bst.show.doi not or + { "" } + { bst.doi.pre doi * bst.doi.post * } + if$ +} + +FUNCTION {format.url.doi} +{ url empty$ + { format.doi } + { doi empty$ + { format.url } + { bst.url.doi #0 = + { format.url output.nocomma + format.doi } + { bst.url.doi #1 = + { format.url } + { format.doi } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% and others +FUNCTION {bst.and.others.output} +{ nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.others.nameorder } + { bst.and.others } + if$ +} + +%%% author and editor + +%%% name +FUNCTION {format.names} +{ 's := + % insert 1 to nameptr. + #1 'nameptr := + % Set the number of authors to numnames. + s num.names$ 'numnames := + numnames 'namesleft := + % Repeat if namesleft > 0 + { namesleft #0 > } + { nameptr #1 = + % First author + { bst.author.name #0 = + bst.author.name #1 = + or + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + if$ + } + % The second or later authors + { bst.author.name #0 = + bst.author.name #2 = + or + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + if$ + } + if$ + + nameptr #1 > + % The second or later authors + { nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { namesleft #1 > + % More than one authors left + { ", " * t * } + % Only one author left + { t "others" = + { bst.and.others.output * } + { numnames #2 = + % Entry with two authors + { bst.and * t * } + { bst.ands * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +% remove successive periods (commas) from author +FUNCTION {remove.ss.period.auth} +{ 's := + s format.names 'tempa := + bst.author.post 'tempb := + tempb #1 #1 substring$ "}" = + { tempa tempb * } + { tempa #-1 #1 substring$ tempb #1 #1 substring$ = + { tempa tempb #2 global.max$ substring$ * } + { tempa tempb * } + if$ + } + if$ +} + +% <prev name list> <new name list> compare.names <modified name list> +FUNCTION {compare.names.aer} +{ 's := + 'tempa := + +% "current.author = " s * "\\" * write$ newline$ +% "prev.author = " tempa * "\\" * write$ newline$ + + tempa num.names$ 'len1.aer := % len1 = the number of previous authors + s num.names$ 'len2.aer := % len2 = the number of current authors + +% len1.aer := min(len1.aer,len2.aer) +% len1 -> min{ the number of previous authors, the number of current authors } + len1.aer len2.aer > + { len2.aer 'len1.aer := } + { } + if$ + +% start with an empty string, then while the components are the same +% add "\bysame" + "" + #1 'i.aer := + + { i.aer len1.aer > not } + { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ + = + { #1 i.aer < + { " and " * } % \bysame で省略する著者の前につく and + { } + if$ + "\bysame{}" * + i.aer #1 + 'i.aer := } + { #-1 'len1.aer := } + if$ + } + while$ + +% add the rest of the second string + { i.aer len2.aer > not } + { #1 i.aer < + { " and " * } + { } + if$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ * + i.aer #1 + 'i.aer := + } + while$ +} + +%%% author +FUNCTION {format.authors} +{ author empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer author compare.names.aer 's := + author 'prev.author.aer := } + { author 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors} +{ editor empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer editor compare.names.aer 's := + editor 'prev.author.aer := } + { editor 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + s num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +FUNCTION {format.authors.alt} +{ author empty$ + { "" } + { extra.label.bysame "bysame" = + {"\bysame "} + { bst.author.pre author remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors.alt} +{ editor empty$ + { "" } + { extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre editor remove.ss.period.auth * } + if$ + editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +%%% format.in.ed.booktitle +FUNCTION {format.editors.x} +{ editor empty$ + { "" } + { bst.editor.btitle.order #0 = + { "" } + { editor num.names$ #1 > + { bst.editors " by " * } + { bst.editor " by " * } + if$ + } + if$ + editor format.names * + bst.editor.btitle.order #0 = + { editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + { "" * } + if$ + } + if$ +} + +%%% Remove commas in the cases like "?." and "?,". +FUNCTION {remove.irrelevant.period.comma} +{ 's := + s empty$ + { "" } + { s #-1 #3 substring$ "?,'" = + s #-1 #3 substring$ "?.'" = or + { s #-3 global.max$ substring$ "'" * } + { s #-1 #4 substring$ "?,''" = + s #-1 #4 substring$ "?.''" = or + { s #-4 global.max$ substring$ "''" * } + { s #-1 #2 substring$ "?," = + s #-1 #2 substring$ "?." = or + { s #-2 global.max$ substring$ "" * } + { s #-1 #3 substring$ "?,~" = + s #-1 #3 substring$ "?.~" = or + { s #-4 global.max$ substring$ "?~" * } + 's + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% title +FUNCTION {format.title.sub} +{ bst.title.lower.case #0 = + { bst.title.pre title * bst.title.post * } + { bst.title.pre title "t" change.case$ * bst.title.post * } + if$ +} + +%%% title +FUNCTION {format.title} +{ title empty$ + bst.hide.title #0 = not or + { "" } + { format.title.sub remove.irrelevant.period.comma } + if$ +} + +%%% title for misc. +FUNCTION {format.misc.title} +{ title empty$ + { "" } + { bst.title.pre title * bst.title.post * } + if$ +} + +% Convert "-" to "--" (for pages field) +FUNCTION {n.dashify} +{ 't := + "" + %% while$ + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +%%% year +FUNCTION {format.year} +{ year empty$ + { "there's no year in " cite$ * warning$ + ", " } + { type$ "article" = + { bst.year.pre year * extra.label * bst.year.post * } + { bst.year.na.pre year * extra.label * bst.year.na.post * } + if$ + } + if$ +} + +%%% page for book +FUNCTION {format.book.pages} +{ pages empty$ + { "" } + { bst.pages.pre pages * bst.pages.post * } + if$ +} + +%%% Attach tie for the string with two or less characters. +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +%%% volume for book +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { bst.volume.pre volume * bst.volume.post * + series empty$ + 'skip$ + %% If there is series field + { " of " * series * bst.series.post * } + if$ +% "volume and number" number either.or.check + } + if$ +} + +%%% series +FUNCTION {output.series} +{ series empty$ + { "" } + { bst.series.pre series * bst.series.post * } + if$ +} + +%%% number and series +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + bst.hide.month #0 = not or + % number is empty + { series empty$ + { "" } + % series is not empty. + { output.series } + if$ + } + % number is not empty$ + { series empty$ + { bst.number.pre number * bst.number.post * } + % series is not empty. + { bst.in bst.series.pre * series * bst.series.post * + bst.number.pre * number * bst.number.post * } + if$ + } + if$ + } + { "" } + if$ +} + +%%% Number or not. +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ + } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% edition + +% Convert edition to 1st, 2nd, 3rd, 4th etc +FUNCTION {eng.ord} +{ duplicate$ "1" swap$ * + #-2 #1 substring$ "1" = + { bst.th * } + { duplicate$ #-1 #1 substring$ + duplicate$ "1" = + { pop$ bst.st * } + { duplicate$ "2" = + { pop$ bst.nd * } + { "3" = + { bst.rd * } + { bst.th * } + if$ + } + if$ + } + if$ + } + if$ +} + +% Convert first, second etc in edition field to 1st, 2nd (from jfm.bst) +FUNCTION {convert.edition} +{ edition extract.num "l" change.case$ 's := + s "first" = s "1" = or + { bst.first } + { s "second" = s "2" = or + { bst.second } + { s "third" = s "3" = or + { bst.third } + { s "fourth" = s "4" = or + { bst.fourth } + { s "fifth" = s "5" = or + { bst.fifth } + { s #1 #1 substring$ is.num + { s eng.ord } + { edition } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% edition +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { bst.edition.pre convert.edition "l" change.case$ * bst.edition.post * } + { bst.edition.pre convert.edition "t" change.case$ * bst.edition.post * } + if$ + } + if$ +} + +%%% month +FUNCTION {format.month} +{ month empty$ + bst.hide.month #0 = not or + { "" } + { bst.month.pre month * bst.month.post * } + if$ +} + +%%% year and month +FUNCTION {format.date} +{ format.month format.year * +} + +%%% Is multiple pages like 1-100? +FUNCTION { multi.page.check } +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +%%% pages +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { bst.pages.pre pages n.dashify tie.or.space.connect * bst.pages.post } + { bst.page.pre pages tie.or.space.connect * bst.page.post } + if$ + } + if$ +} + +%%% number +FUNCTION {format.number} +{ number empty$ + bst.hide.number #0 = not or + { "" } + { bst.number.pre number * bst.number.post * } + if$ +} + +%%% volume +FUNCTION {format.volume} +{ volume empty$ + 'skip$ + { bst.volume.pre volume * bst.volume.post * + bst.year.position #3 = + { format.year * } + 'skip$ + if$ + } + if$ +} + +%%% number, page +FUNCTION {format.number.pages} +{ number empty$ + { format.pages } + { format.number format.pages * } + if$ +} + +%%% volume, page +FUNCTION {format.volume.pages} +{ volume empty$ + { format.pages } + { format.volume format.pages * } + if$ +} + +%%% volume, number, page +FUNCTION {format.volume.number.pages} +{ volume empty$ + { number empty$ + { format.pages } + { format.number format.pages * } + if$ + } + { number empty$ + { format.volume format.pages * } + { format.volume format.number * format.pages * } + if$ + } + if$ +} + +% volume, number, page +FUNCTION {format.vol.num.pages} +{ volume empty$ + %% volume is empty. + { number empty$ + %% number is empty. + { pages empty$ + % warning + { "there is no volume, number, and pages in " cite$ * warning$ "" } + { "" format.pages * } + if$ + } + %% number is not empty. + % warning + { "there's a number but no volume in " cite$ * warning$ + format.number.pages } + if$ + } + %% volume is not empty. + { number empty$ + %% number is empty. + { format.volume.pages } + %% number is not empty. + { format.volume.number.pages } + if$ + } + if$ +} + +%%% chapter +FUNCTION {format.chapter} +{ chapter empty$ + { "" } + { type empty$ + { bst.chapter.pre chapter tie.or.space.connect * bst.chapter.post } + { ", " * type " " * chapter * } + if$ + } + if$ +} + +%%% chapter, pages +FUNCTION {format.chapter.pages} +{ chapter empty$ + { pages empty$ + { "" } + { "" format.pages * } + if$ + } + { pages empty$ + { "" format.chapter * } + { "" format.chapter * format.pages * } + if$ + } + if$ +} + +%%% editor and booktitle +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { bst.in format.btitle * } + { bst.editor.btitle.order #0 = + { bst.in format.editors.x * " " * format.btitle * } + { bst.in format.btitle * " " * format.editors.x * } + if$ + } + if$ + } + if$ +} + +%%% howpublished +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { bst.howpublished.pre howpublished * bst.howpublished.post * } + if$ +} + +%%% address +FUNCTION {format.address} +{ address empty$ + { "" } + { bst.address.pre address * bst.address.post * } + if$ +} + +%%% publisher +FUNCTION {format.publisher} +{ publisher empty$ + { "" } + { bst.publisher.pre publisher * bst.publisher.post * } + if$ +} + +%%% organization +FUNCTION {format.organization} +{ organization empty$ + { "" } + { bst.organization.pre organization * bst.organization.post * } + if$ +} + +%% publisher and address +FUNCTION {output.publisher.address} +{ address empty$ + { format.publisher "publisher" output.check.nocomma } + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ +} + +%% address, organization, publisher +FUNCTION {output.address.organization.publisher} +{ address empty$ + %% address is empty + { organization empty$ + %% organization is empty + { publisher empty$ + 'skip$ + { format.publisher "publisher" output.check.nocomma } + if$ + } + %% organization is not empty + { publisher empty$ + { format.organization "organization" output.check.nocomma } + { format.organization "organization" output.check.nocomma + format.publisher "publisher" output.check.nocomma } + if$ + } + if$ + } + %% address is not empty + { organization empty$ + %% organization is empty + { publisher empty$ + %% publisher is empty + { format.address output.nocomma } + %% publisher is not empty + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + %% organization is not empty + { publisher empty$ + %% publisher is empty + { format.organization "organization" output.check.nocomma + format.address output.nocomma } + %% publisher is not empty + { format.organization "organization" output.check.nocomma + bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% misc +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ " " type * } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + { " " type * } + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +%%% phdthesis +FUNCTION {format.phd} +{ bst.phdthesis } + +%%% mastersthesis +FUNCTION {format.mthesis} +{ bst.mthesis } + +%%% school +FUNCTION {format.school} +{ school empty$ + { "" } + { bst.school.pre school * bst.school.post * } + if$ +} + +%%% institution +FUNCTION {format.institution} +{ institution empty$ + { "" } + { bst.institution.pre institution * bst.institution.post * } + if$ +} + +%%% remove first ? characters. +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { bst.note.pre note * bst.note.post * } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \havarditem + +FUNCTION {output.bibitem} +{ newline$ + "\harvarditem[" write$ + alabel write$ % alabel <- abbreviated citation + "]{" write$ + flabel write$ % flabel <- full citation + "}{" write$ + cyear write$ + % cyear = year + "}{" write$ + cite$ write$ % cite$ -> pusch keyword + "}" write$ + % If number index is on + bst.use.number.index #0 = + 'skip$ + { index #1 + 'index := + "" 'preone := + "" 'preten := + bst.number.index.digit "1" = + 'skip$ + { bst.number.index.digit "2" = + { "\hskip0.5em" 'preone := } + { bst.number.index.digit "3" = + { "\hskip1em" 'preone := + "\hskip0.5em" 'preten := } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + newline$ + before.all 'output.state := + "" + % number index + bst.use.number.index #0 = + 'skip$ + { index #10 < + % Insert spaces according to digit of number index. + { preone } + { index #100 < + { preten } + { "" } + if$ + } + if$ + bst.number.index.pre * index int.to.str$ * bst.number.index.post * write$ + } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% article + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.journal "journal" output.check.nocomma + bst.year.position #2 = + { format.date output.nocomma } + 'skip$ + if$ + format.vol.num.pages output.nocomma + + bst.year.position #1 = + { format.date output.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% book + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + + format.bvolume output.nocomma + format.number.series output.nocomma + output.publisher.address + + format.edition output.nocomma + format.book.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booklet + +FUNCTION {booklet} +{ output.bibitem + format.authors output.nocomma + format.year output.nocomma + format.misc.title "title" output.check.nocomma + format.howpublished output.nocomma + format.address output.nocomma + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inbook + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ +% format.book remove.pre.comma "title" output.check.nocomma + format.book "title" output.check.nocomma + format.edition output.nocomma + + format.bvolume output.nocomma + format.chapter.pages "chapter and pages" output.check.nocomma + format.number.series output.nocomma + output.publisher.address + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% incollection + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + output.address.organization.publisher + format.edition output.nocomma + format.chapter.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inproceedings + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + format.pages output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% conference + +FUNCTION {conference} +{ inproceedings } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% manual +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull.nocomma + address output.nocomma + } + if$ + } + { format.authors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + author empty$ + { organization empty$ + { format.address new.block.check + format.address output.nocomma + } + 'skip$ + if$ + } + { output.address.organization.publisher } + if$ + format.edition output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% mastersthesis + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.mthesis format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% misc + +FUNCTION {misc} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Online + +FUNCTION {online} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% phdthesis + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + format.phd + format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + address empty$ + 'skip$ + { format.address output.nocomma } + if$ + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% proceedings + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output.nocomma } + { format.editors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.btitle remove.pre.comma "title" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% techreport + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.tr.number output.nonnull.nocomma + format.institution "institution" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% unpublished + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + bst.year.position #0 = not + { format.date remove.pre.comma output.nocomma } + { month empty$ + 'skip$ + { format.month remove.pre.comma output.nocomma } + if$ + } + if$ + + format.url.doi output.nocomma + + format.note "note" output.check.nocomma + fin.entry +} + +FUNCTION {default.type} +{ misc } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Alias for month names: + +MACRO {jan} {"January"} +MACRO {feb} {"February"} +MACRO {mar} {"March"} +MACRO {apr} {"April"} +MACRO {may} {"May"} +MACRO {jun} {"June"} +MACRO {jul} {"July"} +MACRO {aug} {"August"} +MACRO {sep} {"September"} +MACRO {oct} {"October"} +MACRO {nov} {"November"} +MACRO {dec} {"December"} + +%%% Read entries: +READ + +%%% Variable for remembering the order of citation. +INTEGERS { order.num } +FUNCTION {initialize.order.num} +{ + #1 'order.num := +} +%%% Initialize a variables +EXECUTE {initialize.order.num} + +%%% Variable for remembering the order of citation. +FUNCTION {set.order.cited} +{ + order.num 'order.cited := + #1 order.num + 'order.num := +} +%%% Iterate for all entries: +ITERATE {set.order.cited} + +%%% check the value of nameorder field. +FUNCTION {set.nameorder} +{ nameorder empty$ + { "" 'nameorder.temp := } + { nameorder 'nameorder.temp := } + if$ +} +%%% Iterate for all entries: +ITERATE {set.nameorder} + +%%% Remove symbols and convert to lowercase. +FUNCTION {sortify} +{ purify$ "l" change.case$ } + +%%% names for sorting +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { ", " * } + 'skip$ + if$ + s nameptr "{ll}{ f}{ j}" format.name$ 't := + nameptr numnames = t "others" = and + { bst.and.others.output *} + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + { s sort.format.names } + { s #1 "{ll}{ f}{ j}" format.name$ " zz " * } + if$ +} + +%%% Label for full author name. +FUNCTION {format.lab.names.full} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { ", " * t * } + if$ + } + { t "others" = + { bst.and.others.output * } + { numnames #2 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.ands * t * } + if$ + } + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.and * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + numnames #1 > #1 #2 = and {", eds" *} {} if$ + numnames #1 = #1 #2 = and {", ed" *} {} if$ +} + +%%% laberl for abbreviated author name. +FUNCTION {format.lab.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + % if the number of authors is less than bst.and.others.num, full name. + { s format.lab.names.full } + % if the number of authors is equal or more than bst.and.others.num, abbreviated name. + { s #1 "{ll}" format.name$ bst.and.others.output * } + if$ +} + +%%% abbreviated author +FUNCTION {author.key.label.abb} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.key.label.full} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {format.names.full.wo.and} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ll}{, ff}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { " " * t * } + { t "others" = + { " " * } + { numnames #2 > + { " " * t * } + { " " * t * } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.full.wo.and} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {author.editor.key.full.wo.and} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {editor.key.organization.key.full.wo.and} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ +} + +FUNCTION {author.key.organization.key.full.wo.and} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +%%% abbreviated author +FUNCTION {author.editor.key.label.abb} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.editor.key.label.full} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.full} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.abb} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +FUNCTION {editor.key.organization.label.full} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ +} + +FUNCTION {editor.key.organization.label.abb} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ +} + +%%% Convert numbers: 0->9, 1->8, 2->7,..., 9->0 +FUNCTION {reverse.num} +{ 's := + s "1" = + { "8" 'year.num := } + { s "2" = + { "7" 'year.num := } + { s "3" = + { "6" 'year.num := } + { s "4" = + { "5" 'year.num := } + { s "5" = + { "4" 'year.num := } + { s "6" = + { "3" 'year.num := } + { s "7" = + { "2" 'year.num := } + { s "8" = + { "1" 'year.num := } + { s "9" = + { "0" 'year.num := } + { s "0" = + { "9" 'year.num := } + { "9" 'year.num := } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + year.num +} + +%%% Convert year (large number -> small number) +FUNCTION {convert.year} +{ 't := + bst.reverse.year #0 = + { t 'tt := } + { t #1 #1 substring$ reverse.num + t #2 #1 substring$ reverse.num * + t #3 #1 substring$ reverse.num * + t #4 #1 substring$ reverse.num * 'tt := } + if$ + tt +} + +%%% cyear +FUNCTION {calc.cyear} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.full.wo.and + { type$ "proceedings" = + 'editor.key.organization.key.full.wo.and + { type$ "manual" = + 'author.key.organization.key.full.wo.and + 'author.key.full.wo.and + if$ + } + if$ + } + if$ + duplicate$ + year empty$ + { "2199" 'cyear := } + { year 'cyear := } + if$ + year empty$ + { " " "2199" convert.year * field.or.null * } + { " " year convert.year * field.or.null * } + if$ + sortify 'sort.label := + % For debug + econ.debug #0 = not + { "sort.label = ``\texttt{" write$ + sort.label write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ + pop$ +} + +FUNCTION {calc.sort.label.abb} +{ author empty$ + { editor empty$ + { "" } + { editor 's := } + if$ + } + { author 's := } + if$ + s sort.format.names.abb 't := + year empty$ + { t sortify " " * "2199" convert.year * 'sort.label.abb := } + { t sortify " " * year convert.year * 'sort.label.abb := } + if$ + econ.debug #0 = not + { "sort.label.abb = ``\texttt{" write$ + sort.label.abb write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% flabel +FUNCTION {calc.flabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.full + { type$ "proceedings" = + 'editor.key.organization.label.full + { type$ "manual" = + 'author.key.organization.label.full + 'author.key.label.full + if$ + } + if$ + } + if$ + 'flabel := + % For debug + econ.debug #0 = not + { "flabel = ``\texttt{" write$ + flabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% alabel +FUNCTION {calc.alabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.abb + { type$ "proceedings" = + 'editor.key.organization.label.abb + { type$ "manual" = + 'author.key.organization.label.abb + 'author.key.label.abb + if$ + } + if$ + } + if$ + 'alabel := + % For debug + econ.debug #0 = not + { "alabel = ``\texttt{" write$ + alabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% title for sorting +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +%%% author for sorting +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +%%% editor for sorting +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +%%% 1,...,9 -> 001,...,009 +%%% 10,...,99 -> 010,...,099 +FUNCTION {add.zero.to.number} +{ 's := + s text.length$ #1 = + { "00" s * } + { s text.length$ #2 = + { "0" s * } + { s } + if$ + } + if$ +} + +%% entry type +FUNCTION {bst.sort.entry.type.order} +{ 'item.type := + item.type "article" = + { "01" } + { item.type "book" = + { "02" } + { item.type "booklet" = + { "03" } + { item.type "comment" = + { "04" } + { item.type "conference" = + { "05" } + { item.type "inbook" = + { "06" } + { item.type "incollection" = + { "07" } + { item.type "inproceedings" = + { "08" } + { item.type "manual" = + { "09" } + { item.type "masterthesis" = + { "10" } + { item.type "misc" = + { "11" } + { item.type "phdthesis" = + { "12" } + { item.type "proceedings" = + { "13" } + { item.type "techreport" = + { "14" } + { item.type "unpublished" = + { "15" } + { "16" } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% Create sort.key$: absorder -> author -> year -> order -> month -> title. +FUNCTION {presort.one} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * + sort.label.abb * + " " * + type$ "book" = type$ "inbook" = or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + * " " * + " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +FUNCTION {presort.two} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * sort.label * " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% Codes for debugging +FUNCTION {calc.alabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.alabel: alabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {calc.flabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.flabel: flabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {presort.one.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (1st time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {presort.two.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (2nd time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.cyear.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.cyear: sort.label = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.sort.label.abb.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.sort.label.abb: sort.label.abb = }\\" write$ + newline$ } + 'skip$ + if$ +} + +%%% alabel +EXECUTE {calc.alabel.mess} +ITERATE {calc.alabel} + +%%% flabel +EXECUTE {calc.flabel.mess} +ITERATE {calc.flabel} + +%%% cyear and sort.label +EXECUTE {calc.cyear.mess} +ITERATE {calc.cyear} + +%%% +EXECUTE {calc.sort.label.abb.mess} +ITERATE {calc.sort.label.abb} + +%%% Sorting by $sort.key (first time) +% +% Sorting is done in two times. This is the first time. +% +EXECUTE {presort.one.mess} +ITERATE {presort.one} +SORT + +FUNCTION {forward.pass} +{ bst.use.bysame #0 = bst.use.bysame #2 = or + % Not use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + } + % Use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + % format.names 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label empty$ not + { cyear extra.label * } + { cyear "" * } + if$ + "" field.or.null * + 'cyear := + extra.label 'next.extra := +} + +%%% \bysame +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +%%% Sorting by sort.key$ (second time) +EXECUTE {presort.two.mess} +ITERATE {presort.two} +SORT + +FUNCTION {reset.prev.author} +{ "xxyyzz" 'prev.author := } + +EXECUTE {reset.prev.author} + +FUNCTION {forward.pass.two} +{ bst.use.bysame #1 = + { author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + 'skip$ + if$ +} + +ITERATE {forward.pass.two} + +FUNCTION{punctuation} +{ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ + "% This bbl file is created by econ.bst ver." econ.version * write$ newline$ + "% The latest econ.bst is available at" write$ newline$ + "% <https://github.com/ShiroTakeda/econ-bst>" write$ newline$ newline$ +} + +EXECUTE {punctuation} + +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + bst.use.bysame #0 = + % Not use \bysame. + 'skip$ + % Use \bysame. + { "%%% Definition of \bysame" write$ newline$ + "\ifx\undefined\bysame" write$ newline$ + "\newcommand{\bysame}{" bst.bysame.definition * "}" * + write$ newline$ + "\fi" write$ newline$ newline$ } + if$ + %% When number index is attached to the beginning of each item. + bst.use.number.index #0 = + 'skip$ + { bst.number.index.digit "1" = + % one digit. + { bst.number.index.bibhang.one } + { bst.number.index.digit "2" = + % two digits. + { bst.number.index.bibhang.ten } + % three or more digits. + { bst.number.index.bibhang.hund } + if$ + } + if$ + 'hang := + "%%% Redefinition of \bibhang" write$ newline$ + "\ifx\undefined\bibhang" write$ newline$ + "\relax" write$ newline$ + "\else" write$ newline$ + "\setlength{\bibhang}{" + hang * "}" * write$ newline$ + "\fi" write$ newline$ newline$ + } + if$ + "\begin{thebibliography}{xxx}" write$ newline$ + + %% Initialize the variable `index'. + #0 'index := +} + +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ } + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +EXECUTE {end.bib} + +% -------------------- +% Local Variables: +% fill-column: 78 +% mode: bst +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.pdf Binary files differnew file mode 100644 index 00000000000..1f55afb51e3 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.tex new file mode 100644 index 00000000000..f4b1251bc7e --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-econometrica.tex @@ -0,0 +1,55 @@ +%#!pdflatex +%#BIBTEX bibtex econ-econometrica + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +This document uses ``\verb|econ-econometrica.bst|''. The style like ({\itshape Econometrica}). + +\vspace{1em} + +\input{cited-part} +\nocite{*} + +%% bst file: +\bibliographystyle{econ-econometrica} +\bibliography{../econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.bst b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.bst new file mode 100644 index 00000000000..7898a51f3a8 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.bst @@ -0,0 +1,3545 @@ +n%% econ.bst: BibTeX style file for papers in economics. +% +% Author: Shiro Takeda +% Maintainer: Shiro Takeda +% Copyright (C) 2001-2018 Shiro Takeda +% First-written: <2007/07/28> +% Time-stamp: <2018-12-07 18:48:36 st> +% Version: 2.5 +% Keywords: TeX, BibTeX, bst +% URL: https://github.com/ShiroTakeda/econ-bst + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is Shiro Takeda. + +%% Main features of econ.bst. + +% "econ.bst" is a BibTeX style file for economics. It provids the following +% features: + +% 1) The author-year type citation (you need "natbib.sty" as well). +% 2) Reference style used in economics papers ("econ.bst" is not a BibTeX style +% for a specific journal). +% 3) Highly customizable. You can easily customize reference style as you wish. +% 4) You can use "certified random order" proposed by Ray ⓡ Robson (2018) +% (http://dx.doi.org/10.1257/aer.20161492). + +% Bug reports, requests and suggestions are welcome. + +% For changelogs, see CHANGES.txt file. + +% version number +FUNCTION {econ.version} { "2.5" } + +% Debug mode. Non-zero makes debug mode on. +FUNCTION {econ.debug} +{ #0 } % Debug mode off (default). +% { #1 } % Debug mode on. + +ENTRY + %%% Declaration of field + { access address author booktitle chapter doi edition editor howpublished + institution journal key month note number organization pages publisher + school series title type url volume year + % Fields specific to econ.bst + order absorder nameorder + } + + % Definition of entry variable. The entry variable is a variable which has + % different values according to different entries. + %% Integer entry variable: + { order.cited } + + %% String entry variable + { label cyear flabel alabel extra.label sort.label sort.label.abb + extra.label.bysame nameorder.temp } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Use \bysame or not. +% +% If set to #0, \bysame is not used. +% If set to #1, \bysame is used +% If set to #2, \bysame is used (alternative abbreviation style). +% +% Note that integer number is expressed as # + integer in bst file. +% \bysame is the function that abbreviates succession of the same authors' name by ---. +% +% See econ-sample.pdf for details. +% +FUNCTION {bst.use.bysame} +{ #0 } % Not use \bysame +% { #1 } % -> Use \bysame (default) +% { #2 } % -> Use \bysame of alternative style. + +% The definition of \bysame command. +% +FUNCTION {bst.bysame.definition} +{ "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default) +% { "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% The order of fist and last name. +% +FUNCTION {bst.author.name} +% { #0 } % (default) +% { #1 } +{ #2 } + +% Case of #0: First author -> last-first, other authors -> first-last. +% Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables. + +% Case of #1: All authors -> last-first +% Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J. + +% Case of #2: All authors -> first-last +% Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Abbreviate first name of authors (editors): +% +FUNCTION {bst.first.name.initial} +% { #0 } % #0 -> full letters (default). +{ #1 } % Non-zero -> initial letter only. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Decapitalize of strings in title field. +% +FUNCTION {bst.title.lower.case} +% { #0 } % If #0, not decapitalize title (default). +{ #1 } % If non-#0, decapitalize title + +% Hide title filed. +% +FUNCTION {bst.hide.title} +{ #0 } % #0 -> Title field is displayed (default) +% { #1 } % Non-zer -> Title field is hidden + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide month. +% +FUNCTION {bst.hide.month} +{ #0 } % #0 -> show month field (default). +% { #1 } % non-#0 -> hide month field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Attach number index like plain.bst. +% +FUNCTION {bst.use.number.index} +{ #0 } % Not use number index (default). +% { #1 } % Non-#0 -> Use number index + +% The string before number index: +% +FUNCTION {bst.number.index.pre} +{ "[" } % (default) + +% The string after number index. Adjustment is recommended. +% +FUNCTION {bst.number.index.post} +{ "]\hskip1.0em " } % (default) + +% Maximum digit of number index: +% If the number of reference items >= 100, set 3 to this function. +% If the number of reference items < 100, set 2 to this function. +% If the number of reference items < 10, set 1 to this function. +% +FUNCTION {bst.number.index.digit} +{ "2" } % (default) +% { "3" } + +% The functions below are used to adjust space and postion. If you use fonts +% other than computer modern fonts, you had better make adjustments. +% +% Setting for bst.number.index.digit = 1: +FUNCTION {bst.number.index.bibhang.one} +{ "2.05em" } % (default) +% Setting for bst.number.index.digit = 2: +FUNCTION {bst.number.index.bibhang.ten} +{ "2.55em" } % (default) +% Setting for bst.number.index.digit = 3: +FUNCTION {bst.number.index.bibhang.hund} +{ "3.05em" } % (default). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Position of "year": +% +% You can choose the position of year by this function. +% +% If set to #0, year is placed right after "author". +% If set to non-zero, year is placed at the end (before note field) except for +% aritcle type entry. +% +% In article type entry, the position of year changes according to the +% following rule: +% +% #1 -> year is placed at the end. +% #2 -> year is placed after journal name in aritcle type entry. +% #3 -> year is placed after volume in aritcle type entry. +% +FUNCTION {bst.year.position} +% { #0 } % (default). +% { #1 } % Last place before note. +% { #2 } % After journal name for aticle type entry. +{ #3 } % After volume for aticle type entry. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If 0, references are sorted by old documents -> recent documents. If +% non-zero, reverse order. +FUNCTION {bst.reverse.year} +{ #0 } % Normal order (old -> recent) (default). +% { #1 } % inverse order (recent -> old) + +% If non-zero, sort references by using year field as the primary key +% (chronological sorting). +FUNCTION {bst.sort.year} +{ #0 } % Normal case: year is used as the sorting key next to author (default). +% { #1 } % year is used as the primary sorting key. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If non-zero, references are listed in citation order. +% +FUNCTION {bst.no.sort} +{ #0 } % (default) +% { #1 } % listed in citation order. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Non-zero -> sort references by entry type (article, book, incollection etc.) +% +FUNCTION {bst.sort.entry.type} +{ #0 } % #0 -> Normal (not sort references by entry type) (default). +% { #1 } % Non-zero -> sort references by entry type. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use absorder field to sort items. Otherwise, ignore absorder field. +% +FUNCTION {bst.notuse.absorder.field} +{ #0 } % #0 -> Use absorder (default). +% { #1 } % Non-#0 -> Not use absorder. +% +% Order of priority to sort items +% +% absorder -> author -> year -> order -> month -> title +% +% wehre absorder and order fields are specific to econ.bst. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use order field to sort items. Otherwise, ignore order field. +% Note: order field is specific to econ.bst. +FUNCTION {bst.notuse.order.field} +{ #0 } % #0 -> Use order field (default). +% { #1 } % Non-#0 -> not use order field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% and + +%%% String used to separate author names in references. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.and} +{ " and " } % (default) + +%%% String used to separate author names in references (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.ands} +{ ", and " } % (default) + +%%% String used to separate author names in citation part. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.cite.and} +{ " and " } % (default) + +%%% String used to separate author names in citation part (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.cite.ands} +{ " and " } % (default) + +%%% If you want to use random author order for some bibliography entries, set +% non-zero to this function. +% +FUNCTION {bst.use.nameorder} +{ #1 } % Use random order (default) +% { #0 } % Not use random order + +%%% String used to separate author names in references for the entry of random +% author order. +% +FUNCTION {bst.and.nameorder} +{ " \textcircled{r} " } % (default) + +%%% String used to separate author names in citation part for the entry of +% random author order +% +FUNCTION {bst.cite.and.nameorder} +{ " \textcircled{r} " } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Author names in the citation part are abbreviated by et al. if the number of +% authors is greater or equal to bst.and.others.num. +FUNCTION {bst.and.others.num} +{ #3 } % If the number of authors is greater or equal to three (default). +% { #4 } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Strings used when abbreviating multiple-authors in citation part. +FUNCTION {bst.and.others} +{ " et~al." } % (default) + +% Strings used when abbreviating multiple-authors in citation part for entries +% with random author order. +FUNCTION {bst.and.others.nameorder} +{ " \textcircled{r}~al." } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% author + +% The string before author: +% +FUNCTION {bst.author.pre} +{ "" } % (default) + +% The string after author: +% +FUNCTION {bst.author.post} +{ ", " } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% year + +% The string before year only for aritcle type entry. +% +FUNCTION {bst.year.pre} +{ " (" } +% { " (" } % (default) + +% The string after year only for aritcle type entry. +% +FUNCTION {bst.year.post} +{ ")" } +% { ") " } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.pre} +{ ", " } +% { " (" } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.post} +{ "" } +% { ") " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% title (except for title in book) + +% The string before title: +% +FUNCTION {bst.title.pre} +{ "" } +% { "``" } % (default) + +% The string after title: +% +FUNCTION {bst.title.post} +{ "," } +% { ",''" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tile for book: + +% The string before book title: +% +FUNCTION {bst.book.pre} +{ "" } +% { " \textit{" } % (default) + +% The string after book title: +% +FUNCTION {bst.book.post} +{ "" } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booktitle + +% The string before booktitle: +% +FUNCTION {bst.btitle.pre} +{ " " } +% { " \textit{" } % (default) + +% The string after booktitle: +% +FUNCTION {bst.btitle.post} +{ "" } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% journal name + +% The string before journal name: +% +FUNCTION {bst.journal.pre} +{ " " } +% { " \textit{" } % (default) + +% The string after journal name: +% +FUNCTION {bst.journal.post} +{ ", " } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% editor notation: + +% The string that indicates multiple editors: +% +FUNCTION {bst.editors} +{ " (Eds.), " } +% { " eds. " } % (default) + +% The string that indicates single editor: +% +FUNCTION {bst.editor} +{ " ed. " } % (default) + +% Order of editor and booktitle in incollection and inproceedings entries. +% +% If set to #0: editors -> booktitle order +% If set to non-zero: booktitle -> editors order +% +FUNCTION {bst.editor.btitle.order} +{ #0 } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% edition + +% The string before edition: +% +FUNCTION {bst.edition.pre} +{ ", " } % (default) + +% The string after edition: +% +FUNCTION {bst.edition.post} +{ " edition" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% volume + +% The string before volume: +% +FUNCTION {bst.volume.pre} +{ " " } +% { ", Vol. " } % (default) + +% The string after volume: +% +FUNCTION {bst.volume.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% number + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide number. If non-zero, number is suppressed. +FUNCTION {bst.hide.number} +% { #0 } % #0 -> show number field (default) +{ #1 } % non-#0 -> Hide number field. + +% The string before number: +% +FUNCTION {bst.number.pre} +{ ", No. " } % (default) + +% The string after number: +% +FUNCTION {bst.number.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% in + +% In +% +FUNCTION {bst.in} +{ " in: " } +% { " in " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% page + +% The string before page (multiple pages): +% +FUNCTION {bst.pages.pre} +{ " " } +% { ", pp." } % (default) + +% The string before page: +% +FUNCTION {bst.page.pre} +{ ", p." } % (default) + +% The string after page (multiple pages): +% +FUNCTION {bst.pages.post} +{ "" } % (default) + +% The string after page: +% +FUNCTION {bst.page.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% chapter + +% The string before chapter: +% +FUNCTION {bst.chapter.pre} +{ ", Chap." } % (default) + +% The string after chapter: +% +FUNCTION {bst.chapter.post} +{ ", " } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% month + +% The string before month: +% +FUNCTION {bst.month.pre} +{ ", " } % (default) + +% The string after month: +% +FUNCTION {bst.month.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% address +% The string before address: +% +FUNCTION {bst.address.pre} +{ ", " } % (default) + +% The string after address: +% +FUNCTION {bst.address.post} +{ "," } +% { "" } % (default) + +% You can choose the order of address and publisher by this function. +% +% If #0, address -> publisher order (the default value). +% If non-zero, publisher -> address order. + +FUNCTION {bst.address.position} +% { #0 } % Address is placed before publisher (default) +{ #1 } % Address is placed after publisher + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% publisher + +% The string before publisher: +% +FUNCTION {bst.publisher.pre} +{ ", " } +% { ": " } % (default) + +% The string after publisher: +% +FUNCTION {bst.publisher.post} +{ "," } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% series + +% The string before series: +% +FUNCTION {bst.series.pre} +{ ", " } % (default) + +% The string after series: +% +FUNCTION {bst.series.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% organization + +% The string before organization: +% +FUNCTION {bst.organization.pre} +{ ", " } % (default) + +% The string after organization: +% +FUNCTION {bst.organization.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% school + +% The string before school: +% +FUNCTION {bst.school.pre} +{ ", " } % (default) + +% The string after school: +% +FUNCTION {bst.school.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% institution + +% The string before institution: +% +FUNCTION {bst.institution.pre} +{ ", " } % (default) + +% The string after institution: +% +FUNCTION {bst.institution.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% howpublished + +% The string before howpublished: +% +FUNCTION {bst.howpublished.pre} +{ " " } % (default) + +% The string after howpublished: +% +FUNCTION {bst.howpublished.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% url + +% Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed. +FUNCTION {bst.show.url} +{ #1 } % non-#0 -> Show url field (default) +% { #0 } % #0 -> Not show url field. + +% The string before url: +% +FUNCTION {bst.url.pre} +{ ", URL: \url{" } % (default) + +% The string after url: +% +FUNCTION {bst.url.post} +{ "}" } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Access + +% This setting is valid only if there are "access" field in bib +% files. The value of access field indicates accessed date for URL. + +% The string before access. +FUNCTION {bst.access.pre} +{ ", accessed on " } % (default) + +% The string after access. +FUNCTION {bst.access.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DOI (digital object identifier) + +% This setting is valid only if there are "doi" field in bib files. + +% Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed. +FUNCTION {bst.show.doi} +{ #1 } % non-#0 -> Show DOI field (default) +% { #0 } % #0 -> Not show DOI field. + +% The string before DOI: +% +FUNCTION {bst.doi.pre} +{ ", DOI: \href{http://dx.doi.org/" doi * "}{" * } % (default) + +% The string after DOI: +% +FUNCTION {bst.doi.post} +{ "}" } % (default) + +FUNCTION {bst.doi.post.jp} +{ "}" } % (default) + +% How to show URL and DOI fields when both fields exist. +% +% #0 -> Both fields are displayed +% #1 -> Only URL field is displayed +% #2 -> Only DOI field is displayed +% +FUNCTION {bst.url.doi} +% { #0 } % (default) -> Both fields are displayed +% { #1 } % -> Only URL field is displayed +{ #2 } % -> Only DOI field is displayed + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Other functions: + +% The string before note. +FUNCTION {bst.note.pre} +{ ", " } % (default) + +% The string after note. +FUNCTION {bst.note.post} +{ "" } % (default) + +% The string that represents Technical report: +% +FUNCTION {bst.techrep} +{ " Tech. Rep." } % (default) + +% The string that represents master thesis: +% +FUNCTION {bst.mthesis} +{ " Master's thesis" } % (default) + +% The string that represents phd thesis: +% +FUNCTION {bst.phdthesis} +{ " Ph.D. dissertation" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization end here: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +FUNCTION {bst.first} +{ "1st" } + +FUNCTION {bst.second} +{ "2nd" } + +FUNCTION {bst.third} +{ "3rd" } + +FUNCTION {bst.fourth} +{ "4th" } + +FUNCTION {bst.fifth} +{ "5th" } + +FUNCTION {bst.st} +{ "st" } + +FUNCTION {bst.nd} +{ "nd" } + +FUNCTION {bst.rd} +{ "rd" } + +FUNCTION {bst.th} +{ "th" } + +%%%%% memo by Takeda + +% "a" 'b := indicates substituting string "a" for variable b. + +% Integer number #0, #1,... + +%%% Function definition: +% +% FUNCTION {name} +% { 's := +% +% } +% +% This is the definition of a function named "name". The function "name" is +% used in the following way +% +% "foo" name +% "foo" is an argument for the function "name". +% +% About the definition of a function with more than two arguments, see the +% definition of "chop.word". + +%%% Declaration of variables: + +%% String global variables: +STRINGS { s t tt } +STRINGS { year.num } +STRINGS { preone preten } +STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author } +STRINGS { hang } +STRINGS { item.type } +STRINGS { tempa tempb } + +%% Integer global variables: +INTEGERS { nameptr namesleft numnames name.num } +INTEGERS { multiresult } +INTEGERS { index } +INTEGERS { len } +INTEGERS { last.extra.num } +INTEGERS { output.state before.all mid.sentence after.sentence after.block } +INTEGERS { last.period.comma } +INTEGERS { len1.aer len2.aer i.aer } + +%%% Definition of functions: +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +%%% Initialize variables: +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +%%% Remove comma and add period: +% +%%% +FUNCTION {add.period.x} +{ duplicate$ + #-1 #1 substring$ "," = + { #-2 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ". " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ", " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ",'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #2 substring$ ",~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #3 substring$ ",''" = + { #-4 global.max$ substring$ ".''" * } + { duplicate$ + #-1 #3 substring$ ".''" = + { #-4 global.max$ substring$ ".''" * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {output.nonnull} +{ 's := + % mid.sentence + output.state mid.sentence = + { ", " * write$ } + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period.x " " * write$ } + if$ + } + if$ + % not mid.sentence, set to mid.sentence + mid.sentence 'output.state := + } + if$ + s +} + +%%% If the last character is period or comma, set non-zero to +%%% last.period.comma. +FUNCTION {period.comma.p} +{ duplicate$ 't := + t #-1 #1 substring$ "." = + t #-1 #1 substring$ "," = or + t #-1 #1 substring$ ":" = or + t #-1 #2 substring$ ".'" = or + t #-1 #2 substring$ ",'" = or + t #-1 #3 substring$ ".''" = or + t #-1 #3 substring$ ",''" = or + t #-1 #2 substring$ ".~" = or + t #-1 #2 substring$ ",~" = or + { #1 'last.period.comma := } + { #0 'last.period.comma := } + if$ +} + +%%% remove unnecessary comma. +FUNCTION {remove.pre.comma} +{ 's := + s empty$ + { "" } + { s #1 #1 substring$ "," = + { s #2 global.max$ substring$ } + { s #1 #1 substring$ "." = + { s #2 global.max$ substring$ } + 's + if$ + } + if$ + } + if$ +} + +%%% output.nonnull.nocomma is the same as output.nonnull except that it does +%%% not add commas even in mid.sentence. +FUNCTION {output.nonnull.nocomma} +{ 's := + output.state mid.sentence = + % mid.sentence + { period.comma.p "" * write$ } + + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + last.period.comma #0 = + { s } + { s remove.pre.comma } + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output} +% { duplicate$ empty$ +% 'pop$ +% 'output.nonnull +% if$ +% } + +FUNCTION {output.nocomma} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.nocomma + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output.check} +% { 't := +% duplicate$ empty$ +% { pop$ "empty " t * " in " * cite$ * warning$ } +% 'output.nonnull +% if$ +% } + +FUNCTION {output.check.nocomma} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull.nocomma + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Format in bbl file: + +% \harvarditem[Brezis et~al.]{Brezis, Krugman and +% Tsiddon}{1993}{brezis93:_leapf_inter_compet} +% Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in +% International Competition: A Theory of Cycles in National Technological +% Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp. +% 1211--1219. + +% \harvarditem[abbreviated citation]{full citation}{year}{keyword} ... + +%%% Add period and newline. +FUNCTION {fin.entry} +{ add.period.x + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.check} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +%%% booktitle +FUNCTION {format.btitle} +{ booktitle empty$ + { "" } + { bst.btitle.pre booktitle * bst.btitle.post * } + if$ +} + +%%% journal +FUNCTION {format.journal} +{ journal empty$ + { "" } + { bst.journal.pre journal * bst.journal.post * } + if$ +} + +%%% title for book +FUNCTION {format.book} +{ title empty$ + { "" } + { bst.book.pre title * bst.book.post * } + if$ +} + +FUNCTION {format.url} +{ url empty$ + { "" } + { type$ "online" = bst.show.url or + { bst.url.pre url * bst.url.post * + access empty$ + { "" * } + { bst.access.pre * access * bst.access.post * } + if$ + } + { "" } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ bst.show.doi not or + { "" } + { bst.doi.pre doi * bst.doi.post * } + if$ +} + +FUNCTION {format.url.doi} +{ url empty$ + { format.doi } + { doi empty$ + { format.url } + { bst.url.doi #0 = + { format.url output.nocomma + format.doi } + { bst.url.doi #1 = + { format.url } + { format.doi } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% and others +FUNCTION {bst.and.others.output} +{ nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.others.nameorder } + { bst.and.others } + if$ +} + +%%% author and editor + +%%% name +FUNCTION {format.names} +{ 's := + % insert 1 to nameptr. + #1 'nameptr := + % Set the number of authors to numnames. + s num.names$ 'numnames := + numnames 'namesleft := + % Repeat if namesleft > 0 + { namesleft #0 > } + { nameptr #1 = + % First author + { bst.author.name #0 = + bst.author.name #1 = + or + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + if$ + } + % The second or later authors + { bst.author.name #0 = + bst.author.name #2 = + or + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + if$ + } + if$ + + nameptr #1 > + % The second or later authors + { nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { namesleft #1 > + % More than one authors left + { ", " * t * } + % Only one author left + { t "others" = + { bst.and.others.output * } + { numnames #2 = + % Entry with two authors + { bst.and * t * } + { bst.ands * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +% remove successive periods (commas) from author +FUNCTION {remove.ss.period.auth} +{ 's := + s format.names 'tempa := + bst.author.post 'tempb := + tempb #1 #1 substring$ "}" = + { tempa tempb * } + { tempa #-1 #1 substring$ tempb #1 #1 substring$ = + { tempa tempb #2 global.max$ substring$ * } + { tempa tempb * } + if$ + } + if$ +} + +% <prev name list> <new name list> compare.names <modified name list> +FUNCTION {compare.names.aer} +{ 's := + 'tempa := + +% "current.author = " s * "\\" * write$ newline$ +% "prev.author = " tempa * "\\" * write$ newline$ + + tempa num.names$ 'len1.aer := % len1 = the number of previous authors + s num.names$ 'len2.aer := % len2 = the number of current authors + +% len1.aer := min(len1.aer,len2.aer) +% len1 -> min{ the number of previous authors, the number of current authors } + len1.aer len2.aer > + { len2.aer 'len1.aer := } + { } + if$ + +% start with an empty string, then while the components are the same +% add "\bysame" + "" + #1 'i.aer := + + { i.aer len1.aer > not } + { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ + = + { #1 i.aer < + { " and " * } % \bysame で省略する著者の前につく and + { } + if$ + "\bysame{}" * + i.aer #1 + 'i.aer := } + { #-1 'len1.aer := } + if$ + } + while$ + +% add the rest of the second string + { i.aer len2.aer > not } + { #1 i.aer < + { " and " * } + { } + if$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ * + i.aer #1 + 'i.aer := + } + while$ +} + +%%% author +FUNCTION {format.authors} +{ author empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer author compare.names.aer 's := + author 'prev.author.aer := } + { author 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors} +{ editor empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer editor compare.names.aer 's := + editor 'prev.author.aer := } + { editor 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + s num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +FUNCTION {format.authors.alt} +{ author empty$ + { "" } + { extra.label.bysame "bysame" = + {"\bysame "} + { bst.author.pre author remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors.alt} +{ editor empty$ + { "" } + { extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre editor remove.ss.period.auth * } + if$ + editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +%%% format.in.ed.booktitle +FUNCTION {format.editors.x} +{ editor empty$ + { "" } + { bst.editor.btitle.order #0 = + { "" } + { editor num.names$ #1 > + { bst.editors " by " * } + { bst.editor " by " * } + if$ + } + if$ + editor format.names * + bst.editor.btitle.order #0 = + { editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + { "" * } + if$ + } + if$ +} + +%%% Remove commas in the cases like "?." and "?,". +FUNCTION {remove.irrelevant.period.comma} +{ 's := + s empty$ + { "" } + { s #-1 #3 substring$ "?,'" = + s #-1 #3 substring$ "?.'" = or + { s #-3 global.max$ substring$ "'" * } + { s #-1 #4 substring$ "?,''" = + s #-1 #4 substring$ "?.''" = or + { s #-4 global.max$ substring$ "''" * } + { s #-1 #2 substring$ "?," = + s #-1 #2 substring$ "?." = or + { s #-2 global.max$ substring$ "" * } + { s #-1 #3 substring$ "?,~" = + s #-1 #3 substring$ "?.~" = or + { s #-4 global.max$ substring$ "?~" * } + 's + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% title +FUNCTION {format.title.sub} +{ bst.title.lower.case #0 = + { bst.title.pre title * bst.title.post * } + { bst.title.pre title "t" change.case$ * bst.title.post * } + if$ +} + +%%% title +FUNCTION {format.title} +{ title empty$ + bst.hide.title #0 = not or + { "" } + { format.title.sub remove.irrelevant.period.comma } + if$ +} + +%%% title for misc. +FUNCTION {format.misc.title} +{ title empty$ + { "" } + { bst.title.pre title * bst.title.post * } + if$ +} + +% Convert "-" to "--" (for pages field) +FUNCTION {n.dashify} +{ 't := + "" + %% while$ + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +%%% year +FUNCTION {format.year} +{ year empty$ + { "there's no year in " cite$ * warning$ + ", " } + { type$ "article" = + { bst.year.pre year * extra.label * bst.year.post * } + { bst.year.na.pre year * extra.label * bst.year.na.post * } + if$ + } + if$ +} + +%%% page for book +FUNCTION {format.book.pages} +{ pages empty$ + { "" } + { bst.pages.pre pages * bst.pages.post * } + if$ +} + +%%% Attach tie for the string with two or less characters. +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +%%% volume for book +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { bst.volume.pre volume * bst.volume.post * + series empty$ + 'skip$ + %% If there is series field + { " of " * series * bst.series.post * } + if$ +% "volume and number" number either.or.check + } + if$ +} + +%%% series +FUNCTION {output.series} +{ series empty$ + { "" } + { bst.series.pre series * bst.series.post * } + if$ +} + +%%% number and series +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + bst.hide.month #0 = not or + % number is empty + { series empty$ + { "" } + % series is not empty. + { output.series } + if$ + } + % number is not empty$ + { series empty$ + { bst.number.pre number * bst.number.post * } + % series is not empty. + { bst.in bst.series.pre * series * bst.series.post * + bst.number.pre * number * bst.number.post * } + if$ + } + if$ + } + { "" } + if$ +} + +%%% Number or not. +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ + } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% edition + +% Convert edition to 1st, 2nd, 3rd, 4th etc +FUNCTION {eng.ord} +{ duplicate$ "1" swap$ * + #-2 #1 substring$ "1" = + { bst.th * } + { duplicate$ #-1 #1 substring$ + duplicate$ "1" = + { pop$ bst.st * } + { duplicate$ "2" = + { pop$ bst.nd * } + { "3" = + { bst.rd * } + { bst.th * } + if$ + } + if$ + } + if$ + } + if$ +} + +% Convert first, second etc in edition field to 1st, 2nd (from jfm.bst) +FUNCTION {convert.edition} +{ edition extract.num "l" change.case$ 's := + s "first" = s "1" = or + { bst.first } + { s "second" = s "2" = or + { bst.second } + { s "third" = s "3" = or + { bst.third } + { s "fourth" = s "4" = or + { bst.fourth } + { s "fifth" = s "5" = or + { bst.fifth } + { s #1 #1 substring$ is.num + { s eng.ord } + { edition } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% edition +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { bst.edition.pre convert.edition "l" change.case$ * bst.edition.post * } + { bst.edition.pre convert.edition "t" change.case$ * bst.edition.post * } + if$ + } + if$ +} + +%%% month +FUNCTION {format.month} +{ month empty$ + bst.hide.month #0 = not or + { "" } + { bst.month.pre month * bst.month.post * } + if$ +} + +%%% year and month +FUNCTION {format.date} +{ format.month format.year * +} + +%%% Is multiple pages like 1-100? +FUNCTION { multi.page.check } +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +%%% pages +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { bst.pages.pre pages n.dashify tie.or.space.connect * bst.pages.post } + { bst.page.pre pages tie.or.space.connect * bst.page.post } + if$ + } + if$ +} + +%%% number +FUNCTION {format.number} +{ number empty$ + bst.hide.number #0 = not or + { "" } + { bst.number.pre number * bst.number.post * } + if$ +} + +%%% volume +FUNCTION {format.volume} +{ volume empty$ + 'skip$ + { bst.volume.pre volume * bst.volume.post * + bst.year.position #3 = + { format.year * } + 'skip$ + if$ + } + if$ +} + +%%% number, page +FUNCTION {format.number.pages} +{ number empty$ + { format.pages } + { format.number format.pages * } + if$ +} + +%%% volume, page +FUNCTION {format.volume.pages} +{ volume empty$ + { format.pages } + { format.volume format.pages * } + if$ +} + +%%% volume, number, page +FUNCTION {format.volume.number.pages} +{ volume empty$ + { number empty$ + { format.pages } + { format.number format.pages * } + if$ + } + { number empty$ + { format.volume format.pages * } + { format.volume format.number * format.pages * } + if$ + } + if$ +} + +% volume, number, page +FUNCTION {format.vol.num.pages} +{ volume empty$ + %% volume is empty. + { number empty$ + %% number is empty. + { pages empty$ + % warning + { "there is no volume, number, and pages in " cite$ * warning$ "" } + { "" format.pages * } + if$ + } + %% number is not empty. + % warning + { "there's a number but no volume in " cite$ * warning$ + format.number.pages } + if$ + } + %% volume is not empty. + { number empty$ + %% number is empty. + { format.volume.pages } + %% number is not empty. + { format.volume.number.pages } + if$ + } + if$ +} + +%%% chapter +FUNCTION {format.chapter} +{ chapter empty$ + { "" } + { type empty$ + { bst.chapter.pre chapter tie.or.space.connect * bst.chapter.post } + { ", " * type " " * chapter * } + if$ + } + if$ +} + +%%% chapter, pages +FUNCTION {format.chapter.pages} +{ chapter empty$ + { pages empty$ + { "" } + { "" format.pages * } + if$ + } + { pages empty$ + { "" format.chapter * } + { "" format.chapter * format.pages * } + if$ + } + if$ +} + +%%% editor and booktitle +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { bst.in format.btitle * } + { bst.editor.btitle.order #0 = + { bst.in format.editors.x * " " * format.btitle * } + { bst.in format.btitle * " " * format.editors.x * } + if$ + } + if$ + } + if$ +} + +%%% howpublished +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { bst.howpublished.pre howpublished * bst.howpublished.post * } + if$ +} + +%%% address +FUNCTION {format.address} +{ address empty$ + { "" } + { bst.address.pre address * bst.address.post * } + if$ +} + +%%% publisher +FUNCTION {format.publisher} +{ publisher empty$ + { "" } + { bst.publisher.pre publisher * bst.publisher.post * } + if$ +} + +%%% organization +FUNCTION {format.organization} +{ organization empty$ + { "" } + { bst.organization.pre organization * bst.organization.post * } + if$ +} + +%% publisher and address +FUNCTION {output.publisher.address} +{ address empty$ + { format.publisher "publisher" output.check.nocomma } + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ +} + +%% address, organization, publisher +FUNCTION {output.address.organization.publisher} +{ address empty$ + %% address is empty + { organization empty$ + %% organization is empty + { publisher empty$ + 'skip$ + { format.publisher "publisher" output.check.nocomma } + if$ + } + %% organization is not empty + { publisher empty$ + { format.organization "organization" output.check.nocomma } + { format.organization "organization" output.check.nocomma + format.publisher "publisher" output.check.nocomma } + if$ + } + if$ + } + %% address is not empty + { organization empty$ + %% organization is empty + { publisher empty$ + %% publisher is empty + { format.address output.nocomma } + %% publisher is not empty + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + %% organization is not empty + { publisher empty$ + %% publisher is empty + { format.organization "organization" output.check.nocomma + format.address output.nocomma } + %% publisher is not empty + { format.organization "organization" output.check.nocomma + bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% misc +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ " " type * } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + { " " type * } + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +%%% phdthesis +FUNCTION {format.phd} +{ bst.phdthesis } + +%%% mastersthesis +FUNCTION {format.mthesis} +{ bst.mthesis } + +%%% school +FUNCTION {format.school} +{ school empty$ + { "" } + { bst.school.pre school * bst.school.post * } + if$ +} + +%%% institution +FUNCTION {format.institution} +{ institution empty$ + { "" } + { bst.institution.pre institution * bst.institution.post * } + if$ +} + +%%% remove first ? characters. +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { bst.note.pre note * bst.note.post * } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \havarditem + +FUNCTION {output.bibitem} +{ newline$ + "\harvarditem[" write$ + alabel write$ % alabel <- abbreviated citation + "]{" write$ + flabel write$ % flabel <- full citation + "}{" write$ + cyear write$ + % cyear = year + "}{" write$ + cite$ write$ % cite$ -> pusch keyword + "}" write$ + % If number index is on + bst.use.number.index #0 = + 'skip$ + { index #1 + 'index := + "" 'preone := + "" 'preten := + bst.number.index.digit "1" = + 'skip$ + { bst.number.index.digit "2" = + { "\hskip0.5em" 'preone := } + { bst.number.index.digit "3" = + { "\hskip1em" 'preone := + "\hskip0.5em" 'preten := } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + newline$ + before.all 'output.state := + "" + % number index + bst.use.number.index #0 = + 'skip$ + { index #10 < + % Insert spaces according to digit of number index. + { preone } + { index #100 < + { preten } + { "" } + if$ + } + if$ + bst.number.index.pre * index int.to.str$ * bst.number.index.post * write$ + } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% article + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.journal "journal" output.check.nocomma + bst.year.position #2 = + { format.date output.nocomma } + 'skip$ + if$ + format.vol.num.pages output.nocomma + + bst.year.position #1 = + { format.date output.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% book + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + + format.bvolume output.nocomma + format.number.series output.nocomma + output.publisher.address + + format.edition output.nocomma + format.book.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booklet + +FUNCTION {booklet} +{ output.bibitem + format.authors output.nocomma + format.year output.nocomma + format.misc.title "title" output.check.nocomma + format.howpublished output.nocomma + format.address output.nocomma + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inbook + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ +% format.book remove.pre.comma "title" output.check.nocomma + format.book "title" output.check.nocomma + format.edition output.nocomma + + format.bvolume output.nocomma + format.chapter.pages "chapter and pages" output.check.nocomma + format.number.series output.nocomma + output.publisher.address + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% incollection + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + output.address.organization.publisher + format.edition output.nocomma + format.chapter.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inproceedings + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + format.pages output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% conference + +FUNCTION {conference} +{ inproceedings } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% manual +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull.nocomma + address output.nocomma + } + if$ + } + { format.authors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + author empty$ + { organization empty$ + { format.address new.block.check + format.address output.nocomma + } + 'skip$ + if$ + } + { output.address.organization.publisher } + if$ + format.edition output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% mastersthesis + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.mthesis format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% misc + +FUNCTION {misc} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Online + +FUNCTION {online} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% phdthesis + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + format.phd + format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + address empty$ + 'skip$ + { format.address output.nocomma } + if$ + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% proceedings + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output.nocomma } + { format.editors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.btitle remove.pre.comma "title" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% techreport + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.tr.number output.nonnull.nocomma + format.institution "institution" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% unpublished + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + bst.year.position #0 = not + { format.date remove.pre.comma output.nocomma } + { month empty$ + 'skip$ + { format.month remove.pre.comma output.nocomma } + if$ + } + if$ + + format.url.doi output.nocomma + + format.note "note" output.check.nocomma + fin.entry +} + +FUNCTION {default.type} +{ misc } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Alias for month names: + +MACRO {jan} {"January"} +MACRO {feb} {"February"} +MACRO {mar} {"March"} +MACRO {apr} {"April"} +MACRO {may} {"May"} +MACRO {jun} {"June"} +MACRO {jul} {"July"} +MACRO {aug} {"August"} +MACRO {sep} {"September"} +MACRO {oct} {"October"} +MACRO {nov} {"November"} +MACRO {dec} {"December"} + +%%% Read entries: +READ + +%%% Variable for remembering the order of citation. +INTEGERS { order.num } +FUNCTION {initialize.order.num} +{ + #1 'order.num := +} +%%% Initialize a variables +EXECUTE {initialize.order.num} + +%%% Variable for remembering the order of citation. +FUNCTION {set.order.cited} +{ + order.num 'order.cited := + #1 order.num + 'order.num := +} +%%% Iterate for all entries: +ITERATE {set.order.cited} + +%%% check the value of nameorder field. +FUNCTION {set.nameorder} +{ nameorder empty$ + { "" 'nameorder.temp := } + { nameorder 'nameorder.temp := } + if$ +} +%%% Iterate for all entries: +ITERATE {set.nameorder} + +%%% Remove symbols and convert to lowercase. +FUNCTION {sortify} +{ purify$ "l" change.case$ } + +%%% names for sorting +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { ", " * } + 'skip$ + if$ + s nameptr "{ll}{ f}{ j}" format.name$ 't := + nameptr numnames = t "others" = and + { bst.and.others.output *} + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + { s sort.format.names } + { s #1 "{ll}{ f}{ j}" format.name$ " zz " * } + if$ +} + +%%% Label for full author name. +FUNCTION {format.lab.names.full} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { ", " * t * } + if$ + } + { t "others" = + { bst.and.others.output * } + { numnames #2 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.ands * t * } + if$ + } + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.and * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + numnames #1 > #1 #2 = and {", eds" *} {} if$ + numnames #1 = #1 #2 = and {", ed" *} {} if$ +} + +%%% laberl for abbreviated author name. +FUNCTION {format.lab.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + % if the number of authors is less than bst.and.others.num, full name. + { s format.lab.names.full } + % if the number of authors is equal or more than bst.and.others.num, abbreviated name. + { s #1 "{ll}" format.name$ bst.and.others.output * } + if$ +} + +%%% abbreviated author +FUNCTION {author.key.label.abb} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.key.label.full} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {format.names.full.wo.and} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ll}{, ff}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { " " * t * } + { t "others" = + { " " * } + { numnames #2 > + { " " * t * } + { " " * t * } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.full.wo.and} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {author.editor.key.full.wo.and} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {editor.key.organization.key.full.wo.and} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ +} + +FUNCTION {author.key.organization.key.full.wo.and} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +%%% abbreviated author +FUNCTION {author.editor.key.label.abb} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.editor.key.label.full} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.full} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.abb} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +FUNCTION {editor.key.organization.label.full} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ +} + +FUNCTION {editor.key.organization.label.abb} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ +} + +%%% Convert numbers: 0->9, 1->8, 2->7,..., 9->0 +FUNCTION {reverse.num} +{ 's := + s "1" = + { "8" 'year.num := } + { s "2" = + { "7" 'year.num := } + { s "3" = + { "6" 'year.num := } + { s "4" = + { "5" 'year.num := } + { s "5" = + { "4" 'year.num := } + { s "6" = + { "3" 'year.num := } + { s "7" = + { "2" 'year.num := } + { s "8" = + { "1" 'year.num := } + { s "9" = + { "0" 'year.num := } + { s "0" = + { "9" 'year.num := } + { "9" 'year.num := } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + year.num +} + +%%% Convert year (large number -> small number) +FUNCTION {convert.year} +{ 't := + bst.reverse.year #0 = + { t 'tt := } + { t #1 #1 substring$ reverse.num + t #2 #1 substring$ reverse.num * + t #3 #1 substring$ reverse.num * + t #4 #1 substring$ reverse.num * 'tt := } + if$ + tt +} + +%%% cyear +FUNCTION {calc.cyear} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.full.wo.and + { type$ "proceedings" = + 'editor.key.organization.key.full.wo.and + { type$ "manual" = + 'author.key.organization.key.full.wo.and + 'author.key.full.wo.and + if$ + } + if$ + } + if$ + duplicate$ + year empty$ + { "2199" 'cyear := } + { year 'cyear := } + if$ + year empty$ + { " " "2199" convert.year * field.or.null * } + { " " year convert.year * field.or.null * } + if$ + sortify 'sort.label := + % For debug + econ.debug #0 = not + { "sort.label = ``\texttt{" write$ + sort.label write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ + pop$ +} + +FUNCTION {calc.sort.label.abb} +{ author empty$ + { editor empty$ + { "" } + { editor 's := } + if$ + } + { author 's := } + if$ + s sort.format.names.abb 't := + year empty$ + { t sortify " " * "2199" convert.year * 'sort.label.abb := } + { t sortify " " * year convert.year * 'sort.label.abb := } + if$ + econ.debug #0 = not + { "sort.label.abb = ``\texttt{" write$ + sort.label.abb write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% flabel +FUNCTION {calc.flabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.full + { type$ "proceedings" = + 'editor.key.organization.label.full + { type$ "manual" = + 'author.key.organization.label.full + 'author.key.label.full + if$ + } + if$ + } + if$ + 'flabel := + % For debug + econ.debug #0 = not + { "flabel = ``\texttt{" write$ + flabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% alabel +FUNCTION {calc.alabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.abb + { type$ "proceedings" = + 'editor.key.organization.label.abb + { type$ "manual" = + 'author.key.organization.label.abb + 'author.key.label.abb + if$ + } + if$ + } + if$ + 'alabel := + % For debug + econ.debug #0 = not + { "alabel = ``\texttt{" write$ + alabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% title for sorting +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +%%% author for sorting +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +%%% editor for sorting +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +%%% 1,...,9 -> 001,...,009 +%%% 10,...,99 -> 010,...,099 +FUNCTION {add.zero.to.number} +{ 's := + s text.length$ #1 = + { "00" s * } + { s text.length$ #2 = + { "0" s * } + { s } + if$ + } + if$ +} + +%% entry type +FUNCTION {bst.sort.entry.type.order} +{ 'item.type := + item.type "article" = + { "01" } + { item.type "book" = + { "02" } + { item.type "booklet" = + { "03" } + { item.type "comment" = + { "04" } + { item.type "conference" = + { "05" } + { item.type "inbook" = + { "06" } + { item.type "incollection" = + { "07" } + { item.type "inproceedings" = + { "08" } + { item.type "manual" = + { "09" } + { item.type "masterthesis" = + { "10" } + { item.type "misc" = + { "11" } + { item.type "phdthesis" = + { "12" } + { item.type "proceedings" = + { "13" } + { item.type "techreport" = + { "14" } + { item.type "unpublished" = + { "15" } + { "16" } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% Create sort.key$: absorder -> author -> year -> order -> month -> title. +FUNCTION {presort.one} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * + sort.label.abb * + " " * + type$ "book" = type$ "inbook" = or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + * " " * + " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +FUNCTION {presort.two} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * sort.label * " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% Codes for debugging +FUNCTION {calc.alabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.alabel: alabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {calc.flabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.flabel: flabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {presort.one.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (1st time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {presort.two.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (2nd time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.cyear.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.cyear: sort.label = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.sort.label.abb.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.sort.label.abb: sort.label.abb = }\\" write$ + newline$ } + 'skip$ + if$ +} + +%%% alabel +EXECUTE {calc.alabel.mess} +ITERATE {calc.alabel} + +%%% flabel +EXECUTE {calc.flabel.mess} +ITERATE {calc.flabel} + +%%% cyear and sort.label +EXECUTE {calc.cyear.mess} +ITERATE {calc.cyear} + +%%% +EXECUTE {calc.sort.label.abb.mess} +ITERATE {calc.sort.label.abb} + +%%% Sorting by $sort.key (first time) +% +% Sorting is done in two times. This is the first time. +% +EXECUTE {presort.one.mess} +ITERATE {presort.one} +SORT + +FUNCTION {forward.pass} +{ bst.use.bysame #0 = bst.use.bysame #2 = or + % Not use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + } + % Use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + % format.names 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label empty$ not + { cyear extra.label * } + { cyear "" * } + if$ + "" field.or.null * + 'cyear := + extra.label 'next.extra := +} + +%%% \bysame +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +%%% Sorting by sort.key$ (second time) +EXECUTE {presort.two.mess} +ITERATE {presort.two} +SORT + +FUNCTION {reset.prev.author} +{ "xxyyzz" 'prev.author := } + +EXECUTE {reset.prev.author} + +FUNCTION {forward.pass.two} +{ bst.use.bysame #1 = + { author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + 'skip$ + if$ +} + +ITERATE {forward.pass.two} + +FUNCTION{punctuation} +{ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ + "% This bbl file is created by econ.bst ver." econ.version * write$ newline$ + "% The latest econ.bst is available at" write$ newline$ + "% <https://github.com/ShiroTakeda/econ-bst>" write$ newline$ newline$ +} + +EXECUTE {punctuation} + +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + bst.use.bysame #0 = + % Not use \bysame. + 'skip$ + % Use \bysame. + { "%%% Definition of \bysame" write$ newline$ + "\ifx\undefined\bysame" write$ newline$ + "\newcommand{\bysame}{" bst.bysame.definition * "}" * + write$ newline$ + "\fi" write$ newline$ newline$ } + if$ + %% When number index is attached to the beginning of each item. + bst.use.number.index #0 = + 'skip$ + { bst.number.index.digit "1" = + % one digit. + { bst.number.index.bibhang.one } + { bst.number.index.digit "2" = + % two digits. + { bst.number.index.bibhang.ten } + % three or more digits. + { bst.number.index.bibhang.hund } + if$ + } + if$ + 'hang := + "%%% Redefinition of \bibhang" write$ newline$ + "\ifx\undefined\bibhang" write$ newline$ + "\relax" write$ newline$ + "\else" write$ newline$ + "\setlength{\bibhang}{" + hang * "}" * write$ newline$ + "\fi" write$ newline$ newline$ + } + if$ + "\begin{thebibliography}{xxx}" write$ newline$ + + %% Initialize the variable `index'. + #0 'index := +} + +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ } + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +EXECUTE {end.bib} + +% -------------------- +% Local Variables: +% fill-column: 78 +% mode: bst +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.pdf Binary files differnew file mode 100644 index 00000000000..8458c1e3fd8 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.tex new file mode 100644 index 00000000000..d130e07be00 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jet.tex @@ -0,0 +1,66 @@ +%#!pdflatex +%#BIBTEX bibtex econ-jet + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage[numbers]{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +This document uses ``\verb|econ-jet.bst|''. The style like JET ({\itshape Journal of +Economic Theory}). + +\vspace{1em} + +\input{cited-part} +\vspace*{1em} + +In the citation part above, we use +\verb|\citet| command which creates the style like ``author name + number''. If we use \verb|\cite| +command, we have the style only with number like the followings: \\ +\cite{Ryza15:_advan_analy_spark_patter_learn_data_scale}, +\cite{yamazaki13:_japan}, \cite{stakeda2013web}, \cite{Takeda2012a}, +\cite{bergemann11:_ration}, \cite{goldin:katz:2011}, \cite{Takeda2011b}, +\cite{takeda2011c}. + +\nocite{*} + +%% bst file: +\bibliographystyle{econ-jet} +\bibliography{../econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.bst b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.bst new file mode 100644 index 00000000000..ee4ff74ecdd --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.bst @@ -0,0 +1,3543 @@ +%% econ.bst: BibTeX style file for papers in economics. +% +% Author: Shiro Takeda +% Maintainer: Shiro Takeda +% Copyright (C) 2001-2018 Shiro Takeda +% First-written: <2007/07/28> +% Time-stamp: <2018-12-07 18:48:19 st> +% Version: 2.5 +% Keywords: TeX, BibTeX, bst +% URL: https://github.com/ShiroTakeda/econ-bst + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is Shiro Takeda. + +%% Main features of econ.bst. + +% "econ.bst" is a BibTeX style file for economics. It provids the following +% features: + +% 1) The author-year type citation (you need "natbib.sty" as well). +% 2) Reference style used in economics papers ("econ.bst" is not a BibTeX style +% for a specific journal). +% 3) Highly customizable. You can easily customize reference style as you wish. +% 4) You can use "certified random order" proposed by Ray ⓡ Robson (2018) +% (http://dx.doi.org/10.1257/aer.20161492). + +% Bug reports, requests and suggestions are welcome. + +% For changelogs, see CHANGES.txt file. + +% version number +FUNCTION {econ.version} { "2.5" } + +% Debug mode. Non-zero makes debug mode on. +FUNCTION {econ.debug} +{ #0 } % Debug mode off (default). +% { #1 } % Debug mode on. + +ENTRY + %%% Declaration of field + { access address author booktitle chapter doi edition editor howpublished + institution journal key month note number organization pages publisher + school series title type url volume year + % Fields specific to econ.bst + order absorder nameorder + } + + % Definition of entry variable. The entry variable is a variable which has + % different values according to different entries. + %% Integer entry variable: + { order.cited } + + %% String entry variable + { label cyear flabel alabel extra.label sort.label sort.label.abb + extra.label.bysame nameorder.temp } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Use \bysame or not. +% +% If set to #0, \bysame is not used. +% If set to #1, \bysame is used +% If set to #2, \bysame is used (alternative abbreviation style). +% +% Note that integer number is expressed as # + integer in bst file. +% \bysame is the function that abbreviates succession of the same authors' name by ---. +% +% See econ-sample.pdf for details. +% +FUNCTION {bst.use.bysame} +% { #0 } % Not use \bysame +{ #1 } % -> Use \bysame (default) +% { #2 } % -> Use \bysame of alternative style. + +% The definition of \bysame command. +% +FUNCTION {bst.bysame.definition} +{ "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default) +% { "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% The order of fist and last name. +% +FUNCTION {bst.author.name} +% { #0 } % (default) +{ #1 } +% { #2 } + +% Case of #0: First author -> last-first, other authors -> first-last. +% Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables. + +% Case of #1: All authors -> last-first +% Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J. + +% Case of #2: All authors -> first-last +% Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Abbreviate first name of authors (editors): +% +FUNCTION {bst.first.name.initial} +% { #0 } % #0 -> full letters (default). +{ #1 } % Non-zero -> initial letter only. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Decapitalize of strings in title field. +% +FUNCTION {bst.title.lower.case} +% { #0 } % If #0, not decapitalize title (default). +{ #1 } % If non-#0, decapitalize title + +% Hide title filed. +% +FUNCTION {bst.hide.title} +{ #0 } % #0 -> Title field is displayed (default) +% { #1 } % Non-zer -> Title field is hidden + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide month. +% +FUNCTION {bst.hide.month} +{ #0 } % #0 -> show month field (default). +% { #1 } % non-#0 -> hide month field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Attach number index like plain.bst. +% +FUNCTION {bst.use.number.index} +{ #0 } % Not use number index (default). +% { #1 } % Non-#0 -> Use number index + +% The string before number index: +% +FUNCTION {bst.number.index.pre} +{ "[" } % (default) + +% The string after number index. Adjustment is recommended. +% +FUNCTION {bst.number.index.post} +{ "]\hskip1.0em " } % (default) + +% Maximum digit of number index: +% If the number of reference items >= 100, set 3 to this function. +% If the number of reference items < 100, set 2 to this function. +% If the number of reference items < 10, set 1 to this function. +% +FUNCTION {bst.number.index.digit} +{ "2" } % (default) +% { "3" } + +% The functions below are used to adjust space and postion. If you use fonts +% other than computer modern fonts, you had better make adjustments. +% +% Setting for bst.number.index.digit = 1: +FUNCTION {bst.number.index.bibhang.one} +{ "2.05em" } % (default) +% Setting for bst.number.index.digit = 2: +FUNCTION {bst.number.index.bibhang.ten} +{ "2.55em" } % (default) +% Setting for bst.number.index.digit = 3: +FUNCTION {bst.number.index.bibhang.hund} +{ "3.05em" } % (default). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Position of "year": +% +% You can choose the position of year by this function. +% +% If set to #0, year is placed right after "author". +% If set to non-zero, year is placed at the end (before note field) except for +% aritcle type entry. +% +% In article type entry, the position of year changes according to the +% following rule: +% +% #1 -> year is placed at the end. +% #2 -> year is placed after journal name in aritcle type entry. +% #3 -> year is placed after volume in aritcle type entry. +% +FUNCTION {bst.year.position} +{ #0 } % (default). +% { #1 } % Last place before note. +% { #2 } % After journal name for aticle type entry. +% { #3 } % After volume for aticle type entry. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If 0, references are sorted by old documents -> recent documents. If +% non-zero, reverse order. +FUNCTION {bst.reverse.year} +{ #0 } % Normal order (old -> recent) (default). +% { #1 } % inverse order (recent -> old) + +% If non-zero, sort references by using year field as the primary key +% (chronological sorting). +FUNCTION {bst.sort.year} +{ #0 } % Normal case: year is used as the sorting key next to author (default). +% { #1 } % year is used as the primary sorting key. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If non-zero, references are listed in citation order. +% +FUNCTION {bst.no.sort} +{ #0 } % (default) +% { #1 } % listed in citation order. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Non-zero -> sort references by entry type (article, book, incollection etc.) +% +FUNCTION {bst.sort.entry.type} +{ #0 } % #0 -> Normal (not sort references by entry type) (default). +% { #1 } % Non-zero -> sort references by entry type. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use absorder field to sort items. Otherwise, ignore absorder field. +% +FUNCTION {bst.notuse.absorder.field} +{ #0 } % #0 -> Use absorder (default). +% { #1 } % Non-#0 -> Not use absorder. +% +% Order of priority to sort items +% +% absorder -> author -> year -> order -> month -> title +% +% wehre absorder and order fields are specific to econ.bst. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use order field to sort items. Otherwise, ignore order field. +% Note: order field is specific to econ.bst. +FUNCTION {bst.notuse.order.field} +{ #0 } % #0 -> Use order field (default). +% { #1 } % Non-#0 -> not use order field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% and + +%%% String used to separate author names in references. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.and} +{ " " } +% { " and " } % (default) + +%%% String used to separate author names in references (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.ands} +{ " " } +% { ", and " } % (default) + +%%% String used to separate author names in citation part. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.cite.and} +{ " and " } % (default) + +%%% String used to separate author names in citation part (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.cite.ands} +{ " and " } % (default) + +%%% If you want to use random author order for some bibliography entries, set +% non-zero to this function. +% +FUNCTION {bst.use.nameorder} +{ #1 } % Use random order (default) +% { #0 } % Not use random order + +%%% String used to separate author names in references for the entry of random +% author order. +% +FUNCTION {bst.and.nameorder} +{ " \textcircled{r} " } % (default) + +%%% String used to separate author names in citation part for the entry of +% random author order +% +FUNCTION {bst.cite.and.nameorder} +{ " \textcircled{r} " } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Author names in the citation part are abbreviated by et al. if the number of +% authors is greater or equal to bst.and.others.num. +FUNCTION {bst.and.others.num} +{ #3 } % If the number of authors is greater or equal to three (default). +% { #4 } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Strings used when abbreviating multiple-authors in citation part. +FUNCTION {bst.and.others} +{ " et~al." } % (default) + +% Strings used when abbreviating multiple-authors in citation part for entries +% with random author order. +FUNCTION {bst.and.others.nameorder} +{ " \textcircled{r}~al." } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% author + +% The string before author: +% +FUNCTION {bst.author.pre} +{ "" } % (default) + +% The string after author: +% +FUNCTION {bst.author.post} +{ "," } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% year + +% The string before year only for aritcle type entry. +% +FUNCTION {bst.year.pre} +{ " " } +% { " (" } % (default) + +% The string after year only for aritcle type entry. +% +FUNCTION {bst.year.post} +{ ". " } +% { ") " } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.pre} +{ " " } +% { " (" } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.post} +{ ". " } +% { ") " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% title (except for title in book) + +% The string before title: +% +FUNCTION {bst.title.pre} +{ "" } +% { "``" } % (default) + +% The string after title: +% +FUNCTION {bst.title.post} +{ "." } +% { ",''" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tile for book: + +% The string before book title: +% +FUNCTION {bst.book.pre} +{ " " } +% { " \textit{" } % (default) + +% The string after book title: +% +FUNCTION {bst.book.post} +{ "." } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booktitle + +% The string before booktitle: +% +FUNCTION {bst.btitle.pre} +{ " " } +% { " \textit{" } % (default) + +% The string after booktitle: +% +FUNCTION {bst.btitle.post} +{ "." } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% journal name + +% The string before journal name: +% +FUNCTION {bst.journal.pre} +{ " " } +% { " \textit{" } % (default) + +% The string after journal name: +% +FUNCTION {bst.journal.post} +{ "" } +% { "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% editor notation: + +% The string that indicates multiple editors: +% +FUNCTION {bst.editors} +{ " (Eds.)," } +% { " eds. " } % (default) + +% The string that indicates single editor: +% +FUNCTION {bst.editor} +{ " ed. " } % (default) + +% Order of editor and booktitle in incollection and inproceedings entries. +% +% If set to #0: editors -> booktitle order +% If set to non-zero: booktitle -> editors order +% +FUNCTION {bst.editor.btitle.order} +{ #0 } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% edition + +% The string before edition: +% +FUNCTION {bst.edition.pre} +{ ", " } % (default) + +% The string after edition: +% +FUNCTION {bst.edition.post} +{ " edition" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% volume + +% The string before volume: +% +FUNCTION {bst.volume.pre} +{ " " } +% { ", Vol. " } % (default) + +% The string after volume: +% +FUNCTION {bst.volume.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% number + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide number. If non-zero, number is suppressed. +FUNCTION {bst.hide.number} +{ #0 } % #0 -> show number field (default) +% { #1 } % non-#0 -> Hide number field. + +% The string before number: +% +FUNCTION {bst.number.pre} +{ " (" } +% { ", No. " } % (default) + +% The string after number: +% +FUNCTION {bst.number.post} +{ ")," } +% { "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% in + +% In +% +FUNCTION {bst.in} +{ " In: " } +% { " in " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% page + +% The string before page (multiple pages): +% +FUNCTION {bst.pages.pre} +{ " " } +% { ", pp." } % (default) + +% The string before page: +% +FUNCTION {bst.page.pre} +{ ", p." } % (default) + +% The string after page (multiple pages): +% +FUNCTION {bst.pages.post} +{ "" } % (default) + +% The string after page: +% +FUNCTION {bst.page.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% chapter + +% The string before chapter: +% +FUNCTION {bst.chapter.pre} +{ ", Chap." } % (default) + +% The string after chapter: +% +FUNCTION {bst.chapter.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% month + +% The string before month: +% +FUNCTION {bst.month.pre} +{ ", " } % (default) + +% The string after month: +% +FUNCTION {bst.month.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% address +% The string before address: +% +FUNCTION {bst.address.pre} +{ ", " } % (default) + +% The string after address: +% +FUNCTION {bst.address.post} +{ "" } % (default) + +% You can choose the order of address and publisher by this function. +% +% If #0, address -> publisher order (the default value). +% If non-zero, publisher -> address order. + +FUNCTION {bst.address.position} +% { #0 } % Address is placed before publisher (default) +{ #1 } % Address is placed after publisher + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% publisher + +% The string before publisher: +% +FUNCTION {bst.publisher.pre} +{ ", " } +% { ": " } % (default) + +% The string after publisher: +% +FUNCTION {bst.publisher.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% series + +% The string before series: +% +FUNCTION {bst.series.pre} +{ ", " } % (default) + +% The string after series: +% +FUNCTION {bst.series.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% organization + +% The string before organization: +% +FUNCTION {bst.organization.pre} +{ ", " } % (default) + +% The string after organization: +% +FUNCTION {bst.organization.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% school + +% The string before school: +% +FUNCTION {bst.school.pre} +{ ", " } % (default) + +% The string after school: +% +FUNCTION {bst.school.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% institution + +% The string before institution: +% +FUNCTION {bst.institution.pre} +{ ", " } % (default) + +% The string after institution: +% +FUNCTION {bst.institution.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% howpublished + +% The string before howpublished: +% +FUNCTION {bst.howpublished.pre} +{ " " } % (default) + +% The string after howpublished: +% +FUNCTION {bst.howpublished.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% url + +% Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed. +FUNCTION {bst.show.url} +{ #1 } % non-#0 -> Show url field (default) +% { #0 } % #0 -> Not show url field. + +% The string before url: +% +FUNCTION {bst.url.pre} +{ ", URL: \url{" } % (default) + +% The string after url: +% +FUNCTION {bst.url.post} +{ "}" } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Access + +% This setting is valid only if there are "access" field in bib +% files. The value of access field indicates accessed date for URL. + +% The string before access. +FUNCTION {bst.access.pre} +{ ", accessed on " } % (default) + +% The string after access. +FUNCTION {bst.access.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DOI (digital object identifier) + +% This setting is valid only if there are "doi" field in bib files. + +% Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed. +FUNCTION {bst.show.doi} +{ #1 } % non-#0 -> Show DOI field (default) +% { #0 } % #0 -> Not show DOI field. + +% The string before DOI: +% +FUNCTION {bst.doi.pre} +{ ", DOI: \href{http://dx.doi.org/" doi * "}{" * } % (default) + +% The string after DOI: +% +FUNCTION {bst.doi.post} +{ "}" } % (default) + +% How to show URL and DOI fields when both fields exist. +% +% #0 -> Both fields are displayed +% #1 -> Only URL field is displayed +% #2 -> Only DOI field is displayed +% +FUNCTION {bst.url.doi} +% { #0 } % (default) -> Both fields are displayed +% { #1 } % -> Only URL field is displayed +{ #2 } % -> Only DOI field is displayed + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Other functions: + +% The string before note. +FUNCTION {bst.note.pre} +{ ", " } % (default) + +% The string after note. +FUNCTION {bst.note.post} +{ "" } % (default) + +% The string that represents Technical report: +% +FUNCTION {bst.techrep} +{ " Tech. Rep." } % (default) + +% The string that represents master thesis: +% +FUNCTION {bst.mthesis} +{ " Master's thesis" } % (default) + +% The string that represents phd thesis: +% +FUNCTION {bst.phdthesis} +{ " Ph.D. dissertation" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization end here: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +FUNCTION {bst.first} +{ "1st" } + +FUNCTION {bst.second} +{ "2nd" } + +FUNCTION {bst.third} +{ "3rd" } + +FUNCTION {bst.fourth} +{ "4th" } + +FUNCTION {bst.fifth} +{ "5th" } + +FUNCTION {bst.st} +{ "st" } + +FUNCTION {bst.nd} +{ "nd" } + +FUNCTION {bst.rd} +{ "rd" } + +FUNCTION {bst.th} +{ "th" } + +%%%%% memo by Takeda + +% "a" 'b := indicates substituting string "a" for variable b. + +% Integer number #0, #1,... + +%%% Function definition: +% +% FUNCTION {name} +% { 's := +% +% } +% +% This is the definition of a function named "name". The function "name" is +% used in the following way +% +% "foo" name +% "foo" is an argument for the function "name". +% +% About the definition of a function with more than two arguments, see the +% definition of "chop.word". + +%%% Declaration of variables: + +%% String global variables: +STRINGS { s t tt } +STRINGS { year.num } +STRINGS { preone preten } +STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author } +STRINGS { hang } +STRINGS { item.type } +STRINGS { tempa tempb } + +%% Integer global variables: +INTEGERS { nameptr namesleft numnames name.num } +INTEGERS { multiresult } +INTEGERS { index } +INTEGERS { len } +INTEGERS { last.extra.num } +INTEGERS { output.state before.all mid.sentence after.sentence after.block } +INTEGERS { last.period.comma } +INTEGERS { len1.aer len2.aer i.aer } + +%%% Definition of functions: +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +%%% Initialize variables: +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +%%% Remove comma and add period: +% +%%% +FUNCTION {add.period.x} +{ duplicate$ + #-1 #1 substring$ "," = + { #-2 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ". " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ", " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ",'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #2 substring$ ",~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #3 substring$ ",''" = + { #-4 global.max$ substring$ ".''" * } + { duplicate$ + #-1 #3 substring$ ".''" = + { #-4 global.max$ substring$ ".''" * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {output.nonnull} +{ 's := + % mid.sentence + output.state mid.sentence = + { ", " * write$ } + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period.x " " * write$ } + if$ + } + if$ + % not mid.sentence, set to mid.sentence + mid.sentence 'output.state := + } + if$ + s +} + +%%% If the last character is period or comma, set non-zero to +%%% last.period.comma. +FUNCTION {period.comma.p} +{ duplicate$ 't := + t #-1 #1 substring$ "." = + t #-1 #1 substring$ "," = or + t #-1 #1 substring$ ":" = or + t #-1 #2 substring$ ".'" = or + t #-1 #2 substring$ ",'" = or + t #-1 #3 substring$ ".''" = or + t #-1 #3 substring$ ",''" = or + t #-1 #2 substring$ ".~" = or + t #-1 #2 substring$ ",~" = or + { #1 'last.period.comma := } + { #0 'last.period.comma := } + if$ +} + +%%% remove unnecessary comma. +FUNCTION {remove.pre.comma} +{ 's := + s empty$ + { "" } + { s #1 #1 substring$ "," = + { s #2 global.max$ substring$ } + { s #1 #1 substring$ "." = + { s #2 global.max$ substring$ } + 's + if$ + } + if$ + } + if$ +} + +%%% output.nonnull.nocomma is the same as output.nonnull except that it does +%%% not add commas even in mid.sentence. +FUNCTION {output.nonnull.nocomma} +{ 's := + output.state mid.sentence = + % mid.sentence + { period.comma.p "" * write$ } + + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + last.period.comma #0 = + { s } + { s remove.pre.comma } + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output} +% { duplicate$ empty$ +% 'pop$ +% 'output.nonnull +% if$ +% } + +FUNCTION {output.nocomma} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.nocomma + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output.check} +% { 't := +% duplicate$ empty$ +% { pop$ "empty " t * " in " * cite$ * warning$ } +% 'output.nonnull +% if$ +% } + +FUNCTION {output.check.nocomma} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull.nocomma + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Format in bbl file: + +% \harvarditem[Brezis et~al.]{Brezis, Krugman and +% Tsiddon}{1993}{brezis93:_leapf_inter_compet} +% Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in +% International Competition: A Theory of Cycles in National Technological +% Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp. +% 1211--1219. + +% \harvarditem[abbreviated citation]{full citation}{year}{keyword} ... + +%%% Add period and newline. +FUNCTION {fin.entry} +{ add.period.x + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.check} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +%%% booktitle +FUNCTION {format.btitle} +{ booktitle empty$ + { "" } + { bst.btitle.pre booktitle * bst.btitle.post * } + if$ +} + +%%% journal +FUNCTION {format.journal} +{ journal empty$ + { "" } + { bst.journal.pre journal * bst.journal.post * } + if$ +} + +%%% title for book +FUNCTION {format.book} +{ title empty$ + { "" } + { bst.book.pre title * bst.book.post * } + if$ +} + +FUNCTION {format.url} +{ url empty$ + { "" } + { type$ "online" = bst.show.url or + { bst.url.pre url * bst.url.post * + access empty$ + { "" * } + { bst.access.pre * access * bst.access.post * } + if$ + } + { "" } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ bst.show.doi not or + { "" } + { bst.doi.pre doi * bst.doi.post * } + if$ +} + +FUNCTION {format.url.doi} +{ url empty$ + { format.doi } + { doi empty$ + { format.url } + { bst.url.doi #0 = + { format.url output.nocomma + format.doi } + { bst.url.doi #1 = + { format.url } + { format.doi } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% and others +FUNCTION {bst.and.others.output} +{ nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.others.nameorder } + { bst.and.others } + if$ +} + +%%% author and editor + +%%% name +FUNCTION {format.names} +{ 's := + % insert 1 to nameptr. + #1 'nameptr := + % Set the number of authors to numnames. + s num.names$ 'numnames := + numnames 'namesleft := + % Repeat if namesleft > 0 + { namesleft #0 > } + { nameptr #1 = + % First author + { bst.author.name #0 = + bst.author.name #1 = + or + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + if$ + } + % The second or later authors + { bst.author.name #0 = + bst.author.name #2 = + or + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + if$ + } + if$ + + nameptr #1 > + % The second or later authors + { nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { namesleft #1 > + % More than one authors left + { ", " * t * } + % Only one author left + { t "others" = + { bst.and.others.output * } + { numnames #2 = + % Entry with two authors + { bst.and * t * } + { bst.ands * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +% remove successive periods (commas) from author +FUNCTION {remove.ss.period.auth} +{ 's := + s format.names 'tempa := + bst.author.post 'tempb := + tempb #1 #1 substring$ "}" = + { tempa tempb * } + { tempa #-1 #1 substring$ tempb #1 #1 substring$ = + { tempa tempb #2 global.max$ substring$ * } + { tempa tempb * } + if$ + } + if$ +} + +% <prev name list> <new name list> compare.names <modified name list> +FUNCTION {compare.names.aer} +{ 's := + 'tempa := + +% "current.author = " s * "\\" * write$ newline$ +% "prev.author = " tempa * "\\" * write$ newline$ + + tempa num.names$ 'len1.aer := % len1 = the number of previous authors + s num.names$ 'len2.aer := % len2 = the number of current authors + +% len1.aer := min(len1.aer,len2.aer) +% len1 -> min{ the number of previous authors, the number of current authors } + len1.aer len2.aer > + { len2.aer 'len1.aer := } + { } + if$ + +% start with an empty string, then while the components are the same +% add "\bysame" + "" + #1 'i.aer := + + { i.aer len1.aer > not } + { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ + = + { #1 i.aer < + { " and " * } % \bysame で省略する著者の前につく and + { } + if$ + "\bysame{}" * + i.aer #1 + 'i.aer := } + { #-1 'len1.aer := } + if$ + } + while$ + +% add the rest of the second string + { i.aer len2.aer > not } + { #1 i.aer < + { " and " * } + { } + if$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ * + i.aer #1 + 'i.aer := + } + while$ +} + +%%% author +FUNCTION {format.authors} +{ author empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer author compare.names.aer 's := + author 'prev.author.aer := } + { author 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors} +{ editor empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer editor compare.names.aer 's := + editor 'prev.author.aer := } + { editor 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + s num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +FUNCTION {format.authors.alt} +{ author empty$ + { "" } + { extra.label.bysame "bysame" = + {"\bysame "} + { bst.author.pre author remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors.alt} +{ editor empty$ + { "" } + { extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre editor remove.ss.period.auth * } + if$ + editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +%%% format.in.ed.booktitle +FUNCTION {format.editors.x} +{ editor empty$ + { "" } + { bst.editor.btitle.order #0 = + { "" } + { editor num.names$ #1 > + { bst.editors " by " * } + { bst.editor " by " * } + if$ + } + if$ + editor format.names * + bst.editor.btitle.order #0 = + { editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + { "" * } + if$ + } + if$ +} + +%%% Remove commas in the cases like "?." and "?,". +FUNCTION {remove.irrelevant.period.comma} +{ 's := + s empty$ + { "" } + { s #-1 #3 substring$ "?,'" = + s #-1 #3 substring$ "?.'" = or + { s #-3 global.max$ substring$ "'" * } + { s #-1 #4 substring$ "?,''" = + s #-1 #4 substring$ "?.''" = or + { s #-4 global.max$ substring$ "''" * } + { s #-1 #2 substring$ "?," = + s #-1 #2 substring$ "?." = or + { s #-2 global.max$ substring$ "" * } + { s #-1 #3 substring$ "?,~" = + s #-1 #3 substring$ "?.~" = or + { s #-4 global.max$ substring$ "?~" * } + 's + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% title +FUNCTION {format.title.sub} +{ bst.title.lower.case #0 = + { bst.title.pre title * bst.title.post * } + { bst.title.pre title "t" change.case$ * bst.title.post * } + if$ +} + +%%% title +FUNCTION {format.title} +{ title empty$ + bst.hide.title #0 = not or + { "" } + { format.title.sub remove.irrelevant.period.comma } + if$ +} + +%%% title for misc. +FUNCTION {format.misc.title} +{ title empty$ + { "" } + { bst.title.pre title * bst.title.post * } + if$ +} + +% Convert "-" to "--" (for pages field) +FUNCTION {n.dashify} +{ 't := + "" + %% while$ + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +%%% year +FUNCTION {format.year} +{ year empty$ + { "there's no year in " cite$ * warning$ + ", " } + { type$ "article" = + { bst.year.pre year * extra.label * bst.year.post * } + { bst.year.na.pre year * extra.label * bst.year.na.post * } + if$ + } + if$ +} + +%%% page for book +FUNCTION {format.book.pages} +{ pages empty$ + { "" } + { bst.pages.pre pages * bst.pages.post * } + if$ +} + +%%% Attach tie for the string with two or less characters. +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +%%% volume for book +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { bst.volume.pre volume * bst.volume.post * + series empty$ + 'skip$ + %% If there is series field + { " of " * series * bst.series.post * } + if$ +% "volume and number" number either.or.check + } + if$ +} + +%%% series +FUNCTION {output.series} +{ series empty$ + { "" } + { bst.series.pre series * bst.series.post * } + if$ +} + +%%% number and series +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + bst.hide.month #0 = not or + % number is empty + { series empty$ + { "" } + % series is not empty. + { output.series } + if$ + } + % number is not empty$ + { series empty$ + { bst.number.pre number * bst.number.post * } + % series is not empty. + { bst.in bst.series.pre * series * bst.series.post * + bst.number.pre * number * bst.number.post * } + if$ + } + if$ + } + { "" } + if$ +} + +%%% Number or not. +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ + } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% edition + +% Convert edition to 1st, 2nd, 3rd, 4th etc +FUNCTION {eng.ord} +{ duplicate$ "1" swap$ * + #-2 #1 substring$ "1" = + { bst.th * } + { duplicate$ #-1 #1 substring$ + duplicate$ "1" = + { pop$ bst.st * } + { duplicate$ "2" = + { pop$ bst.nd * } + { "3" = + { bst.rd * } + { bst.th * } + if$ + } + if$ + } + if$ + } + if$ +} + +% Convert first, second etc in edition field to 1st, 2nd (from jfm.bst) +FUNCTION {convert.edition} +{ edition extract.num "l" change.case$ 's := + s "first" = s "1" = or + { bst.first } + { s "second" = s "2" = or + { bst.second } + { s "third" = s "3" = or + { bst.third } + { s "fourth" = s "4" = or + { bst.fourth } + { s "fifth" = s "5" = or + { bst.fifth } + { s #1 #1 substring$ is.num + { s eng.ord } + { edition } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% edition +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { bst.edition.pre convert.edition "l" change.case$ * bst.edition.post * } + { bst.edition.pre convert.edition "t" change.case$ * bst.edition.post * } + if$ + } + if$ +} + +%%% month +FUNCTION {format.month} +{ month empty$ + bst.hide.month #0 = not or + { "" } + { bst.month.pre month * bst.month.post * } + if$ +} + +%%% year and month +FUNCTION {format.date} +{ format.month format.year * +} + +%%% Is multiple pages like 1-100? +FUNCTION { multi.page.check } +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +%%% pages +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { bst.pages.pre pages n.dashify tie.or.space.connect * bst.pages.post } + { bst.page.pre pages tie.or.space.connect * bst.page.post } + if$ + } + if$ +} + +%%% number +FUNCTION {format.number} +{ number empty$ + bst.hide.number #0 = not or + { "" } + { bst.number.pre number * bst.number.post * } + if$ +} + +%%% volume +FUNCTION {format.volume} +{ volume empty$ + 'skip$ + { bst.volume.pre volume * bst.volume.post * + bst.year.position #3 = + { format.year * } + 'skip$ + if$ + } + if$ +} + +%%% number, page +FUNCTION {format.number.pages} +{ number empty$ + { format.pages } + { format.number format.pages * } + if$ +} + +%%% volume, page +FUNCTION {format.volume.pages} +{ volume empty$ + { format.pages } + { format.volume format.pages * } + if$ +} + +%%% volume, number, page +FUNCTION {format.volume.number.pages} +{ volume empty$ + { number empty$ + { format.pages } + { format.number format.pages * } + if$ + } + { number empty$ + { format.volume format.pages * } + { format.volume format.number * format.pages * } + if$ + } + if$ +} + +% volume, number, page +FUNCTION {format.vol.num.pages} +{ volume empty$ + %% volume is empty. + { number empty$ + %% number is empty. + { pages empty$ + % warning + { "there is no volume, number, and pages in " cite$ * warning$ "" } + { "" format.pages * } + if$ + } + %% number is not empty. + % warning + { "there's a number but no volume in " cite$ * warning$ + format.number.pages } + if$ + } + %% volume is not empty. + { number empty$ + %% number is empty. + { format.volume.pages } + %% number is not empty. + { format.volume.number.pages } + if$ + } + if$ +} + +%%% chapter +FUNCTION {format.chapter} +{ chapter empty$ + { "" } + { type empty$ + { bst.chapter.pre chapter tie.or.space.connect * bst.chapter.post } + { ", " * type " " * chapter * } + if$ + } + if$ +} + +%%% chapter, pages +FUNCTION {format.chapter.pages} +{ chapter empty$ + { pages empty$ + { "" } + { "" format.pages * } + if$ + } + { pages empty$ + { "" format.chapter * } + { "" format.chapter * format.pages * } + if$ + } + if$ +} + +%%% editor and booktitle +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { bst.in format.btitle * } + { bst.editor.btitle.order #0 = + { bst.in format.editors.x * " " * format.btitle * } + { bst.in format.btitle * " " * format.editors.x * } + if$ + } + if$ + } + if$ +} + +%%% howpublished +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { bst.howpublished.pre howpublished * bst.howpublished.post * } + if$ +} + +%%% address +FUNCTION {format.address} +{ address empty$ + { "" } + { bst.address.pre address * bst.address.post * } + if$ +} + +%%% publisher +FUNCTION {format.publisher} +{ publisher empty$ + { "" } + { bst.publisher.pre publisher * bst.publisher.post * } + if$ +} + +%%% organization +FUNCTION {format.organization} +{ organization empty$ + { "" } + { bst.organization.pre organization * bst.organization.post * } + if$ +} + +%% publisher and address +FUNCTION {output.publisher.address} +{ address empty$ + { format.publisher "publisher" output.check.nocomma } + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ +} + +%% address, organization, publisher +FUNCTION {output.address.organization.publisher} +{ address empty$ + %% address is empty + { organization empty$ + %% organization is empty + { publisher empty$ + 'skip$ + { format.publisher "publisher" output.check.nocomma } + if$ + } + %% organization is not empty + { publisher empty$ + { format.organization "organization" output.check.nocomma } + { format.organization "organization" output.check.nocomma + format.publisher "publisher" output.check.nocomma } + if$ + } + if$ + } + %% address is not empty + { organization empty$ + %% organization is empty + { publisher empty$ + %% publisher is empty + { format.address output.nocomma } + %% publisher is not empty + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + %% organization is not empty + { publisher empty$ + %% publisher is empty + { format.organization "organization" output.check.nocomma + format.address output.nocomma } + %% publisher is not empty + { format.organization "organization" output.check.nocomma + bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% misc +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ " " type * } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + { " " type * } + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +%%% phdthesis +FUNCTION {format.phd} +{ bst.phdthesis } + +%%% mastersthesis +FUNCTION {format.mthesis} +{ bst.mthesis } + +%%% school +FUNCTION {format.school} +{ school empty$ + { "" } + { bst.school.pre school * bst.school.post * } + if$ +} + +%%% institution +FUNCTION {format.institution} +{ institution empty$ + { "" } + { bst.institution.pre institution * bst.institution.post * } + if$ +} + +%%% remove first ? characters. +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { bst.note.pre note * bst.note.post * } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \havarditem + +FUNCTION {output.bibitem} +{ newline$ + "\harvarditem[" write$ + alabel write$ % alabel <- abbreviated citation + "]{" write$ + flabel write$ % flabel <- full citation + "}{" write$ + cyear write$ + % cyear = year + "}{" write$ + cite$ write$ % cite$ -> pusch keyword + "}" write$ + % If number index is on + bst.use.number.index #0 = + 'skip$ + { index #1 + 'index := + "" 'preone := + "" 'preten := + bst.number.index.digit "1" = + 'skip$ + { bst.number.index.digit "2" = + { "\hskip0.5em" 'preone := } + { bst.number.index.digit "3" = + { "\hskip1em" 'preone := + "\hskip0.5em" 'preten := } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + newline$ + before.all 'output.state := + "" + % number index + bst.use.number.index #0 = + 'skip$ + { index #10 < + % Insert spaces according to digit of number index. + { preone } + { index #100 < + { preten } + { "" } + if$ + } + if$ + bst.number.index.pre * index int.to.str$ * bst.number.index.post * write$ + } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% article + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.journal "journal" output.check.nocomma + bst.year.position #2 = + { format.date output.nocomma } + 'skip$ + if$ + format.vol.num.pages output.nocomma + + bst.year.position #1 = + { format.date output.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% book + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + + format.bvolume output.nocomma + format.number.series output.nocomma + output.publisher.address + + format.edition output.nocomma + format.book.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booklet + +FUNCTION {booklet} +{ output.bibitem + format.authors output.nocomma + format.year output.nocomma + format.misc.title "title" output.check.nocomma + format.howpublished output.nocomma + format.address output.nocomma + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inbook + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ +% format.book remove.pre.comma "title" output.check.nocomma + format.book "title" output.check.nocomma + format.edition output.nocomma + + format.bvolume output.nocomma + format.chapter.pages "chapter and pages" output.check.nocomma + format.number.series output.nocomma + output.publisher.address + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% incollection + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + output.address.organization.publisher + format.edition output.nocomma + format.chapter.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inproceedings + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + format.pages output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% conference + +FUNCTION {conference} +{ inproceedings } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% manual +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull.nocomma + address output.nocomma + } + if$ + } + { format.authors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + author empty$ + { organization empty$ + { format.address new.block.check + format.address output.nocomma + } + 'skip$ + if$ + } + { output.address.organization.publisher } + if$ + format.edition output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% mastersthesis + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.mthesis format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% misc + +FUNCTION {misc} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Online + +FUNCTION {online} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% phdthesis + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + format.phd + format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + address empty$ + 'skip$ + { format.address output.nocomma } + if$ + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% proceedings + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output.nocomma } + { format.editors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.btitle remove.pre.comma "title" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% techreport + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.tr.number output.nonnull.nocomma + format.institution "institution" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% unpublished + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + bst.year.position #0 = not + { format.date remove.pre.comma output.nocomma } + { month empty$ + 'skip$ + { format.month remove.pre.comma output.nocomma } + if$ + } + if$ + + format.url.doi output.nocomma + + format.note "note" output.check.nocomma + fin.entry +} + +FUNCTION {default.type} +{ misc } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Alias for month names: + +MACRO {jan} {"January"} +MACRO {feb} {"February"} +MACRO {mar} {"March"} +MACRO {apr} {"April"} +MACRO {may} {"May"} +MACRO {jun} {"June"} +MACRO {jul} {"July"} +MACRO {aug} {"August"} +MACRO {sep} {"September"} +MACRO {oct} {"October"} +MACRO {nov} {"November"} +MACRO {dec} {"December"} + +%%% Read entries: +READ + +%%% Variable for remembering the order of citation. +INTEGERS { order.num } +FUNCTION {initialize.order.num} +{ + #1 'order.num := +} +%%% Initialize a variables +EXECUTE {initialize.order.num} + +%%% Variable for remembering the order of citation. +FUNCTION {set.order.cited} +{ + order.num 'order.cited := + #1 order.num + 'order.num := +} +%%% Iterate for all entries: +ITERATE {set.order.cited} + +%%% check the value of nameorder field. +FUNCTION {set.nameorder} +{ nameorder empty$ + { "" 'nameorder.temp := } + { nameorder 'nameorder.temp := } + if$ +} +%%% Iterate for all entries: +ITERATE {set.nameorder} + +%%% Remove symbols and convert to lowercase. +FUNCTION {sortify} +{ purify$ "l" change.case$ } + +%%% names for sorting +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { ", " * } + 'skip$ + if$ + s nameptr "{ll}{ f}{ j}" format.name$ 't := + nameptr numnames = t "others" = and + { bst.and.others.output *} + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + { s sort.format.names } + { s #1 "{ll}{ f}{ j}" format.name$ " zz " * } + if$ +} + +%%% Label for full author name. +FUNCTION {format.lab.names.full} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { ", " * t * } + if$ + } + { t "others" = + { bst.and.others.output * } + { numnames #2 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.ands * t * } + if$ + } + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.and * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + numnames #1 > #1 #2 = and {", eds" *} {} if$ + numnames #1 = #1 #2 = and {", ed" *} {} if$ +} + +%%% laberl for abbreviated author name. +FUNCTION {format.lab.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + % if the number of authors is less than bst.and.others.num, full name. + { s format.lab.names.full } + % if the number of authors is equal or more than bst.and.others.num, abbreviated name. + { s #1 "{ll}" format.name$ bst.and.others.output * } + if$ +} + +%%% abbreviated author +FUNCTION {author.key.label.abb} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.key.label.full} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {format.names.full.wo.and} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ll}{, ff}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { " " * t * } + { t "others" = + { " " * } + { numnames #2 > + { " " * t * } + { " " * t * } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.full.wo.and} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {author.editor.key.full.wo.and} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {editor.key.organization.key.full.wo.and} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ +} + +FUNCTION {author.key.organization.key.full.wo.and} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +%%% abbreviated author +FUNCTION {author.editor.key.label.abb} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.editor.key.label.full} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.full} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.abb} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +FUNCTION {editor.key.organization.label.full} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ +} + +FUNCTION {editor.key.organization.label.abb} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ +} + +%%% Convert numbers: 0->9, 1->8, 2->7,..., 9->0 +FUNCTION {reverse.num} +{ 's := + s "1" = + { "8" 'year.num := } + { s "2" = + { "7" 'year.num := } + { s "3" = + { "6" 'year.num := } + { s "4" = + { "5" 'year.num := } + { s "5" = + { "4" 'year.num := } + { s "6" = + { "3" 'year.num := } + { s "7" = + { "2" 'year.num := } + { s "8" = + { "1" 'year.num := } + { s "9" = + { "0" 'year.num := } + { s "0" = + { "9" 'year.num := } + { "9" 'year.num := } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + year.num +} + +%%% Convert year (large number -> small number) +FUNCTION {convert.year} +{ 't := + bst.reverse.year #0 = + { t 'tt := } + { t #1 #1 substring$ reverse.num + t #2 #1 substring$ reverse.num * + t #3 #1 substring$ reverse.num * + t #4 #1 substring$ reverse.num * 'tt := } + if$ + tt +} + +%%% cyear +FUNCTION {calc.cyear} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.full.wo.and + { type$ "proceedings" = + 'editor.key.organization.key.full.wo.and + { type$ "manual" = + 'author.key.organization.key.full.wo.and + 'author.key.full.wo.and + if$ + } + if$ + } + if$ + duplicate$ + year empty$ + { "2199" 'cyear := } + { year 'cyear := } + if$ + year empty$ + { " " "2199" convert.year * field.or.null * } + { " " year convert.year * field.or.null * } + if$ + sortify 'sort.label := + % For debug + econ.debug #0 = not + { "sort.label = ``\texttt{" write$ + sort.label write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ + pop$ +} + +FUNCTION {calc.sort.label.abb} +{ author empty$ + { editor empty$ + { "" } + { editor 's := } + if$ + } + { author 's := } + if$ + s sort.format.names.abb 't := + year empty$ + { t sortify " " * "2199" convert.year * 'sort.label.abb := } + { t sortify " " * year convert.year * 'sort.label.abb := } + if$ + econ.debug #0 = not + { "sort.label.abb = ``\texttt{" write$ + sort.label.abb write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% flabel +FUNCTION {calc.flabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.full + { type$ "proceedings" = + 'editor.key.organization.label.full + { type$ "manual" = + 'author.key.organization.label.full + 'author.key.label.full + if$ + } + if$ + } + if$ + 'flabel := + % For debug + econ.debug #0 = not + { "flabel = ``\texttt{" write$ + flabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% alabel +FUNCTION {calc.alabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.abb + { type$ "proceedings" = + 'editor.key.organization.label.abb + { type$ "manual" = + 'author.key.organization.label.abb + 'author.key.label.abb + if$ + } + if$ + } + if$ + 'alabel := + % For debug + econ.debug #0 = not + { "alabel = ``\texttt{" write$ + alabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% title for sorting +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +%%% author for sorting +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +%%% editor for sorting +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +%%% 1,...,9 -> 001,...,009 +%%% 10,...,99 -> 010,...,099 +FUNCTION {add.zero.to.number} +{ 's := + s text.length$ #1 = + { "00" s * } + { s text.length$ #2 = + { "0" s * } + { s } + if$ + } + if$ +} + +%% entry type +FUNCTION {bst.sort.entry.type.order} +{ 'item.type := + item.type "article" = + { "01" } + { item.type "book" = + { "02" } + { item.type "booklet" = + { "03" } + { item.type "comment" = + { "04" } + { item.type "conference" = + { "05" } + { item.type "inbook" = + { "06" } + { item.type "incollection" = + { "07" } + { item.type "inproceedings" = + { "08" } + { item.type "manual" = + { "09" } + { item.type "masterthesis" = + { "10" } + { item.type "misc" = + { "11" } + { item.type "phdthesis" = + { "12" } + { item.type "proceedings" = + { "13" } + { item.type "techreport" = + { "14" } + { item.type "unpublished" = + { "15" } + { "16" } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% Create sort.key$: absorder -> author -> year -> order -> month -> title. +FUNCTION {presort.one} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * + sort.label.abb * + " " * + type$ "book" = type$ "inbook" = or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + * " " * + " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +FUNCTION {presort.two} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * sort.label * " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% Codes for debugging +FUNCTION {calc.alabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.alabel: alabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {calc.flabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.flabel: flabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {presort.one.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (1st time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {presort.two.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (2nd time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.cyear.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.cyear: sort.label = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.sort.label.abb.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.sort.label.abb: sort.label.abb = }\\" write$ + newline$ } + 'skip$ + if$ +} + +%%% alabel +EXECUTE {calc.alabel.mess} +ITERATE {calc.alabel} + +%%% flabel +EXECUTE {calc.flabel.mess} +ITERATE {calc.flabel} + +%%% cyear and sort.label +EXECUTE {calc.cyear.mess} +ITERATE {calc.cyear} + +%%% +EXECUTE {calc.sort.label.abb.mess} +ITERATE {calc.sort.label.abb} + +%%% Sorting by $sort.key (first time) +% +% Sorting is done in two times. This is the first time. +% +EXECUTE {presort.one.mess} +ITERATE {presort.one} +SORT + +FUNCTION {forward.pass} +{ bst.use.bysame #0 = bst.use.bysame #2 = or + % Not use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + } + % Use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + % format.names 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label empty$ not + { cyear extra.label * } + { cyear "" * } + if$ + "" field.or.null * + 'cyear := + extra.label 'next.extra := +} + +%%% \bysame +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +%%% Sorting by sort.key$ (second time) +EXECUTE {presort.two.mess} +ITERATE {presort.two} +SORT + +FUNCTION {reset.prev.author} +{ "xxyyzz" 'prev.author := } + +EXECUTE {reset.prev.author} + +FUNCTION {forward.pass.two} +{ bst.use.bysame #1 = + { author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + 'skip$ + if$ +} + +ITERATE {forward.pass.two} + +FUNCTION{punctuation} +{ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ + "% This bbl file is created by econ.bst ver." econ.version * write$ newline$ + "% The latest econ.bst is available at" write$ newline$ + "% <https://github.com/ShiroTakeda/econ-bst>" write$ newline$ newline$ +} + +EXECUTE {punctuation} + +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + bst.use.bysame #0 = + % Not use \bysame. + 'skip$ + % Use \bysame. + { "%%% Definition of \bysame" write$ newline$ + "\ifx\undefined\bysame" write$ newline$ + "\newcommand{\bysame}{" bst.bysame.definition * "}" * + write$ newline$ + "\fi" write$ newline$ newline$ } + if$ + %% When number index is attached to the beginning of each item. + bst.use.number.index #0 = + 'skip$ + { bst.number.index.digit "1" = + % one digit. + { bst.number.index.bibhang.one } + { bst.number.index.digit "2" = + % two digits. + { bst.number.index.bibhang.ten } + % three or more digits. + { bst.number.index.bibhang.hund } + if$ + } + if$ + 'hang := + "%%% Redefinition of \bibhang" write$ newline$ + "\ifx\undefined\bibhang" write$ newline$ + "\relax" write$ newline$ + "\else" write$ newline$ + "\setlength{\bibhang}{" + hang * "}" * write$ newline$ + "\fi" write$ newline$ newline$ + } + if$ + "\begin{thebibliography}{xxx}" write$ newline$ + + %% Initialize the variable `index'. + #0 'index := +} + +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ } + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +EXECUTE {end.bib} + +% -------------------- +% Local Variables: +% fill-column: 78 +% mode: bst +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.pdf Binary files differnew file mode 100644 index 00000000000..900654b4fe8 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.tex new file mode 100644 index 00000000000..aa01c92619c --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-jie.tex @@ -0,0 +1,56 @@ +%#!pdflatex +%#BIBTEX bibtex econ-jie + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +This document uses ``\verb|econ-jie.bst|''. The style like ({\itshape Journal of +International Economics}). + +\vspace{1em} + +\input{cited-part} +\nocite{*} + +%% bst file: +\bibliographystyle{econ-jie} +\bibliography{../econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.bst b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.bst new file mode 100644 index 00000000000..2e272ee2c3d --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.bst @@ -0,0 +1,3521 @@ +%% econ.bst: BibTeX style file for papers in economics. +% +% Author: Shiro Takeda +% Maintainer: Shiro Takeda +% Copyright (C) 2001-2018 Shiro Takeda +% First-written: <2007/07/28> +% Time-stamp: <2018-12-07 18:48:07 st> +% Version: 2.5 +% Keywords: TeX, BibTeX, bst +% URL: https://github.com/ShiroTakeda/econ-bst + +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% of this license or (at your option) any later version. +% The latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is Shiro Takeda. + +%% Main features of econ.bst. + +% "econ.bst" is a BibTeX style file for economics. It provids the following +% features: + +% 1) The author-year type citation (you need "natbib.sty" as well). +% 2) Reference style used in economics papers ("econ.bst" is not a BibTeX style +% for a specific journal). +% 3) Highly customizable. You can easily customize reference style as you wish. +% 4) You can use "certified random order" proposed by Ray ⓡ Robson (2018) +% (http://dx.doi.org/10.1257/aer.20161492). + +% Bug reports, requests and suggestions are welcome. + +% For changelogs, see CHANGES.txt file. + +% version number +FUNCTION {econ.version} { "2.5" } + +% Debug mode. Non-zero makes debug mode on. +FUNCTION {econ.debug} +{ #0 } % Debug mode off (default). +% { #1 } % Debug mode on. + +ENTRY + %%% Declaration of field + { access address author booktitle chapter doi edition editor howpublished + institution journal key month note number organization pages publisher + school series title type url volume year + % Fields specific to econ.bst + order absorder nameorder + } + + % Definition of entry variable. The entry variable is a variable which has + % different values according to different entries. + %% Integer entry variable: + { order.cited } + + %% String entry variable + { label cyear flabel alabel extra.label sort.label sort.label.abb + extra.label.bysame nameorder.temp } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Use \bysame or not. +% +% If set to #0, \bysame is not used. +% If set to #1, \bysame is used +% If set to #2, \bysame is used (alternative abbreviation style). +% +% Note that integer number is expressed as # + integer in bst file. +% \bysame is the function that abbreviates succession of the same authors' name by ---. +% +% See econ-sample.pdf for details. +% +FUNCTION {bst.use.bysame} +% { #0 } % Not use \bysame +{ #1 } % -> Use \bysame (default) +% { #2 } % -> Use \bysame of alternative style. + +% The definition of \bysame command. +% +FUNCTION {bst.bysame.definition} +{ "\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em" } % (default) +% { "\leavevmode\hbox to\leftmargin{\hrulefill\,\,}" } % If you set #2 to bst.use.bysame, use this. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% The order of fist and last name. +% +FUNCTION {bst.author.name} +{ #0 } % (default) +% { #1 } +% { #2 } + +% Case of #0: First author -> last-first, other authors -> first-last. +% Fujita, Masahisa, Paul R. Krugman, and Anthony J. Venables. + +% Case of #1: All authors -> last-first +% Fujita, Masahisa, Krugman, Paul R., and Venables, Anthony J. + +% Case of #2: All authors -> first-last +% Masahisa Fujita, Paul R. Krugman, and Anthony J. Venables. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Abbreviate first name of authors (editors): +% +FUNCTION {bst.first.name.initial} +{ #0 } % #0 -> full letters (default). +% { #1 } % Non-zero -> initial letter only. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Decapitalize of strings in title field. +% +FUNCTION {bst.title.lower.case} +{ #0 } % If #0, not decapitalize title (default). +% { #1 } % If non-#0, decapitalize title + +% Hide title filed. +% +FUNCTION {bst.hide.title} +{ #0 } % #0 -> Title field is displayed (default) +% { #1 } % Non-zer -> Title field is hidden + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide month. +% +FUNCTION {bst.hide.month} +{ #0 } % #0 -> show month field (default). +% { #1 } % non-#0 -> hide month field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Attach number index like plain.bst. +% +FUNCTION {bst.use.number.index} +{ #0 } % Not use number index (default). +% { #1 } % Non-#0 -> Use number index + +% The string before number index: +% +FUNCTION {bst.number.index.pre} +{ "[" } % (default) + +% The string after number index. Adjustment is recommended. +% +FUNCTION {bst.number.index.post} +{ "]\hskip1.0em " } % (default) + +% Maximum digit of number index: +% If the number of reference items >= 100, set 3 to this function. +% If the number of reference items < 100, set 2 to this function. +% If the number of reference items < 10, set 1 to this function. +% +FUNCTION {bst.number.index.digit} +{ "2" } % (default) +% { "3" } + +% The functions below are used to adjust space and postion. If you use fonts +% other than computer modern fonts, you had better make adjustments. +% +% Setting for bst.number.index.digit = 1: +FUNCTION {bst.number.index.bibhang.one} +{ "2.05em" } % (default) +% Setting for bst.number.index.digit = 2: +FUNCTION {bst.number.index.bibhang.ten} +{ "2.55em" } % (default) +% Setting for bst.number.index.digit = 3: +FUNCTION {bst.number.index.bibhang.hund} +{ "3.05em" } % (default). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Position of "year": +% +% You can choose the position of year by this function. +% +% If set to #0, year is placed right after "author". +% If set to non-zero, year is placed at the end (before note field) except for +% aritcle type entry. +% +% In article type entry, the position of year changes according to the +% following rule: +% +% #1 -> year is placed at the end. +% #2 -> year is placed after journal name in aritcle type entry. +% #3 -> year is placed after volume in aritcle type entry. +% +FUNCTION {bst.year.position} +{ #0 } % (default). +% { #1 } % Last place before note. +% { #2 } % After journal name for aticle type entry. +% { #3 } % After volume for aticle type entry. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If 0, references are sorted by old documents -> recent documents. If +% non-zero, reverse order. +FUNCTION {bst.reverse.year} +{ #0 } % Normal order (old -> recent) (default). +% { #1 } % inverse order (recent -> old) + +% If non-zero, sort references by using year field as the primary key +% (chronological sorting). +FUNCTION {bst.sort.year} +{ #0 } % Normal case: year is used as the sorting key next to author (default). +% { #1 } % year is used as the primary sorting key. + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% If non-zero, references are listed in citation order. +% +FUNCTION {bst.no.sort} +% { #0 } % (default) +{ #1 } % listed in citation order. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Non-zero -> sort references by entry type (article, book, incollection etc.) +% +FUNCTION {bst.sort.entry.type} +{ #0 } % #0 -> Normal (not sort references by entry type) (default). +% { #1 } % Non-zero -> sort references by entry type. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use absorder field to sort items. Otherwise, ignore absorder field. +% +FUNCTION {bst.notuse.absorder.field} +{ #0 } % #0 -> Use absorder (default). +% { #1 } % Non-#0 -> Not use absorder. +% +% Order of priority to sort items +% +% absorder -> author -> year -> order -> month -> title +% +% wehre absorder and order fields are specific to econ.bst. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% 0 -> use order field to sort items. Otherwise, ignore order field. +% Note: order field is specific to econ.bst. +FUNCTION {bst.notuse.order.field} +{ #0 } % #0 -> Use order field (default). +% { #1 } % Non-#0 -> not use order field. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% and + +%%% String used to separate author names in references. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.and} +{ " and " } % (default) + +%%% String used to separate author names in references (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.ands} +{ ", and " } % (default) + +%%% String used to separate author names in citation part. +% +% String replaced with _ in "Mr. A _ Mr. B " +% +FUNCTION {bst.cite.and} +{ " and " } % (default) + +%%% String used to separate author names in citation part (more than two authors). +% +% String replaced with _ in "Mr. A, Mr. B _ Mr. C" +% +FUNCTION {bst.cite.ands} +{ " and " } % (default) + +%%% If you want to use random author order for some bibliography entries, set +% non-zero to this function. +% +FUNCTION {bst.use.nameorder} +{ #1 } % Use random order (default) +% { #0 } % Not use random order + +%%% String used to separate author names in references for the entry of random +% author order. +% +FUNCTION {bst.and.nameorder} +{ " \textcircled{r} " } % (default) + +%%% String used to separate author names in citation part for the entry of +% random author order +% +FUNCTION {bst.cite.and.nameorder} +{ " \textcircled{r} " } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Author names in the citation part are abbreviated by et al. if the number of +% authors is greater or equal to bst.and.others.num. +FUNCTION {bst.and.others.num} +{ #3 } % If the number of authors is greater or equal to three (default). +% { #4 } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Strings used when abbreviating multiple-authors in citation part. +FUNCTION {bst.and.others} +{ " et~al." } % (default) + +% Strings used when abbreviating multiple-authors in citation part for entries +% with random author order. +FUNCTION {bst.and.others.nameorder} +{ " \textcircled{r}~al." } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% author + +% The string before author: +% +FUNCTION {bst.author.pre} +{ "" } % (default) + +% The string after author: +% +FUNCTION {bst.author.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% year + +% The string before year only for aritcle type entry. +% +FUNCTION {bst.year.pre} +{ " (" } % (default) + +% The string after year only for aritcle type entry. +% +FUNCTION {bst.year.post} +{ ") " } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.pre} +{ " (" } % (default) + +% The string after year for non-article type entry (book, incollection etc) +% +FUNCTION {bst.year.na.post} +{ ") " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% title (except for title in book) + +% The string before title: +% +FUNCTION {bst.title.pre} +{ "``" } % (default) + +% The string after title: +% +FUNCTION {bst.title.post} +{ ",''" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% tile for book: + +% The string before book title: +% +FUNCTION {bst.book.pre} +{ " \textit{" } % (default) + +% The string after book title: +% +FUNCTION {bst.book.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booktitle + +% The string before booktitle: +% +FUNCTION {bst.btitle.pre} +{ " \textit{" } % (default) + +% The string after booktitle: +% +FUNCTION {bst.btitle.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% journal name + +% The string before journal name: +% +FUNCTION {bst.journal.pre} +{ " \textit{" } % (default) + +% The string after journal name: +% +FUNCTION {bst.journal.post} +{ "}" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% editor notation: + +% The string that indicates multiple editors: +% +FUNCTION {bst.editors} +{ " eds. " } % (default) + +% The string that indicates single editor: +% +FUNCTION {bst.editor} +{ " ed. " } % (default) + +% Order of editor and booktitle in incollection and inproceedings entries. +% +% If set to #0: editors -> booktitle order +% If set to non-zero: booktitle -> editors order +% +FUNCTION {bst.editor.btitle.order} +{ #0 } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% edition + +% The string before edition: +% +FUNCTION {bst.edition.pre} +{ ", " } % (default) + +% The string after edition: +% +FUNCTION {bst.edition.post} +{ " edition" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% volume + +% The string before volume: +% +FUNCTION {bst.volume.pre} +{ ", Vol. " } % (default) + +% The string after volume: +% +FUNCTION {bst.volume.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% number + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% Hide number. If non-zero, number is suppressed. +FUNCTION {bst.hide.number} +% { #0 } % #0 -> show number field (default) +{ #1 } % non-#0 -> Hide number field. + +% The string before number: +% +FUNCTION {bst.number.pre} +{ ", No. " } % (default) + +% The string after number: +% +FUNCTION {bst.number.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% in + +% In +% +FUNCTION {bst.in} +{ " in " } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% page + +% The string before page (multiple pages): +% +FUNCTION {bst.pages.pre} +{ ", pp." } % (default) + +% The string before page: +% +FUNCTION {bst.page.pre} +{ ", p." } % (default) + +% The string after page (multiple pages): +% +FUNCTION {bst.pages.post} +{ "" } % (default) + +% The string after page: +% +FUNCTION {bst.page.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% chapter + +% The string before chapter: +% +FUNCTION {bst.chapter.pre} +{ ", Chap." } % (default) + +% The string after chapter: +% +FUNCTION {bst.chapter.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% month + +% The string before month: +% +FUNCTION {bst.month.pre} +{ ", " } % (default) + +% The string after month: +% +FUNCTION {bst.month.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% address +% The string before address: +% +FUNCTION {bst.address.pre} +{ ", " } % (default) + +% The string after address: +% +FUNCTION {bst.address.post} +{ "" } % (default) + +% You can choose the order of address and publisher by this function. +% +% If #0, address -> publisher order (the default value). +% If non-zero, publisher -> address order. + +FUNCTION {bst.address.position} +{ #0 } % Address is placed before publisher (default) +% { #1 } % Address is placed after publisher + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% publisher + +% The string before publisher: +% +FUNCTION {bst.publisher.pre} +{ ": " } % (default) + +% The string after publisher: +% +FUNCTION {bst.publisher.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% series + +% The string before series: +% +FUNCTION {bst.series.pre} +{ ", " } % (default) + +% The string after series: +% +FUNCTION {bst.series.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% organization + +% The string before organization: +% +FUNCTION {bst.organization.pre} +{ ", " } % (default) + +% The string after organization: +% +FUNCTION {bst.organization.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% school + +% The string before school: +% +FUNCTION {bst.school.pre} +{ ", " } % (default) + +% The string after school: +% +FUNCTION {bst.school.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% institution + +% The string before institution: +% +FUNCTION {bst.institution.pre} +{ ", " } % (default) + +% The string after institution: +% +FUNCTION {bst.institution.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% howpublished + +% The string before howpublished: +% +FUNCTION {bst.howpublished.pre} +{ " " } % (default) + +% The string after howpublished: +% +FUNCTION {bst.howpublished.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% url + +% Show or Hide url. If non-zero, url is displayed. Otherwise, url is suppressed. +FUNCTION {bst.show.url} +{ #1 } % non-#0 -> Show url field (default) +% { #0 } % #0 -> Not show url field. + +% The string before url: +% +FUNCTION {bst.url.pre} +{ ", URL: \url{" } % (default) + +% The string after url: +% +FUNCTION {bst.url.post} +{ "}" } % (default) + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Access + +% This setting is valid only if there are "access" field in bib +% files. The value of access field indicates accessed date for URL. + +% The string before access. +FUNCTION {bst.access.pre} +{ ", accessed on " } % (default) + +% The string after access. +FUNCTION {bst.access.post} +{ "" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% DOI (digital object identifier) + +% This setting is valid only if there are "doi" field in bib files. + +% Show or Hide DOI. If non-zero, DOI is displayed. Otherwise, DOI is suppressed. +FUNCTION {bst.show.doi} +{ #1 } % non-#0 -> Show DOI field (default) +% { #0 } % #0 -> Not show DOI field. + +% The string before DOI: +% +FUNCTION {bst.doi.pre} +{ ", DOI: \href{http://dx.doi.org/" doi * "}{" * } % (default) + +% The string after DOI: +% +FUNCTION {bst.doi.post} +{ "}" } % (default) + +% How to show URL and DOI fields when both fields exist. +% +% #0 -> Both fields are displayed +% #1 -> Only URL field is displayed +% #2 -> Only DOI field is displayed +% +FUNCTION {bst.url.doi} +{ #0 } % (default) -> Both fields are displayed +% { #1 } % -> Only URL field is displayed +% { #2 } % -> Only DOI field is displayed + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Other functions: + +% The string before note. +FUNCTION {bst.note.pre} +{ ", " } % (default) + +% The string after note. +FUNCTION {bst.note.post} +{ "" } % (default) + +% The string that represents Technical report: +% +FUNCTION {bst.techrep} +{ " Tech. Rep." } % (default) + +% The string that represents master thesis: +% +FUNCTION {bst.mthesis} +{ " Master's thesis" } % (default) + +% The string that represents phd thesis: +% +FUNCTION {bst.phdthesis} +{ " Ph.D. dissertation" } % (default) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% Functions for customization end here: +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +FUNCTION {bst.first} +{ "1st" } + +FUNCTION {bst.second} +{ "2nd" } + +FUNCTION {bst.third} +{ "3rd" } + +FUNCTION {bst.fourth} +{ "4th" } + +FUNCTION {bst.fifth} +{ "5th" } + +FUNCTION {bst.st} +{ "st" } + +FUNCTION {bst.nd} +{ "nd" } + +FUNCTION {bst.rd} +{ "rd" } + +FUNCTION {bst.th} +{ "th" } + +%%%%% memo by Takeda + +% "a" 'b := indicates substituting string "a" for variable b. + +% Integer number #0, #1,... + +%%% Function definition: +% +% FUNCTION {name} +% { 's := +% +% } +% +% This is the definition of a function named "name". The function "name" is +% used in the following way +% +% "foo" name +% "foo" is an argument for the function "name". +% +% About the definition of a function with more than two arguments, see the +% definition of "chop.word". + +%%% Declaration of variables: + +%% String global variables: +STRINGS { s t tt } +STRINGS { year.num } +STRINGS { preone preten } +STRINGS { last.sort.label next.extra prev.author prev.author.aer this.author } +STRINGS { hang } +STRINGS { item.type } +STRINGS { tempa tempb } + +%% Integer global variables: +INTEGERS { nameptr namesleft numnames name.num } +INTEGERS { multiresult } +INTEGERS { index } +INTEGERS { len } +INTEGERS { last.extra.num } +INTEGERS { output.state before.all mid.sentence after.sentence after.block } +INTEGERS { last.period.comma } +INTEGERS { len1.aer len2.aer i.aer } + +%%% Definition of functions: +FUNCTION {not} +{ { #0 } + { #1 } + if$ +} + +FUNCTION {and} +{ 'skip$ + { pop$ #0 } + if$ +} + +FUNCTION {or} +{ { pop$ #1 } + 'skip$ + if$ +} + +%%% Initialize variables: +FUNCTION {init.state.consts} +{ #0 'before.all := + #1 'mid.sentence := + #2 'after.sentence := + #3 'after.block := +} + +%%% Remove comma and add period: +% +%%% +FUNCTION {add.period.x} +{ duplicate$ + #-1 #1 substring$ "," = + { #-2 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ". " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ", " = + { #-3 global.max$ substring$ "." * } + { duplicate$ + #-1 #2 substring$ ",'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".'" = + { #-3 global.max$ substring$ ".'" * } + { duplicate$ + #-1 #2 substring$ ".~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #2 substring$ ",~" = + { #-3 global.max$ substring$ ".~" * } + { duplicate$ + #-1 #3 substring$ ",''" = + { #-4 global.max$ substring$ ".''" * } + { duplicate$ + #-1 #3 substring$ ".''" = + { #-4 global.max$ substring$ ".''" * } + { add.period$ } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +FUNCTION {output.nonnull} +{ 's := + % mid.sentence + output.state mid.sentence = + { ", " * write$ } + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period.x " " * write$ } + if$ + } + if$ + % not mid.sentence, set to mid.sentence + mid.sentence 'output.state := + } + if$ + s +} + +%%% If the last character is period or comma, set non-zero to +%%% last.period.comma. +FUNCTION {period.comma.p} +{ duplicate$ 't := + t #-1 #1 substring$ "." = + t #-1 #1 substring$ "," = or + t #-1 #1 substring$ ":" = or + t #-1 #2 substring$ ".'" = or + t #-1 #2 substring$ ",'" = or + t #-1 #3 substring$ ".''" = or + t #-1 #3 substring$ ",''" = or + t #-1 #2 substring$ ".~" = or + t #-1 #2 substring$ ",~" = or + { #1 'last.period.comma := } + { #0 'last.period.comma := } + if$ +} + +%%% remove unnecessary comma. +FUNCTION {remove.pre.comma} +{ 's := + s empty$ + { "" } + { s #1 #1 substring$ "," = + { s #2 global.max$ substring$ } + { s #1 #1 substring$ "." = + { s #2 global.max$ substring$ } + 's + if$ + } + if$ + } + if$ +} + +%%% output.nonnull.nocomma is the same as output.nonnull except that it does +%%% not add commas even in mid.sentence. +FUNCTION {output.nonnull.nocomma} +{ 's := + output.state mid.sentence = + % mid.sentence + { period.comma.p "" * write$ } + + % not mid.sentence + { output.state after.block = + % after.block + { add.period.x " " * write$ } + % before.all + { output.state before.all = + 'write$ + { add.period$ " " * write$ } + if$ + } + if$ + mid.sentence 'output.state := + } + if$ + last.period.comma #0 = + { s } + { s remove.pre.comma } + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output} +% { duplicate$ empty$ +% 'pop$ +% 'output.nonnull +% if$ +% } + +FUNCTION {output.nocomma} +{ duplicate$ empty$ + 'pop$ + 'output.nonnull.nocomma + if$ +} + +% Not used in the current econ.bst. +% FUNCTION {output.check} +% { 't := +% duplicate$ empty$ +% { pop$ "empty " t * " in " * cite$ * warning$ } +% 'output.nonnull +% if$ +% } + +FUNCTION {output.check.nocomma} +{ 't := + duplicate$ empty$ + { pop$ "empty " t * " in " * cite$ * warning$ } + 'output.nonnull.nocomma + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Format in bbl file: + +% \harvarditem[Brezis et~al.]{Brezis, Krugman and +% Tsiddon}{1993}{brezis93:_leapf_inter_compet} +% Brezis, Elise~S., Paul~R. Krugman, and Daniel Tsiddon (1993) ``Leapfrogging in +% International Competition: A Theory of Cycles in National Technological +% Leadership.'', {\em American Economic Review.}, Vol.~83. No.~5. pp. +% 1211--1219. + +% \harvarditem[abbreviated citation]{full citation}{year}{keyword} ... + +%%% Add period and newline. +FUNCTION {fin.entry} +{ add.period.x + write$ + newline$ +} + +FUNCTION {new.block} +{ output.state before.all = + 'skip$ + { after.block 'output.state := } + if$ +} + +FUNCTION {new.sentence} +{ output.state after.block = + 'skip$ + { output.state before.all = + 'skip$ + { after.sentence 'output.state := } + if$ + } + if$ +} + +FUNCTION {new.block.check} +{ empty$ + 'skip$ + 'new.block + if$ +} + +FUNCTION {field.or.null} +{ duplicate$ empty$ + { pop$ "" } + 'skip$ + if$ +} + +%%% booktitle +FUNCTION {format.btitle} +{ booktitle empty$ + { "" } + { bst.btitle.pre booktitle * bst.btitle.post * } + if$ +} + +%%% journal +FUNCTION {format.journal} +{ journal empty$ + { "" } + { bst.journal.pre journal * bst.journal.post * } + if$ +} + +%%% title for book +FUNCTION {format.book} +{ title empty$ + { "" } + { bst.book.pre title * bst.book.post * } + if$ +} + +FUNCTION {format.url} +{ url empty$ + { "" } + { type$ "online" = bst.show.url or + { bst.url.pre url * bst.url.post * + access empty$ + { "" * } + { bst.access.pre * access * bst.access.post * } + if$ + } + { "" } + if$ + } + if$ +} + +FUNCTION {format.doi} +{ doi empty$ bst.show.doi not or + { "" } + { bst.doi.pre doi * bst.doi.post * } + if$ +} + +FUNCTION {format.url.doi} +{ url empty$ + { format.doi } + { doi empty$ + { format.url } + { bst.url.doi #0 = + { format.url output.nocomma + format.doi } + { bst.url.doi #1 = + { format.url } + { format.doi } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% and others +FUNCTION {bst.and.others.output} +{ nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.others.nameorder } + { bst.and.others } + if$ +} + +%%% author and editor + +%%% name +FUNCTION {format.names} +{ 's := + % insert 1 to nameptr. + #1 'nameptr := + % Set the number of authors to numnames. + s num.names$ 'numnames := + numnames 'namesleft := + % Repeat if namesleft > 0 + { namesleft #0 > } + { nameptr #1 = + % First author + { bst.author.name #0 = + bst.author.name #1 = + or + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + if$ + } + % The second or later authors + { bst.author.name #0 = + bst.author.name #2 = + or + { bst.first.name.initial #0 = + { s nameptr "{ff~}{vv~}{ll}{, jj}" format.name$ 't := } + { s nameptr "{f.~}{vv~}{ll}{, jj}" format.name$ 't := } + if$ + } + { bst.first.name.initial #0 = + { s nameptr "{vv~}{ll}{, ff}{, jj}" format.name$ 't := } + { s nameptr "{vv~}{ll}{, f.}{, jj}" format.name$ 't := } + if$ + } + if$ + } + if$ + + nameptr #1 > + % The second or later authors + { nameorder.temp "random" = + bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { namesleft #1 > + % More than one authors left + { ", " * t * } + % Only one author left + { t "others" = + { bst.and.others.output * } + { numnames #2 = + % Entry with two authors + { bst.and * t * } + { bst.ands * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +% remove successive periods (commas) from author +FUNCTION {remove.ss.period.auth} +{ 's := + s format.names 'tempa := + bst.author.post 'tempb := + tempb #1 #1 substring$ "}" = + { tempa tempb * } + { tempa #-1 #1 substring$ tempb #1 #1 substring$ = + { tempa tempb #2 global.max$ substring$ * } + { tempa tempb * } + if$ + } + if$ +} + +% <prev name list> <new name list> compare.names <modified name list> +FUNCTION {compare.names.aer} +{ 's := + 'tempa := + +% "current.author = " s * "\\" * write$ newline$ +% "prev.author = " tempa * "\\" * write$ newline$ + + tempa num.names$ 'len1.aer := % len1 = the number of previous authors + s num.names$ 'len2.aer := % len2 = the number of current authors + +% len1.aer := min(len1.aer,len2.aer) +% len1 -> min{ the number of previous authors, the number of current authors } + len1.aer len2.aer > + { len2.aer 'len1.aer := } + { } + if$ + +% start with an empty string, then while the components are the same +% add "\bysame" + "" + #1 'i.aer := + + { i.aer len1.aer > not } + { tempa i.aer "{ff }{vv }{ll}{ jj}" format.name$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ + = + { #1 i.aer < + { " and " * } % \bysame で省略する著者の前につく and + { } + if$ + "\bysame{}" * + i.aer #1 + 'i.aer := } + { #-1 'len1.aer := } + if$ + } + while$ + +% add the rest of the second string + { i.aer len2.aer > not } + { #1 i.aer < + { " and " * } + { } + if$ + s i.aer "{ff }{vv }{ll}{ jj}" format.name$ * + i.aer #1 + 'i.aer := + } + while$ +} + +%%% author +FUNCTION {format.authors} +{ author empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer author compare.names.aer 's := + author 'prev.author.aer := } + { author 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors} +{ editor empty$ + { "" } + { bst.use.bysame #2 = + { prev.author.aer editor compare.names.aer 's := + editor 'prev.author.aer := } + { editor 's := } + if$ + extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre s remove.ss.period.auth * } + if$ + s num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +FUNCTION {format.authors.alt} +{ author empty$ + { "" } + { extra.label.bysame "bysame" = + {"\bysame "} + { bst.author.pre author remove.ss.period.auth * } + if$ + } + if$ +} + +%%% editor +FUNCTION {format.editors.alt} +{ editor empty$ + { "" } + { extra.label.bysame "bysame" = + { "\bysame " } + { bst.author.pre editor remove.ss.period.auth * } + if$ + editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + if$ +} + +%%% format.in.ed.booktitle +FUNCTION {format.editors.x} +{ editor empty$ + { "" } + { bst.editor.btitle.order #0 = + { "" } + { editor num.names$ #1 > + { bst.editors " by " * } + { bst.editor " by " * } + if$ + } + if$ + editor format.names * + bst.editor.btitle.order #0 = + { editor num.names$ #1 > + { bst.editors * } + { bst.editor * } + if$ + } + { "" * } + if$ + } + if$ +} + +%%% Remove commas in the cases like "?." and "?,". +FUNCTION {remove.irrelevant.period.comma} +{ 's := + s empty$ + { "" } + { s #-1 #3 substring$ "?,'" = + s #-1 #3 substring$ "?.'" = or + { s #-3 global.max$ substring$ "'" * } + { s #-1 #4 substring$ "?,''" = + s #-1 #4 substring$ "?.''" = or + { s #-4 global.max$ substring$ "''" * } + { s #-1 #2 substring$ "?," = + s #-1 #2 substring$ "?." = or + { s #-2 global.max$ substring$ "" * } + { s #-1 #3 substring$ "?,~" = + s #-1 #3 substring$ "?.~" = or + { s #-4 global.max$ substring$ "?~" * } + 's + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% title +FUNCTION {format.title.sub} +{ bst.title.lower.case #0 = + { bst.title.pre title * bst.title.post * } + { bst.title.pre title "t" change.case$ * bst.title.post * } + if$ +} + +%%% title +FUNCTION {format.title} +{ title empty$ + bst.hide.title #0 = not or + { "" } + { format.title.sub remove.irrelevant.period.comma } + if$ +} + +%%% title for misc. +FUNCTION {format.misc.title} +{ title empty$ + { "" } + { bst.title.pre title * bst.title.post * } + if$ +} + +% Convert "-" to "--" (for pages field) +FUNCTION {n.dashify} +{ 't := + "" + %% while$ + { t empty$ not } + { t #1 #1 substring$ "-" = + { t #1 #2 substring$ "--" = not + { "--" * + t #2 global.max$ substring$ 't := + } + { { t #1 #1 substring$ "-" = } + { "-" * + t #2 global.max$ substring$ 't := + } + while$ + } + if$ + } + { t #1 #1 substring$ * + t #2 global.max$ substring$ 't := + } + if$ + } + while$ +} + +%%% year +FUNCTION {format.year} +{ year empty$ + { "there's no year in " cite$ * warning$ + ", " } + { type$ "article" = + { bst.year.pre year * extra.label * bst.year.post * } + { bst.year.na.pre year * extra.label * bst.year.na.post * } + if$ + } + if$ +} + +%%% page for book +FUNCTION {format.book.pages} +{ pages empty$ + { "" } + { bst.pages.pre pages * bst.pages.post * } + if$ +} + +%%% Attach tie for the string with two or less characters. +FUNCTION {tie.or.space.connect} +{ duplicate$ text.length$ #3 < + { "~" } + { " " } + if$ + swap$ * * +} + +FUNCTION {either.or.check} +{ empty$ + 'pop$ + { "can't use both " swap$ * " fields in " * cite$ * warning$ } + if$ +} + +%%% volume for book +FUNCTION {format.bvolume} +{ volume empty$ + { "" } + { bst.volume.pre volume * bst.volume.post * + series empty$ + 'skip$ + %% If there is series field + { " of " * series * bst.series.post * } + if$ +% "volume and number" number either.or.check + } + if$ +} + +%%% series +FUNCTION {output.series} +{ series empty$ + { "" } + { bst.series.pre series * bst.series.post * } + if$ +} + +%%% number and series +FUNCTION {format.number.series} +{ volume empty$ + { number empty$ + bst.hide.month #0 = not or + % number is empty + { series empty$ + { "" } + % series is not empty. + { output.series } + if$ + } + % number is not empty$ + { series empty$ + { bst.number.pre number * bst.number.post * } + % series is not empty. + { bst.in bst.series.pre * series * bst.series.post * + bst.number.pre * number * bst.number.post * } + if$ + } + if$ + } + { "" } + if$ +} + +%%% Number or not. +FUNCTION {is.num} +{ chr.to.int$ + duplicate$ "0" chr.to.int$ < not + swap$ "9" chr.to.int$ > not and +} + +FUNCTION {extract.num} +{ duplicate$ 't := + "" 's := + { t empty$ not } + { t #1 #1 substring$ + t #2 global.max$ substring$ 't := + duplicate$ is.num + { s swap$ * 's := } + { pop$ "" 't := } + if$ + } + while$ + s empty$ + 'skip$ + { pop$ s } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% edition + +% Convert edition to 1st, 2nd, 3rd, 4th etc +FUNCTION {eng.ord} +{ duplicate$ "1" swap$ * + #-2 #1 substring$ "1" = + { bst.th * } + { duplicate$ #-1 #1 substring$ + duplicate$ "1" = + { pop$ bst.st * } + { duplicate$ "2" = + { pop$ bst.nd * } + { "3" = + { bst.rd * } + { bst.th * } + if$ + } + if$ + } + if$ + } + if$ +} + +% Convert first, second etc in edition field to 1st, 2nd (from jfm.bst) +FUNCTION {convert.edition} +{ edition extract.num "l" change.case$ 's := + s "first" = s "1" = or + { bst.first } + { s "second" = s "2" = or + { bst.second } + { s "third" = s "3" = or + { bst.third } + { s "fourth" = s "4" = or + { bst.fourth } + { s "fifth" = s "5" = or + { bst.fifth } + { s #1 #1 substring$ is.num + { s eng.ord } + { edition } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% edition +FUNCTION {format.edition} +{ edition empty$ + { "" } + { output.state mid.sentence = + { bst.edition.pre convert.edition "l" change.case$ * bst.edition.post * } + { bst.edition.pre convert.edition "t" change.case$ * bst.edition.post * } + if$ + } + if$ +} + +%%% month +FUNCTION {format.month} +{ month empty$ + bst.hide.month #0 = not or + { "" } + { bst.month.pre month * bst.month.post * } + if$ +} + +%%% year and month +FUNCTION {format.date} +{ format.month format.year * +} + +%%% Is multiple pages like 1-100? +FUNCTION { multi.page.check } +{ 't := + #0 'multiresult := + { multiresult not + t empty$ not + and + } + { t #1 #1 substring$ + duplicate$ "-" = + swap$ duplicate$ "," = + swap$ "+" = + or or + { #1 'multiresult := } + { t #2 global.max$ substring$ 't := } + if$ + } + while$ + multiresult +} + +%%% pages +FUNCTION {format.pages} +{ pages empty$ + { "" } + { pages multi.page.check + { bst.pages.pre pages n.dashify tie.or.space.connect * bst.pages.post } + { bst.page.pre pages tie.or.space.connect * bst.page.post } + if$ + } + if$ +} + +%%% number +FUNCTION {format.number} +{ number empty$ + bst.hide.number #0 = not or + { "" } + { bst.number.pre number * bst.number.post * } + if$ +} + +%%% volume +FUNCTION {format.volume} +{ volume empty$ + 'skip$ + { bst.volume.pre volume * bst.volume.post * + bst.year.position #3 = + { format.year * } + 'skip$ + if$ + } + if$ +} + +%%% number, page +FUNCTION {format.number.pages} +{ number empty$ + { format.pages } + { format.number format.pages * } + if$ +} + +%%% volume, page +FUNCTION {format.volume.pages} +{ volume empty$ + { format.pages } + { format.volume format.pages * } + if$ +} + +%%% volume, number, page +FUNCTION {format.volume.number.pages} +{ volume empty$ + { number empty$ + { format.pages } + { format.number format.pages * } + if$ + } + { number empty$ + { format.volume format.pages * } + { format.volume format.number * format.pages * } + if$ + } + if$ +} + +% volume, number, page +FUNCTION {format.vol.num.pages} +{ volume empty$ + %% volume is empty. + { number empty$ + %% number is empty. + { pages empty$ + % warning + { "there is no volume, number, and pages in " cite$ * warning$ "" } + { "" format.pages * } + if$ + } + %% number is not empty. + % warning + { "there's a number but no volume in " cite$ * warning$ + format.number.pages } + if$ + } + %% volume is not empty. + { number empty$ + %% number is empty. + { format.volume.pages } + %% number is not empty. + { format.volume.number.pages } + if$ + } + if$ +} + +%%% chapter +FUNCTION {format.chapter} +{ chapter empty$ + { "" } + { type empty$ + { bst.chapter.pre chapter tie.or.space.connect * bst.chapter.post } + { ", " * type " " * chapter * } + if$ + } + if$ +} + +%%% chapter, pages +FUNCTION {format.chapter.pages} +{ chapter empty$ + { pages empty$ + { "" } + { "" format.pages * } + if$ + } + { pages empty$ + { "" format.chapter * } + { "" format.chapter * format.pages * } + if$ + } + if$ +} + +%%% editor and booktitle +FUNCTION {format.in.ed.booktitle} +{ booktitle empty$ + { "" } + { editor empty$ + { bst.in format.btitle * } + { bst.editor.btitle.order #0 = + { bst.in format.editors.x * " " * format.btitle * } + { bst.in format.btitle * " " * format.editors.x * } + if$ + } + if$ + } + if$ +} + +%%% howpublished +FUNCTION {format.howpublished} +{ howpublished empty$ + { "" } + { bst.howpublished.pre howpublished * bst.howpublished.post * } + if$ +} + +%%% address +FUNCTION {format.address} +{ address empty$ + { "" } + { bst.address.pre address * bst.address.post * } + if$ +} + +%%% publisher +FUNCTION {format.publisher} +{ publisher empty$ + { "" } + { bst.publisher.pre publisher * bst.publisher.post * } + if$ +} + +%%% organization +FUNCTION {format.organization} +{ organization empty$ + { "" } + { bst.organization.pre organization * bst.organization.post * } + if$ +} + +%% publisher and address +FUNCTION {output.publisher.address} +{ address empty$ + { format.publisher "publisher" output.check.nocomma } + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ +} + +%% address, organization, publisher +FUNCTION {output.address.organization.publisher} +{ address empty$ + %% address is empty + { organization empty$ + %% organization is empty + { publisher empty$ + 'skip$ + { format.publisher "publisher" output.check.nocomma } + if$ + } + %% organization is not empty + { publisher empty$ + { format.organization "organization" output.check.nocomma } + { format.organization "organization" output.check.nocomma + format.publisher "publisher" output.check.nocomma } + if$ + } + if$ + } + %% address is not empty + { organization empty$ + %% organization is empty + { publisher empty$ + %% publisher is empty + { format.address output.nocomma } + %% publisher is not empty + { bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + %% organization is not empty + { publisher empty$ + %% publisher is empty + { format.organization "organization" output.check.nocomma + format.address output.nocomma } + %% publisher is not empty + { format.organization "organization" output.check.nocomma + bst.address.position #0 = + { format.address output.nocomma + format.publisher "publisher" output.check.nocomma } + { format.publisher "publisher" output.check.nocomma + format.address output.nocomma } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% misc +FUNCTION {empty.misc.check} +{ author empty$ title empty$ howpublished empty$ + month empty$ year empty$ note empty$ + and and and and and + key empty$ not and + { "all relevant fields are empty in " cite$ * warning$ } + 'skip$ + if$ +} + +FUNCTION {format.thesis.type} +{ type empty$ + 'skip$ + { pop$ " " type * } + if$ +} + +FUNCTION {format.tr.number} +{ type empty$ + { "Technical Report" } + { " " type * } + if$ + number empty$ + { "t" change.case$ } + { number tie.or.space.connect } + if$ +} + +%%% phdthesis +FUNCTION {format.phd} +{ bst.phdthesis } + +%%% mastersthesis +FUNCTION {format.mthesis} +{ bst.mthesis } + +%%% school +FUNCTION {format.school} +{ school empty$ + { "" } + { bst.school.pre school * bst.school.post * } + if$ +} + +%%% institution +FUNCTION {format.institution} +{ institution empty$ + { "" } + { bst.institution.pre institution * bst.institution.post * } + if$ +} + +%%% remove first ? characters. +FUNCTION {chop.word} +{ 's := + 'len := + s #1 len substring$ = + { s len #1 + global.max$ substring$ } + 's + if$ +} + +FUNCTION {format.note} +{ note empty$ + { "" } + { bst.note.pre note * bst.note.post * } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \havarditem + +FUNCTION {output.bibitem} +{ newline$ + "\harvarditem[" write$ + alabel write$ % alabel <- abbreviated citation + "]{" write$ + flabel write$ % flabel <- full citation + "}{" write$ + cyear write$ + % cyear = year + "}{" write$ + cite$ write$ % cite$ -> pusch keyword + "}" write$ + % If number index is on + bst.use.number.index #0 = + 'skip$ + { index #1 + 'index := + "" 'preone := + "" 'preten := + bst.number.index.digit "1" = + 'skip$ + { bst.number.index.digit "2" = + { "\hskip0.5em" 'preone := } + { bst.number.index.digit "3" = + { "\hskip1em" 'preone := + "\hskip0.5em" 'preten := } + 'skip$ + if$ + } + if$ + } + if$ + } + if$ + newline$ + before.all 'output.state := + "" + % number index + bst.use.number.index #0 = + 'skip$ + { index #10 < + % Insert spaces according to digit of number index. + { preone } + { index #100 < + { preten } + { "" } + if$ + } + if$ + bst.number.index.pre * index int.to.str$ * bst.number.index.post * write$ + } + if$ +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% article + +FUNCTION {article} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.journal "journal" output.check.nocomma + bst.year.position #2 = + { format.date output.nocomma } + 'skip$ + if$ + format.vol.num.pages output.nocomma + + bst.year.position #1 = + { format.date output.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% book + +FUNCTION {book} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + + format.bvolume output.nocomma + format.number.series output.nocomma + output.publisher.address + + format.edition output.nocomma + format.book.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% booklet + +FUNCTION {booklet} +{ output.bibitem + format.authors output.nocomma + format.year output.nocomma + format.misc.title "title" output.check.nocomma + format.howpublished output.nocomma + format.address output.nocomma + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inbook + +FUNCTION {inbook} +{ output.bibitem + author empty$ + { format.editors "author and editor" output.check.nocomma } + { format.authors output.nonnull.nocomma + "author and editor" editor either.or.check + } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ +% format.book remove.pre.comma "title" output.check.nocomma + format.book "title" output.check.nocomma + format.edition output.nocomma + + format.bvolume output.nocomma + format.chapter.pages "chapter and pages" output.check.nocomma + format.number.series output.nocomma + output.publisher.address + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% incollection + +FUNCTION {incollection} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + output.address.organization.publisher + format.edition output.nocomma + format.chapter.pages output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% inproceedings + +FUNCTION {inproceedings} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + format.in.ed.booktitle "booktitle" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + format.pages output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% conference + +FUNCTION {conference} +{ inproceedings } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% manual +FUNCTION {manual} +{ output.bibitem + author empty$ + { organization empty$ + 'skip$ + { organization output.nonnull.nocomma + address output.nocomma + } + if$ + } + { format.authors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + author empty$ + { organization empty$ + { format.address new.block.check + format.address output.nocomma + } + 'skip$ + if$ + } + { output.address.organization.publisher } + if$ + format.edition output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% mastersthesis + +FUNCTION {mastersthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.mthesis format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% misc + +FUNCTION {misc} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Online + +FUNCTION {online} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.misc.title output.nocomma + format.howpublished output.nocomma + + bst.year.position #0 = not + { format.date output.nocomma } + { format.month output.nocomma } + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry + empty.misc.check +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% phdthesis + +FUNCTION {phdthesis} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.book "title" output.check.nocomma + format.phd + format.thesis.type output.nonnull.nocomma + format.school "school" output.check.nocomma + address empty$ + 'skip$ + { format.address output.nocomma } + if$ + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% proceedings + +FUNCTION {proceedings} +{ output.bibitem + editor empty$ + { organization output.nocomma } + { format.editors output.nonnull.nocomma } + if$ + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.btitle remove.pre.comma "title" output.check.nocomma + format.bvolume output.nocomma + format.number.series output.nocomma + output.address.organization.publisher + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.url.doi output.nocomma + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% techreport + +FUNCTION {techreport} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + format.tr.number output.nonnull.nocomma + format.institution "institution" output.check.nocomma + format.address output.nocomma + + bst.year.position #0 = not + { format.year "year" output.check.nocomma } + 'skip$ + if$ + + format.note output.nocomma + fin.entry +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% unpublished + +FUNCTION {unpublished} +{ output.bibitem + format.authors "author" output.check.nocomma + bst.year.position #0 = + { format.year "year" output.check.nocomma } + 'skip$ + if$ + format.title "title" output.check.nocomma + + bst.year.position #0 = not + { format.date remove.pre.comma output.nocomma } + { month empty$ + 'skip$ + { format.month remove.pre.comma output.nocomma } + if$ + } + if$ + + format.url.doi output.nocomma + + format.note "note" output.check.nocomma + fin.entry +} + +FUNCTION {default.type} +{ misc } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Alias for month names: + +MACRO {jan} {"January"} +MACRO {feb} {"February"} +MACRO {mar} {"March"} +MACRO {apr} {"April"} +MACRO {may} {"May"} +MACRO {jun} {"June"} +MACRO {jul} {"July"} +MACRO {aug} {"August"} +MACRO {sep} {"September"} +MACRO {oct} {"October"} +MACRO {nov} {"November"} +MACRO {dec} {"December"} + +%%% Read entries: +READ + +%%% Variable for remembering the order of citation. +INTEGERS { order.num } +FUNCTION {initialize.order.num} +{ + #1 'order.num := +} +%%% Initialize a variables +EXECUTE {initialize.order.num} + +%%% Variable for remembering the order of citation. +FUNCTION {set.order.cited} +{ + order.num 'order.cited := + #1 order.num + 'order.num := +} +%%% Iterate for all entries: +ITERATE {set.order.cited} + +%%% check the value of nameorder field. +FUNCTION {set.nameorder} +{ nameorder empty$ + { "" 'nameorder.temp := } + { nameorder 'nameorder.temp := } + if$ +} +%%% Iterate for all entries: +ITERATE {set.nameorder} + +%%% Remove symbols and convert to lowercase. +FUNCTION {sortify} +{ purify$ "l" change.case$ } + +%%% names for sorting +FUNCTION {sort.format.names} +{ 's := + #1 'nameptr := + "" + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { nameptr #1 > + { ", " * } + 'skip$ + if$ + s nameptr "{ll}{ f}{ j}" format.name$ 't := + nameptr numnames = t "others" = and + { bst.and.others.output *} + { t sortify * } + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {sort.format.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + { s sort.format.names } + { s #1 "{ll}{ f}{ j}" format.name$ " zz " * } + if$ +} + +%%% Label for full author name. +FUNCTION {format.lab.names.full} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{vv~}{ll}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.and.nameorder * t * } + { ", " * t * } + if$ + } + { t "others" = + { bst.and.others.output * } + { numnames #2 > + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.ands * t * } + if$ + } + { nameorder.temp "random" = bst.use.nameorder #0 = not and + { bst.cite.and.nameorder * t * } + { bst.cite.and * t * } + if$ + } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ + numnames #1 > #1 #2 = and {", eds" *} {} if$ + numnames #1 = #1 #2 = and {", ed" *} {} if$ +} + +%%% laberl for abbreviated author name. +FUNCTION {format.lab.names.abb} +{ 's := + s num.names$ 'numnames := + numnames bst.and.others.num < + % if the number of authors is less than bst.and.others.num, full name. + { s format.lab.names.full } + % if the number of authors is equal or more than bst.and.others.num, abbreviated name. + { s #1 "{ll}" format.name$ bst.and.others.output * } + if$ +} + +%%% abbreviated author +FUNCTION {author.key.label.abb} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.key.label.full} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {format.names.full.wo.and} +{ 's := + #1 'nameptr := + s num.names$ 'numnames := + numnames 'namesleft := + { namesleft #0 > } + { s nameptr "{ll}{, ff}{, jj}" format.name$ 't := + nameptr #1 > + { namesleft #1 > + { " " * t * } + { t "others" = + { " " * } + { numnames #2 > + { " " * t * } + { " " * t * } + if$ + } + if$ + } + if$ + } + 't + if$ + nameptr #1 + 'nameptr := + namesleft #1 - 'namesleft := + } + while$ +} + +FUNCTION {author.key.full.wo.and} +{ author empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {author.editor.key.full.wo.and} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ + } + { author format.names.full.wo.and } + if$ +} + +FUNCTION {editor.key.organization.key.full.wo.and} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.names.full.wo.and } + if$ +} + +FUNCTION {author.key.organization.key.full.wo.and} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.names.full.wo.and } + if$ +} + +%%% abbreviated author +FUNCTION {author.editor.key.label.abb} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ + } + { author format.lab.names.abb } + if$ +} + +%%% full author +FUNCTION {author.editor.key.label.full} +{ author empty$ + { editor empty$ + { key empty$ + { cite$ #1 #3 substring$ } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.full} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.full } + if$ +} + +FUNCTION {author.key.organization.label.abb} +{ author empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { author format.lab.names.abb } + if$ +} + +FUNCTION {editor.key.organization.label.full} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.full } + if$ +} + +FUNCTION {editor.key.organization.label.abb} +{ editor empty$ + { key empty$ + { organization empty$ + { cite$ #1 #3 substring$ } + { "The " #4 organization chop.word #3 text.prefix$ } + if$ + } + { key #3 text.prefix$ } + if$ + } + { editor format.lab.names.abb } + if$ +} + +%%% Convert numbers: 0->9, 1->8, 2->7,..., 9->0 +FUNCTION {reverse.num} +{ 's := + s "1" = + { "8" 'year.num := } + { s "2" = + { "7" 'year.num := } + { s "3" = + { "6" 'year.num := } + { s "4" = + { "5" 'year.num := } + { s "5" = + { "4" 'year.num := } + { s "6" = + { "3" 'year.num := } + { s "7" = + { "2" 'year.num := } + { s "8" = + { "1" 'year.num := } + { s "9" = + { "0" 'year.num := } + { s "0" = + { "9" 'year.num := } + { "9" 'year.num := } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + year.num +} + +%%% Convert year (large number -> small number) +FUNCTION {convert.year} +{ 't := + bst.reverse.year #0 = + { t 'tt := } + { t #1 #1 substring$ reverse.num + t #2 #1 substring$ reverse.num * + t #3 #1 substring$ reverse.num * + t #4 #1 substring$ reverse.num * 'tt := } + if$ + tt +} + +%%% cyear +FUNCTION {calc.cyear} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.full.wo.and + { type$ "proceedings" = + 'editor.key.organization.key.full.wo.and + { type$ "manual" = + 'author.key.organization.key.full.wo.and + 'author.key.full.wo.and + if$ + } + if$ + } + if$ + duplicate$ + year empty$ + { "2199" 'cyear := } + { year 'cyear := } + if$ + year empty$ + { " " "2199" convert.year * field.or.null * } + { " " year convert.year * field.or.null * } + if$ + sortify 'sort.label := + % For debug + econ.debug #0 = not + { "sort.label = ``\texttt{" write$ + sort.label write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ + pop$ +} + +FUNCTION {calc.sort.label.abb} +{ author empty$ + { editor empty$ + { "" } + { editor 's := } + if$ + } + { author 's := } + if$ + s sort.format.names.abb 't := + year empty$ + { t sortify " " * "2199" convert.year * 'sort.label.abb := } + { t sortify " " * year convert.year * 'sort.label.abb := } + if$ + econ.debug #0 = not + { "sort.label.abb = ``\texttt{" write$ + sort.label.abb write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% flabel +FUNCTION {calc.flabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.full + { type$ "proceedings" = + 'editor.key.organization.label.full + { type$ "manual" = + 'author.key.organization.label.full + 'author.key.label.full + if$ + } + if$ + } + if$ + 'flabel := + % For debug + econ.debug #0 = not + { "flabel = ``\texttt{" write$ + flabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% alabel +FUNCTION {calc.alabel} +{ type$ "book" = + type$ "inbook" = + or + 'author.editor.key.label.abb + { type$ "proceedings" = + 'editor.key.organization.label.abb + { type$ "manual" = + 'author.key.organization.label.abb + 'author.key.label.abb + if$ + } + if$ + } + if$ + 'alabel := + % For debug + econ.debug #0 = not + { "alabel = ``\texttt{" write$ + alabel write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% title for sorting +FUNCTION {sort.format.title} +{ 't := + "A " #2 + "An " #3 + "The " #4 t chop.word + chop.word + chop.word + sortify + #1 global.max$ substring$ +} + +%%% author for sorting +FUNCTION {author.sort} +{ author empty$ + { key empty$ + { "to sort, need author or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { author sort.format.names } + if$ +} + +%%% editor for sorting +FUNCTION {author.editor.sort} +{ author empty$ + { editor empty$ + { key empty$ + { "to sort, need author, editor, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { editor sort.format.names } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {author.organization.sort} +{ author empty$ + { organization empty$ + { key empty$ + { "to sort, need author, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { author sort.format.names } + if$ +} + +FUNCTION {editor.organization.sort} +{ editor empty$ + { organization empty$ + { key empty$ + { "to sort, need editor, organization, or key in " cite$ * warning$ + "" + } + { key sortify } + if$ + } + { "The " #4 organization chop.word sortify } + if$ + } + { editor sort.format.names } + if$ +} + +%%% 1,...,9 -> 001,...,009 +%%% 10,...,99 -> 010,...,099 +FUNCTION {add.zero.to.number} +{ 's := + s text.length$ #1 = + { "00" s * } + { s text.length$ #2 = + { "0" s * } + { s } + if$ + } + if$ +} + +%% entry type +FUNCTION {bst.sort.entry.type.order} +{ 'item.type := + item.type "article" = + { "01" } + { item.type "book" = + { "02" } + { item.type "booklet" = + { "03" } + { item.type "comment" = + { "04" } + { item.type "conference" = + { "05" } + { item.type "inbook" = + { "06" } + { item.type "incollection" = + { "07" } + { item.type "inproceedings" = + { "08" } + { item.type "manual" = + { "09" } + { item.type "masterthesis" = + { "10" } + { item.type "misc" = + { "11" } + { item.type "phdthesis" = + { "12" } + { item.type "proceedings" = + { "13" } + { item.type "techreport" = + { "14" } + { item.type "unpublished" = + { "15" } + { "16" } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ + } + if$ +} + +%%% Create sort.key$: absorder -> author -> year -> order -> month -> title. +FUNCTION {presort.one} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * + sort.label.abb * + " " * + type$ "book" = type$ "inbook" = or + 'author.editor.sort + { type$ "proceedings" = + 'editor.organization.sort + { type$ "manual" = + 'author.organization.sort + 'author.sort + if$ + } + if$ + } + if$ + * " " * + " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +FUNCTION {presort.two} +{ + bst.no.sort #0 = not + { order.cited int.to.str$ add.zero.to.number " " * } + { "" } + if$ + bst.sort.year #0 = not + %% Use year field as the primary sorting key. + { year convert.year * } + 'skip$ + if$ + bst.sort.entry.type #0 = not + { type$ bst.sort.entry.type.order * " " * } + 'skip$ + if$ + absorder empty$ + { "/// " * } + { bst.notuse.absorder.field #0 = + { absorder "999" = + { "zzz " * } + { absorder add.zero.to.number "000" = + { "/// " * } + { absorder add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + " " * sort.label * " " + order empty$ + { "/// " * } + { bst.notuse.order.field #0 = + { order "999" = + { "zzz " * } + { order add.zero.to.number "000" = + { "/// " * } + { order add.zero.to.number * " " * } + if$ + } + if$ + } + { "/// " * } + if$ + } + if$ + month empty$ + { * "/// " * } + { month "999" = + { * month add.zero.to.number * "zzz " * } + { month add.zero.to.number "000" = + { * month add.zero.to.number * "/// " * } + { * month add.zero.to.number * " " * } + if$ + } + if$ + } + if$ + title field.or.null sort.format.title + * + #1 entry.max$ substring$ + 'sort.key$ := + % For debug + econ.debug #0 = not + { "``\texttt{" write$ + sort.key$ write$ + "}''\\" write$ + newline$ + } + 'skip$ + if$ +} + +%%% Codes for debugging +FUNCTION {calc.alabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.alabel: alabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {calc.flabel.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.flabel: flabel = }\\" write$ + newline$ } + 'skip$ + if$ +} +FUNCTION {presort.one.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (1st time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {presort.two.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of presort (2nd time): \$sort.key = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.cyear.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.cyear: sort.label = }\\" write$ + newline$ } + 'skip$ + if$ +} + +FUNCTION {calc.sort.label.abb.mess} +{ econ.debug #0 = not + { "\textbf{Iteration of calc.sort.label.abb: sort.label.abb = }\\" write$ + newline$ } + 'skip$ + if$ +} + +%%% alabel +EXECUTE {calc.alabel.mess} +ITERATE {calc.alabel} + +%%% flabel +EXECUTE {calc.flabel.mess} +ITERATE {calc.flabel} + +%%% cyear and sort.label +EXECUTE {calc.cyear.mess} +ITERATE {calc.cyear} + +%%% +EXECUTE {calc.sort.label.abb.mess} +ITERATE {calc.sort.label.abb} + +%%% Sorting by $sort.key (first time) +% +% Sorting is done in two times. This is the first time. +% +EXECUTE {presort.one.mess} +ITERATE {presort.one} +SORT + +FUNCTION {forward.pass} +{ bst.use.bysame #0 = bst.use.bysame #2 = or + % Not use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + } + % Use \bysame + { last.sort.label sort.label.abb = + { last.extra.num #1 + 'last.extra.num := + last.extra.num int.to.chr$ 'extra.label := + } + { "a" chr.to.int$ 'last.extra.num := + "" 'extra.label := + sort.label.abb 'last.sort.label := + } + if$ + author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + % format.names 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + if$ +} + +FUNCTION {reverse.pass} +{ next.extra "b" = + { "a" 'extra.label := } + 'skip$ + if$ + extra.label empty$ not + { cyear extra.label * } + { cyear "" * } + if$ + "" field.or.null * + 'cyear := + extra.label 'next.extra := +} + +%%% \bysame +ITERATE {forward.pass} + +REVERSE {reverse.pass} + +%%% Sorting by sort.key$ (second time) +EXECUTE {presort.two.mess} +ITERATE {presort.two} +SORT + +FUNCTION {reset.prev.author} +{ "xxyyzz" 'prev.author := } + +EXECUTE {reset.prev.author} + +FUNCTION {forward.pass.two} +{ bst.use.bysame #1 = + { author empty$ + { editor empty$ + { "" } + 'format.editors.alt + if$ + } + 'format.authors.alt + if$ + 'this.author := + this.author prev.author = + { "bysame" 'extra.label.bysame := } + { this.author "" = + { "abcxyz" } + 'this.author + if$ + 'prev.author := + } + if$ + } + 'skip$ + if$ +} + +ITERATE {forward.pass.two} + +FUNCTION{punctuation} +{ + "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" write$ newline$ + "% This bbl file is created by econ.bst ver." econ.version * write$ newline$ + "% The latest econ.bst is available at" write$ newline$ + "% <https://github.com/ShiroTakeda/econ-bst>" write$ newline$ newline$ +} + +EXECUTE {punctuation} + +FUNCTION {begin.bib} +{ + preamble$ empty$ + 'skip$ + { preamble$ write$ newline$ } + if$ + bst.use.bysame #0 = + % Not use \bysame. + 'skip$ + % Use \bysame. + { "%%% Definition of \bysame" write$ newline$ + "\ifx\undefined\bysame" write$ newline$ + "\newcommand{\bysame}{" bst.bysame.definition * "}" * + write$ newline$ + "\fi" write$ newline$ newline$ } + if$ + %% When number index is attached to the beginning of each item. + bst.use.number.index #0 = + 'skip$ + { bst.number.index.digit "1" = + % one digit. + { bst.number.index.bibhang.one } + { bst.number.index.digit "2" = + % two digits. + { bst.number.index.bibhang.ten } + % three or more digits. + { bst.number.index.bibhang.hund } + if$ + } + if$ + 'hang := + "%%% Redefinition of \bibhang" write$ newline$ + "\ifx\undefined\bibhang" write$ newline$ + "\relax" write$ newline$ + "\else" write$ newline$ + "\setlength{\bibhang}{" + hang * "}" * write$ newline$ + "\fi" write$ newline$ newline$ + } + if$ + "\begin{thebibliography}{xxx}" write$ newline$ + + %% Initialize the variable `index'. + #0 'index := +} + +FUNCTION {end.bib} +{ newline$ "\end{thebibliography}" write$ newline$ } + +EXECUTE {begin.bib} + +EXECUTE {init.state.consts} + +ITERATE {call.type$} + +EXECUTE {end.bib} + +% -------------------- +% Local Variables: +% fill-column: 78 +% mode: bst +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.pdf Binary files differnew file mode 100644 index 00000000000..b85f9c19ac3 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.tex new file mode 100644 index 00000000000..48134687aa9 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-no-sort.tex @@ -0,0 +1,58 @@ +%#!pdflatex +%#BIBTEX bibtex econ-no-sort + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +This document uses ``\verb|econ-no-sort.bst|''. + +\vspace{1em} +Entries in bibliography are listed in citation order (not in +alphabetical order). +\vspace{1em} + +\input{cited-part} +\nocite{*} + +%% bst file: +\bibliographystyle{econ-no-sort} +\bibliography{../econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-numbers.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-numbers.pdf Binary files differnew file mode 100644 index 00000000000..e8c9e567dfa --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-numbers.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-numbers.tex b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-numbers.tex new file mode 100644 index 00000000000..c071bf5e52e --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/customization/econ-numbers.tex @@ -0,0 +1,72 @@ +%#!pdflatex +%#BIBTEX bibtex econ-numbers + +%############################## Main ################################# +\documentclass[10pt]{article} + +%% Use natbib.sty +\usepackage[numbers]{natbib} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,% +bookmarksnumbered=true,% +colorlinks=true,% +linkcolor=MyBlue,% +citecolor=MyRed,% +filecolor=MyBlue,% +urlcolor=MyGreen% +]{hyperref} + +\setlength{\topmargin}{-20pt} +\setlength{\textheight}{648pt} +\setlength{\oddsidemargin}{15pt} +\setlength{\textwidth}{440pt} + +% Redefine \cicet command so that citet is equal to citep. +\renewcommand{\citet}[1]{\citep{#1}} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +In this document, we use numerical mode of \texttt{natbib.sty}. That is, we cite +references by number index. +\vspace*{1em} + +To use numerical mode of \texttt{natbib.sty}, we use the following setting. +\begin{itemize} + \item Load \texttt{natbib.sty} with option ``\texttt{numbers}'' like \\ + \verb|\usepackage[numbers]{natbib}| + \item Use ``\verb|econ-no-sort.bst|'' which means that entries in the reference + are listed in citation order (not alphabetical order). + \item Use \verb|\citep| command instead of \verb|\citet| command.\\ Note: + strictly speaking, we use \texttt{citet} command but redefine + \texttt{citet} command in the preample so that it is equal to + \texttt{citep}. +\end{itemize} + +\vspace{1em} + +\input{cited-part} +\nocite{*} + +%% bst file: +\bibliographystyle{econ-no-sort} +\bibliography{../econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.bib b/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.bib new file mode 100644 index 00000000000..4b65c99bf3a --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.bib @@ -0,0 +1,537 @@ +% +% Bibliography entries +% + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Article +@Article{brezis93:_leapf_inter_compet, + author = {Elise S. Brezis and Paul R. Krugman and Daniel Tsiddon}, + title = {Leapfrogging in International Competition: A Theory of Cycles + in National Technological Leadership}, + journal = {American Economic Review}, + year = 1993, + volume = 83, + number = 5, + pages = {1211-1219}, + month = {December}, + url = {http://www.jstor.org/stable/2117557}, +} + +@Article{ishikawa94:_revis_stolp_samuel_rybcz_theor_produc_exter, + author = {Jota Ishikawa}, + title = {Revisiting the {Stolper}-{Samuelson} and the {Rybczynski} + Theorems with Production Externalitities}, + journal = {Canadian Journal of Economics}, + year = 1994, + volume = 27, + pages = {101-111}, + number = 1, + url = {http://www.jstor.org/stable/135804}, +} + +@article{Biker-2007-unemployment, + author = {Mustafa H. Babiker and Richard S. Eckaus}, + title = {Unemployment Effects of Climate Policy}, + journal = {Environmental Science and Policy}, + year = 2007, + volume = 10, + number = {7-8}, + pages = {600-609}, + doi = {10.1016/j.envsci.2007.05.002}, + timestamp = {2010.08.28} +} + +@article{Takeda2012a, + author = {Takeda, Shiro and Tetsuya, Horie and Arimura, Toshi H.}, + title = {A CGE Analysis of Border Adjustments under the Cap-and-Trade + System: A Case Study of the {Japanese} Economy}, + journal = {Climate Change Economics}, + volume = 3, + number = 1, + doi = {10.1142/S2010007812500030}, + year = 2012, + url = + {http://www.worldscientific.com/doi/abs/10.1142/S2010007812500030}, +} + +@article{takeda06:_cge_analy_welfar_effec_trade, + author = {Shiro Takeda}, + title = {The Double Dividend from Carbon Regulations in {Japan}}, + journal = {Journal of the Japanese and International Economies}, + year = 2007, + volume = 21, + number = 3, + pages = {336-364}, + month = sep, + doi = {10.1016/j.jjie.2006.01.002}, + absorder = 999 +} + +@Article{yamazaki13:_japan, + author = {Masato Yamazaki and Shiro Takeda}, + title = {An assessment of nuclear power shutdown in {Japan} using the + computable general equilibrium model}, + journal = {Journal of Integrated Disaster Risk Management}, + year = 2013, + volume = 3, + number = 1, + doi = {10.5595/idrim.2013.0055} +} + +@Article{takeda10:_cge_analy_welfar_effec_trade, + author = {Shiro Takeda}, + title = {A {CGE} Analysis of the Welfare Effects of Trade Liberalization under Different + Market Structures}, + journal = {International Review of Applied Economics}, + year = 2010, + volume = 24, + number = 1, + absorder = 999, + pages = {75-93}, + doi = {10.1080/02692170903424307}, +} + +@article{BabikerRutherford-2005-EconomicEffectsof, + author = {Mustafa H. Babiker and Thomas F. Rutherford}, + title = {The Economic Effects of Border Measures in Subglobal Climate Agreements}, + journal = {Energy Journal}, + year = 2005, + volume = 26, + pages = {99-126}, + number = 4 +} + +@article{2009yamasue502165, + author = {Eiji Yamasue and Ryota Minamino and Ichiro Daigo and Hideyuki + Okumura and Keiichi N Ishihara}, + title = {Evaluation of total materials requirement for the recycling of + elements and materials (urban ore {TMR}) from end-of-life + electric home appliances}, + journal = {Materials Transactions}, + year = 2009, + volume = 50, + pages = {2165--2172}, + number = 9, + issn = 13459678, + order = 3, + pdf = {2009yamasue502165.pdf}, + publisher = {Japan Institute of Metals}, + url = {http://ci.nii.ac.jp/naid/40016713752/} +} + +@article{2007yamasue482353, + author = {Eiji Yamasue and Kenichi Nakajima and Ichiro Daigo and Seiji + Hashimoto and Hideyuki Okumura and Keiichi N. Ishihara}, + title = {Evaluation of the Potential Amounts of Dissipated Rare Metals + from WEEE in {Japan}}, + journal = {Materials transactions}, + year = 2007, + volume = 48, + pages = {2353--2357}, + number = 9, + issn = 13459678, + pdf = {2007yamasue482353.pdf}, + publisher = {Japan Institute of Metals}, + url = {http://ci.nii.ac.jp/naid/10019853407/} +} + +@article{Babiker2000525, + author = {Mustafa H. Babiker and John M. Reilly and Henry D. Jacoby}, + title = {The {Kyoto} Protocol and Developing Countries}, + journal = {Energy Policy}, + year = 2000, + volume = 28, + pages = {525--536}, + number = 8, + doi = {10.1016/S0301-4215(00)00033-1}, + issn = {0301-4215}, + keywords = {Climate change} +} + +@article{Parry1997, + author = {Parry, Ian W. H.}, + doi = {10.2139/ssrn.293599}, + journal = {Resource and Energy Economics}, + pages = {5--6}, + title = {{Environmental Taxes and Quotas in the Presence of Distorting + Taxes in Factor Markets}}, + url = {http://linkinghub.elsevier.com/retrieve/pii/S0928765596000127}, + year = {1997} +} + +@Article{bergemann11:_ration, + author = {D. Bergemann and S. Morris and O. Tercieux}, + title = {Rationalizable Implementation}, + journal = {Journal of Economic Theory}, + year = 2011, + volume = 146, + pages = {1253-1274} +} + +@article{goldin:katz:2000, + author = {Claudia Goldin and Lawrence F. Katz}, + title = {Education and Income in the Early Twentieth Century: Evidence from the Prairies}, + journal = {Journal of Economic History}, + year = {2000}, + volume = {60}, + number = {3}, + pages = {782-818} +} + +@article{10.1257/aer.20161492, + Author = {Ray, Debraj and Robson, Arthur}, + Title = {Certified Random: A New Order for Coauthorship}, + Journal = {American Economic Review}, + Volume = {108}, + Number = {2}, + Year = {2018}, + Month = {February}, + Pages = {489-520}, + DOI = {10.1257/aer.20161492}, + URL = {http://www.aeaweb.org/articles?id=10.1257/aer.20161492}, + nameorder = {random} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Book +@Book{krugman91:_geogr_trade, + author = {Paul R. Krugman}, + title = {Geography and Trade}, + publisher = {MIT Press}, + year = 1991, + address = {Cambridge, MA} +} + +@book{helpman91:_inter_trade_trade_polic, + editor = {Elhanan Helpman and Assaf Razin}, + title = {International Trade and Trade Policy}, + publisher = {MIT Press}, + year = 1991, + address = {Cambridge, MA} +} + +@Book{fujita99jp:_spatial_econom, + author = {Masahisa Fujita and Paul R. Krugman and Anthony J. Venables}, + title = {The Spatial Economy}, + publisher = {MIT Press}, + address = {Cambridge, MA}, + year = 1999, + jauthor = {o V}, + jtitle = {Ԍoϊw}, + jpublisher = {moϐV}, + jyear = 2000 +} + +@Book{Ryza15:_advan_analy_spark_patter_learn_data_scale, + author = {Sandy Ryza and Uri Laserson and Sean Owen and Josh Wills}, + title = {Advanced Analytics with Spark Patterns for Learning from Data at Scale}, + publisher = {O'reilly \& Associates Inc}, + year = 2015, +} + +@book{goldin:katz:2008, + author = {Claudia Goldin and Lawrence F. Katz}, + title = {The Race between Education and Technology}, + publisher = {The Belknap Press of Harvard University Press}, + address = {Cambridge, MA}, + year = {2008} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Incollection +@InCollection{krugman91:_is_bilat_bad, + author = {Paul R. Krugman}, + title = {Is Bilateralism Bad?}, + booktitle = {International Trade and Trade Policy}, + pages = {9-23}, + publisher = {MIT Press}, + year = 1991, + editor = {Elhanan Helpman and Assaf Razin}, + address = {Cambridge, MA} +} + +@incollection{lucas76:_econom_polic_evaluat, + author = {Lucas, Jr., Robert E.}, + year = 1976, + title = {Econometric Policy Evaluation: A Critique}, + booktitle = {The {Phillips} Curve and Labor Markets}, + pages = {19-46}, + editors = {Karl Brunner and Allan H. Meltzer}, + volume = 1, + series = {Carnegie Rochester Conference Series on Public Policy}, + publisher = {North-Holland}, + address = {Amsterdam} +} + +@incollection{DeGorter2002, + author = {{De Gorter}, Harry and Swinnen, Johan}, + booktitle = {Handbook of Agricuultural Economics}, + chapter = {36}, + doi = {10.1016/S1574-0072(02)10023-5}, + editor = {Gardner, B. and Rausser, G.}, + isbn = {9780444510792}, + issn = {15740072}, + keywords = {Q18,collective action,commodity policy,developmental + paradox,instrument choice,lobbying,politician-voter,public + goods,rent-seeking,revealed preference,status quo bias,trade + bias}, + pages = {1893--1943}, + publisher = {Elsevier Science B.V.}, + title = {Political Economy of Agricultural Policy}, + url = + {http://www.sciencedirect.com/science/article/pii/S1574007202100235}, + volume = {2}, + year = {2002} +} + +@InCollection{borgers95:_note_implem_stron_domin, + author = {T. Borgers}, + title = {A Note on Implementation and Strong Dominance}, + booktitle = {Social Choice, Welfare, and Ethics: Proceedings of the Eighth International + Symposium in Economic Theory and Econometrics}, + publisher = {Cambridge University Press}, + year = 1995, + editor = {William A. Barnett and Herve Moulin and Maurice Salles and Norman J. Schofield}, + pages = {277-287} +} + +@incollection{goldin:katz:2011, + author = {Claudia Goldin and Lawrence F. Katz}, + title = {Mass Secondary Schooling and the State: The Role of State Compulsion in the High + School Movement}, + booktitle = {Understanding Long-Run Economic Growth: Essays in Honor of Kenneth L. Sokoloff}, + publisher = {University of Chicago Press}, + address = {Chicago, IL}, + year = {2011}, + editor = {D. Costa and N. Lamoreaux}, + chapter = {9}, + pages = {275-310}, +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Unpublished + +@unpublished{ishikawa03:_green_gas_emiss_contr_open_econom, + author = {Jota Ishikawa and Kazuharu Kiyono}, + title = {Greenhouse-Gas Emission Controls in an Open Economy}, + year = 2003, + month = nov, + note = {{COE-RES} Discussion Paper Series, Center of Excellence + Project, Graduate School of Economics and Institute of + Economics Research, Hitotsubashi University} +} + +@unpublished{rutherford00:_gtapin_gtap_eg, + author = {Thomas F. Rutherford and Sergey V. Paltsev}, + title = {{GTAPinGAMS} and {GTAP-EG}: Global Datasets for Economic + Research and Illustrative Models}, + month = sep, + year = 2000, + url = {http://www.mpsge.org/gtap5/index.html}, + access = {29th June, 2013}, + note = {Working Paper, University of Colorad, Department of Economics} +} + +@unpublished{Takeda2011b, + author = {Takeda, Shiro and Arimura, Toshi H. and Tamechika, Hanae and + Fischer, Carolyn and Fox, Alan K.}, + title = {Output Based Allocation of Emissions Permits for Mitigating + the Leakage and Competitiveness Issues for {Japanese} Economy}, + note = {RFF (Resources for the Future) Discussion Paper 11-40, + September 2011}, + url = + {http://rff.org/Publications/Pages/PublicationDetails.aspx?PublicationID=21652}, + year = 2011 +} + +@unpublished{takeda2011c, + author = {Takeda, Shiro and Arimura, Toshi H. and Sugino, Makoto}, + title = {Labor Market Distortions and Welfare-Decreasing International + Emissions Trading}, + url = {http://papers.ssrn.com/sol3/papers.cfm?abstract_id=1886200}, + year = {2011}, + access = {29/06/2013}, +} + +@unpublished{Babiker-1999-KyotoProtocoland, + author = {Mustafa H. Babiker and John M. Reilly and Henry D. Jacoby}, + title = {The {Kyoto} Protocol and Developing Countries}, + note = {MIT Joint Program on the Science and Policy of Global Change (Report No.56)}, + month = {October}, + year = 1999, + owner = {stakeda.lab}, + timestamp = {2010.04.08} +} + +@UNPUBLISHED{Babiker-1999-JapaneseNuclearPower, + author = {Mustafa H. Babiker and John M. Reilly and A. Denny Ellerman}, + title = {{Japanese} Nuclear Power and the {Kyoto} Agreement}, + note = {The MIT Joint Program on the Science and Policy of Global Change (Report No. 51)}, + month = {August}, + year = {1999}, + owner = {stakeda.lab}, + timestamp = {2010.03.26} +} + +@UNPUBLISHED{RePEc:nbr:nberwo:4269, + title = {A Simple Theory of Multinational Corporations and Trade with a + Trade-Off Between Proximity and Concentration}, + author = {Brainard, S. Lael}, + year = {1993}, + note = {NBER Working Paper No. 4269}, + institution = {National Bureau of Economic Research, Inc}, + type = {NBER Working Papers}, + number = {4269}, + abstract = {This paper develops a two-sector, two-country model, where + firms in a differentiated products sector choose between + exporting and multinational expansion as alternative modes of + foreign market penetration, based on a trade-off between + proximity and concentration advantages. The differentiated + sector is characterized by multi-stage production, with + increasing returns at the corporate level associated with some + activity such as R&D, scale economies at the plant level, and + a variable transport cost that rises with distance. A pure + multinational equilibrium, where two-way horizontal expansion + across borders completely supplants two-way trade in + differentiated products, is possible even in the absence of + factor proportion differences. It is more likely the greater + are transport costs relative to fixed plant costs, and the + greater are increasing returns at the corporate level relative + to the plant level. The model also establishes conditions for + a mixed equilibrium, in which national and multinational firms + coexist.}, + url = {http://EconPapers.repec.org/RePEc:nbr:nberwo:4269} +} + +@Unpublished{vohra18:_maxim_farsig_stabl_set, + author = {Rajiv Vohra and Debraj Ray}, + title = {Maximality in The Farsighted Stable Set}, + nameorder = {random}, + year = 2018, + url = + {https://debrajray.com/wp-content/uploads/2018/01/RayVohraHistDep.pdf}, + note = {September, 2018}, +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% inbook +@InBook{wong95:_inter_trade_goods_factor_mobil_, + author = {{Kar-yiu} Wong}, + title = {International Trade in Goods and Factor Mobility}, + chapter = 2, + publisher = {MIT Press}, + year = 1995, + address = {Cambridge, MA}, + pages = {23-84} +} + +@inbook{milne-thomson68:_theor_hydrod, + author = {Milne-Thomson, L. M.}, + title = {Theoretical Hydrodynamics}, + pages = 480, + publisher = {Ma{C}millan Press}, + edition = {5th}, + address = {London}, + year = 1968 +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% inproceedings +@inproceedings{wang89:_model_therm_hydrod_aspec_molten, + author = {Wang, S. K. and Blomquist, C. A. and Spencer, B. W.}, + title = {Modeling of Thermal and Hydrodynamic Aspects of Molten + Jet/Water Interactions}, + booktitle = {ANS Proc. 1989 National Heat Transfer Conference}, + year = 1989, + pages = {225-232}, + volume = 4, + address = {Philadelphia}, + month = sep # "~6" +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Manual +@Manual{brooke03:_gams, + author = {Anthony Brooke and David Kendrick and Alexander Meeraus and + Ramesh Raman}, + title = {{GAMS}: A User's Guide}, + year = 2003, + organization = {GAMS Development Corporation} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% techreport + +@techreport{Peri2007, + address = {Cambridge, MA}, + author = {Peri, Giovanni}, + doi = {10.3386/w12956}, + institution = {National Bureau of Economic Research}, + month = {mar}, + title = {Immigrants' Complementarities and Native Wages: Evidence from + {California}}, + url = {http://www.nber.org/papers/w12956.pdf}, + year = {2007} +} + +@TechReport{RePEc:hka:wpaper:2018-037, + author = {Piotr Dworczak and Scott Duke Kominers and Mohammad Akbarpour}, + title = {Redistribution through Markets}, + year = 2018, + month = Jun, + nameorder = {random}, + institution = {Human Capital and Economic Opportunity Working Group}, + type = {Working Papers}, + url = {https://ideas.repec.org/p/hka/wpaper/2018-037.html}, + number = {2018-037}, + keywords = {optimal mechanism design; redistribution; Inequality; welfare + theorems}, + doi = {}, +} + +@techreport{NBERw25205, + title = "Electoral Systems and Inequalities in Government + Interventions", + author = "Garance Genicot and Laurent Bouton and Micael Castanheira", + institution = "National Bureau of Economic Research", + type = "Working Paper", + series = "Working Paper Series", + number = "25205", + year = "2018", + month = "October", + doi = {10.3386/w25205}, + URL = "http://www.nber.org/papers/w25205", + nameorder = {random} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Online +@online{stakeda2013web, + author = {Shiro Takeda}, + year = {2013}, + title = {econ.bst: {BibTeX} style file for economics}, + url = {http://shirotakeda.org/en/tex/econ-bst.html}, + access = {4th July, 2013} +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%% +% Phdthesis +@PhdThesis{takeda05:_econom_analy_envir_regul, + author = {Shiro Takeda}, + title = {An Economic Analysis of Environmental Regulations}, + school = {Hitotsubashi University}, + year = 2005} + +% proceedings +% techreport +% mastersthesis +% misc +% booklet + +% -------------------- +% Local Variables: +% mode: bibtex +% fill-column: 80 +% code: utf-8-dos +% End: diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.pdf b/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.pdf Binary files differnew file mode 100644 index 00000000000..bfd58cac6b6 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.pdf diff --git a/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.tex b/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.tex new file mode 100644 index 00000000000..237076ccc07 --- /dev/null +++ b/Master/texmf-dist/doc/bibtex/econ-bst/econ-example.tex @@ -0,0 +1,851 @@ +%#!pdflatex +%#BIBTEX bibtex econ-example +% Filename: econ-example.tex +% Author: Shiro Takeda +% First-written: <2002/11/02> +% Time-stamp: <2018-12-06 00:47:47 st> +% +% This document explains how to use econ.bst. + +%############################## Main ################################# + +\documentclass[10pt]{article} + +%% Use natbib.sty. +\usepackage{natbib} +\usepackage{fancybox} +\usepackage{mathpazo} +\usepackage{url} +\usepackage{graphicx} +\usepackage{color} +\definecolor{MyBrown}{rgb}{0.3,0,0} +\definecolor{MyBlue}{rgb}{0,0,0.3} +\definecolor{MyRed}{rgb}{0.4,0,0.1} +\definecolor{MyGreen}{rgb}{0,0.4,0} +\usepackage[bookmarks=true,bookmarksnumbered=true,colorlinks=true,linkcolor=MyBlue,citecolor=MyRed,filecolor=MyBlue,urlcolor=MyGreen]{hyperref} + +\setlength{\topmargin}{-15pt} +\setlength{\textheight}{638pt} +\setlength{\oddsidemargin}{25pt} +\setlength{\textwidth}{420pt} + +\makeatletter + +\newenvironment{Frame}% +{\setlength{\fboxsep}{15pt} +\setlength{\mylength}{\linewidth}% +\addtolength{\mylength}{-2\fboxsep}% +\addtolength{\mylength}{-2\fboxrule}% +\Sbox +\minipage{\mylength}% +\setlength{\abovedisplayskip}{0pt}% +\setlength{\belowdisplayskip}{0pt}% +}% +{\endminipage\endSbox +\[\fbox{\TheSbox}\]} + +\newcommand{\bysameline}{\hskip.3em \leavevmode\rule[.5ex]{3em}{.3pt}\hskip0.5em} + +%% Define \BibTeX command +\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em + T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}} +\makeatother + +%%% title, author, acknowledgement, and date +\title{\texttt{econ.bst}:\\ +\BibTeX{} style for economics\\ +(for ver. 2.4) +\thanks{\texttt{econ.bst} is available at +\url{https://github.com/ShiroTakeda/econ-bst}} +} + +\author{Shiro Takeda\thanks{email: {\ttfamily shiro.takeda@gmail.com}.}} +\date{\today} + +%##################################################################### +%######################### Document Starts ########################### +%##################################################################### +\begin{document} + +%%% Title +\maketitle + +\newlength{\mylength} +\setlength{\fboxsep}{15pt} +\setlength{\mylength}{\linewidth} +\addtolength{\mylength}{-2\fboxsep} +\addtolength{\mylength}{-2\fboxrule} + +%%% Table of contents. +\tableofcontents + +%########################## Text Starts ############################## + +\setlength{\baselineskip}{16pt} + +\section{Main features} + +``\texttt{econ.bst}'' is a \BibTeX{} style file. It provids the following +features: +\begin{Frame} + \begin{itemize} + \item The author-year type citation (you need ``\texttt{natbib.sty}'' as well). + \item Reference style used in economics papers. + \item Highly customizable. You can easily customize reference style as you + wish. + \item You can use ``\textit{certified random order}'' proposed by + \href{http://dx.doi.org/10.1257/aer.20161492}{\citet[][AER]{10.1257/aer.20161492}}. + \end{itemize} +\end{Frame} + +\textbf{The third feature is the key characteristic of ``\texttt{econ.bst}''.} + +\section{How to use ``\texttt{econ.bst}''} + +\begin{itemize} + \item ``\texttt{econ.bst}'' requires ``\texttt{natbib.sty}''. + If ``\texttt{natbib.sty}'' is not installed in your \TeX{} system, you must + install it first. + \item Put ``\texttt{econ.bst}'' file somewhere under the directory (folder) + ``\texttt{/texmf/bibtex/bst}''. Or you can place ``\texttt{econ.bst}'' at + the same directory as the \TeX{} file you are editting. + \item You may need to change the character code of ``\texttt{econ.bst}'' + according to your \TeX system. + \item See ``\texttt{econ-example.tex}'' for an example tex file. + \item For \BibTeX{} in general, see, for example, + \href{https://www.economics.utoronto.ca/osborne/latex/BIBTEX.HTM}{Using + BibTeX: a short guide} by Martin J. Osborne. +\end{itemize} + + +\subsection{Preparing a tex file} + +In the tex file you are editting, you first need to load \texttt{natbib} +package. +\begin{Frame} +\begin{verbatim} +\usepackage{natbib} +\end{verbatim} +\end{Frame} + +In the main text, you can cite bibliographic entries by \verb|\citet| +command. + +For example, ``\verb|\citet{Takeda2011b}| is my paper'' generates the output like +\begin{Frame} +\citet{Takeda2011b} is my paper. +\end{Frame} + +At the place where you want to add ``the reference part'', you have to set the +bibliography style (\texttt{econ.bst}) and database (\texttt{econ-example.bib}) like +\begin{Frame} +\begin{verbatim} +\bibliographystyle{econ} +\bibliography{econ-example} +\end{verbatim} +\end{Frame} + + +\section{Customization} + +``\texttt{econ.bst}'' defines many functions which have names like +``\texttt{bst.xxx.yyy}''. You can easily customize the reference style by +changing the contents of these functions. + +\subsection{Notes on customization} + +\begin{itemize} + \item Customization here is customization of the reference part. Style + in the citation part mainly depends on a style file for citation + (``\texttt{natbib.sty}''). + \item Except for some cases, customization here cannot change order + of fields (order of author, year, title etc.) + \item Functions with ``\texttt{.pre}'' define strings attached to the start + of the field and functions with ``\texttt{.post}'' define strings + attached to the end of field. For exmple, + ``\texttt{bst.author.pre}'' defines strings attached before author. + \item You can change order of entries (references). It will be + explained in Section \ref{sec:sort_rule}. + \item In a bst file, integer (e.g. 0, 1, 2) is represented as \verb|#0|, \verb|#1| , \verb|#2|. +\end{itemize} + +\subsection{Examples of customization} + +\subsubsection{Change delimiter used to separate mutiple author names + from ``and'' to ``\&''.} + +For this, change the contents of ``\texttt{bst.and}'' and ``\texttt{bst.ands}''. +\paragraph{Default definition:} +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.and} +{ " and " } +FUNCTION {bst.ands} +{ ", and " } +\end{verbatim} +\end{Frame} + +\paragraph{New definition:} +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.and} +{ " \& " } +FUNCTION {bst.ands} +{ " \& " } +\end{verbatim} +\end{Frame} + +Then, author names in reference part are displayed as follows: +\begin{center} +Fujita, Masahisa, Paul~R. Krugman, and Anthony~J. Venables \\ + $\downarrow$ \\ +Fujita, Masahisa, Paul~R. Krugman \& Anthony~J. Venables +\end{center} + +See ``\texttt{econ-b.bst}'' for an example. + +\subsubsection{Make author to small caps style} + +For this, change the contents of ``\texttt{bst.author.pre}'' and ``\texttt{bst.author.post}''. +\paragraph{Default definition:} +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.author.pre} +{ "" } +FUNCTION {bst.author.post} +{ "" } +\end{verbatim} +\end{Frame} + +\paragraph{New definition:} +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.author.pre} +{ "\textsc{" } +FUNCTION {bst.author.post} +{ "}" } +\end{verbatim} +\end{Frame} + +Then, author names in reference part are changed as follows: +\begin{center} +Fujita, Masahisa, Paul~R. Krugman, and Anthony~J. Venables \\ + $\downarrow$ \\ +\textsc{Fujita, Masahisa, Paul~R. Krugman, and Anthony~J. Venables} +\end{center} + +See ``\texttt{econ-b.bst}'' for an example. + +\subsubsection{Change the style of volume and number} + +For this, change the contents of ``\texttt{bst.volume.pre}'', +``\texttt{bst.volume.post}'', ``\texttt{bst.number.pre}'' and +``\texttt{bst.number.post}''. + +\paragraph{Default definition:} +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.volume.pre} +{ ", Vol. " } +FUNCTION {bst.volume.post} +{ "" } +FUNCTION {bst.number.pre} +{ ", No. " } +FUNCTION {bst.number.post} +{ "" } +\end{verbatim} +\end{Frame} + +\paragraph{New definition:} +\begin{Frame} + \begin{verbatim} +FUNCTION {bst.volume.pre} +{ ", \textbf{" } +FUNCTION {bst.volume.post} +{ "}" } +FUNCTION {bst.number.pre} +{ " (" } +FUNCTION {bst.number.post} +{ ")" } +\end{verbatim} +\end{Frame} + +By this, the style of volume and number change from ``Vol. 5, No. 10'' +to ``\textbf{5} (10)''. See ``\texttt{econ-b.bst}'' for an example. + + +\subsubsection{Abbreviation of author name} + +By default, when there are mutiple documents of the same author, author +name except for the first document is abbreviated by \verb|\bysame| +command (i.e. \bysameline). + +If you want to always show author name for all documents, change the +content of ``\texttt{bst.use.bysame}'' as follows: +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.use.bysame} +{ #0 } +\end{verbatim} +\end{Frame} + +In the default setting (`\texttt{bst.use.bysame}' is set to \#1), author names +are abbreviated when they are exactly the same. For example, suppose that there +are the following entries +\begin{itemize} + \item Mazda, A., Subaru, B., and Honda, C., (2011) "ABC" + \item Mazda, A., Subaru, B., and Honda, C., (2011) "DEF" + \item Mazda, A., Subaru, B., and Toyota, D., (2011) "GHI" +\end{itemize} +\vspace*{1em} + +In the default setting, these entries are listed like +\begin{Frame} +\begin{itemize} + \item Mazda, A., Subaru, B., and Honda, C., (2011) "ABC" + \item \bysameline, (2011) "DEF" + \item Mazda, A., Subaru, B., and Toyota, D., (2011) "GHI" +\end{itemize} +\end{Frame} + +That is, the abbreviation of authors by `bysame' is only applied to +entries with exactly the same authors. + +If you set \#2 to `bst.use.bysame' like +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.use.bysame} +{ #2 } +\end{verbatim} +\end{Frame} +you can choose alternative abbreviation style like +\begin{Frame} +\begin{itemize} + \item Mazda, A., Subaru, B., Honda, C., (2011) "ABC" + \item \bysameline, \bysameline, and \bysameline, (2011) "DEF" + \item \bysameline, \bysameline, and Toyota, D., (2011) "GHI" +\end{itemize} +\end{Frame} +\vspace*{1em} + +See ``\texttt{econ-a.bst}'' and ``\texttt{econ-b.bst}'' for examples. + + +\subsubsection{Order of first and last name in author field} + +``\texttt{bst.author.name}'' defines order of first and last name in author field. + +\paragraph{Default definition:} +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.author.name} +{ #0 } +\end{verbatim} +\end{Frame} + +If you change \verb|#0| to \verb|#1| or \verb|#2|, you can customize +order of first and family name. For example, suppose author field is +defined as follows: +\begin{verbatim} + author = {Masahisa Fujita and Paul R. Krugman and Anthony J. Venables} +\end{verbatim} + +According to the content of ``\texttt{bst.author.name}'', expression of +author changes as follows: +\begin{Frame} +\begin{itemize} + \item \verb|#0|: First author $\rightarrow$ last-first, other authors + $\rightarrow$ first-last.\\ + $\rightarrow$ Fujita, Masahisa, Paul~R. Krugman, and + Anthony~J. Venables + \item \verb|#1|: All authos $\rightarrow$ last-first \\ + $\rightarrow$ Fujita, Masahisa, Krugman, Paul~R., and Venables, Anthony~J. + \item \verb|#2|: All authors $\rightarrow$ first-last \\ + $\rightarrow$ Masahisa Fujita, Paul~R. Krugman, and Anthony~J. Venables +\end{itemize} +\end{Frame} + +\subsubsection{First name in initial} + +By default, first name is displayed in full. If you change the content +of ``\texttt{bst.first.name.initial}'' to non-zero, first name is displayed +in initial. For example, +\begin{center} +Fujita, Masahisa, Paul~R. Krugman, and Anthony~J. Venables \\ + $\downarrow$ \\ +Fujita, M., P.~R. Krugman, and A.~J. Venables +\end{center} + +See ``\texttt{econ-a.bst}'' for an exmpale. + +\subsubsection{Decapitalize letters in title field} + +Suppose that the title field is defined as follows +\begin{center} + \verb| title = {Econometric Policy Evaluation: A Critique}| +\end{center} + +Then, title is displayed in reference as follows: +\begin{center} + Econometric Policy Evaluation: A Critique +\end{center} + +If you change the content of ``\texttt{bst.title.lower.case}'' to +non-zero, letters except the first letter are decapitalized. That is, +you get the following expression in reference: +\begin{center} + Econometric policy evaluation: A critique +\end{center} + +See ``\texttt{econ-a.bst}'' for an exmpale. + + +\subsubsection{Number index before documents in reference} + +You can put the number index to each documents as in +``\texttt{plain.bst}''. For this, change the content of +``\texttt{bst.use.number.index}'' to non-zero. +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.use.number.index} + { #1 } +\end{verbatim} +\end{Frame} + +If you use fonts other than computer modern fonts, you had better adjust +the contents of functions ``\texttt{bst.number.index.xxx.yyy}''. + +See ``\texttt{econ-b.bst}'' for an exmpale. + + +\subsubsection{List old references first} + +By default, references written by the same author are listed in +chronological order (old documents are listed first). If you change the +contents of ``\texttt{bst.reverse.year}'' to non-zero, the order is +reversed. +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.reverse.year} +{ #1 } +\end{verbatim} +\end{Frame} + +\subsubsection{Change the position of year} + +By default, year is always displayed right after author name. You can +change the place of year by setting other values to +``\texttt{bst.year.position}''. +\\ + +If non-zero set to ``\texttt{bst.year.position}'', year is placed +\begin{itemize} + \item at the end of line if there is no ``\texttt{note}'' field, + \item and before ``\texttt{note}'' field if there is. +\end{itemize} +for non-article type entry. + +With respect to aritcle type entry, the following rule is applied: +\begin{Frame} +\begin{enumerate} + \item \verb|#1|: $\rightarrow$ year is placed at the end (before note field). + \item \verb|#2|: $\rightarrow$ year is placed after journal name. + \item \verb|#3|: $\rightarrow$ year is placed after volume. +\end{enumerate} +\end{Frame} + +For example, reference style changes as follows: +\begin{description} + \item[\#0: ] Mazda, A. and B. Subaru, 2007, ``ABC,'' \textit{Journal of Automobiles}, Vol. 1, pp. 1-10. + \item[\#1: ] Mazda, A. and B. Subaru, ``ABC,'' \textit{Journal of Automobiles}, Vol. 1, pp. 1-10, 2007. + \item[\#2: ] Mazda, A. and B. Subaru, ``ABC,'' \textit{Journal of Automobiles}, 2007, Vol. 1, pp. 1-10. + \item[\#3: ] Mazda, A. and B. Subaru, ``ABC,'' \textit{Journal of Automobiles}, Vol. 1, 2007, pp. 1-10. +\end{description} + +See ``\texttt{econ-a.bst}'' and ``\texttt{econ-b.bst}'' for exmpales. + + +\subsubsection{Order of editors and book title in incollection and inproceedings entry} + +By default, editor name comes before book title in incollection and +inproceedings entry. You can reverse this order by +setting non-zero to `bst.editor.btitle.order' like +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.editor.btitle.order} +{ #1 } +\end{verbatim} +\end{Frame} + + +\begin{Frame} +Krugman, Paul~R. (1991) ``Is Bilateralism Bad?'' in Elhanan Helpman and Assaf + Razin eds. {\it International Trade and Trade Policy}, Cambridge, MA: MIT + Press, pp. 9--23. +\begin{center} + $\downarrow$ +\end{center} +Krugman, Paul~R. (1991) ``Is Bilateralism Bad?'' in {\it International Trade +and Trade Policy} eds. by Elhanan Helpman and Assaf Razin, Cambridge, MA: +MIT Press, pp. 9--23. +\end{Frame} + +\subsubsection{Order of address and publisher} + +By default, publisher address is placed before publisher name. You can +reverse this order by setting non-zero to `bst.address.position'. +\begin{Frame} +Krugman, Paul~R. (1991) ``Is Bilateralism Bad?'' in Elhanan Helpman and + Assaf Razin eds. {\it International Trade and Trade Policy}, + Cambridge, MA, MIT Press, pp. 9--23. +\begin{center} + $\downarrow$ +\end{center} +Krugman, Paul~R. (1991) ``Is Bilateralism Bad?'' in Elhanan Helpman and Assaf + Razin eds. {\it International Trade and Trade Policy}, MIT Press, + Cambridge, MA, pp. 9--23. +\end{Frame} + +\subsection{Customization of citation part} + +We have so far seen the customization of reference part. ``\texttt{econ.bst}'' +also can change the styles of citation part although it is highly limited. + +\subsubsection{The number of authors for ``\textit{et al.}'' in citation part} + +With \texttt{natbib.sty}, you can cite a paper by both full names and +abbreviated names. For example, by using command `\verb|\citet|' and +`\verb|\citet*|', you can generate the following two styles. +\begin{itemize} + \item Citation by full names: \\ + \verb|\citet*{Takeda2011b}| $\longrightarrow$ \citet*{Takeda2011b} + \item Citation by abbreviated names: \\ + \verb|\citet{Takeda2011b}| $\longrightarrow$ \citet{Takeda2011b} +\end{itemize} + +By the default, author names more than three are abbreviated. But you can change +the number of authors to which abbreviation is applied. For example, if you set +\verb|#4| to `\texttt{bst.and.others.num}`, abbreviation is applied only to the +entry with more than four authors. +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.and.others.num} +{ #4 } +\end{verbatim} +\end{Frame} + +\subsection{Customization of citation part by \texttt{natbib.sty}} + +The style of citation part is mainly controlled by \texttt{natbib.sty}. You can +change the style of citation part by changing commands and options provided by +\texttt{natbib.sty}. +See the manual of \texttt{natbib.sty} for the details. +\begin{itemize} + \item The manual of \texttt{natbib.sty}: + \href{http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/natbib/natbib.pdf}{natbib.pdf} + \item The reference sheet of \texttt{natbib.sty}: + \href{http://mirror.las.iastate.edu/tex-archive/macros/latex/contrib/natbib/natnotes.pdf}{natnotex.pdf} +\end{itemize} + +\subsubsection{Citation by number index} + +Here I show one customization of \texttt{natbib.sty} for citation style. With +\texttt{natbib.sty}, we usually use ``author (year)'' citation format. However, +we can use citation by numder index like [1], [2], [3]... + +To use this style, you first need to load \texttt{natbib} package with option +``\texttt{numbers}'' +\begin{Frame} +\begin{verbatim} +\usepackage[numbers]{natbib} +\end{verbatim} +\end{Frame} + +In addition, you need to use \texttt{citep} command in the citation part like +\begin{Frame} +\begin{verbatim} +\citep{Takeda2011b} +\end{verbatim} +\end{Frame} + +See ``\texttt{econ-numbers.tex}'' and ``\texttt{econ-numbers.pdf}'' for an example. + +\section{Certified random order} +\label{sec:cro} + +\subsection{What is ``certified random order''?} + +The ordering of author names in joint publications in economics is typically +alphabetical. However, alphabetical order has its shortcomings; in particular, +it confers greater benefits on the first author.\footnote{See +\citet{10.1257/aer.20161492} for the details.} This can happen for various +reasons, including the use of the ``et al.'' convention, the bunching of +bibliographic references for early-ordered names in reference lists, and the +psychological focus on first authors. + +\citet{10.1257/aer.20161492} propose ``certified random order,'' in which names +are separated by a symbol, \textcircled{r}, that certifies or signals that the +author names are in random order. In particular, the symbol permits authors to +``certify'' that a reverse name order is only due to randomization, and avoids +the usual interpretation of name reversal in economics. + +``\texttt{econ.bst}'' can handle references to papers in random order. Examples +of such papers in this document are \citet{10.1257/aer.20161492}, +\citet{RePEc:hka:wpaper:2018-037}, \citet{vohra18:_maxim_farsig_stabl_set}, +\citet{NBERw25205}. + + +\subsection{How to cite papers in certified random order} + +To cite papers in certified random order with ``\texttt{econ.bst}'', you must +flag those entries in the bib file. To achieve this, ``\texttt{econ.bst}'' +contains the field ``\texttt{nameorder}''. If the bibliographical entry uses +random order, add the following information to that entry: +\begin{verbatim} + nameorder = {random} +\end{verbatim} + +For intance, the entry for \citet{10.1257/aer.20161492} is specified in +\texttt{econ-example.bib} as follows: +\begin{verbatim} +@article{10.1257/aer.20161492, + Author = {Ray, Debraj and Robson, Arthur}, + Title = {Certified Random: A New Order for Coauthorship}, + Journal = {American Economic Review}, + Volume = {108}, + Number = {2}, + Year = {2018}, + Month = {February}, + Pages = {489-520}, + DOI = {10.1257/aer.20161492}, + URL = {http://www.aeaweb.org/articles?id=10.1257/aer.20161492}, + nameorder = {random} +} +\end{verbatim} + +\noindent \textbf{[Notes]} \\ +1. The field ``nameorder'' is currently unique to \texttt{econ.bst} and it +is not a field used in bibliography databases (at least for now). + +\noindent 2. ``\texttt{econ.bst}'' does not itself randomize the order of +names. It simply cites an existing reference in random order, as the authors +intend it to be cited. +\vspace*{1em} + + +With the ``nameorder'' field in place, there is nothing else you need to change, +and you can cite bibliographic entries as before. For example, the command +\verb|\citet{10.1257/aer.20161492}| will generate the citation +\citet{10.1257/aer.20161492} in the text, and the following entry in the +references: + +\begin{quote} +Ray, Debraj \textcircled{r} Arthur Robson (2018) ``Certified Random: A New Order +for Coauthorship,'' \textit{American Economic Review}, Vol. 108, No. 2, +pp. 489--520, URL: \url{http://www.aeaweb.org/articles?id=10.1257/aer.20161492}, +DOI: \href{http://dx.doi.org/10.1257/aer.20161492}{10.1257/aer.20161492}. +\end{quote} + +Under the random order style, an entry with two authors is cited as already +described: \citet{10.1257/aer.20161492}. On the other hand, an entry with more +than two authors has two citation styles, depending on whether all names are +cited in full, or the citation is abbreviated: +\begin{itemize} + \item All-names citation $\longrightarrow$ \citet*{NBERw25205} + \item Abbreviated citation $\longrightarrow$ \citet{NBERw25205} +\end{itemize} + +Note that in the abbreviated names style, \textcircled{r} is used instead of +``et''. Think of \textcircled{r} as a conjunction just as ``and'' or ``but''. In +verbal citations, it would be pronounced just as the letter ``r'' is pronounced. + +\subsection{Customization for certified random order} + +The behavior of random order is controlled by the following functions: +`\texttt{bst.use.nameorder}', `\texttt{bst.and.nameorder}', +`\texttt{bst.cite.and.nameorder}' and `\texttt{bst.and.others.nameorder}'. +\vspace*{1em} + +Under the default setting of ``\texttt{econ.bst}'', random order is +automatically used for bibliographic entries with `\texttt{nameorder}' field. +However, if you set \verb|#0| to `\texttt{bst.use.nameorder}' as follows, the +function of random order is not used. +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.use.nameorder} +{ #0 } % Not use random order +\end{verbatim} +\end{Frame} + +Under the default setting, the symbol ``\textcircled{r}'' +(\verb|\textcircled{r}|) is used. But you can use another symbol. If you want +to use an alternative symbol, you need to change settings for +`\texttt{bst.and.nameorder}', `\texttt{bst.cite.and.nameorder}' and +`\texttt{bst.and.others.nameorder}'. + + +\section{Sorting rule} +\label{sec:sort_rule} + +\noindent \textbf{[Note]} If you want to create an ordinary list of +references, you need not read this part. The explanation below is +for sorting references in a special way. + +\subsection{Basic sorting rule} + +The sorting of references is done according to values of fields defined +in bib files. Basically, sorting is done according to the following +order of priority: +\begin{enumerate} + \item Type of entry (if ``\texttt{bst.sort.entry.type}'' has non-zero value) + \item Value of ``\texttt{year}'' field (if ``\texttt{bst.sort.year}'' has non-zero value) + \item Value of ``\texttt{absorder}'' field. + \item Value of ``\texttt{author}'' (or ``\texttt{editor}'') field. + \item Value of ``\texttt{year}'' field. + \item Value of ``\texttt{order}'' field. + \item Value of ``\texttt{month}'' field. + \item Value of ``\texttt{title}'' field. +\end{enumerate} + +By default, +\begin{itemize} + \item ``\texttt{bst.sort.entry.type}'' and ``\texttt{bst.sort.year}'' have + zero, + \item \textbf{''\texttt{absorder}''} and \textbf{''\texttt{order}''} + fields are not assigned values because they are fields specific + to ``\texttt{econ.bst}''. +\end{itemize} +Thus, references are sorted according to +\begin{Frame} + \begin{center} + ``\texttt{author}'' $\rightarrow$ ``\texttt{year}'' $\rightarrow$ + ``\texttt{month}'' $\rightarrow$ ``\texttt{title}'' +\end{center} +\end{Frame} +That is, ``\texttt{author}'' is used as the primary key, ``\texttt{year}'' as +the secondary key, ``\texttt{month}'' as the third key and ``\texttt{title}'' as +the fourth key. + +\subsection{No sorting} + +If you want to list references in citation order, set non-zero value to +``\texttt{bst.no.sort}''. +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.no.sort} +{ #1 } +\end{verbatim} +\end{Frame} + +Note that when you set non-zero value to ``\texttt{bst.no.sort}'', you had better not +use \verb|\bysame|. + +\subsection{Sort references by type} + +If you want to gather references according to their types (article, +book, incollection, unpublished etc.), set non-zero value to +``\texttt{bst.sort.entry.type}''. +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.sort.entry.type} +{ #1 } +\end{verbatim} +\end{Frame} + +Order of listing by entry type is determined by function +``\texttt{bst.sort.entry.type.order}'' (by default, listed in alphabetical +order, that is, article $\rightarrow$ book $\rightarrow$ booklet +$\rightarrow$ comment $\rightarrow$ inbook $\rightarrow$ incollection +$\rightarrow$ $\cdots$ $\rightarrow$ unpublished). See +``\texttt{bst.sort.entry.type.order}'' in ``\texttt{econ.bst}''. + +\subsection{Use ``\texttt{year}'' as the primary sorting key} + +When you create CV or a list of your papers, you may want to sort +references in chronological order. If all papers are written soley by +yourself, references are sorted in chronological order by default. +However, there are co-writers and if you are not the first author, +references are not sorted in chronological order because the author name +is used as the primary sorting key by default. +If you want to sort references in chronological order even when +there are co-writers, set non-zero to ``\texttt{bst.sort.year}''. +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.sort.year} +{ #1 } +\end{verbatim} +\end{Frame} + +By default, old references are listed first. But if you set non-zero to +``\texttt{bst.reverse.year}'', new references are listed first. + +\subsection{Sorting by ''\texttt{absorder}'' field} + +If ``\texttt{absorder}'' is defined in bib file, +``\texttt{econ.bst}'' uses its content as the primary sorting key. +You can set number 0--999 to ''\texttt{absorder}'' field. + +\begin{Frame} +\begin{center} + no absorder or absorder = 0 $\rightarrow$ absorder = 1 $\rightarrow$ absorder = 2 + $\rightarrow$ $\cdots$ $\rightarrow$ absorder = 999 +\end{center} +\end{Frame} +That is, reference with a small value of ``\texttt{absorder}'' is listed +first. In this document (``\texttt{econ-example.bib}''), the reference +with the key \citet{takeda10:_cge_analy_welfar_effec_trade} has 999 for +``\texttt{absorder}'' field and thus listed in the last. + + +\subsubsection{Ignore ''\texttt{absorder}'' field} + +If you set some values for ``\texttt{absorder}'' fields in bib file, +but if you want to ignore them, set non-zero to +``\texttt{bst.notuse.absorder.field}''. +\begin{Frame} +\begin{verbatim} +FUNCTION {bst.notuse.absorder.field} +{ #1 } +\end{verbatim} +\end{Frame} + +\section{Misc.} + +\begin{itemize} + \item Email: \verb|<shiro.takeda@gmail.com>|. + \item ``\texttt{econ.bst}'' is available at \url{https://github.com/ShiroTakeda/econ-bst}. +\end{itemize} +\vspace*{1em} + +\citet{borgers95:_note_implem_stron_domin}, +\citet{bergemann11:_ration}, +\citet{takeda2011c}, +\citet{Takeda2011b}, +\citet{Biker-2007-unemployment}, +\citet{Babiker-1999-JapaneseNuclearPower}, +\citet{Babiker-1999-KyotoProtocoland}, +\citet{Babiker2000525}, +\citet{BabikerRutherford-2005-EconomicEffectsof}, +\citet{goldin:katz:2011}, \citet{goldin:katz:2008}, \citet{goldin:katz:2000}. +\citet{stakeda2013web} +\vspace*{1em} + +\nocite{*} + +%%% BibTeX style. +\bibliographystyle{econ} + +%% BibTeX database file. +\addcontentsline{toc}{section}{References} +\bibliography{econ-example} + +\end{document} + +%##################################################################### +%######################### Document Ends ############################# +%##################################################################### +% -------------------- +% Local Variables: +% fill-column: 80 +% End: + |