Other languages for Table and Figure in officedown

40 Views Asked by At

Is there a way to use German words for "Table" and "Figure" in officedown::rocx_document? Just like in the YAML lang: de in a normal word_document from rmarkdown? This does not work here.

This is my YAML:

---
date: "`r Sys.Date()`"
author: "Your Name"
title: "officedown template"
output: 
  officedown::rdocx_document:
    mapstyles:
      Normal: ['First Paragraph']
---
1

There are 1 best solutions below

1
On BEST ANSWER

Don't know of a lang option but you can set the prefix used for figure and table captions in the YAML like so. (Note: There are several more options. See ?officedown::rdocx_document)

---
date: "`r Sys.Date()`"
author: "Your Name"
title: "officedown template"
output: 
  officedown::rdocx_document:
    tables:
      caption:
        pre: 'Tabelle'
    plots:
      caption:
        pre: 'Abbildung'
      topcaption: true
---

```{r setup, include=FALSE}
library(officedown)
library(ggplot2)
```

## Figure

```{r fig.cap="economics plot", fig.id = "tsplot", fig.cap.style = "Image Caption"}
ggplot(economics, aes(date, unemploy / pop)) + 
  geom_line() + 
  theme_minimal()
```

## Table

```{r tab.cap="economics table", tab.id = "mytab", tab.cap.style = "Table Caption"}
head(economics)
```

enter image description here