作者:Yihui Xie
译者:郑宝童
日期:2021.05.18
3 Output Formats
The bookdown package primarily supports three types of output formats: HTML, LaTeX/PDF, and e-books. In this chapter, we introduce the possible options for these formats. Output formats can be specified either in the YAML metadata of the first Rmd file of the book, or in a separate YAML file named
_output.ymlunder the root directory of the book. Here is a brief example of the former (output formats are specified in theoutputfield of the YAML metadata):
bookdown包主要支持三种输出格式:HTML、LaTeX/PDF和电子书。在本章中,我们将介绍这些格式的可能的选项。输出格式可以在书的第一个Rmd文件的YAML元数据中指定,也可以在书籍根目录下名为 _output.yml的单独YAML文件中指定。下面是前者的一个简单示例(输出格式在output的YAML元数据字段中指定):
---title: "An Impressive Book"author: "Li Lei and Han Meimei"output:bookdown::gitbook:lib_dir: assetssplit_by: sectionconfig:toolbar:position: staticbookdown::pdf_book:keep_tex: yesbookdown::html_book:css: toc.cssdocumentclass: book---
Here is an example of
_output.yml:
这里展示一个 _output.yml的;例子:
bookdown::gitbook:lib_dir: assetssplit_by: sectionconfig:toolbar:position: staticbookdown::pdf_book:keep_tex: yesbookdown::html_book:css: toc.css
In this case, all formats should be at the top level, instead of under an output field. You do not need the three dashes --- in _output.yml.
在这种情况下,所有格式都应该在顶层,而不是在output 字段下。您不需要在_output.yml.中使用三个破折号 --- 。
