I have created a single document with the Bookdown-package of R-Markdown that allows both html- and pdf-output. I would like to change the caption labels Figure
, Table
and Table of Contents
into another language. Here's a minimal example:
---
title: Dokument auf Deutsch
output:
bookdown::html_document2:
toc: yes
bookdown::pdf_document2:
toc: yes
---
# Erstes Kapitel
Abbildung \@ref(fig:pressure) ist Deutsch.
```{r pressure, echo=FALSE, out.width = "80%", fig.pos='h', fig.cap="Deutsche Bildunterschrift"}
plot(pressure)
```
Bookdown uses the English word 'Figure' for the figure caption prefix. When knitting to pdf_document2, Bookdown uses the English word 'Contents' for the toc. How to change these to 'Abbildung' and 'Inhalt'?
I have read section 4.5 Internationalization in the Bookdown manual. The author suggests to edit a configuration file _bookdown.yml
, where one could change the label names. However, I can't find such a configuration file, my single Bookdown-document seems to be self-contained. Also, the example in section 4.5 doesn't indicate how to change the term for the toc.
I found this answer with the \renewcommand
. This works for figures and tables when using output:pdf_document2
, but not with output:html_document2
. As a side issue, \renewcommand{\contentsname}{Inhalt}
doesn't change 'Contents' into 'Inhalt' in the pdf-output. So \renewcommand
is not an ideal workaround.
I would actually like to use the original solution described in the above section 4.5 of the Bookdown manual. Where can I find this configuration file _bookdown.yml
when I write a single Bookdown-document? Where in that file could I change the term for the toc? If I have to first create this configuration file, how exactly should I do that and how can I link it to my single Rmd-document?
_bookdown.yml
file in the same directory as your.Rmd
file though, bookdown should automatically link to it when compiling. – Upkeep