haozhu233 / kableExtra

Construct Complex Table with knitr::kable() + pipe.
https://haozhu233.github.io/kableExtra/
Other
688 stars 147 forks source link

Empty Latex Table #848

Closed nmwitzig closed 3 months ago

nmwitzig commented 3 months ago

Hi!

If I do:

kbl(mtcars[1:8, 1:4], booktabs = T, linesep = "") %>% kable_styling(latex_options = "striped", stripe_index = c(1,2, 5:6)) %>%
  save_kable(file = "test.tex")

the results latex file is empty. I am pretty sure I used to do things like this all the time, so I am curious what could fix this issue.

Thank you!

dmurdoch commented 3 months ago

The kbl() function was not told that you want LaTeX output, and it guessed HTML instead. Just add format = "latex" and it will work.