4
我正在從rmarkdown文檔渲染pdf_document。在這個文檔中,我在for循環中製作了10個乳膠表(來自Hmisc包的乳膠功能)。Rmarkdown錯誤:「!段落在 @ fileswith @ ptions完成之前結束」
E.g的rmarkdown代碼如下所示:
---
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")
}
```
我得到這個錯誤:
! Paragraph ended before \@[email protected] 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
我怎樣才能確保段落沒有結束整理表之前?
'header-includes'中的'\ usepackage [here]'導致了問題。刪除它或將其替換爲有效的'\ usepackage [opt] {pkg}' – scoa
@scoa感謝您的回覆。爲了在最終文檔中將表格放置在我想要的位置,我需要該包。你知道一個有效的包嗎? – rdatasculptor
是「這裏」的包名?然後,'\ usepackage {here}'。問題是你有'['設置選項,但沒有'{',所以你的'\ usepackage'不完整 – scoa