0

I have an incosistent behavior when clicking the knit button versus launching rmarkdown::render. I have a parameterized .Rmd called test.Rmd:

---
title: '`r params$college` report'
params:
  college: 'Art & Business'
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, message = F)
```

```{r}
library(tidyverse)
library(knitr)
library(kableExtra)
```

```{r}
mtcars %>% 
 kable( format = 'latex',  longtable = T, booktabs = T) %>% 
  kable_styling(bootstrap_options = "condensed", font_size = 8) %>% 
  landscape(margin = c('1cm')) 
```

The files knits if I click on the knit button. However, if I knit from the console using:

rmarkdown::render('test.Rmd', 
                               params = list(college = 'Art and Business'),
                               output_format = 'pdf_document')

I get the following error:

/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.tex --template /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in' ! LaTeX Error: Environment landscape undefined.

Error: Failed to compile test.tex. See test.log for more info.

Dambo
  • 3,318
  • 5
  • 30
  • 79
  • Do you have any extra aspects that can be stripped out of this question? Does it throw an error if (a) kableExtra functions are excluded, (b) use a normal kable call (ie, without longtable or booktabs), or (c) don't pass the params to rmarkdown? – wibeasley Mar 16 '18 at 23:00
  • @wibeasley it works without `kableExtra::landscape()` – Dambo Mar 17 '18 at 15:30

0 Answers0