作者: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.yml
under the root directory of the book. Here is a brief example of the former (output formats are specified in theoutput
field 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: assets
split_by: section
config:
toolbar:
position: static
bookdown::pdf_book:
keep_tex: yes
bookdown::html_book:
css: toc.css
documentclass: book
---
Here is an example of
_output.yml
:
这里展示一个 _output.yml
的;例子:
bookdown::gitbook:
lib_dir: assets
split_by: section
config:
toolbar:
position: static
bookdown::pdf_book:
keep_tex: yes
bookdown::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
.中使用三个破折号 ---
。