从TeX源生成PDF时出错错误:pandoc文档转换失败,错误43 [英] Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 Execution halted
问题描述
我是R的新手,并一直试图用R markdown编写我的项目报告.但是,我面临着问题.我曾尝试实现堆栈溢出以及其他网站上存在的解决方案,但我一直无法取得进展.
I am new to R and have been trying to write my project report in R markdown. However I am facing issues. I tried implementing solutions present on stack overflow as well as other websites, but I have not been able to make progress.
详细信息:
R版本3.2.1(2015-06-18)-世界著名的宇航员"
R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut"
RStudio版本0.99.441 –©2009-2015
RStudio Version 0.99.441 – © 2009-2015
Mac OS X Yosemite版本10.10.5
Mac OS X Yosemite version 10.10.5
已安装pandoc 1.15.0.6 https://github.com/jgm/pandoc/releases/tag/1.15.0.6
Installed pandoc 1.15.0.6 https://github.com/jgm/pandoc/releases/tag/1.15.0.6
MacTeX-2015发行版,来自 http://tug.org/mactex/
The MacTeX-2015 Distribution from http://tug.org/mactex/
mactex-20150613
mactex-20150613
在全局"选项下,我使用knitr编织了Rnw文件,使用XeLaTex将TypeLaTeX排版为PDF,并在编译后取消选择了干净的辅助输出.
Under Global options I have weave Rnw files using knitr, Typeset LaTeX into PDF using XeLaTex, have deselected clean auxiliary output after compile.
我收到以下错误:
输出文件:07.Random_Forest.knit.md
output file: 07.Random_Forest.knit.md
/usr/local/bin/pandoc 07.Random_Forest.utf8.md --to乳胶-from markdown + autolink_bare_uris + ascii_identifiers + tex_math_single_backslash-implicit_figures --output 07.Random_Forest.pdf --template/Library/Frameworks/R.framework/Versions/3.2/Resources/library/rmarkdown/rmd/latex/default-1.14.tex --highlight-style tango --latex-engine/Library/TeX/texbin/pdflatex !未定义的控制顺序. l.921 {\居中\ includegraphics
/usr/local/bin/pandoc 07.Random_Forest.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output 07.Random_Forest.pdf --template /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rmarkdown/rmd/latex/default-1.14.tex --highlight-style tango --latex-engine /Library/TeX/texbin/pdflatex ! Undefined control sequence. l.921 {\centering \includegraphics
pandoc:从TeX源生成PDF时出错 错误:pandoc文档转换失败,错误43 执行停止
pandoc: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 Execution halted
随附我的R降价代码的一部分,以供参考:
Part of my R markdown code is attached for reference:
---
title: "Decision Trees and Random Forest"
paper: a4paper
fontsize: 12pt
geometry:
- tmargin=2cm
- bmargin=2cm
- lmargin=3cm
- rmargin=3cm
documentclass: report
classoption: twoside, bindingoffset=1cm
linkcolor: blue
author: "Chaitanya Jagtap"
date: "15 September 2015"
output: pdf_document
---
opts_chunk$set(echo=FALSE, warning=FALSE, message=FALSE, error=FALSE, collapse=TRUE, tidy=TRUE, highlight=TRUE, comment='')
opts_knit$set(progress=TRUE, verbose=TRUE)
```{r include=TRUE}
library(extrafont)
loadfonts()
library(SDMTools)
library(caTools)
library(randomForest)
library(rpart)
library(rattle)
library(rpart.plot)
library(RColorBrewer)
library(partykit)
library(rmarkdown)
library(geometry)
library(knitr)
library(highr)
library(xtable)
set.seed(211)
fonttable()
options(digits=4)
par(cex=0.9,cex.axis=1,cex.lab=1,cex.main=1.2,cex.sub=1,
font=1,font.axis=1,font.lab=2,font.main=2,font.sub=1,
pin=c(4,3), mai=c(1, 1, 1, .2), oma=c(0.2,0.2,2,0.2), mgp = c(3, 1, 0), adj=0.5,
las=0, xaxs="i", yaxs="i",
col.lab = "firebrick4", col.main="deepskyblue4", col.sub="royalblue", lab=c(10,10,7),
lwd=2,family="Times New Roman", ps=12)
setwd("/Users/Urmila/Desktop/Chaitanya/Study/001_Great Lakes/001_Capstone/002_Give_me_some_credit/")
load("capstone_df_train.RData")
load("capstone_df_test.RData")
xyvar <- c( "GB", "Age_woe", "num_30_59_dpd_woe", "num_60_89_dpd_woe", "num_90_dpd_woe",
"num_open_trades_woe", "num_RE_trades_woe", "Rev_Util_unsec_woe", "Debt_Ratio_woe",
"MI_num_depend_woe")
xvar <- c("Age_woe", "num_30_59_dpd_woe", "num_60_89_dpd_woe", "num_90_dpd_woe",
"num_open_trades_woe", "num_RE_trades_woe", "Rev_Util_unsec_woe", "Debt_Ratio_woe",
"MI_num_depend_woe")
capstone_df_train_xyvar <- capstone_df_train[xyvar]
capstone_df_test_xyvar <- capstone_df_test[xyvar]
weight <- ifelse(capstone_df_train_xyvar$GB == 0,1,12)
dtree_train <- rpart(GB ~ ., data=capstone_df_train_xyvar,
method="class", parms=list(split="information"),
minsplit = 1000, minbucket = 500, cp=-1,
weights = weight)
```
```{r include = TRUE}
dtree_train$cptable
```
```{r include=TRUE, fig.align='center', fig.cap="Plot of cross-validated error against complexity parameter cp"}
plotcp(dtree_train, minline = TRUE, lty=2, col = "firebrick", upper = "size")
mtext("Plot of cross-validated error against complexity parameter cp", side=3, cex=1.1,
line=0.6, col = "dodgerblue4", outer=TRUE)
box("plot", col="blue", lty = "solid")
box("figure", col="forestgreen", lty = "solid")
```
感谢您的时间和帮助.
柴塔尼亚
推荐答案
Pandoc不知道您的输出包含图形,因为您使用了块选项fig.align = 'center'
.您可以将graphics: yes
添加到R Markdown文档的YAML元数据中.
Pandoc does not know your output contains graphics, because you used the chunk option fig.align = 'center'
. You can add graphics: yes
to the YAML metadata of your R Markdown document.
这篇关于从TeX源生成PDF时出错错误:pandoc文档转换失败,错误43的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!