【发布时间】:2020-09-04 14:00:39
【问题描述】:
我在使用 bookdown 方法从许多 Rmd 文件编译整个文档时遇到了一些麻烦。
如果我编织单独的 .Rmd 文件,则将考虑 YAML 选项中包含的“preamble.tex”。
如果我渲染这本书 (with both approaches described here),那么 'preamble.tex' 将被忽略。
为了使事情具体化,请考虑以下 mwe:
preamble.tex:
\usepackage{times}
index.Rmd:
---
title: "My paper"
site: "bookdown::bookdown_site"
output:
bookdown::pdf_document2:
includes:
in_header: "preamble.tex"
---
01-intro.Rmd:
# Introduction
This chapter is an overview of the methods that we propose to solve an **important problem**.
然后,通过编织 'index.Rmd' 或 '01-intro.Rmd' 使用 'preamble.tex' 中指示的字体。
但是,当使用 bookdown::render_book('index.Rmd',"bookdown::pdf_book", new_session = T) 进行渲染时,它会被忽略。
更重要的是,在我的实际项目中,还有其他输出选项最终会被忽略。例如,我使用toc: false,它在编织单个文件时有效,但在渲染文档时失败。
在这个简单的示例中,可以使用单个文件,但我的实际项目有很多章节,每个章节中都有 R 块。因此,构建单个文件似乎不是一个好主意。
感谢任何关于我在这里遗漏的提示。
提前致谢。
【问题讨论】: