How to split a FlexTable across more than 1 page? PDF output, RMarkdown

1.6k Views Asked by At

How to fix Float too large for page by 281.56999pt on input line 453?

Here's an example rmarkdown file:

---
output:
  pdf_document:
    latex_engine: xelatex
---

```{r, results='asis'}
library(flextable)
data <- mtcars[1:50,1:8]
ft <- flextable(data)
autofit(ft)

>LaTeX Warning: Float too large for page by 281.56999pt on input line 453.
2

There are 2 best solutions below

7
On BEST ANSWER

It looks like I haven't fully explained what I mean. The end part of the table generated by flextable::flextable() is not shown on the next page in the pdf file. Here is another example of the tables generated with KableExtra::kable() and FlexTable::flextable().

---

output:
  pdf_document:
    latex_engine: xelatex
---

```{r, results='asis'}
knitr::kable(iris[1:80,])
flextable::flextable(iris[1:80,])
1
On

Using set_table_properties(ft, layout = "autofit") will let latex do the column sizing:

---
output:
  pdf_document:
    latex_engine: xelatex
---

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

```{r}
library(flextable)
data <- mtcars[1:50,1:8]
ft <- flextable(data)
set_table_properties(ft, layout = "autofit")
```