---
title: "Style guide for LADAL tutorials"
author: "Your Name"
date: "`r format(Sys.time(), '%Y-%m-%d')`"
output:
  bookdown::html_document2
bibliography: bibliography.bib
link-citations: yes
---

```{r uq1, echo=F, fig.cap="", message=FALSE, warning=FALSE, out.width='100%'}
knitr::include_graphics("https://slcladal.github.io/images/uq1.jpg")
```

# Introduction{-}

This document represents an empty R Markdown file (or Rmd file) for a LADAL tutorial. The R Markdown document for this tutorial can be downloaded [here](https://slcladal.github.io/content/base.Rmd).

You will also have to download the bibliography file from https://slcladal.github.io/content/bibliography.bib for the tutorial to be knitted correctly. Although the knitted (or rendered) html file will look different from the LADAL design (because we have modified the theme for the LADAL page), it will be just like a proper LADAL tutorial once we have knitted the Rmd file on our machines and integrated your tutorial into the LADAL website.

**Preparation and session set up**

This tutorial is based on R. If you have not installed R or are new to it, you will find an introduction to and more information how to use R [here](https://slcladal.github.io/intror.html). For this tutorials, we need to install certain *packages* from an R *library* so that the scripts shown below are executed without errors. Before turning to the code below, please install the packages by running the code below this paragraph. If you have already installed the packages mentioned below, then you can skip ahead and ignore this section. To install the necessary packages, simply run the following code - it may take some time (between 1 and 5 minutes to install all of the libraries so you do not need to worry if it takes some time).

```{r prep1, echo=T, eval = F, message=FALSE, warning=FALSE}
# set options
options(stringsAsFactors = F)         # no automatic data transformation
options("scipen" = 100, "digits" = 4) # suppress math annotation
# install packages
install.packages("tidyverse")
install.packages("flextable")
# install klippy for copy-to-clipboard button in code chunks
install.packages("remotes")
remotes::install_github("rlesur/klippy")
```

Next, we activate the packages. Please include `klippy` in the installation and loading chunks  to allow easy copy&pasting of code.

```{r prep2, message=FALSE, warning=FALSE}
# activate packages
library(tidyverse)
library(flextable)
# activate klippy for copy-to-clipboard button
klippy::klippy()
```

Once you have installed R, RStudio, and have also initiated the session by executing the code shown above, you are good to go.

# Tutorial content

Load some data and show what you want to show.


```{r load, message=FALSE, warning=FALSE}
# load data
data <- base::readRDS(url("https://slcladal.github.io/data/sld.rda", "rb"))
```

Use `flextable` for displaying tabular data as shown below. 

```{r extable, echo = T, message=F, warning=F}
data %>%
  as.data.frame() %>%
  head(10) %>%
  flextable() %>%
  flextable::set_table_properties(width = .5, layout = "autofit") %>%
  flextable::theme_zebra() %>%
  flextable::fontsize(size = 12) %>%
  flextable::fontsize(size = 12, part = "header") %>%
  flextable::align_text_col(align = "center") %>%
  flextable::set_caption(caption = "")  %>%
  flextable::border_outer()
```



Below is the code chunk for exercises.


***

<div class="warning" style='padding:0.1em; background-color:#51247a; color:#f2f2f2'>
<span>
<p style='margin-top:1em; text-align:center'>
<b>EXERCISE TIME!</b></p>
<p style='margin-left:1em;'>
</p></span>
</div>

<div class="question">` 

1. This is an example question.

<details>
  <summary>Answer</summary>
  ```{r message=FALSE, warning=FALSE}
  # this is some code
  1+1
  ```
</details>


</div>`

***

# Remarks on type setting

Level 1 headers with numbers,, lower level headers without numbering (add {-} at the end of the header to suppress numbering).

Function and package names in `package` style (different from normal text). 

Use italics for emphasis rather than bold type. 

# Citation & Session Info {-}

Your last name, your first name. `r format(Sys.time(), '%Y')`. *The title of your tutorial*. Your location: your affiliation (in case you have one). url: https://slcladal.github.io/shorttitleofyourtutorial.html (Version `r format(Sys.time(), '%Y.%m.%d')`).

```
@manual{yourlastname`r format(Sys.time(), '%Y')`net,
  author = {YourLastName, YourFirstName},
  title = {The title of your tutorials},
  note = {https://slcladal.github.io/shorttitleofyourtutorial.html},
  year = {`r format(Sys.time(), '%Y')`},
  organization = {Your affiliation},
  address = {Your location},
  edition = {`r format(Sys.time(), '%Y.%m.%d')`}
}
```

```{r fin}
sessionInfo()
```



***

[Back to top](#introduction)

[Back to HOME](https://slcladal.github.io/index.html)

***

# References {-}

