3
votes

I'm using rmarkdown in rstudio and want to knit to pdf. This works well, except for when I use kable. I'm using the following yaml and it used to work in the past, but now I had to reinstall R, Rstudio and MacTex and now it doesn't work anymore.

---
title: "example"
output:
  pdf_document:
    df_print: kable
    latex_engine: xelatex
---

```{r}
cars
```

The error message I get is:

output file: example.knit.md

! LaTeX Error: Environment kable-table undefined.

Error: LaTeX failed to compile example.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See Study-1.log for more info.

Does anyone know how to solve this?

1
If you reinstalled R, did you also reinstall all your packages, e.g. rmarkdown, kabelExtra, ...? - J_F
I reinstalled most of them, but I may still be missing a few. I have rmarkdown, kabelExtra, and knitr, for example, but I'm not 100% sure which ones I need. - Laurens
Can you upload your complete RMD file (e.g. to github or elsewhere)? - J_F
I'll upload a basic version here: --- title: "example" output: pdf_document: df_print: kable latex_engine: xelatex --- {r setup, include=FALSE} library(tidyverse) library(kableExtra) library(dplyr) library(base) library(broom) library(pander) library(knitr) {r cars, echo=FALSE} cars - Laurens
Without the df_print: kable in the yaml it does work, but then the output is rather ugly. It used to work for me with that part in the yaml before I had to reinstall all my software - Laurens

1 Answers

3
votes

This is a bug of rmarkdown (against higher versions of Pandoc), which I just fixed on Github. Please try:

remotes::install_github('rstudio/rmarkdown')