【发布时间】:2018-07-04 19:31:21
【问题描述】:
我正在尝试找到一种简单的方法将图像包含在 knit pdfs 和 html 中。编写一组易于转换为任何一种格式的指令会很好。我在这里读到:
Insert picture/table in R Markdown
包含图形的最佳方式是使用代码块。似乎它应该适用于编织 pdf 和 html。但是,它仅包含 pdf 中的图形,而 html 中缺少它。以下是 MWE。
---
title: "a title"
author: "a"
date: "March 3, 2016"
# header-includes: \usepackage{graphicx}
# output:
# pdf_document:
# toc: true
# toc_depth: 3 # default = 3
# number_sections: true # add section numbering to headers
output:
html_document:
toc: true
toc_float:
collapsed: false
toc_depth: 4
number_sections: true
highlight: tango
theme: simplex
---
### Support Vector Machines (SVMs)
SVM optimal hyperplane:
```{r pressure, echo=FALSE, fig.cap="A caption", out.width = '100%', fig.align = 'center'}
# https://bookdown.org/yihui/bookdown/figures.html
knitr::include_graphics("./All_Figures/Chapter8/8.3.pdf")
```
【问题讨论】: