galaaz 0.4.10 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2048 -531
  3. data/Rakefile +3 -2
  4. data/bin/gknit +152 -6
  5. data/bin/gknit-draft +105 -0
  6. data/bin/gknit-draft.rb +28 -0
  7. data/bin/gknit_Rscript +127 -0
  8. data/bin/grun +27 -1
  9. data/bin/gstudio +47 -4
  10. data/bin/{gstudio.rb → gstudio_irb.rb} +0 -0
  11. data/bin/gstudio_pry.rb +7 -0
  12. data/blogs/galaaz_ggplot/galaaz_ggplot.html +10 -195
  13. data/blogs/galaaz_ggplot/galaaz_ggplot.md +404 -0
  14. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
  15. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
  16. data/blogs/gknit/gknit.Rmd +5 -3
  17. data/blogs/gknit/gknit.pdf +0 -0
  18. data/blogs/gknit/lst.rds +0 -0
  19. data/blogs/manual/lst.rds +0 -0
  20. data/blogs/manual/manual.Rmd +826 -53
  21. data/blogs/manual/manual.html +2338 -695
  22. data/blogs/manual/manual.md +2032 -539
  23. data/blogs/manual/manual.pdf +0 -0
  24. data/blogs/manual/manual.tex +1804 -594
  25. data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
  26. data/blogs/manual/manual_files/figure-html/diverging_bar.png +0 -0
  27. data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
  28. data/blogs/manual/manual_files/figure-latex/diverging_bar.pdf +0 -0
  29. data/blogs/manual/model.rb +41 -0
  30. data/blogs/nse_dplyr/nse_dplyr.Rmd +226 -73
  31. data/blogs/nse_dplyr/nse_dplyr.html +254 -336
  32. data/blogs/nse_dplyr/nse_dplyr.md +353 -158
  33. data/blogs/oh_my/oh_my.html +274 -386
  34. data/blogs/oh_my/oh_my.md +208 -205
  35. data/blogs/ruby_plot/ruby_plot.html +20 -205
  36. data/blogs/ruby_plot/ruby_plot.md +14 -15
  37. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
  38. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
  39. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
  40. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
  41. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
  42. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
  43. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
  44. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
  45. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
  46. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
  47. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
  48. data/examples/Bibliography/master.bib +50 -0
  49. data/examples/Bibliography/stats.bib +72 -0
  50. data/examples/islr/x_y_rnorm.jpg +0 -0
  51. data/examples/latex_templates/Test-acm_article/Makefile +16 -0
  52. data/examples/latex_templates/Test-acm_article/Test-acm_article.Rmd +65 -0
  53. data/examples/latex_templates/Test-acm_article/acm_proc_article-sp.cls +1670 -0
  54. data/examples/latex_templates/Test-acm_article/sensys-abstract.cls +703 -0
  55. data/examples/latex_templates/Test-acm_article/sigproc.bib +59 -0
  56. data/examples/latex_templates/Test-acs_article/Test-acs_article.Rmd +260 -0
  57. data/examples/latex_templates/Test-acs_article/Test-acs_article.pdf +0 -0
  58. data/examples/latex_templates/Test-acs_article/acs-Test-acs_article.bib +11 -0
  59. data/examples/latex_templates/Test-acs_article/acs-my_output.bib +11 -0
  60. data/examples/latex_templates/Test-acs_article/acstest.bib +17 -0
  61. data/examples/latex_templates/Test-aea_article/AEA.cls +1414 -0
  62. data/{blogs/gknit/marshal.dump → examples/latex_templates/Test-aea_article/BibFile.bib} +0 -0
  63. data/examples/latex_templates/Test-aea_article/Test-aea_article.Rmd +108 -0
  64. data/examples/latex_templates/Test-aea_article/Test-aea_article.pdf +0 -0
  65. data/examples/latex_templates/Test-aea_article/aea.bst +1269 -0
  66. data/examples/latex_templates/Test-aea_article/multicol.sty +853 -0
  67. data/examples/latex_templates/Test-aea_article/references.bib +0 -0
  68. data/examples/latex_templates/Test-aea_article/setspace.sty +546 -0
  69. data/examples/latex_templates/Test-amq_article/Test-amq_article.Rmd +256 -0
  70. data/examples/latex_templates/Test-amq_article/Test-amq_article.pdf +0 -0
  71. data/examples/latex_templates/Test-amq_article/Test-amq_article.pdfsync +3397 -0
  72. data/examples/latex_templates/Test-amq_article/pics/Figure2.pdf +0 -0
  73. data/examples/latex_templates/Test-ams_article/Test-ams_article.Rmd +215 -0
  74. data/examples/latex_templates/Test-ams_article/amstest.bib +436 -0
  75. data/examples/latex_templates/Test-asa_article/Test-asa_article.Rmd +153 -0
  76. data/examples/latex_templates/Test-asa_article/Test-asa_article.pdf +0 -0
  77. data/examples/latex_templates/Test-asa_article/agsm.bst +1353 -0
  78. data/examples/latex_templates/Test-asa_article/bibliography.bib +233 -0
  79. data/examples/latex_templates/Test-ieee_article/IEEEtran.bst +2409 -0
  80. data/examples/latex_templates/Test-ieee_article/IEEEtran.cls +6346 -0
  81. data/examples/latex_templates/Test-ieee_article/Test-ieee_article.Rmd +175 -0
  82. data/examples/latex_templates/Test-ieee_article/Test-ieee_article.pdf +0 -0
  83. data/examples/latex_templates/Test-ieee_article/mybibfile.bib +20 -0
  84. data/examples/latex_templates/Test-rjournal_article/RJournal.sty +335 -0
  85. data/examples/latex_templates/Test-rjournal_article/RJreferences.bib +18 -0
  86. data/examples/latex_templates/Test-rjournal_article/RJwrapper.pdf +0 -0
  87. data/examples/latex_templates/Test-rjournal_article/Test-rjournal_article.Rmd +52 -0
  88. data/examples/latex_templates/Test-springer_article/Test-springer_article.Rmd +65 -0
  89. data/examples/latex_templates/Test-springer_article/Test-springer_article.pdf +0 -0
  90. data/examples/latex_templates/Test-springer_article/bibliography.bib +26 -0
  91. data/examples/latex_templates/Test-springer_article/spbasic.bst +1658 -0
  92. data/examples/latex_templates/Test-springer_article/spmpsci.bst +1512 -0
  93. data/examples/latex_templates/Test-springer_article/spphys.bst +1443 -0
  94. data/examples/latex_templates/Test-springer_article/svglov3.clo +113 -0
  95. data/examples/latex_templates/Test-springer_article/svjour3.cls +1431 -0
  96. data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.Rmd +73 -0
  97. data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.pdf +0 -0
  98. data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.Rmd +382 -0
  99. data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.pdf +0 -0
  100. data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.Rmd +164 -0
  101. data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.pdf +0 -0
  102. data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.Rmd +92 -0
  103. data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.pdf +0 -0
  104. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/attend-grade-relationships.csv +482 -0
  105. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.Rmd +280 -0
  106. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.pdf +0 -0
  107. data/examples/rmarkdown/svm-xaringan-example/svm-xaringan-example.Rmd +386 -0
  108. data/lib/R_interface/r.rb +1 -1
  109. data/lib/R_interface/r_libs.R +1 -1
  110. data/lib/R_interface/r_methods.rb +10 -0
  111. data/lib/R_interface/rpkg.rb +1 -0
  112. data/lib/R_interface/rsupport.rb +4 -6
  113. data/lib/gknit.rb +2 -0
  114. data/lib/gknit/draft.rb +105 -0
  115. data/lib/gknit/knitr_engine.rb +0 -33
  116. data/lib/util/exec_ruby.rb +1 -27
  117. data/specs/figures/bg.jpeg +0 -0
  118. data/specs/figures/bg.png +0 -0
  119. data/specs/figures/dose_len.png +0 -0
  120. data/specs/figures/no_args.jpeg +0 -0
  121. data/specs/figures/no_args.png +0 -0
  122. data/specs/figures/width_height.jpeg +0 -0
  123. data/specs/figures/width_height.png +0 -0
  124. data/specs/figures/width_height_units1.jpeg +0 -0
  125. data/specs/figures/width_height_units1.png +0 -0
  126. data/specs/figures/width_height_units2.jpeg +0 -0
  127. data/specs/figures/width_height_units2.png +0 -0
  128. data/specs/r_dataframe.spec.rb +11 -11
  129. data/specs/ruby_expression.spec.rb +1 -0
  130. data/specs/tmp.rb +41 -20
  131. data/version.rb +1 -1
  132. metadata +73 -35
  133. data/blogs/galaaz_ggplot/galaaz_ggplot.aux +0 -41
  134. data/blogs/galaaz_ggplot/galaaz_ggplot.out +0 -10
  135. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/midwest_rb.pdf +0 -0
  136. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-latex/scatter_plot_rb.pdf +0 -0
  137. data/blogs/gknit/gknit.md +0 -1430
  138. data/blogs/gknit/gknit.tex +0 -1358
  139. data/blogs/manual/graph.rb +0 -29
  140. data/blogs/nse_dplyr/nse_dplyr.tex +0 -1373
  141. data/blogs/ruby_plot/ruby_plot.Rmd_external_figs +0 -662
  142. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.svg +0 -57
  143. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.svg +0 -106
  144. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.svg +0 -110
  145. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.svg +0 -174
  146. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.svg +0 -236
  147. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.svg +0 -296
  148. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.svg +0 -236
  149. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.svg +0 -218
  150. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.svg +0 -128
  151. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.svg +0 -150
  152. data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
  153. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  154. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  155. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  156. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  157. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  158. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  159. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  160. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  161. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  162. data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  163. data/examples/paper/paper.rb +0 -36
@@ -0,0 +1,108 @@
1
+ ---
2
+ title: "Untitled"
3
+ short: "A shorter title"
4
+ journal: "AER" # AER, AEJ, PP, JEL
5
+ month: "`r format(Sys.Date(), '%m')`"
6
+ year: "`r format(Sys.Date(), '%Y')`"
7
+ vol: 1
8
+ issue: 1
9
+ jel:
10
+ - A10
11
+ - A11
12
+ keywords:
13
+ - first keyword
14
+ - second keyword
15
+ author:
16
+ - name: Alice Anonymous
17
+ firstname: Alice
18
+ surname: Anonymous
19
+ email: alice@example.com
20
+ affiliation: Some Institute of Technology
21
+ - name: Bob Security
22
+ firstname: Bob
23
+ surname: Security
24
+ email: bob@example.com
25
+ affiliation: Another University
26
+ acknowledgements: |
27
+ Acknowledgements
28
+ abstract: |
29
+ Abstract goes here
30
+ output: rticles::aea_article
31
+ ---
32
+
33
+ American Economic Review Pointers:
34
+
35
+ \begin{itemize}
36
+ \item Do not use an "Introduction" heading. Begin your introductory material
37
+ before the first section heading.
38
+
39
+ \item Avoid style markup (except sparingly for emphasis).
40
+
41
+ \item Avoid using explicit vertical or horizontal space.
42
+
43
+ \item Captions are short and go below figures but above tables.
44
+
45
+ \item The tablenotes or figurenotes environments may be used below tables
46
+ or figures, respectively, as demonstrated below.
47
+
48
+ \item If you have difficulties with the mathtime package, adjust the package
49
+ options appropriately for your platform. If you can't get it to work, just
50
+ remove the package or see our technical support document online (please
51
+ refer to the author instructions).
52
+
53
+ \item If you are using an appendix, it goes last, after the bibliography.
54
+ Use regular section headings to make the appendix headings.
55
+
56
+ \item If you are not using an appendix, you may delete the appendix command
57
+ and sample appendix section heading.
58
+
59
+ \item Either the natbib package or the harvard package may be used with bibtex.
60
+ To include one of these packages, uncomment the appropriate usepackage command
61
+ above. Note: you can't use both packages at once or compile-time errors will result.
62
+
63
+ \end{itemize}
64
+
65
+ \section{First Section in Body}
66
+
67
+ Sample figure:
68
+
69
+ \begin{figure}
70
+ Figure here.
71
+
72
+ \caption{Caption for figure below.}
73
+ \begin{figurenotes}
74
+ Figure notes without optional leadin.
75
+ \end{figurenotes}
76
+ \begin{figurenotes}[Source]
77
+ Figure notes with optional leadin (Source, in this case).
78
+ \end{figurenotes}
79
+ \end{figure}
80
+
81
+ Sample table:
82
+
83
+ \begin{table}
84
+ \caption{Caption for table above.}
85
+
86
+ \begin{tabular}{lll}
87
+ & Heading 1 & Heading 2 \\
88
+ Row 1 & 1 & 2 \\
89
+ Row 2 & 3 & 4%
90
+ \end{tabular}
91
+ \begin{tablenotes}
92
+ Table notes environment without optional leadin.
93
+ \end{tablenotes}
94
+ \begin{tablenotes}[Source]
95
+ Table notes environment with optional leadin (Source, in this case).
96
+ \end{tablenotes}
97
+ \end{table}
98
+
99
+ References here (manual or bibTeX). If you are using bibTeX, add your bib file
100
+ name in place of BibFile in the bibliography command.
101
+ % Remove or comment out the next two lines if you are not using bibtex.
102
+ \bibliographystyle{aea}
103
+ \bibliography{references}
104
+
105
+ % The appendix command is issued once, prior to all appendices, if any.
106
+ \appendix
107
+
108
+ \section{Mathematical Appendix}
@@ -0,0 +1,1269 @@
1
+ % BibTeX standard bibliography style `aea' (one of the harvard family)
2
+ % version 0.99a for BibTeX versions 0.99a or later, LaTeX version 2.09.
3
+ % Copyright (C) 2008, all rights reserved.
4
+ % Melissa Rice (melissa@fmtek.net), Full Moon Technical Solutions, LLC (dba FMTek)
5
+ % last revised: 20 May 2009
6
+
7
+ ENTRY
8
+ { address
9
+ author
10
+ booktitle
11
+ chapter
12
+ edition
13
+ editor
14
+ howpublished
15
+ institution
16
+ journal
17
+ key
18
+ month
19
+ note
20
+ number
21
+ organization
22
+ pages
23
+ presented
24
+ publisher
25
+ school
26
+ series
27
+ title
28
+ type
29
+ URL
30
+ volume
31
+ year
32
+ }
33
+ { field.used etal.allowed etal.required}
34
+ { extra.label sort.label list.year }
35
+
36
+ STRINGS { s t f }
37
+
38
+ % BOOLEAN OPERATORS
39
+
40
+ FUNCTION {not}
41
+ { { #0 }
42
+ { #1 }
43
+ if$
44
+ }
45
+
46
+ FUNCTION {and}
47
+ { 'skip$
48
+ { pop$ #0 }
49
+ if$
50
+ }
51
+
52
+ FUNCTION {or}
53
+ { { pop$ #1 }
54
+ 'skip$
55
+ if$
56
+ }
57
+
58
+ % CHECKS
59
+
60
+ FUNCTION {author.or.editor.check}
61
+ { author empty$ editor empty$ and
62
+ { "empty author and editor in " cite$ * warning$ }
63
+ { skip$ }
64
+ if$
65
+ }
66
+
67
+ FUNCTION {chapter.or.pages.check}
68
+ { chapter empty$ pages empty$ and
69
+ { "empty chapter and pages in " cite$ * warning$ }
70
+ { skip$ }
71
+ if$
72
+ }
73
+
74
+
75
+ FUNCTION {required}
76
+ { 't := % name of variable
77
+ empty$ % value of variable on stack
78
+ { "empty " t * " in " * cite$ * warning$ }
79
+ { skip$ }
80
+ if$
81
+ }
82
+
83
+ FUNCTION {field.or.null}
84
+ { duplicate$ empty$
85
+ { pop$ "" }
86
+ 'skip$
87
+ if$
88
+ }
89
+
90
+ % GENERAL FORMATTING
91
+
92
+ FUNCTION {emphasize}
93
+ { duplicate$ empty$
94
+ { pop$ "" }
95
+ { "{\em " swap$ * "}" * }
96
+ if$
97
+ }
98
+
99
+ FUNCTION {embolden}
100
+ { duplicate$ empty$
101
+ { pop$ "" }
102
+ { "{\bf " swap$ * "}" * }
103
+ if$
104
+ }
105
+
106
+ FUNCTION {quote}
107
+ { duplicate$ empty$
108
+ { pop$ "" }
109
+ { "`" swap$ * "'" * }
110
+ if$
111
+ }
112
+
113
+ FUNCTION {doublequote}
114
+ { duplicate$ empty$
115
+ { pop$ "" }
116
+ { "``" swap$ * "''" * }
117
+ if$
118
+ }
119
+
120
+ FUNCTION {join}
121
+ { 't := % second string
122
+ 'f := % join character
123
+ 's := % first string
124
+ s empty$
125
+ { t empty$
126
+ { "" }
127
+ { t }
128
+ if$
129
+ }
130
+ { t empty$
131
+ { s }
132
+ { f ". " =
133
+ { s add.period$ " " * t * }
134
+ { s f * t * }
135
+ if$
136
+ }
137
+ if$
138
+ }
139
+ if$
140
+ }
141
+
142
+ FUNCTION {tie.or.space.connect}
143
+ { duplicate$ text.length$ #3 <
144
+ { "~" }
145
+ { " " }
146
+ if$
147
+ swap$ * *
148
+ }
149
+
150
+ INTEGERS { len }
151
+
152
+ FUNCTION {chop.word}
153
+ { 's :=
154
+ 'len :=
155
+ s #1 len substring$ =
156
+ { s len #1 + global.max$ substring$ }
157
+ 's
158
+ if$
159
+ }
160
+
161
+ INTEGERS { ind tsslen }
162
+
163
+ STRINGS { tss ret rss istr }
164
+
165
+ FUNCTION {replace.substring}{
166
+ 'rss :=
167
+ 'tss :=
168
+ 'istr :=
169
+ "" 'ret :=
170
+ tss text.length$ 'tsslen :=
171
+ #1 'ind :=
172
+ { istr ind tsslen substring$ "" = not }
173
+ { istr ind tsslen substring$ tss =
174
+ { ret rss * 'ret :=
175
+ ind tsslen + 'ind :=
176
+ }
177
+ { ret istr ind #1 substring$ * 'ret :=
178
+ ind #1 + 'ind :=
179
+ }
180
+ if$
181
+ }
182
+ while$
183
+ ret
184
+ }
185
+
186
+ FUNCTION {n.dashify}
187
+ { 't :=
188
+ ""
189
+ { t empty$ not }
190
+ { t #1 #1 substring$ "-" =
191
+ { t #1 #2 substring$ "--" = not
192
+ { "--" *
193
+ t #2 global.max$ substring$ 't :=
194
+ }
195
+ { { t #1 #1 substring$ "-" = }
196
+ { "-" *
197
+ t #2 global.max$ substring$ 't :=
198
+ }
199
+ while$
200
+ }
201
+ if$
202
+ }
203
+ { t #1 #1 substring$ *
204
+ t #2 global.max$ substring$ 't :=
205
+ }
206
+ if$
207
+ }
208
+ while$
209
+ }
210
+
211
+ INTEGERS { multiresult }
212
+
213
+ FUNCTION {multi.page.check}
214
+ { 't :=
215
+ #0 'multiresult :=
216
+ { multiresult not
217
+ t empty$ not
218
+ and
219
+ }
220
+ { t #1 #1 substring$
221
+ duplicate$ "-" =
222
+ swap$ duplicate$ "," =
223
+ swap$ "+" =
224
+ or or
225
+ { #1 'multiresult := }
226
+ { t #2 global.max$ substring$ 't := }
227
+ if$
228
+ }
229
+ while$
230
+ multiresult
231
+ }
232
+
233
+
234
+ % OUTPUT FUNCTIONS
235
+
236
+ FUNCTION {output} % writ
237
+ { duplicate$ empty$
238
+ { pop$ }
239
+ { write$}
240
+ if$
241
+ }
242
+
243
+ FUNCTION {output.year} % writ
244
+ { list.year empty$
245
+ { skip$ }
246
+ { list.year ". " * write$}
247
+ if$
248
+ }
249
+
250
+ FUNCTION {output.title.quoted}
251
+ { title empty$
252
+ { skip$ }
253
+ { title add.period$ doublequote " " * write$ }
254
+ if$
255
+ }
256
+
257
+ FUNCTION {output.title.italic}
258
+ { title empty$
259
+ { skip$ }
260
+ { title add.period$ emphasize " " * write$ }
261
+ if$
262
+ }
263
+
264
+ FUNCTION {output.entry}
265
+ { duplicate$ "" =
266
+ { pop$ }
267
+ { add.period$
268
+ write$
269
+ }
270
+ if$
271
+ newline$
272
+ }
273
+
274
+ % FIELD FORMATTING
275
+
276
+ FUNCTION {format.address.only}
277
+ { address empty$
278
+ { "" }
279
+ { address }
280
+ if$
281
+ }
282
+
283
+ FUNCTION {format.journal}
284
+ { journal empty$
285
+ { "" }
286
+ { journal emphasize }
287
+ if$
288
+ }
289
+
290
+ FUNCTION {format.type}
291
+ { type empty$
292
+ { "" }
293
+ { type }
294
+ if$
295
+ }
296
+
297
+ FUNCTION {format.number}
298
+ { number empty$
299
+ { "" }
300
+ { number }
301
+ if$
302
+ }
303
+
304
+
305
+ FUNCTION {format.school}
306
+ { school empty$
307
+ { "" }
308
+ { school }
309
+ if$
310
+ }
311
+
312
+ FUNCTION {format.institution}
313
+ { institution empty$
314
+ { "" }
315
+ { institution }
316
+ if$
317
+ }
318
+
319
+ FUNCTION {format.masters}
320
+ { "Master's diss."
321
+ }
322
+
323
+ FUNCTION {format.phd}
324
+ { "PhD diss."
325
+ }
326
+
327
+ FUNCTION {format.note}
328
+ { note empty$
329
+ { "" }
330
+ { note }
331
+ if$
332
+ }
333
+
334
+ FUNCTION {format.booktitle}
335
+ { booktitle empty$
336
+ { "" }
337
+ { booktitle emphasize }
338
+ if$
339
+ }
340
+
341
+ FUNCTION {format.booktitle.label}
342
+ { booktitle empty$
343
+ { "" }
344
+ { booktitle embolden }
345
+ if$
346
+ }
347
+
348
+ FUNCTION {format.title.bold}
349
+ { title empty$
350
+ { "" }
351
+ { title add.period$ embolden }
352
+ if$
353
+ }
354
+
355
+ FUNCTION {format.month}
356
+ { month empty$
357
+ { "" }
358
+ { month }
359
+ if$
360
+ }
361
+
362
+ FUNCTION {format.vol.num.pages} % writ
363
+ { volume empty$
364
+ { number empty$
365
+ {""}
366
+ { "there's a number but no volume in " cite$ * warning$ ", (" number * ")" *}
367
+ if$
368
+ }
369
+ { number empty$
370
+ { volume }
371
+ { volume "(" * number * ")" *}
372
+ if$
373
+ }
374
+ if$
375
+ pages empty$
376
+ { skip$ }
377
+ { duplicate$ "" =
378
+ { pages n.dashify * }
379
+ { ":~" * pages n.dashify * }
380
+ if$
381
+ }
382
+ if$
383
+ }
384
+
385
+ FUNCTION {format.edition} % writ
386
+ { edition empty$
387
+ { "" }
388
+ { edition " ed." * }
389
+ if$
390
+ }
391
+
392
+ FUNCTION {format.book.vol.series.ed} % writ
393
+ { volume empty$
394
+ { series empty$
395
+ { "" }
396
+ { series emphasize }
397
+ if$
398
+ }
399
+ { "Vol." volume tie.or.space.connect
400
+ series empty$
401
+ 'skip$
402
+ { " of " * series emphasize * }
403
+ if$
404
+ }
405
+ if$
406
+ edition empty$
407
+ { skip$ }
408
+ { ". " * edition * " ed." *}
409
+ if$
410
+ }
411
+
412
+ FUNCTION {format.address.publisher} % writ
413
+ { address empty$
414
+ { publisher empty$
415
+ { "" }
416
+ { publisher }
417
+ if$
418
+ }
419
+ { publisher empty$
420
+ { address }
421
+ { address ":" * publisher *}
422
+ if$
423
+ }
424
+ if$
425
+ }
426
+
427
+ FUNCTION {format.howpublished}
428
+ { howpublished empty$
429
+ { "" }
430
+ { howpublished emphasize }
431
+ if$
432
+ }
433
+
434
+ FUNCTION {format.organization}
435
+ { organization empty$
436
+ { "" }
437
+ { organization }
438
+ if$
439
+ }
440
+
441
+ FUNCTION {format.organization.presented}
442
+ { organization empty$
443
+ { "" }
444
+ { presented empty$
445
+ { organization }
446
+ { presented " " * organization * }
447
+ if$
448
+ }
449
+ if$
450
+ }
451
+
452
+ FUNCTION {format.pages}
453
+ { pages empty$
454
+ { "" }
455
+ { pages multi.page.check
456
+ { pages n.dashify }
457
+ { pages }
458
+ if$
459
+ }
460
+ if$
461
+ }
462
+
463
+ FUNCTION {format.chapter.pages}
464
+ { chapter empty$
465
+ { pages empty$
466
+ { "" }
467
+ { format.pages }
468
+ if$
469
+ }
470
+ { pages empty$
471
+ { "Chapter " chapter * }
472
+ { "Chapter " chapter * ", " * format.pages * }
473
+ if$
474
+ }
475
+ if$
476
+ }
477
+
478
+ INTEGERS { nameptr namesleft numnames }
479
+
480
+ % Format names so that first author is "last, first" and subsequent authors are "first last" with commas
481
+ % separating authors whenever there are two or more and "and" precedes last author if 2 or more.
482
+ FUNCTION {format.names}
483
+ { 's :=
484
+ #1 'nameptr :=
485
+ s num.names$ 'numnames :=
486
+ numnames 'namesleft :=
487
+ { namesleft #0 > }
488
+ { nameptr #1 =
489
+ { s nameptr "{vv~}{ll}{, jj}{, ff}" format.name$ 't := }
490
+ { s nameptr "{ff }{vv~}{ll}{, jj}" format.name$ 't := }
491
+ if$
492
+ nameptr #1 >
493
+ { namesleft #1 >
494
+ { ", " * t * }
495
+ { t "others" =
496
+ { ", et~al." * }
497
+ { ", and " * t * }
498
+ if$
499
+ }
500
+ if$
501
+ }
502
+ 't
503
+ if$
504
+ nameptr #1 + 'nameptr :=
505
+ namesleft #1 - 'namesleft :=
506
+ }
507
+ while$
508
+ }
509
+
510
+ FUNCTION {format.names.forward}
511
+ { 's :=
512
+ #1 'nameptr :=
513
+ s num.names$ 'numnames :=
514
+ numnames 'namesleft :=
515
+ { namesleft #0 > }
516
+ { s nameptr "{ff }{vv~}{ll}{, jj}" format.name$ 't :=
517
+ nameptr #1 >
518
+ { namesleft #1 >
519
+ { ", " * t * }
520
+ { t "others" =
521
+ { " et~al." * }
522
+ { " and " * t * }
523
+ if$
524
+ }
525
+ if$
526
+ }
527
+ 't
528
+ if$
529
+ nameptr #1 + 'nameptr :=
530
+ namesleft #1 - 'namesleft :=
531
+ }
532
+ while$
533
+ }
534
+
535
+ INTEGERS { author.field editor.field organization.field title.field key.field }
536
+
537
+ FUNCTION {init.field.constants}
538
+ { #0 'author.field :=
539
+ #1 'editor.field :=
540
+ #2 'organization.field :=
541
+ #3 'title.field :=
542
+ #4 'key.field :=
543
+ }
544
+
545
+
546
+
547
+ FUNCTION {format.names.label}
548
+ { 's :=
549
+ #1 'nameptr :=
550
+ s num.names$ 'numnames :=
551
+ numnames 'namesleft :=
552
+ { namesleft #0 > }
553
+ { s nameptr "{ff }{vv~}{ll}{, jj}" format.name$ 't :=
554
+ nameptr #1 >
555
+ { namesleft #1 >
556
+ { ", " * t * }
557
+ { t "others" =
558
+ { " et~al." * }
559
+ { " \harvardand\ " * t * }
560
+ if$
561
+ }
562
+ if$
563
+ }
564
+ 't
565
+ if$
566
+ nameptr #1 + 'nameptr :=
567
+ namesleft #1 - 'namesleft :=
568
+ }
569
+ while$
570
+ }
571
+
572
+ FUNCTION {format.names.label.short}
573
+ { 's :=
574
+ #1 'nameptr :=
575
+ s num.names$ 'numnames :=
576
+ numnames #3 >
577
+ { s #1 "{vv~}{ll}" format.name$ " et~al." *}
578
+ { numnames 'namesleft :=
579
+ { namesleft #0 > }
580
+ { s nameptr "{vv~}{ll}" format.name$ 't :=
581
+ nameptr #1 >
582
+ { namesleft #1 >
583
+ { ", " * t * }
584
+ { t "others" =
585
+ { " et~al." * }
586
+ { " \harvardand\ " * t * }
587
+ if$
588
+ }
589
+ if$
590
+ }
591
+ 't
592
+ if$
593
+ nameptr #1 + 'nameptr :=
594
+ namesleft #1 - 'namesleft :=
595
+ }
596
+ while$
597
+ }
598
+ if$
599
+ }
600
+
601
+ FUNCTION {format.authors}
602
+ { author empty$
603
+ { "" }
604
+ { author format.names add.period$ embolden}
605
+ if$
606
+ }
607
+
608
+ FUNCTION {format.editors}
609
+ { editor empty$
610
+ { "" }
611
+ { editor format.names add.period$ embolden}
612
+ if$
613
+ }
614
+
615
+ FUNCTION {format.editors.primary}
616
+ { editor empty$
617
+ { "" }
618
+ { editor format.names ", " * embolden " ed" *}
619
+ if$
620
+ }
621
+
622
+ FUNCTION {format.editors.secondary}
623
+ { editor empty$
624
+ { "" }
625
+ { ", ed. " editor format.names.forward *}
626
+ if$
627
+ }
628
+
629
+ FUNCTION {make.list.label} % writ
630
+ { author.field field.used =
631
+ { format.authors }
632
+ { editor.field field.used =
633
+ { format.editors.primary }
634
+ { organization.field field.used =
635
+ { "The " #4 organization chop.word embolden }
636
+ { title.field field.used =
637
+ { format.title.bold }
638
+ { key.field field.used =
639
+ { key }
640
+ { "Internal error :001 on " cite$ * " label" * warning$ }
641
+ if$
642
+ }
643
+ if$
644
+ }
645
+ if$
646
+ }
647
+ if$
648
+ }
649
+ if$
650
+ }
651
+
652
+ FUNCTION {output.list.label} % writ
653
+ { make.list.label add.period$ " " * write$
654
+ }
655
+
656
+ FUNCTION {make.label.short} % writ
657
+ { author.field field.used =
658
+ { author format.names.label.short }
659
+ { editor.field field.used =
660
+ { editor format.names.label.short }
661
+ { organization.field field.used =
662
+ { "The " #4 organization chop.word}
663
+ { title.field field.used =
664
+ { format.booktitle.label }
665
+ { key.field field.used =
666
+ { key }
667
+ {"Internal error :001 on " cite$ * " label" * warning$ }
668
+ if$
669
+ }
670
+ if$
671
+ }
672
+ if$
673
+ }
674
+ if$
675
+ }
676
+ if$
677
+ }
678
+
679
+ FUNCTION {make.label.full} % writ
680
+ { author.field field.used =
681
+ { author format.names.label }
682
+ { editor.field field.used =
683
+ { editor format.names.label }
684
+ { organization.field field.used =
685
+ { "The " #4 organization chop.word}
686
+ { title.field field.used =
687
+ { format.booktitle.label }
688
+ { key.field field.used =
689
+ { key }
690
+ {"Internal error :001 on " cite$ * " label" * warning$ }
691
+ if$
692
+ }
693
+ if$
694
+ }
695
+ if$
696
+ }
697
+ if$
698
+ }
699
+ if$
700
+ }
701
+
702
+ % bibitem syntax:
703
+ % \harvarditem[abbr-citation]{full-citation}{citation-year}{cite-key}
704
+ % abbr-citation: names for 2nd and subsequent citations
705
+ % full-citation: names for 1st citation
706
+
707
+ % Give full name (first name, middle initial, and last name) of author(s) and year of publication in the first citation.
708
+ % Give the last name of author and year of publication in parentheses for each subsequent citation.
709
+ % If there are four or more authors, refer to the first author, followed by et al. and the year.
710
+
711
+ FUNCTION {output.bibitem} % writ
712
+ { newline$
713
+ "\harvarditem[" make.label.short * "]" *
714
+ "{" make.label.full * "}" * *
715
+ "{" list.year * "}" * *
716
+ "{" cite$ * "}" * * write$
717
+ newline$
718
+ }
719
+
720
+ FUNCTION {stack.show}
721
+ { duplicate$ "stack top: " swap$ * " in " * cite$ * warning$
722
+ duplicate$ "" =
723
+ { "stack top is blank" warning$ }
724
+ { "stack top is non-blank" warning$ }
725
+ if$
726
+ }
727
+ FUNCTION {article} % writ
728
+ { output.bibitem
729
+ output.list.label % write author or surrogate label
730
+ output.year
731
+ output.title.quoted
732
+ author "author" required
733
+ title "title" required
734
+ journal "journal" required
735
+ year "year" required
736
+ format.journal ", "
737
+ % format.month join ", "
738
+ format.vol.num.pages join ". "
739
+ format.note join
740
+ output.entry
741
+ }
742
+
743
+ FUNCTION {book}
744
+ { output.bibitem
745
+ output.list.label % write author or surrogate label
746
+ output.year
747
+ output.title.italic
748
+ author.or.editor.check
749
+ title "title" required
750
+ publisher "publisher" required
751
+ year "year" required
752
+ % format.month ", "
753
+ % format.book.vol.series.ed join ", "
754
+ format.book.vol.series.ed ", "
755
+ format.address.publisher join ". "
756
+ format.note join
757
+ output.entry
758
+ }
759
+
760
+
761
+ FUNCTION {booklet}
762
+ { output.bibitem
763
+ output.list.label % write author or surrogate label
764
+ year empty$
765
+ { skip$ }
766
+ { output.year }
767
+ if$
768
+ author empty$
769
+ { skip$ }
770
+ { output.title.quoted }
771
+ if$
772
+ title "title" required
773
+ format.howpublished ", "
774
+ % format.month join ", "
775
+ format.address.only join ". "
776
+ format.note join
777
+ output.entry
778
+ }
779
+
780
+ FUNCTION {inbook}
781
+ { output.bibitem
782
+ output.list.label % write author or surrogate label
783
+ output.year
784
+ output.title.quoted
785
+ author.or.editor.check
786
+ chapter.or.pages.check
787
+ title "title" required
788
+ publisher "publisher" required
789
+ year "year" required
790
+ format.booktitle ", "
791
+ format.editors.secondary join " "
792
+ format.book.vol.series.ed join ", "
793
+ format.chapter.pages join ". "
794
+ format.address.publisher join ". "
795
+ format.note join
796
+ output.entry
797
+ }
798
+
799
+ FUNCTION {incollection}
800
+ { output.bibitem
801
+ output.list.label % write author or surrogate label
802
+ output.year
803
+ output.title.quoted
804
+ "In " format.booktitle * ". " * output
805
+ author "author" required
806
+ title "title" required
807
+ booktitle "booktitle" required
808
+ publisher "publisher" required
809
+ year "year" required
810
+ format.book.vol.series.ed ", "
811
+ format.editors.secondary join ", "
812
+ format.chapter.pages join ". "
813
+ format.address.publisher join ". "
814
+ format.note join
815
+ output.entry
816
+ }
817
+
818
+ FUNCTION {inproceedings}
819
+ { output.bibitem
820
+ output.list.label % write author or surrogate label
821
+ output.year
822
+ output.title.quoted
823
+ author "author" required
824
+ title "title" required
825
+ booktitle "booktitle" required
826
+ year "year" required
827
+ format.book.vol.series.ed ", "
828
+ format.pages join ", "
829
+ format.organization.presented join ". "
830
+ format.address.publisher join ". "
831
+ format.note join
832
+ output.entry
833
+ }
834
+
835
+ FUNCTION {conference} { inproceedings }
836
+
837
+ FUNCTION {manual}
838
+ { output.bibitem
839
+ output.list.label % write author or surrogate label
840
+ title "title" required
841
+ year empty$
842
+ { skip$ }
843
+ { output.year }
844
+ if$
845
+ author empty$
846
+ { skip$ }
847
+ { output.title.quoted }
848
+ if$
849
+ format.edition ", "
850
+ format.address.only join ", "
851
+ format.organization join ", "
852
+ % format.month join ", "
853
+ format.note join
854
+ output.entry
855
+ }
856
+
857
+ FUNCTION {mastersthesis}
858
+ { output.bibitem
859
+ output.list.label % write author or surrogate label
860
+ output.year
861
+ output.title.quoted
862
+ author "author" required
863
+ title "title" required
864
+ school "school" required
865
+ year "year" required
866
+ format.masters " "
867
+ format.school join ", "
868
+ format.address.only join ", "
869
+ % format.month join ", "
870
+ format.note join
871
+ output.entry
872
+ }
873
+
874
+ FUNCTION {misc}
875
+ { output.bibitem
876
+ output.list.label % write author or surrogate label
877
+ output.year
878
+ author empty$
879
+ { skip$ }
880
+ { output.title.quoted }
881
+ if$
882
+ format.howpublished ", "
883
+ % format.month join ". "
884
+ format.note join
885
+ output.entry
886
+ }
887
+
888
+ FUNCTION {phdthesis}
889
+ { output.bibitem
890
+ output.list.label % write author or surrogate label
891
+ output.year
892
+ output.title.quoted
893
+ author "author" required
894
+ title "title" required
895
+ school "school" required
896
+ year "year" required
897
+ format.phd " "
898
+ format.school join ", "
899
+ format.address.only join ", "
900
+ % format.month join ". "
901
+ format.note join
902
+ output.entry
903
+ }
904
+
905
+ FUNCTION {proceedings}
906
+ { output.bibitem
907
+ output.list.label % write author or surrogate label
908
+ output.year
909
+ title "title" required
910
+ year "year" required
911
+ editor empty$ organization empty$ and
912
+ { skip$ }
913
+ { output.title.quoted }
914
+ if$
915
+ editor empty$
916
+ { "" "" }
917
+ { format.organization ", " }
918
+ if$
919
+ format.address.publisher join ", "
920
+ format.note join
921
+ output.entry
922
+ }
923
+
924
+ FUNCTION {techreport}
925
+ { output.bibitem
926
+ output.list.label % write author or surrogate label
927
+ output.year
928
+ output.title.quoted
929
+ author "author" required
930
+ title "title" required
931
+ institution "institution" required
932
+ year "year" required
933
+ format.institution " "
934
+ format.type join " "
935
+ format.number join ", "
936
+ % format.month join ", "
937
+ format.address.publisher join ". "
938
+ format.note join
939
+ output.entry
940
+ }
941
+
942
+ FUNCTION {unpublished}
943
+ { output.bibitem
944
+ output.list.label % write author or surrogate label
945
+ year empty$
946
+ { skip$ }
947
+ { output.year }
948
+ if$
949
+ output.title.quoted
950
+ author "author" required
951
+ title "title" required
952
+ note "note" required
953
+ format.note
954
+ output.entry
955
+ }
956
+
957
+
958
+ FUNCTION {default.type} { misc }
959
+
960
+ MACRO {jan} {"January"}
961
+
962
+ MACRO {feb} {"February"}
963
+
964
+ MACRO {mar} {"March"}
965
+
966
+ MACRO {apr} {"April"}
967
+
968
+ MACRO {may} {"May"}
969
+
970
+ MACRO {jun} {"June"}
971
+
972
+ MACRO {jul} {"July"}
973
+
974
+ MACRO {aug} {"August"}
975
+
976
+ MACRO {sep} {"September"}
977
+
978
+ MACRO {oct} {"October"}
979
+
980
+ MACRO {nov} {"November"}
981
+
982
+ MACRO {dec} {"December"}
983
+
984
+ READ
985
+
986
+ EXECUTE {init.field.constants}
987
+
988
+ FUNCTION {sortify}
989
+ { purify$
990
+ "l" change.case$
991
+ }
992
+
993
+ FUNCTION {sortify.names}
994
+ { " \harvardand\ " " " replace.substring
995
+ " et~al." " zzz" replace.substring
996
+ sortify
997
+ }
998
+
999
+ FUNCTION {author.key.label}
1000
+ { author empty$
1001
+ { key empty$
1002
+ { title.field 'field.used := }
1003
+ { key.field 'field.used := }
1004
+ if$
1005
+ }
1006
+ { author.field 'field.used := }
1007
+ if$
1008
+ }
1009
+
1010
+ FUNCTION {author.editor.key.label}
1011
+ { author empty$
1012
+ { editor empty$
1013
+ { key empty$
1014
+ { title.field 'field.used := }
1015
+ { key.field 'field.used := }
1016
+ if$
1017
+ }
1018
+ { editor.field 'field.used := }
1019
+ if$
1020
+ }
1021
+ { author.field 'field.used := }
1022
+ if$
1023
+ }
1024
+
1025
+ FUNCTION {author.key.organization.label}
1026
+ { author empty$
1027
+ { key empty$
1028
+ { organization empty$
1029
+ { title.field 'field.used := }
1030
+ { organization.field 'field.used := }
1031
+ if$
1032
+ }
1033
+ { key.field 'field.used := }
1034
+ if$
1035
+ }
1036
+ { author.field 'field.used := }
1037
+ if$
1038
+ }
1039
+
1040
+ FUNCTION {editor.key.organization.label}
1041
+ { editor empty$
1042
+ { key empty$
1043
+ { organization empty$
1044
+ { title.field 'field.used := }
1045
+ { organization.field 'field.used := }
1046
+ if$
1047
+ }
1048
+ { key.field 'field.used := }
1049
+ if$
1050
+ }
1051
+ { editor.field 'field.used := }
1052
+ if$
1053
+ }
1054
+
1055
+ FUNCTION {sort.format.title}
1056
+ { 't :=
1057
+ "A " #2
1058
+ "An " #3
1059
+ "The " #4 t chop.word
1060
+ chop.word
1061
+ chop.word
1062
+ sortify
1063
+ #1 global.max$ substring$
1064
+ }
1065
+
1066
+ FUNCTION {calc.label}
1067
+ { make.label.short
1068
+ title.field field.used =
1069
+ { sort.format.title }
1070
+ { sortify.names }
1071
+ if$
1072
+ year field.or.null purify$ #-1 #4 substring$ sortify
1073
+ *
1074
+ 'sort.label :=
1075
+ }
1076
+
1077
+ FUNCTION {preliminaries}
1078
+ { type$ "book" =
1079
+ type$ "inbook" =
1080
+ or
1081
+ 'author.editor.key.label
1082
+ { type$ "proceedings" =
1083
+ 'editor.key.organization.label
1084
+ { type$ "manual" =
1085
+ 'author.key.organization.label
1086
+ 'author.key.label
1087
+ if$
1088
+ }
1089
+ if$
1090
+ }
1091
+ if$
1092
+ author.field field.used =
1093
+ {
1094
+ author num.names$ #2 >
1095
+ { #1 }
1096
+ { #0 }
1097
+ if$
1098
+ 'etal.required :=
1099
+ }
1100
+ {
1101
+ editor.field field.used =
1102
+ {
1103
+ editor num.names$ #2 >
1104
+ { #1 }
1105
+ { #0 }
1106
+ if$
1107
+ }
1108
+ { #0 }
1109
+ if$
1110
+ 'etal.required :=
1111
+ }
1112
+ if$
1113
+ #1 'etal.allowed :=
1114
+ }
1115
+
1116
+ FUNCTION {first.presort}
1117
+ { calc.label
1118
+ sort.label
1119
+ title.field field.used =
1120
+ { skip$ }
1121
+ { " "
1122
+ *
1123
+ make.list.label sortify.names
1124
+ *
1125
+ " "
1126
+ *
1127
+ title field.or.null
1128
+ sort.format.title
1129
+ *
1130
+ }
1131
+ if$
1132
+ #1 entry.max$ substring$
1133
+ 'sort.key$ :=
1134
+ }
1135
+
1136
+ ITERATE {preliminaries}
1137
+
1138
+ ITERATE {first.presort}
1139
+
1140
+ SORT
1141
+
1142
+ STRINGS { last.sort.label next.extra last.full.label}
1143
+
1144
+ INTEGERS { last.extra.num last.etal.allowed}
1145
+
1146
+ FUNCTION {initialize.confusion}
1147
+ { #0 int.to.chr$ 'last.sort.label :=
1148
+ #0 int.to.chr$ 'last.full.label :=
1149
+ #1 'last.etal.allowed :=
1150
+ }
1151
+
1152
+ FUNCTION {confusion.pass}
1153
+ { last.sort.label sort.label =
1154
+ { last.etal.allowed
1155
+ { last.full.label make.label.full sortify.names =
1156
+ { skip$ }
1157
+ { #0 'etal.allowed :=
1158
+ #0 'last.etal.allowed :=
1159
+ }
1160
+ if$
1161
+ }
1162
+ { #0 'etal.allowed := }
1163
+ if$
1164
+ }
1165
+ { sort.label 'last.sort.label :=
1166
+ make.label.full sortify.names 'last.full.label :=
1167
+ #1 'last.etal.allowed :=
1168
+ }
1169
+ if$
1170
+ }
1171
+
1172
+ EXECUTE {initialize.confusion}
1173
+
1174
+ ITERATE {confusion.pass}
1175
+
1176
+ EXECUTE {initialize.confusion}
1177
+
1178
+ REVERSE {confusion.pass}
1179
+
1180
+ FUNCTION {initialize.last.extra.num}
1181
+ { #0 int.to.chr$ 'last.sort.label :=
1182
+ "" 'next.extra :=
1183
+ #0 'last.extra.num :=
1184
+ }
1185
+
1186
+ FUNCTION {forward.pass}
1187
+ { last.sort.label sort.label =
1188
+ { last.extra.num #1 + 'last.extra.num :=
1189
+ last.extra.num int.to.chr$ 'extra.label :=
1190
+ }
1191
+ { "a" chr.to.int$ 'last.extra.num :=
1192
+ "" 'extra.label :=
1193
+ sort.label 'last.sort.label :=
1194
+ }
1195
+ if$
1196
+ }
1197
+
1198
+ FUNCTION {reverse.pass}
1199
+ { next.extra "b" =
1200
+ { "a" 'extra.label := }
1201
+ 'skip$
1202
+ if$
1203
+ year empty$
1204
+ { "n.d." extra.label emphasize * 'list.year := }
1205
+ { year extra.label emphasize * 'list.year := }
1206
+ if$
1207
+ extra.label 'next.extra :=
1208
+ }
1209
+
1210
+ ITERATE {first.presort}
1211
+
1212
+ SORT
1213
+
1214
+ EXECUTE {initialize.last.extra.num}
1215
+
1216
+ ITERATE {forward.pass}
1217
+
1218
+ REVERSE {reverse.pass}
1219
+
1220
+ FUNCTION {second.presort}
1221
+ { make.list.label
1222
+ title.field field.used =
1223
+ { sort.format.title }
1224
+ { sortify.names }
1225
+ if$
1226
+ " "
1227
+ *
1228
+ list.year field.or.null sortify
1229
+ *
1230
+ " "
1231
+ *
1232
+ title.field field.used =
1233
+ { skip$ }
1234
+ { title field.or.null
1235
+ sort.format.title
1236
+ *
1237
+ }
1238
+ if$
1239
+ #1 entry.max$ substring$
1240
+ 'sort.key$ :=
1241
+ }
1242
+
1243
+ ITERATE {second.presort}
1244
+
1245
+ SORT
1246
+
1247
+ FUNCTION {begin.bib}
1248
+ { newline$ newline$ "% Bibstyle aea.bst version 2009.05.20" write$ newline$ newline$
1249
+ preamble$ empty$
1250
+ 'skip$
1251
+ { "\harvardpreambledefs{%" write$ newline$
1252
+ preamble$ write$ "}" write$ newline$
1253
+ "\harvardpreambletext{%" write$ newline$
1254
+ preamble$ write$ "}" write$ newline$ }
1255
+ if$
1256
+ "\begin{thebibliography}{xx}" write$ newline$
1257
+ }
1258
+
1259
+ EXECUTE {begin.bib}
1260
+
1261
+ ITERATE {call.type$}
1262
+
1263
+ FUNCTION {end.bib}
1264
+ { newline$
1265
+ "\end{thebibliography}" write$ newline$
1266
+ }
1267
+
1268
+ EXECUTE {end.bib}
1269
+