【发布时间】:2016-02-07 14:22:20
【问题描述】:
我正在从 rmarkdown 文档渲染 pdf_document。在本文档中,我在 for 循环中创建了十个乳胶表(来自 Hmisc 包的乳胶函数)。
例如,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 \@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
在完成表格之前如何确保段落没有结束?
【问题讨论】:
-
header-includes中的\usepackage[here]导致了问题。将其删除或替换为有效的\usepackage[opt]{pkg} -
@scoa 感谢您的回复。我需要那个包以便将表格准确地放置在最终文档中我想要的位置。你知道一个有效的包做同样的事情吗?
-
“这里”是包的名称吗?然后,
\usepackage{here}。问题是你有[来设置选项,但没有{,所以你的\usepackage不完整 -
就是这样!我不敢相信我以前没有看到。这很简单。我想这与我是乳胶新手有关。如果你愿意,我会添加这个作为答案。
-
好吧,latex 错误信息并不清楚。我投票决定将您的问题作为印刷错误结束,因为答案不太可能对其他人有益
标签: r latex r-markdown