在Knitr中指定多种同时输出格式 [英] Specifying multiple simultaneous output formats in knitr

查看:68
本文介绍了在Knitr中指定多种同时输出格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够同时指定多种输出格式,例如html_document和pdf_document.我知道可以通过类似

I would like to be able to specify multiple output formats at the same time, for instance html_document and a pdf_document. I know that this can be done very simply with something like

---
  output: [html_document, pdf_document]
---

我可能已经关闭了某些语法,但是我似乎找不到任何地方的文档.我最近发现了knitr-bootstrap并喜欢它.我一直在寻找能够动态隐藏我的代码和输出块的东西.不幸的是,默认情况下,用于knitr-bootstrap调用的YAML块非常复杂,我不知道如何为此指定多个输出.我查看了YAML规范并尝试了一些其他操作,但我很茫然.以下是我当前的YAML前题.任何帮助将不胜感激.

I might have some of that syntax off, but I can not seem to find the documentation anywhere. I have recently discovered knitr-bootstrap and love it. It is what I have been looking for to be able to dynamically hide my code and output blocks. Unfortunately, by default, the YAML block for the knitr-bootstrap invocation is quite complex and I do not know how to specify multiple outputs for this. I have looked at the YAML spec and tried a few different things but I am at a loss. Below is my current YAML frontmatter. Any help would be very grateful.

title: "Beta Regression Comparison"
opset: bootstrap
output:
  knitrBootstrap::bootstrap_document:
    title: "Beta Regression Comparison"
    theme: Simplex
    highlight: Solarized - Light
    theme.chooser: FALSE
    highlight.chooser: FALSE
    menu: FALSE
  pdf_document
---

推荐答案

解决方案是将pdf_document更改为pdf_document: default.不幸的是,我在官方文档中找不到该语法的参考.但是,如果您在RStudio的最新版本中打开RMarkdown文档,请单击Knit HTML,然后单击Knit PDF,它将使用此: default语法.

The solution is to change pdf_document to pdf_document: default. I can't unfortunately find a reference for this syntax in the official documentation. If however you open a RMarkdown document in a recent version of RStudio, click Knit HTML and then Knit PDF, it uses this : default syntax.

语法为:

---
output:
  html_document:
    keep_md: yes
  pdf_document: default
---

这篇关于在Knitr中指定多种同时输出格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆