本文介绍了我们如何在rmarkdown中将pandoc_args传递给yaml标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用rmarkdown生成单词(.docx)报告.我想更改目录的标题.这似乎是可能的,因为对于doc文件(1),可以在yaml标头中将pandoc_args作为选项传递.但是我做的不对.谁能提供一个可行的例子?

I'm using rmarkdown to produce a word (.docx) report. I would like to change the header of the toc. This seems possible as pandoc_args can be passed as options in the yaml header in the case of a doc file (1). But I'm not doing it right. Could anyone provide a working example ?

(1) pandoc.args包含在rmarkdown可能的选项中,并且在pandoc手册中,有toc-title选项

---
title: "yaml header"
author: "cedric"
output:  
  word_document:
   toc: true
pandoc_args: toc-title="Table des matières"
---
# One section
# Another

这产生了:

推荐答案

目录的标题为文档元数据,因此您可以使用YAML元数据块进行设置.

The title of the table of contents is document metadata, so you can set it with YAML metadata block.

---
title: "yaml header"
author: "cedric"
output:  
  word_document:
    toc: true
toc-title: "Table des matières"
---

或通过-M命令行标志将其传递.

Or passed it in with the -M command-line flag.

---
title: "yaml header"
author: "cedric"
output:  
  word_document:
    toc: true
    pandoc_args: [
      "-M", "toc-title=Table des matières"
    ]
---

这篇关于我们如何在rmarkdown中将pandoc_args传递给yaml标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 03:41