forked from mdscheuerell/present
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.html
More file actions
547 lines (385 loc) · 18.6 KB
/
template.html
File metadata and controls
547 lines (385 loc) · 18.6 KB
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
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" href="my-theme.css" type="text/css" />
</head>
<body>
<textarea id="source">
class: center, middle, inverse
# This is where you write a really great title, whether it be short or long
## Mark Scheuerell
.large[_Northwest Fisheries Science Center<br>National Oceanic and Atmospheric Administration<br>Seattle, WA_]
.futnote[mark.scheuerell@noaa.gov]
.citation[@mark_scheuerell]
---
class: center, middle
# This is where you write a really great title on a white background
## Mark Scheuerell
.large[_Northwest Fisheries Science Center<br>National Oceanic and Atmospheric Administration<br>Seattle, WA_]
.futnote.blue-text[mark.scheuerell@noaa.gov]
.citation.blue-text[@mark_scheuerell]
---
# A standard bulleted list
* create something
* discuss it with others
* .red-text[make it red]
---
# A standard numbered list
1. the first thing: create
2. the second thing: discuss
3. the third thing: .red-text[make it red]
---
# Hello there
## How are you?
### .red-text[Awesome!]
This slide shows all 3 levels for headers (titles).
It's easy to make .orange-text[colored] .blue-text[text]. To do so, you need to:
1. change the css stylesheet
(press arrow to see next thing);
--
2. Just kidding, that's all
---
class: frimg
# Landscape pic on left plus text
.img-left-land[]
.img-right-text[
* this pic is awesome
* seriously, though
]
---
class: frimg
# Square pic on left plus text
.pull-left[]
.pull-right[
* this pic is awesome
* seriously, though
]
---
class: frimg
# .right[ Landscape pic on right plus text]
.img-right-land[]
.img-left-text[
* this pic is awesome
* seriously, though
]
---
class: frimg, large
# .right[pic on right with larger font size]
.pull-left[
* this pic is awesome
* seriously, though
]
.pull-right[]
---
class: frimg, right
# pic on right plus text
.pull-left-img[
I could say something about the pic
but at this point there is really nothing left to say
]
.pull-right[]
---
class: frimg
# 2 pics with text on bottom
.pull-left[]
.pull-right[]
.pull-left.center[Center caption: Nice shot!]
.right[Right caption: Not too bad]
---
class: frimg, large
# 2 pics with text on top & bigger font
.pull-left.center[A centered title]
.pull-right.center[Another centered title]
.pull-left[]
.pull-right[]
---
class: frimg, center
background-image: url(figs/me_head.jpeg)
background-size: 300px 300px
# A centered pic (background)
---
class: frimg, center
# Centered pic (object); text above
<img src="figs/me_head.jpeg", alt="", height=300, width=300>
---
class: frimg, center, bottom
<img src="figs/me_head.jpeg", alt="", height=300, width=300>
# Centered pic (object); text below
---
class: center, bottom, inverse-black
# You only live once!
---
# Math expressions: inline
You can write LaTeX math expressions inside a pair of dollar signs, such that
```
$\alpha + \beta = \gamma$
```
renders to
`\(\alpha + \beta = \gamma\)`
---
# Math expressions: display
You can use the LaTeX display style with double $. Note that display equations are always centered on the page. For example,
```
$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$
```
renders to
`$$\bar{X}=\frac{1}{n}\sum_{i=1}^nX_i$$`
--
You can also group multiple equations with a `\\` suffix, such that:
```
$$\mathbf{x}_t = \mathbf{x}_{t-1} + \mathbf{w}_t \\
\mathbf{y}_t = \mathbf{x}_t + \mathbf{v}_t$$
```
renders to
`$$\mathbf{x}_t = \mathbf{x}_{t-1} + \mathbf{w}_t \\
\mathbf{y}_t = \mathbf{x}_t + \mathbf{v}_t$$`
---
# Math side-by-side
Here are two sets of equations. To do this, you have to use inline math (single $) with each equation on its own line.
.pull-left.center[
.under[Random walk]
`\(\mathbf{x}_t = \mathbf{x}_{t-1} + \mathbf{w}_t\)`
`\(\mathbf{y}_t = \mathbf{x}_t + \mathbf{v}_t\)`
]
.pull-right.center[
.under[Biased random walk]
`\(\boldsymbol{\theta}_t = \boldsymbol{\theta}_{t-1} + \boldsymbol{\mu} + \boldsymbol{\omega}_t\)`
`\(\mathbf{y}_t = \boldsymbol{\theta}_t + \boldsymbol{\eta}_t\)`
]
---
class: inverse-blue, middle, center
# This is getting good
---
# Some code displayed
Here is an example of a YAML code block that uses .gray-text[`xaringan::moon_reader`] as a wrapper for remark.js<sup>*</sup>.
```yaml
---
title: "A Cool Presentation"
output:
xaringan::moon_reader
yolo: true
nature:
autoplay: 30000
---
```
See the help page .gray-text[`?xaringan::moon_reader`] for all possible options that you can use.
.footnote[\* check out Xie 2017]
.citation[(see Xie 2017 for more details)]
---
# R Code with output
```r
## a boring regression
fit = lm(dist ~ 1 + speed, data = cars)
coef(summary(fit))
```
```
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -17.579095 6.7584402 -2.601058 1.231882e-02
## speed 3.932409 0.4155128 9.463990 1.489836e-12
```
---
# Code highlighting
You can use `{{}}` in **R** code chunks to highlight lines of code. To do so, you must also add the option .gray-text[`highlightLines: true`] in the .gray-text[`nature`] part of the YAML.
.orange-text[Input:]
```r
if(TRUE) {
{{ message("Very important!") }}
}
```
.blue-text[Output:]
```r
if(TRUE) {
* message("Very important!")
}
```
```
## Very important!
```
---
# R Plots - square
```r
par(mai = c(0.9, 0.9, 0.1, 0.1), omi=c(0,0,0,0))
plot(cars, pch = 19, las = 1)
abline(fit, lwd = 2, col="gray")
```
<img src="template_files/figure-html/cars-1.png" width="50%" height="50%" style="display: block; margin: auto;" />
---
# R Plots - rectangle
```r
par(mai = c(0.8, 0.8, 0.2, 0.2))
plot.ts(cumsum(rnorm(100)), las=1, col="blue",
ylab=expression(italic(x[t])))
```
<img src="template_files/figure-html/timeseries-1.png" width="80%" height="80%" style="display: block; margin: auto;" />
---
# Tables
If you want to generate a table, make sure it is in the HTML format (instead of Markdown or other formats), e.g.,
```r
knitr::kable(head(iris, 4), format = 'html',
align=c('c', 'c', 'r', 'l', 'r'))
```
<table>
<thead>
<tr>
<th style="text-align:center;"> Sepal.Length </th>
<th style="text-align:center;"> Sepal.Width </th>
<th style="text-align:right;"> Petal.Length </th>
<th style="text-align:left;"> Petal.Width </th>
<th style="text-align:right;"> Species </th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center;"> 5.1 </td>
<td style="text-align:center;"> 3.5 </td>
<td style="text-align:right;"> 1.4 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:right;"> setosa </td>
</tr>
<tr>
<td style="text-align:center;"> 4.9 </td>
<td style="text-align:center;"> 3.0 </td>
<td style="text-align:right;"> 1.4 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:right;"> setosa </td>
</tr>
<tr>
<td style="text-align:center;"> 4.7 </td>
<td style="text-align:center;"> 3.2 </td>
<td style="text-align:right;"> 1.3 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:right;"> setosa </td>
</tr>
<tr>
<td style="text-align:center;"> 4.6 </td>
<td style="text-align:center;"> 3.1 </td>
<td style="text-align:right;"> 1.5 </td>
<td style="text-align:left;"> 0.2 </td>
<td style="text-align:right;"> setosa </td>
</tr>
</tbody>
</table>
---
# Tables 2
Here is a table using the **huxtable** package.
```r
ht <- as_hux(head(iris, 4), add_colnames=TRUE)
right_padding(ht) <- 10; left_padding(ht) <- 10
bold(ht)[1,] <- TRUE; italic(ht)[2:5,5] <- TRUE
top_border(ht)[1,] <- 3
bottom_border(ht)[1,] <- 1; bottom_border(ht)[5,] <- 3
number_format(ht) <- 1
align(ht) <- 'center'
ht
```
<table class="huxtable" style="border-collapse: collapse; width: 50%; margin-left: auto; margin-right: auto;">
<col style="width: NA;"><col style="width: NA;"><col style="width: NA;"><col style="width: NA;"><col style="width: NA;"><tr>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:3px 0px 1px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-weight: bold; ">Sepal.Length</span></td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:3px 0px 1px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-weight: bold; ">Sepal.Width</span></td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:3px 0px 1px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-weight: bold; ">Petal.Length</span></td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:3px 0px 1px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-weight: bold; ">Petal.Width</span></td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:3px 0px 1px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-weight: bold; ">Species</span></td>
</tr>
<tr>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">5.1</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">3.5</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">1.4</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">0.2</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-style: italic; ">setosa</span></td>
</tr>
<tr>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">4.9</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">3.0</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">1.4</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">0.2</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-style: italic; ">setosa</span></td>
</tr>
<tr>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">4.7</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">3.2</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">1.3</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">0.2</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 0px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-style: italic; ">setosa</span></td>
</tr>
<tr>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 3px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">4.6</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 3px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">3.1</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 3px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">1.5</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 3px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; ">0.2</td>
<td style="vertical-align: top; text-align: center; white-space: nowrap; border-width:0px 0px 3px 0px; border-style: solid; border-top-color: NA; border-right-color: NA; border-bottom-color: NA; border-left-color: NA; padding: 4pt 10pt 4pt 10pt; "><span style="font-style: italic; ">setosa</span></td>
</tr>
</table>
---
# Timers
- Slides can be automatically played if you set the .gary-text[`autoplay`] option under .gray-text[`nature`]. Note that time has units of milliseconds.
```yaml
output:
xaringan::moon_reader:
nature:
autoplay: 30000
```
--
- A countdown timer can be added to every slide using the .gary-text[`countdown`] option under .gray-text[`nature`]. Again, time is in milliseconds.
```yaml
output:
xaringan::moon_reader:
nature:
countdown: 60000
```
You will see a timer counting down from `01:00`, `00:59`, `00:58`, ... When the timer hits 00:00, the timer will continue but the time turns red.
---
class: small
# Using offline
- To make slides work offline, you need to download a copy of remark.js in advance, because **xaringan** uses the online version by default (see the help page `?xaringan::moon_reader`).
- You can use `xaringan::summon_remark()` to download the latest or a specified version of remark.js. By default, it is downloaded to `libs/remark-latest.min.js`.
- Then change the `chakra` option in YAML to point to this file, e.g.
```yaml
output:
xaringan::moon_reader:
chakra: libs/remark-latest.min.js
```
- If you used Google fonts in slides (the default theme uses _Yanone Kaffeesatz_, _Droid Serif_, and _Source Code Pro_), they won't work offline unless you download or install them locally. The Heroku app [google-webfonts-helper](https://google-webfonts-helper.herokuapp.com/fonts) can help you download fonts and generate the necessary CSS.
---
class: inverse, middle, center
background-image: url(https://upload.wikimedia.org/wikipedia/commons/3/39/Naruto_Shiki_Fujin.svg)
background-size: contain
# Naruto
---
class: small
background-image: url(https://upload.wikimedia.org/wikipedia/commons/b/be/Sharingan_triple.svg)
background-size: 100px
background-position: 90% 8%
# Sharingan
The R package name **xaringan** was derived<sup>1</sup> from **Sharingan**, a dōjutsu in the Japanese anime _Naruto_ with two abilities:
- the "Eye of Insight"
- the "Eye of Hypnotism"
</textarea>
<script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
<script>var slideshow = remark.create({
"highlightStyle": "github",
"highlightLines": true
});
if (window.HTMLWidgets) slideshow.on('afterShowSlide', function (slide) {window.dispatchEvent(new Event('resize'));});
(function() {var d = document, s = d.createElement("style"), r = d.querySelector(".remark-slide-scaler"); if (!r) return; s.type = "text/css"; s.innerHTML = "@page {size: " + r.style.width + " " + r.style.height +"; }"; d.head.appendChild(s);})();</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre']
}
});
</script>
<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
(function () {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://cdn.bootcss.com/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML';
if (location.protocol !== 'file:' && /^https?:/.test(script.src))
script.src = script.src.replace(/^https?:/, '');
document.getElementsByTagName('head')[0].appendChild(script);
})();
</script>
</body>
</html>