Cross-references {#cross}

Cross-references make it easier for your readers to find and link to elements in your book.

Chapters and sub-chapters

There are two steps to cross-reference any heading:

  1. Label the heading: # Hello world {#nice-label}.

    • Leave the label off if you like the automated heading generated based on your heading title: for example, # Hello world = # Hello world {#hello-world}.
    • To label an un-numbered heading, use: # Hello world {-#nice-label} or {# Hello world .unnumbered}.
  2. Next, reference the labeled heading anywhere in the text using \@ref(nice-label); for example, please see Chapter \@ref(cross).

Captioned figures and tables

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)

Don't miss Table \@ref(tab:nice-tab).

  head(pressure, 10), caption = 'Here is a nice table!',
  booktabs = TRUE

Try the bookdown package in your browser

Any scripts or data that you put into this service are public.

bookdown documentation built on Sept. 5, 2021, 5:19 p.m.