-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.qmd
348 lines (241 loc) · 7.72 KB
/
template.qmd
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
---
title: "YOUR AMAZING PRESENTATION TITLE"
author:
# can add multiple authors or remove any of the following lines
- name: First Last
orcid: 0000-0000-0000-0000
email: twri@tamu.edu
affiliation: TWRI, Texas A&M AgriLife Extension
- name: Michael Schramm
orcid: 0000-0003-1876-6592
email: michael.schramm@ag.tamu.edu
affiliation: TWRI, Texas A&M AgriLife Research
date: today
bibliography: refs.bib
format: txwri-revealjs
embed-resources: true
---
## Install
Start from scratch:
```bash
quarto install extension txwri/quarto-revealjs-txwri
```
Or install and include this template:
```bash
quarto use template txwri/quarto-revealjs-txwri
```
## Install
In RStudio, install using the Terminal tab:
![](images/terminal.png){width="75%"}
## Example slide
### This is a subtitle
Here we have some text that may run over several lines of the slide frame,
depending on how long it is.
- first item
- A sub item
## Render figures
Include output from R or Python directly as figures:
```{r}
#| echo: true
#| fig-width: 2.5
#| fig-height: 2.5
#| output-location: column
library(ggplot2)
library(tidyr)
library(dplyr)
library(stringr)
library(scico)
data("volcano")
volcano |>
as_tibble(.name_repair = "universal") |>
mutate(latitude = 1:n()) |>
pivot_longer(!latitude, names_to = "longitude", values_to = "altitude") |>
mutate(longitude = longitude |>
str_remove("[\\.]{3}") |>
as.numeric()) |>
ggplot() +
geom_contour_filled(aes(latitude, longitude, z = altitude),
bins = 20) +
scale_fill_scico_d(palette = "batlowW") +
theme_void() +
theme(legend.position = "none")
```
## Render tables
```{r}
#| label: tbl-cars
#| tbl-cap: "Cars"
#| tbl-colwidths: [60,40]
#| echo: true
#| output-location: column
library(knitr)
kable(head(cars))
```
## Math
Feel free to include some math:
$$
\left( \prod_{i=1}^{n} \right)^{\frac{1}{n}} =\sqrt[n]{x_1, x_2, ... x_n}
$$
or, equivalently:
$$
\exp\left(\frac{1}{n} \sum_{i=1}^n \ln{a_i} \right)
$$
## More info
The Quarto website provides more guidance on revealjs slides and Quarto in general:
https://quarto.org/docs/presentations/
## Additional theme classes
### Some extra things you can do with the txwri-revealjs theme
Special classes for emphasis
- `.alert` class for default emphasis, e.g. [important note]{.alert}.
- `.fg` class for custom colour, e.g. [important note]{.fg style="--col: #e64173"}.
- `.bg` class for custom background, e.g. [important note]{.bg style="--col: #e64173"}.
Cross-references
- `.button` class provides a Beamer-like button, e.g. [[Appendix]{.button}](#sec-appendix)
- Quarto's native cross-ref syntax, e.g., "See @sec-appendix."
## Components
### Citations
Citations follow the standard
[Quarto format](https://quarto.org/docs/authoring/footnotes-and-citations.html#citations)
and be sourced from BibLaTex, BibTeX, or CLS files. For example:
- [Topic 1:]{.alert} Stats and trends [@helselStatisticalMethodsWater2020; @schrammTotalMaximumDaily2022]
- [Topic 2:]{.alert} Watershed governance [@biddleImprovingEffectivenessCollaborative2017]
## Components
### Blocks
Quarto provides
[dedicated environments](https://quarto.org/docs/authoring/cross-references.html#theorems-and-proofs)
for theorems, lemmas, and so forth.
But in presentation format, it's arguably more effective just to use a
[Callout Block](https://quarto.org/docs/authoring/callouts.html).
:::{.callout-note}
## Regression Specification
The main specification is as follows:
$$
y_{it} = X_{it} \beta + \mu_i + \varepsilon_{it}
$$
:::
## Components
### Multicolumn I: Text only
:::: {.columns}
::: {.column width="50%"}
#### Column 1
Here is a long sentence that will wrap onto the next line as it hits the column
width, and continue this way until it stops.
:::
::: {.column width="50%"}
#### Column 2
Some other text in another column.
A second paragraph.
:::
::::
Multicolumn support is very flexible and we can continue with a single full
span column in the same slide.
## Components
### Multicolumn II: Text and figures
:::: {.columns}
::: {.column width="50%"}
![](images/kanagawa.jpg){width="70%"}
:::
::: {.column width="50%"}
- A point about the figure that is potentially important.
- Another point about the figure that is also potentially important.
:::
::::
Note that sub- and multi-panel figures are also natively supported by Quarto.
See [here](https://quarto.org/docs/authoring/figures.html#subfigures).
## Components
### Multicolumn III: Code and output
```{r}
#| echo: true
#| label: fig-pairs
#| fig-cap: "Pairwise scatterplot"
#| fig-asp: 1
#| out-width: 75%
#| output-location: column
palette("Classic Tableau")
par(
family = "HersheySans",
las = 1, pch = 19, cex = 1.5
)
pairs(
iris[,1:4],
col=iris$Species
)
```
# Figures {background-color="#0054a4"}
## Figure
![](images/Tres_Palacios_PHOTO_BY_ED_RHODES-001.JPG){width="75%" fig-align="center"}
::: {.attribution}
Photo courtesy of Ed Rhodes
:::
## Figure {background-image="images/kanagawa.jpg" background-size="cover" background-position="top" background-opacity="0.15"}
### Full-size Figures
You can use the `{.background-image}` container environment to completely fill
the slide background with an image.
Ideally, your figure will be the same aspect ratio as the screen that you're presenting on.
- This can be a bit tricky because of the dynamic nature of reveal.js / HTML. But it's probably something close to 16:9.
- Aspect ratio can also matter for a regular full-frame images (previous slide).
# Tables
## Table
Quarto provides support for creating tables with markdown, html, R, Python and more: [https://quarto.org/docs/authoring/tables.html](https://quarto.org/docs/authoring/tables.html)
## Table
With a little effort you can create amazing html tables using the [gt](https://gt.rstudio.com) R package.
```{r}
library(dplyr)
library(tidyr)
library(gt)
countrypops |>
pivot_wider(names_from = year,
names_prefix = "year_",
values_from = population) |>
mutate(ratio = log(year_2021/year_1960),
change = year_2021-year_1960) |>
arrange(desc(change)) |>
head(50) |>
gt(id = "one") |>
cols_hide(c(country_code_2, country_code_3)) |>
cols_nanoplot(columns = starts_with("year"),
new_col_name = "nanoplots",
new_col_label = md("1960-2021 Trend"),
options = nanoplot_options(data_point_fill_color = "#5d0025",
data_area_fill_color = "#5d0025")) |>
tab_header(title = md("**Global Population Increase**"),
subtitle= md("Top 50 countries by total population change (1960-2020)")) |>
fmt_number(columns = ratio) |>
fmt_integer(columns = change) |>
cols_label(country_name = "Country",
ratio = "Log Ratio (2021:1960)",
change = "Population Increase") |>
opt_table_font(font = list(google_font(name = "Open Sans"),
"Arial", "sans serif")) |>
opt_interactive(page_size_default = 5,
use_text_wrapping = FALSE,
use_compact_mode = TRUE,
use_highlight = TRUE) |>
opt_css(css = "
#one .reactable {
font-size: 18px !important;
}
#one .gt_title {
font-size: 26px !important;
}
#one .gt-subtitle {
font-size: 22px !important;
}
")
```
## Contact us
:::: {.columns}
::: {.column width="50%"}
![](images/phone.png)
:::
::: {.column width="50%"}
We'd love to talk about all things water
- {{< fa phone >}} 979.314.2824
- {{< fa envelope >}} <a href = "mailto: twri@tamu.edu">twri@tamu.edu</a>
- {{< fa computer >}} [twri.tamu.edu](twri.tamu.edu)
:::
::::
## References
::: {#refs}
:::
## Appendix {#sec-appendix}
You can add an appendix after a reference slide like this.