Note that the following toy Rmd file will successfully compile to a pdf using the Knit button in Rstudio:
toy_ex.Rmd:
---
title: "toy_example"
output: pdf_document
---
```{r cars}
library(kableExtra)
kable(head(mtcars), format = "latex", booktabs = T)
```
It fails, however, using rmarkdown::render("toy_ex.Rmd") from the console, producing this error at the end of attempted compliation:
! Undefined control sequence.
l.121 \toprule
Error: LaTeX failed to compile toy_ex.tex.
This seems to be some problem with the intermediate .tex file that the call to kable() is generating, but why woud it knit successfully from the Rstudio IDE and not from the console?
I've followed Yihui's debugging steps here; updated packages, reinstalled tinytex, etc.
Versions-
rstudio: 1.2.1335
knitr: 1.28
rmarkdown: 2.3
tinytex: 0.22
kableExtra: 1.1.0
I'm on a mac running 10.15.4 Catalina
Any answers are appreciated-