Set page width in Knitr for md or HTML output

十年热恋 提交于 2019-12-04 03:25:18

knitr does not take care of markdown rendering directly, and you can compile *.md to *.html through the markdown package, for which knitr has a wrapper function knit2html(). To get the table of contents, you can add the toc option to markdown::markdownToHTML(), e.g.

library(knitr)
knit2html('foo.Rmd', options = c('toc', markdown::markdownHTMLOptions(TRUE)))

To avoid scrolling, You can use out.width and out.height to fix width and height of the plot in the final output file.

```{r fig.width=7, fig.height=6,out.width=250,out.height=400}
plot(cars)
```
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!