RMarkdown: How to change headline in table of contents in R Markdown?

人走茶凉 提交于 2019-12-22 03:25:00

问题


When I'm using the toc: yes command, the document contains "Content" as the headline of the table of contents. Due to the fact that I want to write this document in german, I also want to change the headline of the table of contents to the equivalent german word. Any suggestions on how to change this?


回答1:


With this YAML header that includes LaTeX-Package babel, it works for me:

---
title: "TOC in German"
header-includes:
  - \usepackage[ngerman]{babel}
output: 
  pdf_document:
    toc: true
    number_sections: yes
---



回答2:


This in your YAML should also work:

header-includes: \renewcommand{\contentsname}{Inhalt}




回答3:


You can also make use of babel simply specifying in the YAML header the "lang" field. For example:

---
lang: de-DE
title: "Ausgefallener Titel"
toc: 1
---

I.e., you can use the "lang" field and specify your desired language-and-country code. For example, de-DE, en-US, etc. (Of course, the corresponding babel package for that language should be installed, or you'll get an error).



来源:https://stackoverflow.com/questions/29080642/rmarkdown-how-to-change-headline-in-table-of-contents-in-r-markdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!