I have a problem that I've seen several times on here, but the usual solutions aren't working. I can't share all of my code due to some PHI concerns, but I'll try to share as much as I can.
The problem
My kable tables are showing up below the respective headers.
What I've tried
So there are already a few answers on here about similar problems, like
So when I added some random text prior to the tables that weren't showing up in the right spot, they did show up correctly. (Pictured below) Problem is, I don't want to have to add text there.
CodePudding user response:
Ok, let's solve it with the pure LaTeX ;)
---
title: "Test Table"
date: '2021-11-11'
header-includes:
- \usepackage{float}
- \usepackage{caption}
output:
pdf_document
---
```{r}
library(kableExtra)
tab1<- head(mtcars) %>% kbl()
```
\begin{table}[H]
\captionof{table}{Table, stay here!}
`r tab1`
\end{table}