如何更改Knitr中的内容标题表? [英] How to change table of content header in knitr?

查看:55
本文介绍了如何更改Knitr中的内容标题表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下选项来生成带有knitr的pdf文档:

I am using the following options to produce a pdf document with knitr:

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

我想更改目录表的标题(即目录"),因为我正在制作葡萄牙语文档.有什么方法可以自定义它?

I would like to change the header of the table of contents (which is "Contents"), since I am producing a document in Portuguese. Is there any way to customize it?

推荐答案

感谢@Molx和@Chris的评论,我可以找到一个解决方案.

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

解决方案1 ​​

\renewcommand{\contentsname}{Índice}添加到文档中,以使.Rmd标头为:

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
---

使用此解决方案,标题是Whatever,您可以将其放置在\contentsname参数中.

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

解决方案2

lang: portuguese添加到文档中,以使.Rmd标头为:

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
---

使用此解决方案,标题是内容"到葡萄牙语的翻译.如果您的TeX安装支持该语言,则此方法应该起作用.

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

这篇关于如何更改Knitr中的内容标题表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆