书本文档可用的输出键值选项?

时间:2019-04-30 21:17:02

标签: r r-markdown pandoc bookdown

如何了解不同的Bookdown输出格式可以使用哪些输出选项键值?

例如,下面我显示了我的书本文档的YAML标头。我可以提供word_document2键值对(reference_docxtemplate-v01.docx)。但是还有哪些其他可用键?我想知道是否有一个font键,因为我想将默认输出字体从Cambria更改为Calibri。

--- 
title: "A Minimal Book Example Foo"
author: "Yihui Xie"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
output: 
  bookdown::pdf_book:
    includes:
      in_header: preamble-v01.tex
    toc: no
  bookdown::word_document2:
    reference_docx: template-v01.docx
---

1 个答案:

答案 0 :(得分:1)

一种快速简便的方法来查找正在使用的特定版本中的选项,只是去R控制台并键入?bookdown::word_document2。 这对所有输出格式均有效,并且您应该会看到带有所有特定于格式的选项的内容。这是?rmarkdown::word_document的输出,用于bookdown::word_document2内部:

Convert to an MS Word document

Description:

     Format for converting from R Markdown to an MS Word document.

Usage:

     word_document(toc = FALSE, toc_depth = 3, fig_width = 5,
       fig_height = 4, fig_caption = TRUE, df_print = "default",
       smart = TRUE, highlight = "default", reference_docx = "default",
       keep_md = FALSE, md_extensions = NULL, pandoc_args = NULL)

(出于相关性考虑,您的版本可能有所不同)

对于其他任何内容,您都可以阅读本书,以获取更好的参考文献here。请注意,output对象上不存在的其他值将根据您用作输出的内容和模板接受的内容而有所不同,但通常您可以查阅书册或pandoc参考以获取更多详细信息({ {3}}。

对于字体问题,您需要更改参考文档以应用字体(请参见pandoc readme)。 fontfamily: arev应该适用于pdf / latex输出。如果还要输出HTML,则可能需要在CSS文件中自定义HTML,请参见thisthis以供参考。