galaaz 0.4.6 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +3575 -118
  3. data/Rakefile +21 -4
  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.Rmd +3 -12
  13. data/blogs/galaaz_ggplot/galaaz_ggplot.html +77 -222
  14. data/blogs/galaaz_ggplot/galaaz_ggplot.md +4 -31
  15. data/blogs/galaaz_ggplot/galaaz_ggplot.pdf +0 -0
  16. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
  17. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
  18. data/blogs/galaaz_ggplot/midwest.Rmd +1 -9
  19. data/blogs/gknit/gknit.Rmd +232 -123
  20. data/blogs/{dev/dev.html → gknit/gknit.html} +1897 -33
  21. data/blogs/gknit/gknit.pdf +0 -0
  22. data/blogs/gknit/lst.rds +0 -0
  23. data/blogs/gknit/stats.bib +27 -0
  24. data/blogs/manual/lst.rds +0 -0
  25. data/blogs/manual/manual.Rmd +1893 -47
  26. data/blogs/manual/manual.html +3153 -347
  27. data/blogs/manual/manual.md +3575 -118
  28. data/blogs/manual/manual.pdf +0 -0
  29. data/blogs/manual/manual.tex +4026 -0
  30. data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
  31. data/blogs/manual/manual_files/figure-html/diverging_bar.png +0 -0
  32. data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
  33. data/blogs/manual/manual_files/figure-latex/diverging_bar.pdf +0 -0
  34. data/blogs/{dev → manual}/model.rb +0 -0
  35. data/blogs/nse_dplyr/nse_dplyr.Rmd +849 -0
  36. data/blogs/nse_dplyr/nse_dplyr.html +878 -0
  37. data/blogs/nse_dplyr/nse_dplyr.md +1198 -0
  38. data/blogs/nse_dplyr/nse_dplyr.pdf +0 -0
  39. data/blogs/oh_my/oh_my.html +274 -386
  40. data/blogs/oh_my/oh_my.md +208 -205
  41. data/blogs/ruby_plot/ruby_plot.Rmd +64 -84
  42. data/blogs/ruby_plot/ruby_plot.html +235 -208
  43. data/blogs/ruby_plot/ruby_plot.md +239 -34
  44. data/blogs/ruby_plot/ruby_plot.pdf +0 -0
  45. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
  46. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
  47. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
  48. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
  49. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
  50. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
  51. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
  52. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
  53. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
  54. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
  55. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
  56. data/examples/Bibliography/master.bib +50 -0
  57. data/examples/Bibliography/stats.bib +72 -0
  58. data/examples/islr/ch2.spec.rb +1 -1
  59. data/examples/islr/ch3_boston.rb +4 -4
  60. data/examples/islr/x_y_rnorm.jpg +0 -0
  61. data/examples/latex_templates/Test-acm_article/Makefile +16 -0
  62. data/examples/latex_templates/Test-acm_article/Test-acm_article.Rmd +65 -0
  63. data/examples/latex_templates/Test-acm_article/acm_proc_article-sp.cls +1670 -0
  64. data/examples/latex_templates/Test-acm_article/sensys-abstract.cls +703 -0
  65. data/examples/latex_templates/Test-acm_article/sigproc.bib +59 -0
  66. data/examples/latex_templates/Test-acs_article/Test-acs_article.Rmd +260 -0
  67. data/examples/latex_templates/Test-acs_article/Test-acs_article.pdf +0 -0
  68. data/examples/latex_templates/Test-acs_article/acs-Test-acs_article.bib +11 -0
  69. data/examples/latex_templates/Test-acs_article/acs-my_output.bib +11 -0
  70. data/examples/latex_templates/Test-acs_article/acstest.bib +17 -0
  71. data/examples/latex_templates/Test-aea_article/AEA.cls +1414 -0
  72. data/examples/latex_templates/Test-aea_article/BibFile.bib +0 -0
  73. data/examples/latex_templates/Test-aea_article/Test-aea_article.Rmd +108 -0
  74. data/examples/latex_templates/Test-aea_article/Test-aea_article.pdf +0 -0
  75. data/examples/latex_templates/Test-aea_article/aea.bst +1269 -0
  76. data/examples/latex_templates/Test-aea_article/multicol.sty +853 -0
  77. data/examples/latex_templates/Test-aea_article/references.bib +0 -0
  78. data/examples/latex_templates/Test-aea_article/setspace.sty +546 -0
  79. data/examples/latex_templates/Test-amq_article/Test-amq_article.Rmd +256 -0
  80. data/examples/latex_templates/Test-amq_article/Test-amq_article.pdf +0 -0
  81. data/examples/latex_templates/Test-amq_article/Test-amq_article.pdfsync +3397 -0
  82. data/examples/latex_templates/Test-amq_article/pics/Figure2.pdf +0 -0
  83. data/examples/latex_templates/Test-ams_article/Test-ams_article.Rmd +215 -0
  84. data/examples/latex_templates/Test-ams_article/amstest.bib +436 -0
  85. data/examples/latex_templates/Test-asa_article/Test-asa_article.Rmd +153 -0
  86. data/examples/latex_templates/Test-asa_article/Test-asa_article.pdf +0 -0
  87. data/examples/latex_templates/Test-asa_article/agsm.bst +1353 -0
  88. data/examples/latex_templates/Test-asa_article/bibliography.bib +233 -0
  89. data/examples/latex_templates/Test-ieee_article/IEEEtran.bst +2409 -0
  90. data/examples/latex_templates/Test-ieee_article/IEEEtran.cls +6346 -0
  91. data/examples/latex_templates/Test-ieee_article/Test-ieee_article.Rmd +175 -0
  92. data/examples/latex_templates/Test-ieee_article/Test-ieee_article.pdf +0 -0
  93. data/examples/latex_templates/Test-ieee_article/mybibfile.bib +20 -0
  94. data/examples/latex_templates/Test-rjournal_article/RJournal.sty +335 -0
  95. data/examples/latex_templates/Test-rjournal_article/RJreferences.bib +18 -0
  96. data/examples/latex_templates/Test-rjournal_article/RJwrapper.pdf +0 -0
  97. data/examples/latex_templates/Test-rjournal_article/Test-rjournal_article.Rmd +52 -0
  98. data/examples/latex_templates/Test-springer_article/Test-springer_article.Rmd +65 -0
  99. data/examples/latex_templates/Test-springer_article/Test-springer_article.pdf +0 -0
  100. data/examples/latex_templates/Test-springer_article/bibliography.bib +26 -0
  101. data/examples/latex_templates/Test-springer_article/spbasic.bst +1658 -0
  102. data/examples/latex_templates/Test-springer_article/spmpsci.bst +1512 -0
  103. data/examples/latex_templates/Test-springer_article/spphys.bst +1443 -0
  104. data/examples/latex_templates/Test-springer_article/svglov3.clo +113 -0
  105. data/examples/latex_templates/Test-springer_article/svjour3.cls +1431 -0
  106. data/examples/misc/moneyball.rb +1 -1
  107. data/examples/misc/subsetting.rb +37 -37
  108. data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.Rmd +73 -0
  109. data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.pdf +0 -0
  110. data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.Rmd +382 -0
  111. data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.pdf +0 -0
  112. data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.Rmd +164 -0
  113. data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.pdf +0 -0
  114. data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.Rmd +92 -0
  115. data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.pdf +0 -0
  116. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/attend-grade-relationships.csv +482 -0
  117. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.Rmd +280 -0
  118. data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.pdf +0 -0
  119. data/examples/rmarkdown/svm-xaringan-example/svm-xaringan-example.Rmd +386 -0
  120. data/lib/R_interface/r.rb +2 -2
  121. data/lib/R_interface/r_libs.R +6 -1
  122. data/lib/R_interface/r_methods.rb +12 -2
  123. data/lib/R_interface/rdata_frame.rb +8 -17
  124. data/lib/R_interface/rindexed_object.rb +1 -2
  125. data/lib/R_interface/rlist.rb +1 -0
  126. data/lib/R_interface/robject.rb +20 -23
  127. data/lib/R_interface/rpkg.rb +15 -6
  128. data/lib/R_interface/rsupport.rb +13 -19
  129. data/lib/R_interface/ruby_extensions.rb +14 -18
  130. data/lib/R_interface/rvector.rb +0 -12
  131. data/lib/gknit.rb +2 -0
  132. data/lib/gknit/draft.rb +105 -0
  133. data/lib/gknit/knitr_engine.rb +6 -37
  134. data/lib/util/exec_ruby.rb +22 -84
  135. data/lib/util/inline_file.rb +7 -3
  136. data/specs/figures/bg.jpeg +0 -0
  137. data/specs/figures/bg.png +0 -0
  138. data/specs/figures/bg.svg +2 -2
  139. data/specs/figures/dose_len.png +0 -0
  140. data/specs/figures/no_args.jpeg +0 -0
  141. data/specs/figures/no_args.png +0 -0
  142. data/specs/figures/no_args.svg +2 -2
  143. data/specs/figures/width_height.jpeg +0 -0
  144. data/specs/figures/width_height.png +0 -0
  145. data/specs/figures/width_height_units1.jpeg +0 -0
  146. data/specs/figures/width_height_units1.png +0 -0
  147. data/specs/figures/width_height_units2.jpeg +0 -0
  148. data/specs/figures/width_height_units2.png +0 -0
  149. data/specs/r_dataframe.spec.rb +184 -11
  150. data/specs/r_list.spec.rb +4 -4
  151. data/specs/r_list_apply.spec.rb +11 -10
  152. data/specs/ruby_expression.spec.rb +3 -11
  153. data/specs/tmp.rb +106 -34
  154. data/version.rb +1 -1
  155. metadata +96 -33
  156. data/bin/gknit_old_r +0 -236
  157. data/blogs/dev/dev.Rmd +0 -77
  158. data/blogs/dev/dev.md +0 -87
  159. data/blogs/dev/dev_files/figure-html/bubble-1.png +0 -0
  160. data/blogs/dev/dev_files/figure-html/diverging_bar. +0 -0
  161. data/blogs/dev/dev_files/figure-html/diverging_bar.png +0 -0
  162. data/blogs/dplyr/dplyr.rb +0 -63
  163. data/blogs/galaaz_ggplot/galaaz_ggplot.aux +0 -43
  164. data/blogs/galaaz_ggplot/galaaz_ggplot.log +0 -640
  165. data/blogs/galaaz_ggplot/galaaz_ggplot.out +0 -10
  166. data/blogs/galaaz_ggplot/galaaz_ggplot.tex +0 -481
  167. data/blogs/galaaz_ggplot/midwest.png +0 -0
  168. data/blogs/galaaz_ggplot/scatter_plot.png +0 -0
  169. data/blogs/ruby_plot/ruby_plot.Rmd_external_figs +0 -662
  170. data/blogs/ruby_plot/ruby_plot.tex +0 -1077
  171. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.svg +0 -57
  172. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.svg +0 -106
  173. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.svg +0 -110
  174. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.svg +0 -174
  175. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.svg +0 -236
  176. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.svg +0 -296
  177. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.svg +0 -236
  178. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.svg +0 -218
  179. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.svg +0 -128
  180. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.svg +0 -150
  181. data/examples/paper/paper.rb +0 -36
@@ -0,0 +1,175 @@
1
+ ---
2
+ title: Bare Demo of IEEEtran.cls for IEEE Conferences
3
+ affiliation:
4
+ ## use one only of the following
5
+ # author-columnar: true ## one column per author
6
+ institution-columnar: true ## one column per institution (multiple autors eventually)
7
+ # wide: true ## one column wide author/affiliation fields
8
+
9
+ institution:
10
+ - name: Georgia Institute of Technology
11
+ department: School of Electrical and Computer Engineering
12
+ location: Atlanta, Georgia 30332--0250
13
+ email: ece@datech.edu
14
+ mark: 1
15
+ author:
16
+ - name: Michael Shell
17
+ - name: Twentieth Century Fox
18
+ location: Springfield, USA
19
+ mark: 2
20
+ author:
21
+ - name: Homer Simpson
22
+ email: homer@thesimpsons.com
23
+ - name: Starfleet Academy
24
+ location: San Francisco, California 96678-2391
25
+ other: "Telephone: (800) 555--1212, Fax: (888) 555--1212"
26
+ mark: 3
27
+ author:
28
+ - name: Montgomery Scott
29
+ - name: Tyrell Inc.
30
+ location: 123 Replicant Street, Los Angeles, USA 90210--4321
31
+ mark: 4
32
+ author:
33
+ - name: Eldon Tyrell
34
+ email: eldon@starfleet-academy.star
35
+ - name: Roy Batty
36
+ email: roy@replicant.offworld
37
+ abstract: |
38
+ The abstract goes here.
39
+ On multiple lines eventually.
40
+
41
+ bibliography: mybibfile.bib
42
+ output: rticles::ieee_article
43
+ ---
44
+
45
+ Introduction
46
+ =============
47
+ <!-- no \IEEEPARstart -->
48
+ This demo file is intended to serve as a ``starter file''
49
+ for IEEE conference papers produced under \LaTeX\ using
50
+ IEEEtran.cls version 1.8b and later.
51
+ <!-- You must have at least 2 lines in the paragraph with the drop letter -->
52
+ <!-- (should never be an issue) -->
53
+ I wish you the best of success.
54
+
55
+
56
+ ## Subsection Heading Here
57
+ Subsection text here.
58
+
59
+ ### Subsubsection Heading Here
60
+ Subsubsection text here.
61
+
62
+ <!-- An example of a floating figure using the graphicx package. -->
63
+ <!-- Note that \label must occur AFTER (or within) \caption. -->
64
+ <!-- For figures, \caption should occur after the \includegraphics. -->
65
+ <!-- Note that IEEEtran v1.7 and later has special internal code that -->
66
+ <!-- is designed to preserve the operation of \label within \caption -->
67
+ <!-- even when the captionsoff option is in effect. However, because -->
68
+ <!-- of issues like this, it may be the safest practice to put all your -->
69
+ <!-- \label just after \caption rather than within \caption{}. -->
70
+
71
+ <!-- Reminder: the "draftcls" or "draftclsnofoot", not "draft", class -->
72
+ <!-- option should be used if it is desired that the figures are to be -->
73
+ <!-- displayed while in draft mode. -->
74
+
75
+ <!-- \begin{figure}[!t] -->
76
+ <!-- \centering -->
77
+ <!-- \includegraphics[width=2.5in]{myfigure} -->
78
+ <!-- where an .eps filename suffix will be assumed under latex, -->
79
+ <!-- and a .pdf suffix will be assumed for pdflatex; or what has been declared -->
80
+ <!-- via \DeclareGraphicsExtensions. -->
81
+ <!-- \caption{Simulation results for the network.} -->
82
+ <!-- \label{fig_sim} -->
83
+ <!-- \end{figure} -->
84
+
85
+ <!-- Note that the IEEE typically puts floats only at the top, even when this -->
86
+ <!-- results in a large percentage of a column being occupied by floats. -->
87
+
88
+
89
+ <!-- An example of a double column floating figure using two subfigures. -->
90
+ <!-- (The subfig.sty package must be loaded for this to work.) -->
91
+ <!-- The subfigure \label commands are set within each subfloat command, -->
92
+ <!-- and the \label for the overall figure must come after \caption. -->
93
+ <!-- \hfil is used as a separator to get equal spacing. -->
94
+ <!-- Watch out that the combined width of all the subfigures on a -->
95
+ <!-- line do not exceed the text width or a line break will occur. -->
96
+
97
+ <!-- \begin{figure*}[!t] -->
98
+ <!-- \centering -->
99
+ <!-- \subfloat[Case I]{\includegraphics[width=2.5in]{box}% -->
100
+ <!-- \label{fig_first_case}} -->
101
+ <!-- \hfil -->
102
+ <!-- \subfloat[Case II]{\includegraphics[width=2.5in]{box}% -->
103
+ <!-- \label{fig_second_case}} -->
104
+ <!-- \caption{Simulation results for the network.} -->
105
+ <!-- \label{fig_sim} -->
106
+ <!-- \end{figure*} -->
107
+
108
+ <!-- Note that often IEEE papers with subfigures do not employ subfigure -->
109
+ <!-- captions (using the optional argument to \subfloat[]), but instead will -->
110
+ <!-- reference/describe all of them (a), (b), etc., within the main caption. -->
111
+ <!-- Be aware that for subfig.sty to generate the (a), (b), etc., subfigure -->
112
+ <!-- labels, the optional argument to \subfloat must be present. If a -->
113
+ <!-- subcaption is not desired, just leave its contents blank, -->
114
+ <!-- e.g., \subfloat[]. -->
115
+
116
+
117
+ <!-- An example of a floating table. Note that, for IEEE style tables, the -->
118
+ <!-- \caption command should come BEFORE the table and, given that table -->
119
+ <!-- captions serve much like titles, are usually capitalized except for words -->
120
+ <!-- such as a, an, and, as, at, but, by, for, in, nor, of, on, or, the, to -->
121
+ <!-- and up, which are usually not capitalized unless they are the first or -->
122
+ <!-- last word of the caption. Table text will default to \footnotesize as -->
123
+ <!-- the IEEE normally uses this smaller font for tables. -->
124
+ <!-- The \label must come after \caption as always. -->
125
+
126
+ <!-- \begin{table}[!t] -->
127
+ <!-- % increase table row spacing, adjust to taste -->
128
+ <!-- \renewcommand{\arraystretch}{1.3} -->
129
+ <!-- if using array.sty, it might be a good idea to tweak the value of -->
130
+ <!-- \extrarowheight as needed to properly center the text within the cells -->
131
+ <!-- \caption{An Example of a Table} -->
132
+ <!-- \label{table_example} -->
133
+ <!-- \centering -->
134
+ <!-- % Some packages, such as MDW tools, offer better commands for making tables -->
135
+ <!-- % than the plain LaTeX2e tabular which is used here. -->
136
+ <!-- \begin{tabular}{|c||c|} -->
137
+ <!-- \hline -->
138
+ <!-- One & Two\\ -->
139
+ <!-- \hline -->
140
+ <!-- Three & Four\\ -->
141
+ <!-- \hline -->
142
+ <!-- \end{tabular} -->
143
+ <!-- \end{table} -->
144
+
145
+
146
+ <!-- Note that the IEEE does not put floats in the very first column -->
147
+ <!-- - or typically anywhere on the first page for that matter. Also, -->
148
+ <!-- in-text middle ("here") positioning is typically not used, but it -->
149
+ <!-- is allowed and encouraged for Computer Society conferences (but -->
150
+ <!-- not Computer Society journals). Most IEEE journals/conferences use -->
151
+ <!-- top floats exclusively. -->
152
+ <!-- Note that, LaTeX2e, unlike IEEE journals/conferences, places -->
153
+ <!-- footnotes above bottom floats. This can be corrected via the -->
154
+ <!-- \fnbelowfloat command of the stfloats package. -->
155
+
156
+
157
+ Conclusion
158
+ ============
159
+ The conclusion goes here.
160
+
161
+ <!-- conference papers do not normally have an appendix -->
162
+
163
+ Acknowledgment {#acknowledgment}
164
+ ==============
165
+
166
+ The authors would like to thank...
167
+
168
+ Bibliography styles
169
+ ===================
170
+
171
+ Here are two sample references: @Feynman1963118 [@Dirac1953888].
172
+
173
+ \newpage
174
+ References {#references .numbered}
175
+ ==========
@@ -0,0 +1,20 @@
1
+ @article{Dirac1953888,
2
+ title = "The lorentz transformation and absolute time",
3
+ journal = "Physica",
4
+ volume = "19",
5
+ number = "1--12",
6
+ pages = "888--896",
7
+ year = "1953",
8
+ doi = "10.1016/S0031-8914(53)80099-6",
9
+ author = "P.A.M. Dirac"
10
+ }
11
+
12
+ @article{Feynman1963118,
13
+ title = "The theory of a general quantum system interacting with a linear dissipative system",
14
+ journal = "Annals of Physics ",
15
+ volume = "24",
16
+ pages = "118--173",
17
+ year = "1963",
18
+ doi = "10.1016/0003-4916(63)90068-X",
19
+ author = "R.P Feynman and F.L {Vernon Jr.}"
20
+ }
@@ -0,0 +1,335 @@
1
+ % Package `RJournal' to use with LaTeX2e
2
+ % Copyright (C) 2010 by the R Foundation
3
+ % Copyright (C) 2013 by the R Journal
4
+ %
5
+ % Originally written by Kurt Hornik and Friedrich Leisch with subsequent
6
+ % edits by the editorial board
7
+
8
+ \NeedsTeXFormat{LaTeX2e}[1995/12/01]
9
+ \ProvidesPackage{RJournal}[2013/08/27 v0.13 RJournal package]
10
+
11
+ \RequirePackage{tikz}
12
+
13
+ % Overall page layout, fonts etc -----------------------------------------------
14
+
15
+ % Issues of of \emph{The R Journal} are created from the standard \LaTeX{}
16
+ % document class \pkg{report}.
17
+
18
+ \RequirePackage{geometry}
19
+ \geometry{a4paper,
20
+ textwidth=14cm, top=1cm, bottom=1cm,
21
+ includehead,includefoot,centering,
22
+ footskip=1.5cm}
23
+ \raggedbottom
24
+
25
+ \RequirePackage{fancyhdr}
26
+ \fancyhead{}
27
+ \fancyheadoffset{2cm}
28
+ \fancyhead[L]{\textsc{\RJ@sectionhead}}
29
+ \fancyhead[R]{\thepage}
30
+ \fancyfoot{}
31
+ \fancyfoot[L]{The R Journal Vol. \RJ@volume/\RJ@number, \RJ@month}
32
+ \fancyfoot[R]{ISSN 2073-4859}
33
+ \pagestyle{fancy}
34
+
35
+ % We use the following fonts (all with T1 encoding):
36
+ %
37
+ % rm & palatino
38
+ % tt & inconsolata
39
+ % sf & helvetica
40
+ % math & palatino
41
+
42
+ \RequirePackage{microtype}
43
+
44
+ \RequirePackage[scaled=0.92]{helvet}
45
+ \RequirePackage{palatino,mathpazo}
46
+ \RequirePackage[scaled=1.02]{inconsolata}
47
+ \RequirePackage[T1]{fontenc}
48
+
49
+ \RequirePackage[hyphens]{url}
50
+ \RequirePackage[pagebackref]{hyperref}
51
+ \renewcommand{\backref}[1]{[p#1]}
52
+
53
+ % Dark blue colour for all links
54
+ \RequirePackage{color}
55
+ \definecolor{link}{rgb}{0.45,0.51,0.67}
56
+ \hypersetup{
57
+ colorlinks,%
58
+ citecolor=link,%
59
+ filecolor=link,%
60
+ linkcolor=link,%
61
+ urlcolor=link
62
+ }
63
+
64
+ % Give the text a little room to breath
65
+ \setlength{\parskip}{3pt}
66
+ \RequirePackage{setspace}
67
+ \setstretch{1.05}
68
+
69
+ % Issue and article metadata ---------------------------------------------------
70
+
71
+ % Basic front matter information about the issue: volume, number, and
72
+ % date.
73
+
74
+ \newcommand{\volume}[1]{\def\RJ@volume{#1}}
75
+ \newcommand{\volnumber}[1]{\def\RJ@number{#1}}
76
+ \renewcommand{\month}[1]{\def\RJ@month{#1}}
77
+ \renewcommand{\year}[1]{\def\RJ@year{#1}}
78
+
79
+
80
+ % Individual articles correspond to
81
+ % chapters, and are contained in |article| environments. This makes it
82
+ % easy to have figures counted within articles and hence hyperlinked
83
+ % correctly.
84
+
85
+ % An article has an author, a title, and optionally a subtitle. We use
86
+ % the obvious commands for specifying these. Articles will be put in certain
87
+ % journal sections, named by \sectionhead.
88
+
89
+ \newcommand {\sectionhead} [1]{\def\RJ@sectionhead{#1}}
90
+ \renewcommand{\author} [1]{\def\RJ@author{#1}}
91
+ \renewcommand{\title} [1]{\def\RJ@title{#1}}
92
+ \newcommand {\subtitle} [1]{\def\RJ@subtitle{#1}}
93
+
94
+ % Control appearance of titles: make slightly smaller than usual, and
95
+ % suppress section numbering. See http://tex.stackexchange.com/questions/69749
96
+ % for why we don't use \setcounter{secnumdepth}{-1}
97
+
98
+ \usepackage[medium]{titlesec}
99
+ \usepackage{titletoc}
100
+ \titleformat{\section} {\normalfont\large\bfseries}{}{0em}{}
101
+ \titleformat{\subsection}{\normalfont\normalsize\bfseries}{}{0em}{}
102
+ \titlecontents{chapter} [0em]{}{}{}{\titlerule*[1em]{.}\contentspage}
103
+
104
+ % Article layout ---------------------------------------------------------------
105
+
106
+ % Environment |article| clears the article header information at its beginning.
107
+ % We use |\FloatBarrier| from the placeins package to keep floats within
108
+ % the article.
109
+ \RequirePackage{placeins}
110
+ \newenvironment{article}{\author{}\title{}\subtitle{}\FloatBarrier}{\FloatBarrier}
111
+
112
+ % Refereed articles should have an abstract, so we redefine |\abstract| to
113
+ % give the desired style
114
+
115
+ \renewcommand{\abstract}[1]{%
116
+ \setstretch{1}%
117
+ \noindent%
118
+ \small%
119
+ \textbf{Abstract} #1
120
+ }
121
+
122
+ % The real work is done by a redefined version of |\maketitle|. Note
123
+ % that even though we do not want chapters (articles) numbered, we
124
+ % need to increment the chapter counter, so that figures get correct
125
+ % labelling.
126
+
127
+ \renewcommand{\maketitle}{%
128
+ \noindent
129
+ \chapter{\RJ@title}\refstepcounter{chapter}
130
+ \ifx\empty\RJ@subtitle
131
+ \else
132
+ \noindent\textbf{\RJ@subtitle}
133
+ \par\nobreak\addvspace{\baselineskip}
134
+ \fi
135
+ \ifx\empty\RJ@author
136
+ \else
137
+ \noindent\textit{\RJ@author}
138
+ \par\nobreak\addvspace{\baselineskip}
139
+ \fi
140
+ \@afterindentfalse\@nobreaktrue\@afterheading
141
+ }
142
+
143
+ % Now for some ugly redefinitions. We do not want articles to start a
144
+ % new page. (Actually, we do, but this is handled via explicit
145
+ % \newpage
146
+ %
147
+ % The name@of@eq is a hack to get hyperlinks to equations to work
148
+ % within each article, even though there may be multiple eq.(1)
149
+ % \begin{macrocode}
150
+ \renewcommand\chapter{\secdef\RJ@chapter\@schapter}
151
+ \providecommand{\nohyphens}{%
152
+ \hyphenpenalty=10000\exhyphenpenalty=10000\relax}
153
+ \newcommand{\RJ@chapter}{%
154
+ \edef\name@of@eq{equation.\@arabic{\c@chapter}}%
155
+ \renewcommand{\@seccntformat}[1]{}%
156
+ \@startsection{chapter}{0}{0mm}{%
157
+ -2\baselineskip \@plus -\baselineskip \@minus -.2ex}{\p@}{%
158
+ \phantomsection\normalfont\huge\bfseries\raggedright}}
159
+
160
+ % Book reviews should appear as sections in the text and in the pdf bookmarks,
161
+ % however we wish them to appear as chapters in the TOC. Thus we define an
162
+ % alternative to |\maketitle| for reviews.
163
+ \newcommand{\review}[1]{
164
+ \pdfbookmark[1]{#1}{#1}
165
+ \section*{#1}
166
+ \addtocontents{toc}{\protect\contentsline{chapter}{#1}{\thepage}{#1.1}}
167
+ }
168
+
169
+ % We want bibliographies as starred sections within articles.
170
+ %
171
+ \RequirePackage[sectionbib,round]{natbib}
172
+ \bibliographystyle{abbrvnat}
173
+
174
+ % Equations, figures and tables are counted within articles, but we do
175
+ % not show the article number. For equations it becomes a bit messy to avoid
176
+ % having hyperref getting it wrong.
177
+
178
+ % \numberwithin{equation}{chapter}
179
+ \renewcommand{\theequation}{\@arabic\c@equation}
180
+ \renewcommand{\thefigure}{\@arabic\c@figure}
181
+ \renewcommand{\thetable}{\@arabic\c@table}
182
+
183
+ % Issue layout -----------------------------------------------------------------
184
+
185
+ % Need to provide our own version of |\tableofcontents|. We use the
186
+ % tikz package to get the rounded rectangle. Notice that |\section*|
187
+ % is really the same as |\chapter*|.
188
+ \renewcommand{\contentsname}{Contents}
189
+ \renewcommand\tableofcontents{%
190
+ \vspace{1cm}
191
+ \section*{\contentsname}
192
+ { \@starttoc{toc} }
193
+ }
194
+
195
+ \renewcommand{\titlepage}{%
196
+ \thispagestyle{empty}
197
+ \hypersetup{
198
+ pdftitle={The R Journal Volume \RJ@volume/\RJ@number, \RJ@month \RJ@year},%
199
+ pdfauthor={R Foundation for Statistical Computing},%
200
+ }
201
+ \noindent
202
+ \begin{center}
203
+ \fontsize{50pt}{50pt}\selectfont
204
+ The \raisebox{-8pt}{\includegraphics[height=77pt]{Rlogo-4}}\hspace{10pt}
205
+ Journal
206
+
207
+ \end{center}
208
+ {\large \hfill Volume \RJ@volume/\RJ@number, \RJ@month{} \RJ@year \quad}
209
+
210
+ \rule{\textwidth}{1pt}
211
+ \begin{center}
212
+ {\Large A peer-reviewed, open-access publication of the \\
213
+ R Foundation for Statistical Computing}
214
+ \end{center}
215
+
216
+ % And finally, put in the TOC box. Note the way |tocdepth| is adjusted
217
+ % before and after producing the TOC: thus, we can ensure that only
218
+ % articles show up in the printed TOC, but that in the PDF version,
219
+ % bookmarks are created for sections and subsections as well (provided
220
+ % that the non-starred forms are used).
221
+ \setcounter{tocdepth}{0}
222
+ \tableofcontents
223
+ \setcounter{tocdepth}{2}
224
+ \clearpage
225
+ }
226
+
227
+ % Text formatting --------------------------------------------------------------
228
+
229
+ \newcommand{\R}{R}
230
+ \newcommand{\address}[1]{\addvspace{\baselineskip}\noindent\emph{#1}}
231
+ \newcommand{\email}[1]{\href{mailto:#1}{\normalfont\texttt{#1}}}
232
+
233
+ % Simple font selection is not good enough. For example, |\texttt{--}|
234
+ % gives `\texttt{--}', i.e., an endash in typewriter font. Hence, we
235
+ % need to turn off ligatures, which currently only happens for commands
236
+ % |\code| and |\samp| and the ones derived from them. Hyphenation is
237
+ % another issue; it should really be turned off inside |\samp|. And
238
+ % most importantly, \LaTeX{} special characters are a nightmare. E.g.,
239
+ % one needs |\~{}| to produce a tilde in a file name marked by |\file|.
240
+ % Perhaps a few years ago, most users would have agreed that this may be
241
+ % unfortunate but should not be changed to ensure consistency. But with
242
+ % the advent of the WWW and the need for getting `|~|' and `|#|' into
243
+ % URLs, commands which only treat the escape and grouping characters
244
+ % specially have gained acceptance
245
+
246
+ \DeclareRobustCommand\code{\bgroup\@noligs\@codex}
247
+ \def\@codex#1{\texorpdfstring%
248
+ {{\normalfont\ttfamily\hyphenchar\font=-1 #1}}%
249
+ {#1}\egroup}
250
+ \newcommand{\kbd}[1]{{\normalfont\texttt{#1}}}
251
+ \newcommand{\key}[1]{{\normalfont\texttt{\uppercase{#1}}}}
252
+ \DeclareRobustCommand\samp{`\bgroup\@noligs\@sampx}
253
+ \def\@sampx#1{{\normalfont\texttt{#1}}\egroup'}
254
+ \newcommand{\var}[1]{{\normalfont\textsl{#1}}}
255
+ \let\env=\code
256
+ \newcommand{\file}[1]{{`\normalfont\textsf{#1}'}}
257
+ \let\command=\code
258
+ \let\option=\samp
259
+ \newcommand{\dfn}[1]{{\normalfont\textsl{#1}}}
260
+ % \acronym is effectively disabled since not used consistently
261
+ \newcommand{\acronym}[1]{#1}
262
+ \newcommand{\strong}[1]{\texorpdfstring%
263
+ {{\normalfont\fontseries{b}\selectfont #1}}%
264
+ {#1}}
265
+ \let\pkg=\strong
266
+ \newcommand{\CRANpkg}[1]{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}%
267
+ \let\cpkg=\CRANpkg
268
+ \newcommand{\ctv}[1]{\href{http://CRAN.R-project.org/view=#1}{\emph{#1}}}
269
+ \newcommand{\BIOpkg}[1]{\href{http://www.bioconductor.org/packages/release/bioc/html/#1.html}{\pkg{#1}}}
270
+
271
+ % Example environments ---------------------------------------------------------
272
+ \RequirePackage{fancyvrb}
273
+ \RequirePackage{alltt}
274
+
275
+ \DefineVerbatimEnvironment{example}{Verbatim}{}
276
+ \renewenvironment{example*}{\begin{alltt}}{\end{alltt}}
277
+
278
+ % Support for output from Sweave, and generic session style code
279
+ % These used to have fontshape=sl for Sinput/Scode/Sin, but pslatex
280
+ % won't use a condensed font in that case.
281
+
282
+ \DefineVerbatimEnvironment{Sinput}{Verbatim}{fontsize=\small}
283
+ \DefineVerbatimEnvironment{Soutput}{Verbatim}{fontsize=\small}
284
+ \DefineVerbatimEnvironment{Scode}{Verbatim}{fontsize=\small}
285
+ \DefineVerbatimEnvironment{Sin}{Verbatim}{fontsize=\small}
286
+ \DefineVerbatimEnvironment{Sout}{Verbatim}{fontsize=\small}
287
+ \newenvironment{Schunk}{}{}
288
+
289
+ % Mathematics ------------------------------------------------------------------
290
+
291
+ % The implementation of |\operatorname| is similar to the mechanism
292
+ % \LaTeXe{} uses for functions like sin and cos, and simpler than the
293
+ % one of \AmSLaTeX{}. We use |\providecommand| for the definition in
294
+ % order to keep the one of the \pkg{amstex} if this package has
295
+ % already been loaded.
296
+ % \begin{macrocode}
297
+ \providecommand{\operatorname}[1]{%
298
+ \mathop{\operator@font#1}\nolimits}
299
+ \RequirePackage{amsfonts}
300
+
301
+ \renewcommand{\P}{%
302
+ \mathop{\operator@font I\hspace{-1.5pt}P\hspace{.13pt}}}
303
+ \newcommand{\E}{%
304
+ \mathop{\operator@font I\hspace{-1.5pt}E\hspace{.13pt}}}
305
+ \newcommand{\VAR}{\operatorname{var}}
306
+ \newcommand{\COV}{\operatorname{cov}}
307
+ \newcommand{\COR}{\operatorname{cor}}
308
+
309
+ % Figures ----------------------------------------------------------------------
310
+
311
+ \RequirePackage[font=small,labelfont=bf]{caption}
312
+
313
+ % Wide environments for figures and tables -------------------------------------
314
+ \RequirePackage{environ}
315
+
316
+ % An easy way to make a figure span the full width of the page
317
+ \NewEnviron{widefigure}[1][]{
318
+ \begin{figure}[#1]
319
+ \advance\leftskip-2cm
320
+ \begin{minipage}{\dimexpr\textwidth+4cm\relax}%
321
+ \captionsetup{margin=2cm}
322
+ \BODY
323
+ \end{minipage}%
324
+ \end{figure}
325
+ }
326
+
327
+ \NewEnviron{widetable}[1][]{
328
+ \begin{table}[#1]
329
+ \advance\leftskip-2cm
330
+ \begin{minipage}{\dimexpr\textwidth+4cm\relax}%
331
+ \captionsetup{margin=2cm}
332
+ \BODY
333
+ \end{minipage}%
334
+ \end{table}
335
+ }