R Sweave(Rnw)无法产生PDF文件-退出代码1 [英] R Sweave (Rnw) won't produce a PDF file - exit code 1

查看:181
本文介绍了R Sweave(Rnw)无法产生PDF文件-退出代码1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在学习如何在Rstudio中使用Sweave从Rstudio中创建PDF文件,而我的机器突然停止了使用Sweave创建PDF的功能.它仍然可以在rMarkdown中创建PDF,但是当它无法通过转位创建退出代码时,它会给出一个退出代码.

I've recently been learning how to use sweave in R to create PDF files out of Rstudio, and my machine has suddenly stopped being able to create a PDF using sweave. It can still create PDFs in rMarkdown, but it gives the exit code one when it fails to do so in sweave.

我在网上发现了十二个类似的问题,但没有一个答案有帮助.我尝试在环境窗口中更改%PATH%,卸载并重新安装了rStudio和Miktex,已将乳胶的路径直接设置到Rstudio的控制台中,尝试使用knitr而不是编织,我试过启用外壳转义命令.不幸的是,这些都不起作用.

There are maybe a dozen questions that I've found online that ask similar questions, but none of the answers have helped. I've tried changing the %PATH% in my environment window, I've uninstalled and reinstalled rStudio and Miktex, I've set the path to latex directly into the console in Rstudio, I've tried using knitr instead of sweave, and I've tried enabling shell escape commands. Unfortunately, none of these have worked.

为了验证我的代码不是问题,我创建了一个简单的示例,遇到了同样的问题.这是我的Rnw代码:

To verify that it's not an issue with my code, I've created a simple example that runs into the same issue. Here's my Rnw code:


\documentclass{article}

\begin{document}
\SweaveOpts{concordance=TRUE}

Hello world

\end{document}

这是编译PDF"选项卡中的输出(请注意,我的Miktex版本为2.9,而不是1.9):

Here's the output in the Compile PDF tab (note, I have Miktex version 2.9, not 1.9):

Writing to file trash.tex
Processing code chunks with options ...
 1 : echo keep.source term verbatim (trash.Rnw:6)

You can now run (pdf)latex on 'trash.tex'
Running pdflatex.exe on trash.tex...failed
Error running C:/PROGRA~1/MIKTEX~1.9/miktex/bin/x64/pdflatex.exe (exit code 1)

这是日志文件(请注意,它始终引用miktex 2.9,而不是1.9):

And here's the log file (note that it always references miktex 2.9, not 1.9):

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.7000 64-bit) (preloaded format=pdflatex 2019.4.18)  19 APR 2019 09:52
entering extended mode
**./trash.tex
(trash.tex
LaTeX2e <2018-12-01>
("C:\Program Files\MiKTeX 2.9\tex/latex/base\article.cls"
Document Class: article 2018/09/03 v1.4i Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex/latex/base\size10.clo"
File: size10.clo 2018/09/03 v1.4i Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(C:/PROGRA~1/R/R-35~1.3/share/texmf/tex/latex\Sweave.sty
Package: Sweave 

("C:\Program Files\MiKTeX 2.9\tex/latex/base\ifthen.sty"
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
)
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\graphicx.sty"
Package: graphicx 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\keyval.sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\graphics.sty"
Package: graphics 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)

("C:\Program Files\MiKTeX 2.9\tex/latex/graphics\trig.sty"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
("C:\Program Files\MiKTeX 2.9\tex/latex/graphics-cfg\graphics.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 99.

("C:\Program Files\MiKTeX 2.9\tex/latex/graphics-def\pdftex.def"
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
))
\Gin@req@height=\dimen103
\Gin@req@width=\dimen104
)

我正在学习如何在错误开始时将我在代码块中的某些工作从rmarkdown转换为sweave,因此我只是希望在问题解决后得到一份定期的PDF,说"hello world".尤其令人困惑的是,在我运行一个简单程序之前,sweave可以很好地创建PDF,此后一切都变得艰难.

I was learning how to transition some of my work in codechunks from rmarkdown to sweave when the error started, so I'm just expecting to get a regular PDF saying "hello world" when the issue is fixed. What's especially puzzling is that sweave was creating PDFs just fine until I ran a simple program, and it's all been downhill since then.

在此先感谢您的任何评论,建议或帮助!

Thank you in advance to any comments, suggestions, or help!

推荐答案

我也发生了(退出代码1).稍后,在下载或加载MikTeX之后,只需转到MikTeX控制台=>设置=>常规=>您可以选择是否即时安装丢失的软件包:选择始终即时安装丢失的软件包.来自 https://yihui.name/zh/2018/03/miktex的引用-自动安装/

I also happen (exit code 1). Later, when downloading or after loading MikTeX, just go to MikTeX Console => Settings => General => You can choose whether missing packages are to be installed on-the-fly : choose Always install missing packages on-the-fly. Reference from https://yihui.name/en/2018/03/miktex-auto-install/

这篇关于R Sweave(Rnw)无法产生PDF文件-退出代码1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆