使用RStudio时,Booktabs和xtable会发生Rmarkdown失败。 Tufte模板工作正常,但使用标准的.Rmd文件失败并显示错误消息:
! Undefined control sequence. l.133 \toprule pandoc.exe: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43一个可重现的例子:
--- title: "Testing booktabs" author: "r.bot" date: "11 June 2015" output: pdf_document --- ```{r, results='asis'} library(xtable) options(xtable.comment = FALSE) options(xtable.booktabs = TRUE) xtable(head(mtcars[,1:6]), caption = "First rows of mtcars") ```R版本3.1.2(2014-10-31)平台:x86_64-w64-mingw32 / x64(64位)安装最新版本的Pandoc。
Booktabs and xtable fail with Rmarkdown using RStudio. The Tufte template works fine, but using a standard .Rmd file fails with the error message:
! Undefined control sequence. l.133 \toprule pandoc.exe: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43A reproducible example:
--- title: "Testing booktabs" author: "r.bot" date: "11 June 2015" output: pdf_document --- ```{r, results='asis'} library(xtable) options(xtable.comment = FALSE) options(xtable.booktabs = TRUE) xtable(head(mtcars[,1:6]), caption = "First rows of mtcars") ```R version 3.1.2 (2014-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit) Latest version of Pandoc installed.
最满意答案
尝试包括一个文件header.tex ,其中您依赖于booktabs包。 有关详细信息,请参阅rmarkdown 的乳胶选项 。
编辑:虽然包含头文件很方便,并允许更广泛的变化,但在这里,我们通过顶层选项tables: true 。 所以上面例子的最小变化是
--- title: "Testing booktabs" author: "r.bot" date: "June 11, 2015" output: pdf_document tables: true ---之后,样本xtable输出将与booktabs xtable出现。
Try including a file header.tex in which you depend on the booktabs package. See the latex options for rmarkdown for details.
Edit: While the inclusion of headers is convenient and allows for wider ranging changes, here we get by with the top-level options tables: true. So the minimal change for the example above is
--- title: "Testing booktabs" author: "r.bot" date: "June 11, 2015" output: pdf_document tables: true ---after which the sample xtable output appears with booktabs.
更多推荐
发布评论