How to change table of content header in knitr?

☆樱花仙子☆ 提交于 2019-12-05 22:29:10

Thanks to @Molx and @Chris in the comments I could find a solution.

Solution 1

Add \renewcommand{\contentsname}{Índice} to the document so that the .Rmd header is:

---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
header-includes:
   - \renewcommand{\contentsname}{Whatever}
toc: yes
---

With this solution the header is Whatever you put inside \contentsname argument.

Solution 2

Add lang: portuguese to the document so that the .Rmd header is:

---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
lang: portuguese
toc: yes
---

Using this solution the header was a translation of "Contents" to Portuguese. This should work if your TeX installation supports the language.

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