繁体   English   中英

我们如何在rmarkdown中将pandoc_args传递给yaml头?

[英]How can we pass pandoc_args to yaml header in rmarkdown?

我正在使用rmarkdown生成一个单词(.docx)报告。 我想改变toc的标题。 这似乎是可能的,因为在doc文件(1)的情况下, pandoc_args可以作为yaml头中的选项传递。 但我做得不对。 有人能提供一个有效的例子吗?

(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

这会产生:

文档没有改变toc_title

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

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

或者使用-M命令行标志传递它。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM