I'm tinkering with blogdown
and would like to create figures and table with non-English caption headers. The following chunk
```{r label1, echo=FALSE, fig.cap="Fancy caption", fig.fullwidth=TRUE}
plot(1,1)
```
produces the plot and a caption that reads
Figure 1: Fancy caption
I'd like to be able to change the label such that, say, "Figure" becomes "Plot". I thought I could fix it in the same way as for bookdown
: In the _bookdown.yml
file I could have
language:
ui:
chapter_name: "Chap "
appendix_name: "App "
label:
fig: 'Plot '
tab: 'Fancy table '
but I'm not sure how to do something similar with a Hugo-based setup from blogdown
. How can I add the above information to, say, the config.toml
file or set it somewhere else?
First, store the _bookdown.yml
file you described in the same folder as the blog post source .Rmd
file, e.g. content/post/_bookdown.yml
if your file is at content/post/my_post.Rmd
.
Then, add _bookdown.yml
to the list of ignoreFiles
in your config.toml
so that Hugo doesn't move _bookdown.yml
to the public directory.
This works because blogdown::html_page()
is based on bookdown::html_document2()
, which will pick up the _bookdown.yml
in the same directory of the source Rmd. I don't think it's possible to set this globally from your blogdown root dir, but if you store all your posts in content/post
it's basically the same thing.
来源:https://stackoverflow.com/questions/49440295/change-figure-and-table-captions-in-blogdown