Reputation: 43
I'm using bookdown to make a simple (one document) Rmarkdown document, knitting to HTML. I understand how to make figures with captions and reference those figures, but I would like to change the numbering on my figures. A simple example of what I'm doing is below.
---
title: "My Title"
author: "Me"
date: "1/1/2016"
output: bookdown::html_document2
bibliography: refs.bib
---
```{r heatmap, fig.cap = "Plot showing blah blah"}
plot(mydata)
```
The above code creates a figure labeled "Figure 1: Plot showing blah blah". I want the figure to be labeled "Figure S1: Plot showing blah blah" (note the "S" before the figure number). (I'm writing a supplement for a journal submission.) I have read into how bookdown works and it seems like I can easily accomplish this by changing one line in the _bookdown.yml
file (see: https://bookdown.org/yihui/bookdown/internationalization.html). The problem is that I don't have a _bookdown.yml
file, I don't know how to make one or how to link it to my .Rmd file. All I have is a .Rmd file that knits perfectly fine with working figure labels, etc.
Any help making, editing, and linking a _bookdown.yml
file would be appreciated. Alternatively, are there any other ways to change the figure numbering? I don't mind the fix being annoying, I just want it to work!
Upvotes: 4
Views: 367
Reputation: 9678
Welcome to stackoverflow!
_bookdown.yml
is a YAML file for optional settings for a bookdown project. See Yihui's documentation for an overview of available options.
You can easily generate such a file yourself, e.g., by saving an R script in RStudio with the .yml extension. There is no need for linking to link to the .Rmd file – it suffices to place it in the project directory.
The most basic _bookdown.yml
that accomplishes what you need is
_bookdown.yml
language:
label:
fig: 'Figure S'
Upvotes: 3