forked from jvcasillas/ru_xaringan
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.Rmd
508 lines (316 loc) · 8.67 KB
/
index.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
---
title: "`R` Xaringan Package Slide Deck"
subtitle: "ScPo template"
author: "Florian Oswald"
date: "SciencesPo Paris </br> `r Sys.Date()`"
output:
xaringan::moon_reader:
lib_dir: libs
css: [default, "scpo.css", "scpo-fonts.css"]
nature:
beforeInit: ["js/ru_xaringan.js"]
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
ratio: "16:9"
includes:
in_header: "./libs/partials/header.html"
---
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
```
background-size: 100%
background-image: url(https://media.giphy.com/media/94iS62lx8CRQA/giphy.gif)
???
Image test. Taken from google.
---
background-size: 100%
background-image: url(https://media.giphy.com/media/J3GSVuDnnYeDEd4Nrr/giphy.gif)
???
Second Image test. Taken from google.
---
layout: true
<div class="my-footer"><img src="./img/logo/ScPo-shield.png" style="height: 60px;"/></div>
---
# Attribution
- This template is based on a fork of
[jvcasillas](https://github.com/jvcasillas/ru_xaringan) template for Rutgers University.
- I changed some small things in the CSS.
1. Used SciencesPo Logos
1. Added a ScPo logo in the footer of standard slides.
- The template is now here: https://github.com/ScPoEcon/scpo_xaringan. Visit to check out instructions.
---
# Maths without Beamer!
## You must be kidding me.
You can write $\LaTeX$ math expressions inside a pair of dollar signs, e.g. `$\alpha+\beta$` renders $\alpha+\beta$. (No blanks after `$`!). You can use the display style with double dollar signs:
```latex
$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$
```
$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$
--
## OK, fine. What about multiple lines?
---
# Multiple Lines of Math
```latex
$$\begin{align}
x &= 3 \\
y &= \log z \\
\psi &= \int \frac{x}{y} dx
\end{align}$$
```
$$\begin{align}
x &= 3 \\
y &= \log{z} \\
\psi &= \int \frac{x}{y} dx
\end{align}$$
* Must be written *exactly* like that (no spaces or linebreaks)
---
# (Working) Code in a Slideshow?
- Sometimes it is useful to show code.
--
- Particularly when teaching.
--
- You want that code to *actually work* (i.e. not just copy and paste input and output into your slides).
--
- Right?
---
# Standard slide with R code
This slide runs code and shows the output.
```{r tidy=FALSE, fig.width=12, fig.retina=2, fig.align='center',fig.height=5, warning=FALSE, message=FALSE}
library(tidyverse)
# can highlight lines of code!
ggplot(cars, aes(x = dist, y = speed)) + geom_point() +
{{ geom_smooth(method = 'lm', formula = y ~ poly(x, 2)) }}
```
---
# Slide with table
A table directly generared from `R` code.
```{r}
knitr::kable(head(iris), format = "html")
```
---
# Slide basics
- Unordered lists
- can be created using "-"
- and they can be nested using 2 or 4 spaces
- We can also make `blockquotes`
- we can use `<ru-blockquote>text</ru-blockquote>`
- or `>`
<ru-blockquote>This is a blocked quote</ru-blockquote>
- Footnotes<sup>1</sup>
.footnote[
[1] Information here.
]
---
# More basics
### Ordered list
1. one
2. two
3. three
--
- Spaced
--
- List
--
- with increments
--
An incremental
--
sentence with
--
separation.
---
layout: true
<div class="my-footer"></div>
---
background-image: url(`r xaringan:::karl`)
background-position: 50% 50%
class: center, bottom, inverse
# You only live once!
---
layout: true
<div class="my-footer"><img src="./img/logo/ScPo-shield.png" style="height: 60px;"/></div>
---
background-image: url("./img/logo/ScPo-econ.png")
background-position: 90% 50%
background-size: 300pt
# Another example
### Lists to the left
- We can place images
- anywhere on the screen
- by using **background-image**
- in conjunction with
- **background-position**
### Image to the right
- This can replicate my 'float right' hack
- We can control the
- size of the image
- by using the
- **background-size** option
---
layout: true
<div class="my-footer"></div>
---
class: center, middle
# Text adjustments
--
It is also possible to change the .blue[color] of any
text by using...
--
.color[text here]
--
For example
--
.grey[grey]
--
will make text .grey[grey]
--
We can do this with white, .grey[grey], .black[black], .RUred[red] and .blue[blue].
--
To really make text stand out we can just use \*\*text\*\* like **this**.
---
layout: true
<div class="my-footer"><img src="./img/logo/ScPo-shield.png" style="height: 60px;"/></div>
---
# Two columns!
.pull-left[
### Some things on the left
1. List of things
1. Plain Markdown;
1. blah blah
1. Plain Markdown;
]
--
.pull-right[
### and other things on the right
1. We do this by using the
1. \.pull-left[] and \.pull-right[]
1. commands. Just put any text inside the
1. brackets and you're good to go
]
---
# R code and highlighting (I never use this)
.pull-left[
An example using a leading `*`:
```r
if (TRUE) {
** message("Very important!")
}
```
Output:
```r
if (TRUE) {
* message("Very important!")
}
```
This is invalid R code, so it is a plain fenced code block that is not executed.
]
.pull-right[
An example using `{{}}`:
`r ''````{r tidy=FALSE}
if (TRUE) {
*{{ message("Very important!") }}
}
```
Output:
```{r tidy=FALSE}
if (TRUE) {
{{ message("Very important!") }}
}
```
It is valid R code so you can run it.
]
---
class: middle, bottom
background-image: url(./img/logo/ScPo-shield.png)
background-size: contain
### <grey>You can</grey>
### <grey>fill the</grey>
### <grey>screen with </grey>
### **background-size: contain**
---
# Macros
- We can insert javascript macros into our presentations
- For example, if we put the following code into `macros.js`...
```js
remark.macros.scale = function (percentage) {
var url = this;
return '<img src="' + url + '" style="width: ' + percentage + '" />';
};
```
- ...we can use the markdown call to resize images...
```md

```
- These calls can also be put inside html divs so as to control where they appear.
<div align="center">

</div>
- All we need to do is include `beforeInit: "macros.js"` under nature in our YAML front matter
---
# ScPo stuff
### General
- The theme was designed to work with a 16:9 aspect ratio
- Set the aspect ratio under the **nature** output parameter...
nature:
ratio: "16:9"
### Sections
- We can create section dividers with ScPo red and grey by using the `class` call:
```md
class: title-slide-section-red
```
or
```md
class: title-slide-section-grey
```
---
class: title-slide-section-red
# ScPo red section divider
### This is the H3 font color
- Our text goes here
- We can use **bold**
- and .blue[blue]
- and also .grey[grey]
---
class: title-slide-section-grey
# ScPo grey section divider
### This is the H3 font color
- Our text goes here
- We can use **bold**
- and .blue[blue]
- and also .black[black]
---
# Tables
### Centering
- Tables are centered by default in **xaringan**.
- We can override this using...
.pull-left[], .pull-right[], etc.
.pull-right[
| This | is | a | Table |
| :---- | :-- | :----- | :----------: |
| It is | now | pulled | to the right |
| 12 | 34 | 56 | 78 |
]
---
background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg)
background-size: 100px
background-position: 90% 8%
# xaringan
- Press `h` or `?` to see the possible ninjutsu you can use in remark.js.
- You can see all the goodies like this.
- Check out more in-depth tutorial [here](https://slides.yihui.name/xaringan/#1)
---
class: title-slide-final, middle
background-image: url(./img/logo/ScPo-Econ.png)
background-size: 250px
background-position: 9% 19%
# Thanks!
## This is the final slide
### you can add your email, twitter, github, etc. info here
Here is an example:
| | |
| :--------------------------------------------------------------------------------------------------------- | :-------------------------------- |
| <a href="mailto:[email protected]">.ScPored[<i class="fa fa-paper-plane fa-fw"></i>] | [email protected] |
| <a href="https://scpoecon.github.io/scpo_xaringan">.ScPored[<i class="fa fa-link fa-fw"></i>] | slides |
| <a href="http://twitter.com/ScPoEcon">.ScPored[<i class="fa fa-twitter fa-fw"></i>] | @ScPoEcon |
| <a href="http://github.com/ScPoEcon">.ScPored[<i class="fa fa-github fa-fw"></i>] | @ScPoEcon |