How to change headline of table of contents in R Markdown Powerpoint presentation?

Viewed 138

I want to change the text "Table of Contents" to "Inhalt" in the pptx presentation. How could I do this? This is what I tried:

---
title: "Untitled"
author: "STAT-UP"
date: "28/09/2020"
output: 
  powerpoint_presentation:
    toc: true
lang: de-DE
header-includes:
  - \renewcommand{\contentsname}{Inhalt}
  - \usepackage[ngerman]{babel}
---

## R Markdown

## Slide with Bullets
1 Answers

toc-title: "Inhalt" on the YAML section changes the title of TOC. So, the following example can produce a pptx file with Inhalt rather than Table of contents.

---
date: "`r Sys.Date()`"
author: "Your Name"
title: "Untitled"
output: 
  powerpoint_presentation:
    toc: true
  officedown::rpptx_document:
    toc: true
    base_format: "bookdown::powerpoint_presentation2" # For cross-reference of Figs/Tabs
    keep_md: TRUE
toc-title: "Inhalt"
---

## Slide 1

This is a slide.

## Slide 2

This is a slide, too.

By the code above, you will get a pptx file as follows:

enter image description here

By the way, I don't think lang key supports pptx outputs. Since Pandoc official manual mentions here that lang key "affects most formats, and controls hyphenation in PDF output when using LaTeX (through babel and polyglossia) or ConTeXt," the key seems to only support PDF and HTML generation and the key has nothing to do with the translation of any header (e.g. "Table of contents" to German "Inhalt", "Table 1" to Spanish "Tabla 1").

Related