Cross-references make it easier for your readers to find and link to elements in your book.
There are two steps to cross-reference any heading:
Label the heading: # Hello world {#nice-label}
.
# Hello world
= # Hello world {#hello-world}
.# Hello world {-#nice-label}
or {# Hello world .unnumbered}
.Next, reference the labeled heading anywhere in the text using \@ref(nice-label)
; for example, please see Chapter \@ref(cross).
Figures and tables with captions can also be cross-referenced from elsewhere in your book using \@ref(fig:chunk-label)
and \@ref(tab:chunk-label)
, respectively.
See Figure \@ref(fig:nice-fig).
par(mar = c(4, 4, .1, .1))
plot(pressure, type = 'b', pch = 19)
(\#fig:nice-fig)Here is a nice figure!
Don't miss Table \@ref(tab:nice-tab).
knitr::kable(
head(pressure, 10), caption = 'Here is a nice table!',
booktabs = TRUE
)
Table: (#tab:nice-tab)Here is a nice table!
| temperature| pressure| |-----------:|--------:| | 0| 0.0002| | 20| 0.0012| | 40| 0.0060| | 60| 0.0300| | 80| 0.0900| | 100| 0.2700| | 120| 0.7500| | 140| 1.8500| | 160| 4.2000| | 180| 8.8000|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.