RMarkdown上的grid_tables扩展

时间:2017-07-22 12:05:20

标签: r markdown rstudio r-markdown pandoc

我在尝试使用grid_tables markdown的扩展名渲染pdf_document(以及html)时遇到问题。 Bellow是一个最小的例子,它不会渲染到网格表。

这是RMarkdown,我的代码还是其他任何问题?

谢谢! 拉斐尔。

title: "Test grid_table"
author: "Rafael"
date: "22 de julho de 2017"
output: 
  pdf_document:
    md_extensions: +grid_tables
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper |
|               |               | - bright color     |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
|               |               | - tasty            |
+---------------+---------------+--------------------+

这是来自RStudio的pandoc调用:

  

/ usr / lib / rstudio / bin / pandoc / pandoc + RTS -K512m -RTS teste.utf8.md --to latex --from markdown + autolink_bare_uris + ascii_identifiers + tex_math_single_backslash + grid_tables --output teste.pdf - template /home/rafael/R/i686-pc-linux-gnu-library/3.4/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine pdflatex --variable graphics =是 - 变量'geometry:margin = 1in'

     

输出文件:teste.knit.md

     

创建的输出:teste.pdf

1 个答案:

答案 0 :(得分:0)

您需要在代码和表格之间换行:

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper |
|               |               | - bright color     |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
|               |               | - tasty            |
+---------------+---------------+--------------------+