How to customise figure caption in R markdown

Viewed 34

I used output: bookdown::html_document2 in the YAML to successfully cross reference figures in the R markdown output. However, as my sections are numbered, the figures do not start at 1. How do I customise this so that it starts from 1 and increases?

E.g. I have

```{r fig1,fig.cap="Figure 1: Histogram"}

# code to generate the plot ---

```

in the code chunk and include \@ref(fig:fig1) in the markdown. But in the output, it refers to this Figure as Figure 2.1, corresponding to my numbered sections.

Any help would be appreciated.

0 Answers
Related