简体   繁体   中英

R bookdown: How to change the title of the table of content for rendering a PDF book

I am using bookdown to render a PDF book using the documentclass "scrreprt" from koma script. This works so far, however the book is in German and the table of contents has a title "Contents" instead of a german "Inhaltsverzeichnis".

The "header" of my index.rmd:

---
title: "Mein Buchtitel"
author: "Jens Laufer"
date: "`r Sys.Date()`"
documentclass: scrreprt
---

The output of table of contents looks like this:

在此处输入图片说明 I tried also to add a preamble.tex in index.Rmd:

---
title: "Mein Buchtitel"
author: "Jens Laufer"
date: "`r Sys.Date()`"
documentclass: scrreprt
output:
  bookdown::pdf_book:
    includes:
      in_header: preamble.tex
---

preamble.tex

\renewcommand{\contentsname}{Inhaltsverzeichnis}

However this doesn't help.

Any ideas? Thanks!

You can set the variable toc-title in the YAML metadata, eg,

toc-title: "Table of Contents"

See the Pandoc Manual for more info: https://pandoc.org/MANUAL.html

I could fix the problem by changing the preamble.tex to this:

\usepackage[ngerman]{babel}
\selectlanguage{ngerman}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM