我们如何将 pandoc_args 传递给 rmarkdown 中的 yaml 标头? [英] How can we pass pandoc_args to yaml header in rmarkdown?

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

问题描述

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

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

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

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