I am creating serial reportings.
I have a long table, created with kable
. In some reports the pagebreak in the table unfortunately happens in a way that only one row of the table ends up on the next page. Can I prevent this? E.g. saying, that on each page there needs to be at least 2 rows?
Example:
---
title: "Example_long_table"
output: pdf_document
header-includes:
\usepackage{longtable}
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(dplyr)
library(kableExtra)
```
```{r longtable, echo=FALSE}
knitr::kable(cars[1:40,],
caption = "long table",
booktabs = T,
longtable = T)%>%
kable_styling(latex_options = c("HOLD_position", "repeat_header"))
```
I tried looking in the tex file, but it looks like I need to change something in the kable
in order for this to work.