How to translate words "Figure" and "Table" in bookdown::html_document2 documents?

223 Views Asked by At

In bookdown projects, it is possible to translate automatically generated words, such as "Table" or "Figure" by changing settings in the _bookdown.yml file (see https://bookdown.org/yihui/bookdown/internationalization.html). An how can I achieve the same result (translate the words) in bookdown::html_document2 documents? The contens of my R Markdown document:

---
output:
  bookdown::html_document2
---

```{r fig1, fig.cap=CAPTION}
CAPTION = "My plot.  "
plot(women)
```

And the figure caption in the rendered document is:

enter image description here

I'd like to have "Fig." instead of "Figure".

1

There are 1 best solutions below

1
On BEST ANSWER

You need to add a file _bookdown.yml in the same directory as your .Rmd. It should look like this:

_bookdown.yml

language:
  label:
    fig: "Fig. "

.Rmd

---
title: your doc
output: bookdown::html_document2
---

# Chapter 1

A reference to Figure \@ref(fig:women).

```{r women, echo=FALSE, fig.cap="CAPTION"}
plot(women)
```

enter image description here