Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rmarkdown Error: "! Paragraph ended before \@fileswith@ptions was complete"

I am rendering pdf_document from an rmarkdown document. In this document I make ten latex tables (latex function from Hmisc package) in a for loop.

E.g the rmarkdown code looks like this:

---
title: "test"
output:
  pdf_document:
    latex_engine: lualatex
    number_sections: yes
    toc: yes
    toc_depth: 3
  html_document: default
header-includes:
- \usepackage[dutch]{babel}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyfoot[LE,RO]{title}
- \usepackage{dcolumn}
- \usepackage[here]

---
```{r}
library(Hmisc)
```

```{r results="asis",tidy=FALSE,eval=TRUE,echo=FALSE,message=FALSE, error=FALSE, warning=FALSE, comment = NA}
data_object <- structure(list(test = structure(c(1L, 1L, 2L, 2L), .Label = c("test1", 
"test2"), class = "factor"), test2 = structure(1:4, .Label = c("1", 
"2", "3", "4"), class = "factor")), .Names = c("test", "test2"
), row.names = c(NA, -4L), class = "data.frame")

   for (i in 1:10){
     latex(data_object, title='',file='',caption="title")

   }
```

I get this error:

    ! Paragraph ended before \@fileswith@ptions was complete.
<to be read again> 
\par 
l.101 

pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43

How can I make sure paragraph is not ended before finishing the tables?

like image 610
rdatasculptor Avatar asked Nov 06 '15 12:11

rdatasculptor


1 Answers

This error is common when packages aren't called with brackets {}. Try this substitute in your code:

#Change this:
- \usepackage[here]

#To this:
- \usepackage{here}
like image 58
www Avatar answered Sep 29 '22 17:09

www