diff --git a/70_classroom-overview.Rmd b/60_classroom-overview.Rmd similarity index 100% rename from 70_classroom-overview.Rmd rename to 60_classroom-overview.Rmd diff --git a/50_more-content.Rmd b/70_more-content.Rmd similarity index 99% rename from 50_more-content.Rmd rename to 70_more-content.Rmd index 337771fe..2aad6225 100644 --- a/50_more-content.Rmd +++ b/70_more-content.Rmd @@ -1,4 +1,4 @@ -# (PART) More {-} +# (PART) Meta {-} # Notes diff --git a/79_bookdown-cheat-sheet.Rmd b/79_bookdown-cheat-sheet.Rmd new file mode 100644 index 00000000..18151223 --- /dev/null +++ b/79_bookdown-cheat-sheet.Rmd @@ -0,0 +1,48 @@ +# Bookdown cheat sheet + +Here's where I park _little_ *examples* **for myself** about bookdown mechanics that I keep forgetting. + +## Heading blah blah + +## About labelling things {#id-example} + +You can label chapter and section titles using `{#label}` after them, e.g., we can reference Section \@ref(id-example). If you do not manually label them, there will be automatic labels anyway, e.g., this reference to the unlabelled heading \@ref(heading-blah-blah) uses the automatically generated label `\@ref(heading-blah-blah)`. + +## Cross-references + +Add an explicit label by adding `{#label}` to the end of the section header. If you know you're going to refer to something, this is probably a good idea. + +To refer to in a chapter- or section-number-y way, use `\@ref(label)`. + + * `\@ref(install-git)` example: In chapter \@ref(install-git) we explain how to install Git. + +If you are happy with the section header as the link text, use it inside a single set of square brackets: + + * `[A picture is worth a thousand words]`: example "A picture is worth a thousand words" via [A picture is worth a thousand words] + +There are two ways to specify custom link text: + + * `[link text][Section header text]`, e.g., "pic = 1000 words" via [pic = 1000 words][A picture is worth a thousand words] + * `[link text](#label)`, e.g., "RStudio, meet Git" via [RStudio, meet Git](#rstudio-see-git) + +The Pandoc documentation provides more details on automatic section IDs and implicit header references. + +## Figures, tables, citations + +Figures and tables with captions will be placed in `figure` and `table` environments, respectively. + +```{r nice-fig, fig.cap='Here is a nice figure!', out.width='80%', fig.asp=.75, fig.align='center'} +par(mar = c(4, 4, .1, .1)) +plot(pressure, type = 'b', pch = 19) +``` + +Reference a figure by its code chunk label with the `fig:` prefix, e.g., see Figure \@ref(fig:nice-fig). Similarly, you can reference tables generated from `knitr::kable()`, e.g., see Table \@ref(tab:nice-tab). + +```{r nice-tab, tidy=FALSE} +knitr::kable( + head(iris, 20), caption = 'Here is a nice table!', + booktabs = TRUE +) +``` + +You can write citations, too. For example, we are using the **bookdown** package [@R-bookdown] in this sample book, which was built on top of R Markdown and **knitr** [@xie2015]. diff --git a/80_shell.Rmd b/80_shell.Rmd index fe78d00c..85d7c3ff 100644 --- a/80_shell.Rmd +++ b/80_shell.Rmd @@ -1,4 +1,4 @@ -# (APPENDIX) Appendix {-} +# (APPENDIX) Appendix {-} # The shell {#shell} diff --git a/99_sample.Rmd b/99_sample.Rmd deleted file mode 100644 index e86fcb3a..00000000 --- a/99_sample.Rmd +++ /dev/null @@ -1,29 +0,0 @@ -# Applications - -Some _significant_ applications are demonstrated in this chapter. - -## Example one - -## Example two - -# Introduction {#intro} - -You can label chapter and section titles using `{#label}` after them, e.g., we can reference Chapter \@ref(intro). If you do not manually label them, there will be automatic labels anyway, e.g., Chapter \@ref(methods). - -Figures and tables with captions will be placed in `figure` and `table` environments, respectively. - -```{r nice-fig, fig.cap='Here is a nice figure!', out.width='80%', fig.asp=.75, fig.align='center'} -par(mar = c(4, 4, .1, .1)) -plot(pressure, type = 'b', pch = 19) -``` - -Reference a figure by its code chunk label with the `fig:` prefix, e.g., see Figure \@ref(fig:nice-fig). Similarly, you can reference tables generated from `knitr::kable()`, e.g., see Table \@ref(tab:nice-tab). - -```{r nice-tab, tidy=FALSE} -knitr::kable( - head(iris, 20), caption = 'Here is a nice table!', - booktabs = TRUE -) -``` - -You can write citations, too. For example, we are using the **bookdown** package [@R-bookdown] in this sample book, which was built on top of R Markdown and **knitr** [@xie2015]. diff --git a/_bookdown.yml b/_bookdown.yml index c943d56f..d43ad8a5 100644 --- a/_bookdown.yml +++ b/_bookdown.yml @@ -37,9 +37,10 @@ rmd_files: [ "44_prompt-practice-resets.Rmd", "45_prompt-search-github.Rmd", - "50_more-content.Rmd", + "60_classroom-overview.Rmd", - "70_classroom-overview.Rmd", + "70_more-content.Rmd", + "79_bookdown-cheat-sheet.Rmd", "80_shell.Rmd",