Question Details

No question body available.

Tags

r r-markdown bookdown

Answers (1)

Accepted Answer Available
Accepted Answer
August 5, 2025 Score: 4 Rep: 12,561 Quality: Expert Completeness: 80%

Add a file _bookdown.yml to the same directory of your bookdown file with the following content:

language:
  label:
    fig: !expr "function(i) paste0('Figure ', i, ': ')"

out To quote bookdown chapter 4.5:

If the language of your book is not English, you will need to translate certain English words and phrases into your language, such as the words “Figure” and “Table” when figures/tables are automatically numbered in the HTML output.(...) For example, if you want FIGURE x.x instead of Figure x.x, you can change fig to "FIGURE " (...) or you can pass an R function that takes a figure reference number as the input and returns a string. (e.g., !expr function(i) paste('Figure', i))

We can use this, to wrap the "Figure XX:" in the HTML bold-tag . I had to wrap the whole expression in quotes, because the colon : has it's own meaning within YAML.


This Github Post, which wanted to translate the Figure to Figura helped a lot: https://github.com/rstudio/pagedown/issues/164#issuecomment-586573398