title: Prevent pagebreak in kableExtra landscape table
body: <p>How can a landscape table be plotted in R Markdown (PDF output) without causing a page break to be inserted?</p>
  
  <p>There is the function <code>landscape</code> from the <strong>kableExtra</strong> package, but this forces a page break to be inserted.</p>
  
  <p><strong>Example:</strong></p>
  
  <p>The normal behaviour for tables in R Markdown is that the will float to minimise the breaking up of text. </p>
  
  <pre><code>---
  output: pdf_document
  ---
  
  Some Text
  
  ```{r, echo=F, warning=F}
  library(kableExtra)
  knitr::kable(mtcars, format = "latex", caption = "A table")
  ```
  
  More Text
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/hK8Gy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hK8Gy.png" alt="enter image description here"></a></p>
  
  <p><strong>Landscape</strong>:</p>
  
  <pre><code>---
  output: pdf_document
  ---
  
  Some Text
  
  ```{r, echo=F, warning=F}
  library(kableExtra)
  knitr::kable(mtcars, format = "latex", booktabs = T, caption = "A table") %&gt;%
    landscape()
  ```
  
  More Text
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/fCA9d.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fCA9d.png" alt="enter image description here"></a></p>