galaaz 2.1.8 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/Rakefile +20 -2
- data/bin/check_gemfile_lock_version +46 -0
- data/bin/release_bump +26 -0
- data/blogs/README.md +4 -0
- data/blogs/galaaz_2_0/galaaz_2_0.Rmd +385 -0
- data/blogs/galaaz_2_0/galaaz_2_0.md +409 -0
- data/blogs/galaaz_2_0/galaaz_2_0.tex +756 -0
- data/blogs/galaaz_2_0/images/galaaz-header.png +0 -0
- data/blogs/galaaz_2_0/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +14 -1
- data/blogs/galaaz_ggplot/galaaz_ggplot.md +123 -103
- data/blogs/galaaz_ggplot/galaaz_ggplot.tex +60 -23
- data/blogs/galaaz_ggplot/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/gknit/gknit.Rmd +16 -1
- data/blogs/gknit/gknit.md +13 -1
- data/blogs/gknit/gknit.tex +64 -23
- data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
- data/blogs/gknit/gknit_files/figure-latex/bubble-1.png +0 -0
- data/blogs/gknit/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/manual/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/manual/manual.Rmd +32 -11
- data/blogs/manual/manual.md +30 -23
- data/blogs/manual/manual.tex +88 -66
- data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
- data/blogs/nse_dplyr/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/nse_dplyr/nse_dplyr.Rmd +14 -1
- data/blogs/nse_dplyr/nse_dplyr.md +697 -649
- data/blogs/nse_dplyr/nse_dplyr.tex +61 -24
- data/blogs/oh_my/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/oh_my/oh_my.Rmd +14 -1
- data/blogs/oh_my/oh_my.md +36 -26
- data/blogs/oh_my/oh_my.tex +95 -58
- data/blogs/r_on_rails_ledger/images/00_portfolio_page.png +0 -0
- data/blogs/r_on_rails_ledger/images/01_results_panel.png +0 -0
- data/blogs/r_on_rails_ledger/images/02_density_tail_risk.png +0 -0
- data/blogs/r_on_rails_ledger/images/03_mc_cone.png +0 -0
- data/blogs/r_on_rails_ledger/images/04_rolling_var.png +0 -0
- data/blogs/r_on_rails_ledger/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.Rmd +354 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.md +365 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.tex +670 -0
- data/blogs/ruby_plot/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/ruby_plot/ruby_plot.Rmd +14 -1
- data/blogs/ruby_plot/ruby_plot.md +11 -1
- data/blogs/ruby_plot/ruby_plot.tex +60 -23
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/lib/galaaz/cli.rb +47 -3
- data/logos/icon-font/README.md +27 -0
- data/logos/icon-font/build_font.py +130 -0
- data/logos/icon-font/galaaz-mark.svg +34 -0
- data/script/omarchy/README.md +8 -1
- data/script/omarchy/fonts/galaaz.ttf +0 -0
- data/script/omarchy/install-galaaz.sh +8 -1
- data/script/omarchy/omarchy-menu.jsonc +21 -9
- data/sty/galaaz-header.png +0 -0
- data/sty/galaaz-headers-from-p3.tex +4 -0
- data/sty/galaaz.sty +54 -23
- data/version.rb +1 -1
- metadata +30 -9
- data/blogs/galaaz_ggplot/galaaz_ggplot.log +0 -745
- data/blogs/gknit/gknit_files/gknit_files/figure-latex/bubble-1.png +0 -0
- data/blogs/manual/manual.log +0 -1530
- data/blogs/manual/manual_files/manual_files/figure-latex/bubble-1.png +0 -0
- data/blogs/nse_dplyr/nse_dplyr.log +0 -824
- data/blogs/oh_my/oh_my.log +0 -974
- data/blogs/ruby_plot/ruby_plot.log +0 -887
|
Binary file
|
|
Binary file
|
|
@@ -8,9 +8,17 @@ output:
|
|
|
8
8
|
html_document:
|
|
9
9
|
self_contained: true
|
|
10
10
|
keep_md: true
|
|
11
|
+
toc: true
|
|
12
|
+
toc_float: true
|
|
13
|
+
toc_depth: 2
|
|
14
|
+
number_sections: true
|
|
15
|
+
includes:
|
|
16
|
+
before_body: _logo_before_body.html
|
|
11
17
|
pdf_document:
|
|
12
18
|
includes:
|
|
13
|
-
in_header:
|
|
19
|
+
in_header:
|
|
20
|
+
- "../../sty/galaaz.sty"
|
|
21
|
+
- "../../sty/galaaz-headers-from-p3.tex"
|
|
14
22
|
keep_tex: yes
|
|
15
23
|
number_sections: yes
|
|
16
24
|
toc: true
|
|
@@ -25,6 +33,11 @@ fontsize: 11pt
|
|
|
25
33
|
options(width = 70)
|
|
26
34
|
```
|
|
27
35
|
|
|
36
|
+
```{r brand_logo, echo=FALSE, fig.align='center', out.width='45%', eval=knitr::is_latex_output()}
|
|
37
|
+
# PDF only — HTML uses _logo_before_body.html (above the TOC).
|
|
38
|
+
knitr::include_graphics("images/galaaz-lockup-stacked.png")
|
|
39
|
+
```
|
|
40
|
+
|
|
28
41
|
# Introduction
|
|
29
42
|
|
|
30
43
|
Galaaz is a system for tightly coupling Ruby and R. Ruby is a powerful language, with
|
|
@@ -1,37 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Ruby Plotting with Galaaz"
|
|
3
|
+
subtitle: "An example of tightly coupling Ruby and R (JRuby or CRuby + GNU R, Galaaz 2.0)"
|
|
4
|
+
author: "Rodrigo Botafogo"
|
|
5
|
+
tags: [Galaaz, Ruby, R, JRuby, CRuby, "GNU R", ggplot2]
|
|
6
|
+
date: "16 October 2018 (narrative updated for Galaaz 2.0, 2026)"
|
|
7
|
+
output:
|
|
8
|
+
html_document:
|
|
9
|
+
self_contained: true
|
|
10
|
+
keep_md: true
|
|
11
|
+
toc: true
|
|
12
|
+
toc_float: true
|
|
13
|
+
toc_depth: 2
|
|
14
|
+
number_sections: true
|
|
15
|
+
includes:
|
|
16
|
+
before_body: _logo_before_body.html
|
|
17
|
+
pdf_document:
|
|
18
|
+
includes:
|
|
19
|
+
in_header:
|
|
20
|
+
- "../../sty/galaaz.sty"
|
|
21
|
+
- "../../sty/galaaz-headers-from-p3.tex"
|
|
22
|
+
keep_tex: yes
|
|
23
|
+
number_sections: yes
|
|
24
|
+
toc: true
|
|
25
|
+
toc_depth: 2
|
|
26
|
+
md_document:
|
|
27
|
+
variant: markdown_github
|
|
28
|
+
fontsize: 11pt
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
1
35
|
# Introduction
|
|
2
36
|
|
|
3
|
-
Galaaz is a system for tightly coupling Ruby and R.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
**bridge** evaluates R from Ruby and exchanges data between processes.
|
|
18
|
-
|
|
19
|
-
An **earlier** Galaaz prototype used Oracle’s **GraalVM** with
|
|
20
|
-
**TruffleRuby** and **FastR** in one JVM. That stack is **historical**;
|
|
21
|
-
today’s documentation and tooling assume **NewBridge on JRuby or CRuby**
|
|
37
|
+
Galaaz is a system for tightly coupling Ruby and R. Ruby is a powerful language, with
|
|
38
|
+
a large community, a very large set of libraries and great for web development. However,
|
|
39
|
+
it lacks libraries for data science, statistics, scientific plotting and machine learning.
|
|
40
|
+
On the other hand, R is considered one of the most powerful languages for solving all of the
|
|
41
|
+
above problems. **Python** is a strong competitor: NumPy, pandas, SciPy, and scikit-learn are
|
|
42
|
+
widely used examples among **many thousands** of packages on PyPI for numerical and ML work.
|
|
43
|
+
|
|
44
|
+
With Galaaz we do not intend to re-implement any of the scientific libraries in R; we allow
|
|
45
|
+
for very tight coupling between the two languages to the point that the Ruby developer does
|
|
46
|
+
not need to think about R syntax for every call. **Galaaz 2.0** does this with **[JRuby](https://www.jruby.org/)**
|
|
47
|
+
or **CRuby** and **GNU R**: a **bridge** evaluates R from Ruby and exchanges data between processes.
|
|
48
|
+
|
|
49
|
+
An **earlier** Galaaz prototype used Oracle’s **GraalVM** with **TruffleRuby** and **FastR** in one JVM.
|
|
50
|
+
That stack is **historical**; today’s documentation and tooling assume **NewBridge on JRuby or CRuby**
|
|
22
51
|
(see the project manual and **`bin/galaaz-ruby`** / **`bin/gknit`**).
|
|
23
52
|
|
|
24
53
|
For background on the old stack:
|
|
25
54
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
FastR](https://medium.com/graalvm/faster-r-with-fastr-4b8db0e0dceb)
|
|
55
|
+
* [GraalVM Home](https://www.graalvm.org/)
|
|
56
|
+
* [TruffleRuby](https://github.com/oracle/truffleruby)
|
|
57
|
+
* [FastR](https://github.com/oracle/fastr)
|
|
58
|
+
* [Faster R with FastR](https://medium.com/graalvm/faster-r-with-fastr-4b8db0e0dceb)
|
|
31
59
|
|
|
32
60
|
## What does Galaaz mean
|
|
33
61
|
|
|
34
|
-
Galaaz is the Portuguese name for
|
|
62
|
+
Galaaz is the Portuguese name for "Galahad". From Wikipedia:
|
|
35
63
|
|
|
36
64
|
Sir Galahad (sometimes referred to as Galeas or Galath),
|
|
37
65
|
in Arthurian legend, is a knight of King Arthur's Round Table and one
|
|
@@ -48,31 +76,29 @@ Galaaz is the Portuguese name for “Galahad”. From Wikipedia:
|
|
|
48
76
|
|
|
49
77
|
## Prerequisites (Galaaz 2.0)
|
|
50
78
|
|
|
51
|
-
|
|
52
|
-
|
|
79
|
+
* **JRuby** and a compatible **JDK**, *or* **CRuby 3.3+**
|
|
80
|
+
* **GNU R** on your `PATH`
|
|
53
81
|
|
|
54
|
-
The following R packages will be automatically installed when necessary,
|
|
55
|
-
|
|
82
|
+
The following R packages will be automatically installed when necessary, but could be installed prior
|
|
83
|
+
to the demo if desired:
|
|
56
84
|
|
|
57
|
-
|
|
58
|
-
|
|
85
|
+
* ggplot2
|
|
86
|
+
* gridExtra
|
|
59
87
|
|
|
60
|
-
Installation of R packages requires a development environment.
|
|
61
|
-
|
|
62
|
-
Apple’s **Xcode Command Line Tools** are commonly required.
|
|
88
|
+
Installation of R packages requires a development environment. On Linux, a typical build toolchain
|
|
89
|
+
(GCC, headers) is usually enough. On macOS, Apple’s **Xcode Command Line Tools** are commonly required.
|
|
63
90
|
|
|
64
|
-
In order to run the
|
|
91
|
+
In order to run the 'specs' the following Ruby package is necessary:
|
|
65
92
|
|
|
66
|
-
|
|
93
|
+
* gem install rspec
|
|
67
94
|
|
|
68
95
|
## Preparation
|
|
69
96
|
|
|
70
|
-
|
|
97
|
+
* gem install galaaz
|
|
71
98
|
|
|
72
99
|
## Running the demo
|
|
73
100
|
|
|
74
|
-
The ggplot examples for this demo were adapted from:
|
|
75
|
-
<http://r-statistics.co/Top50-Ggplot2-Visualizations-MasterList-R-Code.html>.
|
|
101
|
+
The ggplot examples for this demo were adapted from: http://r-statistics.co/Top50-Ggplot2-Visualizations-MasterList-R-Code.html.
|
|
76
102
|
|
|
77
103
|
At the shell, from a suitable Galaaz environment:
|
|
78
104
|
|
|
@@ -84,20 +110,19 @@ Running
|
|
|
84
110
|
|
|
85
111
|
galaaz -T
|
|
86
112
|
|
|
87
|
-
lists available demo tasks.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
**sthda** category, use `galaaz sthda:all`. Some examples require
|
|
91
|
-
**rspec**; install it with `gem install rspec`.
|
|
113
|
+
lists available demo tasks. To run a demo, use **`galaaz`** where you would otherwise invoke **`rake`**.
|
|
114
|
+
For example, if the list shows `rake sthda:bar`, run `galaaz sthda:bar`. To run every demo in the **sthda**
|
|
115
|
+
category, use `galaaz sthda:all`. Some examples require **rspec**; install it with `gem install rspec`.
|
|
92
116
|
|
|
93
117
|
# The demo code
|
|
94
118
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
If the example is **run**, the plot will appear on the
|
|
98
|
-
generate an SVG image and then include it in this document.
|
|
99
|
-
generate and image, the R.svg device is used.
|
|
100
|
-
|
|
119
|
+
|
|
120
|
+
The following is the Ruby code and plot for the above example. There is a small difference between
|
|
121
|
+
the code in the example and the code below. If the example is **run**, the plot will appear on the
|
|
122
|
+
screen; below, we generate an SVG image and then include it in this document. In order to
|
|
123
|
+
generate and image, the R.svg device is used. To generate the plot on the screen, use the R.awt
|
|
124
|
+
device, as commented on the code.
|
|
125
|
+
|
|
101
126
|
|
|
102
127
|
``` ruby
|
|
103
128
|
require 'galaaz'
|
|
@@ -124,10 +149,13 @@ gg = midwest.ggplot(E.aes(x: :area, y: :poptotal)) +
|
|
|
124
149
|
puts gg
|
|
125
150
|
```
|
|
126
151
|
|
|
127
|
-
|
|
152
|
+
|
|
153
|
+

|
|
154
|
+
|
|
128
155
|
|
|
129
156
|
In R, the code to generate this plot is the following
|
|
130
157
|
|
|
158
|
+
|
|
131
159
|
``` r
|
|
132
160
|
# install.packages("ggplot2")
|
|
133
161
|
# load package and data
|
|
@@ -152,42 +180,37 @@ gg <- ggplot(midwest, aes(x=area, y=poptotal)) +
|
|
|
152
180
|
plot(gg)
|
|
153
181
|
```
|
|
154
182
|
|
|
155
|
-
Note that both codes are very similar.
|
|
156
|
-
|
|
157
|
-
becomes
|
|
158
|
-
size = popdensity), become in Ruby (col: :state, size: :popdensity).
|
|
159
|
-
|
|
160
|
-
One last
|
|
161
|
-
function.
|
|
162
|
-
explanation of why E.aes is needed is an advanced topic in R and
|
|
163
|
-
on what is know as Non-standard Evaluation (NSE) in R.
|
|
164
|
-
|
|
165
|
-
geom_point
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
order to delay the evaluation of function aes we need to use E.aes. The
|
|
171
|
-
interested reader on NSE in R is directed to
|
|
172
|
-
<http://adv-r.had.co.nz/Computing-on-the-language.html>.
|
|
183
|
+
Note that both codes are very similar. The Ruby code requires the use of "R." before calling
|
|
184
|
+
any functions,
|
|
185
|
+
for instance R function 'geom_point' becomes 'R.geom_point' in Ruby. R named parameters such as
|
|
186
|
+
(col = state, size = popdensity), become in Ruby (col: :state, size: :popdensity).
|
|
187
|
+
|
|
188
|
+
One last
|
|
189
|
+
point that needs to be observed is the call to the 'aes' function. In Ruby instead of doing
|
|
190
|
+
'R.aes', we use 'E.aes'. The explanation of why E.aes is needed is an advanced topic in R and
|
|
191
|
+
depends on what is know as Non-standard Evaluation (NSE) in R. In short, function 'aes' is lazily
|
|
192
|
+
evaluated in R, i.e., in R when calling geom_point(aes(col=state, size=popdensity)), function
|
|
193
|
+
geom_point receives as argument something similar to a string containing
|
|
194
|
+
'aes(col=state, size=popdensity)', and the aes function will be evaluated inside the geom_point
|
|
195
|
+
function. In Ruby, there is no Lazy evaluation and doing R.aes would try to evaluate aes
|
|
196
|
+
immediately. In order to delay the evaluation of function aes we need to use E.aes. The
|
|
197
|
+
interested reader on NSE in R is directed to http://adv-r.had.co.nz/Computing-on-the-language.html.
|
|
173
198
|
|
|
174
199
|
# An extension to the example
|
|
175
200
|
|
|
176
|
-
If both codes are so similar, then why would one use Ruby instead of R
|
|
177
|
-
|
|
201
|
+
If both codes are so similar, then why would one use Ruby instead of R and what good is galaaz
|
|
202
|
+
after all?
|
|
203
|
+
|
|
204
|
+
Ruby is a modern OO language with numerous very useful constructs such as classes, modules, blocks,
|
|
205
|
+
procs, etc. The example above focus on the coupling of both languages, and does not show the
|
|
206
|
+
use of other Ruby constructs. In the following example, we will show a more complex example using
|
|
207
|
+
other Ruby constructs. This is certainly not a very well written and robust Ruby code, but
|
|
208
|
+
it give the idea of how Ruby and R are strongly coupled.
|
|
178
209
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
constructs. In the following example, we will show a more complex
|
|
183
|
-
example using other Ruby constructs. This is certainly not a very well
|
|
184
|
-
written and robust Ruby code, but it give the idea of how Ruby and R are
|
|
185
|
-
strongly coupled.
|
|
210
|
+
Let's imagine that we work in a corporation that has its plot themes. So, it has defined a
|
|
211
|
+
'CorpTheme' module. Plots in this corporation should not have grids, numbers in labels should
|
|
212
|
+
not use scientific notation and the preferred color is blue.
|
|
186
213
|
|
|
187
|
-
Let’s imagine that we work in a corporation that has its plot themes.
|
|
188
|
-
So, it has defined a ‘CorpTheme’ module. Plots in this corporation
|
|
189
|
-
should not have grids, numbers in labels should not use scientific
|
|
190
|
-
notation and the preferred color is blue.
|
|
191
214
|
|
|
192
215
|
``` ruby
|
|
193
216
|
# corp_theme.rb
|
|
@@ -234,6 +257,7 @@ end
|
|
|
234
257
|
|
|
235
258
|
We now define a ScatterPlot class:
|
|
236
259
|
|
|
260
|
+
|
|
237
261
|
``` ruby
|
|
238
262
|
# ScatterPlot.rb
|
|
239
263
|
# creates a scatter plot and allow some configuration
|
|
@@ -325,8 +349,8 @@ class ScatterPlot
|
|
|
325
349
|
end
|
|
326
350
|
```
|
|
327
351
|
|
|
328
|
-
And this is the final code for making the scatter plot with the midwest
|
|
329
|
-
|
|
352
|
+
And this is the final code for making the scatter plot with the midwest data
|
|
353
|
+
|
|
330
354
|
|
|
331
355
|
``` ruby
|
|
332
356
|
require 'galaaz'
|
|
@@ -345,27 +369,23 @@ sp.add_smoothing_line(method: "glm")
|
|
|
345
369
|
sp.plot
|
|
346
370
|
```
|
|
347
371
|
|
|
348
|
-
|
|
372
|
+
|
|
373
|
+

|
|
349
374
|
|
|
350
375
|
# Conclusion
|
|
351
376
|
|
|
352
|
-
R is a very powerful language for statistical analysis, data analytics,
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
Ruby, since syntax is almost identical and **GNU R** remains the engine
|
|
362
|
-
for statistics and **ggplot2**. Further, by using Galaaz the R developer
|
|
363
|
-
can start (slowly if needed) using Ruby’s constructs and libraries that
|
|
377
|
+
R is a very powerful language for statistical analysis, data analytics, machine learning, plotting
|
|
378
|
+
and many other scientific applications with a very large package ecosystem. However R is often
|
|
379
|
+
considered hard to learn and lacking modern language features such as object-oriented
|
|
380
|
+
classes, modules, and first-class functions. For that reason, many teams have standardized on
|
|
381
|
+
Python (or stayed entirely inside R) rather than mixing ecosystems.
|
|
382
|
+
|
|
383
|
+
With Galaaz, R programmers can almost transparently migrate from R to Ruby, since syntax is
|
|
384
|
+
almost identical and **GNU R** remains the engine for statistics and **ggplot2**. Further, by using
|
|
385
|
+
Galaaz the R developer can start (slowly if needed) using Ruby’s constructs and libraries that
|
|
364
386
|
nicely complement R packages.
|
|
365
387
|
|
|
366
|
-
For the Ruby developer, Galaaz allows the immediate use of R functions
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
access to the JVM ecosystem; **CRuby** works equally for the Galaaz
|
|
371
|
-
bridge itself.
|
|
388
|
+
For the Ruby developer, Galaaz allows the immediate use of R functions with minimal ceremony. As
|
|
389
|
+
shown in the second example above, class `ScatterPlot` hides most R call details from the Ruby
|
|
390
|
+
developer. Prefer **JRuby** when you want **real parallel threads** on the Ruby side and access to
|
|
391
|
+
the JVM ecosystem; **CRuby** works equally for the Galaaz bridge itself.
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
\usepackage[utf8]{inputenc}
|
|
102
102
|
|
|
103
103
|
\usepackage{geometry}
|
|
104
|
-
\geometry{a4paper, top=
|
|
104
|
+
\geometry{a4paper, top=1.05in, headheight=30pt, headsep=14pt}
|
|
105
105
|
|
|
106
106
|
% needed for kableExtra
|
|
107
107
|
\usepackage{longtable}
|
|
@@ -122,29 +122,60 @@
|
|
|
122
122
|
\usepackage{graphicx}
|
|
123
123
|
|
|
124
124
|
\usepackage{fancyhdr}
|
|
125
|
-
%
|
|
126
|
-
%
|
|
127
|
-
%
|
|
125
|
+
% Header: small Galaaz mark (left); page number + section title (right),
|
|
126
|
+
% matching classic LaTeX style: "4 AN EXTENSION TO THE EXAMPLE"
|
|
127
|
+
% (upright page number, uppercase italic section name).
|
|
128
|
+
% Logo paths cover repo blogs (../../sty/), installed ~/sty/, and local images/.
|
|
129
|
+
% Blogs may delay headers with \renewcommand{\galaazheaderfrompage}{3} after this sty
|
|
130
|
+
% (e.g. skip title/TOC and a logo splash page).
|
|
131
|
+
\newcommand{\galaazheaderfrompage}{1}
|
|
132
|
+
\newcommand{\galaazheaderlogo}{%
|
|
133
|
+
\raisebox{-0.12\height}{%
|
|
134
|
+
\IfFileExists{../../sty/galaaz-header.png}{%
|
|
135
|
+
\includegraphics[height=0.32in]{../../sty/galaaz-header.png}%
|
|
136
|
+
}{%
|
|
137
|
+
\IfFileExists{galaaz-header.png}{%
|
|
138
|
+
\includegraphics[height=0.32in]{galaaz-header.png}%
|
|
139
|
+
}{%
|
|
140
|
+
\IfFileExists{images/galaaz-header.png}{%
|
|
141
|
+
\includegraphics[height=0.32in]{images/galaaz-header.png}%
|
|
142
|
+
}{}%
|
|
143
|
+
}%
|
|
144
|
+
}%
|
|
145
|
+
}%
|
|
146
|
+
}
|
|
147
|
+
% Section title only in marks (no \thesection); page number is separate.
|
|
148
|
+
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
|
|
149
|
+
\renewcommand{\subsectionmark}[1]{}% keep the current section in the header
|
|
150
|
+
\newcommand{\galaazmaybeheaderlogo}{%
|
|
151
|
+
\ifnum\value{page}<\galaazheaderfrompage\relax\else\galaazheaderlogo\fi}
|
|
152
|
+
\newcommand{\galaazmayberighthead}{%
|
|
153
|
+
\ifnum\value{page}<\galaazheaderfrompage\relax
|
|
154
|
+
\else
|
|
155
|
+
\textup{\thepage}\hspace{1em}\textit{\MakeUppercase{\leftmark}}%
|
|
156
|
+
\fi
|
|
157
|
+
}
|
|
128
158
|
\pagestyle{fancy}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
%
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
%
|
|
143
|
-
%
|
|
144
|
-
%
|
|
145
|
-
%
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
\fancyhf{}
|
|
160
|
+
\fancyhead[L]{\galaazmaybeheaderlogo}
|
|
161
|
+
\fancyhead[R]{\galaazmayberighthead}
|
|
162
|
+
\renewcommand{\headrulewidth}{0.3pt}
|
|
163
|
+
\makeatletter
|
|
164
|
+
\renewcommand{\headrule}{%
|
|
165
|
+
\ifnum\value{page}<\galaazheaderfrompage\relax
|
|
166
|
+
\else
|
|
167
|
+
\hrule\@height\headrulewidth\@width\headwidth
|
|
168
|
+
\vskip-\headrulewidth
|
|
169
|
+
\fi
|
|
170
|
+
}
|
|
171
|
+
\makeatother
|
|
172
|
+
% First page often uses plain; same conditional header logic.
|
|
173
|
+
\fancypagestyle{plain}{%
|
|
174
|
+
\fancyhf{}%
|
|
175
|
+
\fancyhead[L]{\galaazmaybeheaderlogo}%
|
|
176
|
+
\fancyhead[R]{\galaazmayberighthead}%
|
|
177
|
+
\renewcommand{\headrulewidth}{0.3pt}%
|
|
178
|
+
}
|
|
148
179
|
|
|
149
180
|
% make available command lastpage
|
|
150
181
|
\usepackage{lastpage}
|
|
@@ -189,6 +220,10 @@
|
|
|
189
220
|
|
|
190
221
|
%
|
|
191
222
|
%\newcommand{\atraso}[1]{\color{red} \textbf {Tempo desde a Assinatura do Contrato: #1 dias}}
|
|
223
|
+
% No header on title/TOC (p.1) or splash logo page (p.2);
|
|
224
|
+
% logo + page number + section title from page 3 onward.
|
|
225
|
+
% Load after galaaz.sty.
|
|
226
|
+
\renewcommand{\galaazheaderfrompage}{3}
|
|
192
227
|
\usepackage{bookmark}
|
|
193
228
|
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
|
|
194
229
|
\urlstyle{same}
|
|
@@ -217,6 +252,8 @@ GNU R, Galaaz 2.0)}
|
|
|
217
252
|
\setcounter{tocdepth}{2}
|
|
218
253
|
\tableofcontents
|
|
219
254
|
}
|
|
255
|
+
\begin{center}\includegraphics[width=0.45\linewidth]{images/galaaz-lockup-stacked} \end{center}
|
|
256
|
+
|
|
220
257
|
\section{Introduction}\label{introduction}
|
|
221
258
|
|
|
222
259
|
Galaaz is a system for tightly coupling Ruby and R. Ruby is a powerful
|
|
Binary file
|
data/blogs/gknit/gknit.Rmd
CHANGED
|
@@ -9,12 +9,22 @@ bibliography: stats.bib
|
|
|
9
9
|
output:
|
|
10
10
|
pdf_document:
|
|
11
11
|
includes:
|
|
12
|
-
in_header:
|
|
12
|
+
in_header:
|
|
13
|
+
- "../../sty/galaaz.sty"
|
|
14
|
+
- "../../sty/galaaz-headers-from-p3.tex"
|
|
13
15
|
keep_tex: yes
|
|
14
16
|
number_sections: yes
|
|
17
|
+
toc: true
|
|
18
|
+
toc_depth: 2
|
|
15
19
|
html_document:
|
|
16
20
|
self_contained: true
|
|
17
21
|
keep_md: true
|
|
22
|
+
toc: true
|
|
23
|
+
toc_float: true
|
|
24
|
+
toc_depth: 2
|
|
25
|
+
number_sections: true
|
|
26
|
+
includes:
|
|
27
|
+
before_body: _logo_before_body.html
|
|
18
28
|
biblio-style: apsr
|
|
19
29
|
---
|
|
20
30
|
|
|
@@ -22,6 +32,11 @@ biblio-style: apsr
|
|
|
22
32
|
options(width = 70)
|
|
23
33
|
```
|
|
24
34
|
|
|
35
|
+
```{r brand_logo, echo=FALSE, fig.align='center', out.width='45%', eval=knitr::is_latex_output()}
|
|
36
|
+
# PDF only — HTML uses _logo_before_body.html (above the TOC).
|
|
37
|
+
knitr::include_graphics("images/galaaz-lockup-stacked.png")
|
|
38
|
+
```
|
|
39
|
+
|
|
25
40
|
# Introduction
|
|
26
41
|
|
|
27
42
|
The idea of "literate programming" was first introduced by Donald Knuth in the
|
data/blogs/gknit/gknit.md
CHANGED
|
@@ -9,17 +9,29 @@ bibliography: stats.bib
|
|
|
9
9
|
output:
|
|
10
10
|
pdf_document:
|
|
11
11
|
includes:
|
|
12
|
-
in_header:
|
|
12
|
+
in_header:
|
|
13
|
+
- "../../sty/galaaz.sty"
|
|
14
|
+
- "../../sty/galaaz-headers-from-p3.tex"
|
|
13
15
|
keep_tex: yes
|
|
14
16
|
number_sections: yes
|
|
17
|
+
toc: true
|
|
18
|
+
toc_depth: 2
|
|
15
19
|
html_document:
|
|
16
20
|
self_contained: true
|
|
17
21
|
keep_md: true
|
|
22
|
+
toc: true
|
|
23
|
+
toc_float: true
|
|
24
|
+
toc_depth: 2
|
|
25
|
+
number_sections: true
|
|
26
|
+
includes:
|
|
27
|
+
before_body: _logo_before_body.html
|
|
18
28
|
biblio-style: apsr
|
|
19
29
|
---
|
|
20
30
|
|
|
21
31
|
|
|
22
32
|
|
|
33
|
+
|
|
34
|
+
|
|
23
35
|
# Introduction
|
|
24
36
|
|
|
25
37
|
The idea of "literate programming" was first introduced by Donald Knuth in the
|
data/blogs/gknit/gknit.tex
CHANGED
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
\usepackage[utf8]{inputenc}
|
|
134
134
|
|
|
135
135
|
\usepackage{geometry}
|
|
136
|
-
\geometry{a4paper, top=
|
|
136
|
+
\geometry{a4paper, top=1.05in, headheight=30pt, headsep=14pt}
|
|
137
137
|
|
|
138
138
|
% needed for kableExtra
|
|
139
139
|
\usepackage{longtable}
|
|
@@ -154,29 +154,60 @@
|
|
|
154
154
|
\usepackage{graphicx}
|
|
155
155
|
|
|
156
156
|
\usepackage{fancyhdr}
|
|
157
|
-
%
|
|
158
|
-
%
|
|
159
|
-
%
|
|
157
|
+
% Header: small Galaaz mark (left); page number + section title (right),
|
|
158
|
+
% matching classic LaTeX style: "4 AN EXTENSION TO THE EXAMPLE"
|
|
159
|
+
% (upright page number, uppercase italic section name).
|
|
160
|
+
% Logo paths cover repo blogs (../../sty/), installed ~/sty/, and local images/.
|
|
161
|
+
% Blogs may delay headers with \renewcommand{\galaazheaderfrompage}{3} after this sty
|
|
162
|
+
% (e.g. skip title/TOC and a logo splash page).
|
|
163
|
+
\newcommand{\galaazheaderfrompage}{1}
|
|
164
|
+
\newcommand{\galaazheaderlogo}{%
|
|
165
|
+
\raisebox{-0.12\height}{%
|
|
166
|
+
\IfFileExists{../../sty/galaaz-header.png}{%
|
|
167
|
+
\includegraphics[height=0.32in]{../../sty/galaaz-header.png}%
|
|
168
|
+
}{%
|
|
169
|
+
\IfFileExists{galaaz-header.png}{%
|
|
170
|
+
\includegraphics[height=0.32in]{galaaz-header.png}%
|
|
171
|
+
}{%
|
|
172
|
+
\IfFileExists{images/galaaz-header.png}{%
|
|
173
|
+
\includegraphics[height=0.32in]{images/galaaz-header.png}%
|
|
174
|
+
}{}%
|
|
175
|
+
}%
|
|
176
|
+
}%
|
|
177
|
+
}%
|
|
178
|
+
}
|
|
179
|
+
% Section title only in marks (no \thesection); page number is separate.
|
|
180
|
+
\renewcommand{\sectionmark}[1]{\markboth{#1}{}}
|
|
181
|
+
\renewcommand{\subsectionmark}[1]{}% keep the current section in the header
|
|
182
|
+
\newcommand{\galaazmaybeheaderlogo}{%
|
|
183
|
+
\ifnum\value{page}<\galaazheaderfrompage\relax\else\galaazheaderlogo\fi}
|
|
184
|
+
\newcommand{\galaazmayberighthead}{%
|
|
185
|
+
\ifnum\value{page}<\galaazheaderfrompage\relax
|
|
186
|
+
\else
|
|
187
|
+
\textup{\thepage}\hspace{1em}\textit{\MakeUppercase{\leftmark}}%
|
|
188
|
+
\fi
|
|
189
|
+
}
|
|
160
190
|
\pagestyle{fancy}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
%
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
%
|
|
175
|
-
%
|
|
176
|
-
%
|
|
177
|
-
%
|
|
178
|
-
|
|
179
|
-
|
|
191
|
+
\fancyhf{}
|
|
192
|
+
\fancyhead[L]{\galaazmaybeheaderlogo}
|
|
193
|
+
\fancyhead[R]{\galaazmayberighthead}
|
|
194
|
+
\renewcommand{\headrulewidth}{0.3pt}
|
|
195
|
+
\makeatletter
|
|
196
|
+
\renewcommand{\headrule}{%
|
|
197
|
+
\ifnum\value{page}<\galaazheaderfrompage\relax
|
|
198
|
+
\else
|
|
199
|
+
\hrule\@height\headrulewidth\@width\headwidth
|
|
200
|
+
\vskip-\headrulewidth
|
|
201
|
+
\fi
|
|
202
|
+
}
|
|
203
|
+
\makeatother
|
|
204
|
+
% First page often uses plain; same conditional header logic.
|
|
205
|
+
\fancypagestyle{plain}{%
|
|
206
|
+
\fancyhf{}%
|
|
207
|
+
\fancyhead[L]{\galaazmaybeheaderlogo}%
|
|
208
|
+
\fancyhead[R]{\galaazmayberighthead}%
|
|
209
|
+
\renewcommand{\headrulewidth}{0.3pt}%
|
|
210
|
+
}
|
|
180
211
|
|
|
181
212
|
% make available command lastpage
|
|
182
213
|
\usepackage{lastpage}
|
|
@@ -221,6 +252,10 @@
|
|
|
221
252
|
|
|
222
253
|
%
|
|
223
254
|
%\newcommand{\atraso}[1]{\color{red} \textbf {Tempo desde a Assinatura do Contrato: #1 dias}}
|
|
255
|
+
% No header on title/TOC (p.1) or splash logo page (p.2);
|
|
256
|
+
% logo + page number + section title from page 3 onward.
|
|
257
|
+
% Load after galaaz.sty.
|
|
258
|
+
\renewcommand{\galaazheaderfrompage}{3}
|
|
224
259
|
\usepackage{booktabs}
|
|
225
260
|
\usepackage{longtable}
|
|
226
261
|
\usepackage{array}
|
|
@@ -251,6 +286,12 @@
|
|
|
251
286
|
\begin{document}
|
|
252
287
|
\maketitle
|
|
253
288
|
|
|
289
|
+
{
|
|
290
|
+
\setcounter{tocdepth}{2}
|
|
291
|
+
\tableofcontents
|
|
292
|
+
}
|
|
293
|
+
\begin{center}\includegraphics[width=0.45\linewidth]{images/galaaz-lockup-stacked} \end{center}
|
|
294
|
+
|
|
254
295
|
\section{Introduction}\label{introduction}
|
|
255
296
|
|
|
256
297
|
The idea of ``literate programming'' was first introduced by Donald
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|