How do I change the title of the content title in knitr?
I am using the following options to generate a pdf with knitr:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
toc: yes
---
I would like to change the title of the table of contents (this is "Table of Contents") since I am creating a document in Portuguese. Is there a way to customize it?
source to share
Thanks to @Molx and @Chris in the comments, I could find a solution.
Solution 1
Add \renewcommand{\contentsname}{Índice}
to your document to have a title .Rmd
:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
header-includes:
- \renewcommand{\contentsname}{Whatever}
toc: yes
---
In this solution, Whatever
you put the title inside the argument \contentsname
.
Solution 2
Add lang: portuguese
to your document to have a title .Rmd
:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
lang: portuguese
toc: yes
---
Using this solution, the title was translated "Contents" into Portuguese. This should work if your TeX installation supports the language.
source to share