gpt4 book ai didi

r - 我们如何在 rmarkdown 中将 pandoc_args 传递给 yaml header ?

转载 作者:行者123 更新时间:2023-12-04 03:00:26 25 4
gpt4 key购买 nike

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

(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

这产生:

document without change in toc_title

最佳答案

目录的标题是document metadata ,因此您可以使用 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"
]
---

关于r - 我们如何在 rmarkdown 中将 pandoc_args 传递给 yaml header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47290659/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com