如何将 Rmarkdown 中的 html table 转换为 Latex 以便以 pdf 格式输出?
How can I convert a html table in Rmarkdown into Latex in order to output in a pdf?
我正在处理 RMarkdown pdf 文档,我正在尝试使用 RepoRters 包的 FlexTable 对象转换 table 格式的 html 格式,并希望将其转换为乳胶,以便我可以将 table 输出为 pdf。
有办法吗?
谢谢!
拉斐尔
这是一个适用于我的机器的示例。请务必在 YAML 内容中包含 header-includes
块。
---
title: "lazyWeave Example"
output: pdf_document
header-includes:
- \usepackage{xcolor}
- \usepackage{graphicx}
- \usepackage{colortbl}
---
After running `install.packages("lazyWeave")` the following should produce the desired table.
```{r}
library(lazyWeave)
options(lazyReportFormat = "latex")
```
```{r, results='asis'}
lazy.matrix(mtcars[1:10, ],
rcol = c(TRUE, FALSE),
usecol = "lightgray")
```
我正在处理 RMarkdown pdf 文档,我正在尝试使用 RepoRters 包的 FlexTable 对象转换 table 格式的 html 格式,并希望将其转换为乳胶,以便我可以将 table 输出为 pdf。
有办法吗?
谢谢! 拉斐尔
这是一个适用于我的机器的示例。请务必在 YAML 内容中包含 header-includes
块。
---
title: "lazyWeave Example"
output: pdf_document
header-includes:
- \usepackage{xcolor}
- \usepackage{graphicx}
- \usepackage{colortbl}
---
After running `install.packages("lazyWeave")` the following should produce the desired table.
```{r}
library(lazyWeave)
options(lazyReportFormat = "latex")
```
```{r, results='asis'}
lazy.matrix(mtcars[1:10, ],
rcol = c(TRUE, FALSE),
usecol = "lightgray")
```