编织Lyx问题 [英] Knitr Lyx Problems
问题描述
我正在努力获取knitr
,然后重新安装LyX并进行新的OS设置.我以前有工作.我在Windows 7 Enterprise计算机上安装了最新版本的R(3.0.1),Knitr版本1.3.3,包括MiKTex 2.9发行版的LyX 2.0.6和RStudio 0.97.551.如果我打开Lyx并仅查看本教程,则可以得到pdflatex输出,因此基本系统正在运行.
I'm working on getting knitr
and LyX re-installed and working on my fresh OS setup. I had it working previously. I installed the latest version of R (3.0.1), Knitr is ver 1.3.3, LyX 2.0.6 including the MiKTex 2.9 distribution, and RStudio 0.97.551 on a Windows 7 Enterprise computer. I can get pdflatex output if I open up Lyx and simply view the tutorial, so the basic system is working.
我尝试运行与Knitr一起使用的旧LyX文件,但现在它们失败了.最初似乎存在路径问题,因为从未创建Rnw
文件.现在,它已经完成了Rnw
文件的创建,无法按照以下错误转换为pdf
.
I've tried running old LyX files I had with Knitr, but now they fail. Initially there appeared to be a path issue, as the Rnw
file was never created. Now it fails on converting to pdf
as in the errors below, having completed the creation of the Rnw
file.
15:34:23.619: Previewing ...
15:34:23.639: (buffer-view: Ctrl+R)
15:34:23.786: Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX 2.0/Resources/scripts/lyxknitr.R" "C:/Users/tbrooks/AppData/Local/Temp/lyx_tmpdir.Hp6600/lyx_tmpbuf2/""knitr-minimal.Rnw" "C:/Users/tbrooks/AppData/Local/Temp/lyx_tmpdir.Hp6600/lyx_tmpbuf2/""knitr-minimal.tex" ISO-8859-15 "C:/Users/tbrooks/Desktop/"
15:34:23.813: The system cannot find the path specified.
Running: Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX 2.0/Resources/scripts/lyxknitr.R" "C:/Users/tbrooks/AppData/Local/Temp/lyx_tmpdir.Hp6600/lyx_tmpbuf2/""knitr-minimal.Rnw" "C:/Users/tbrooks/AppData/Local/Temp/lyx_tmpdir.Hp6600/lyx_tmpbuf2/""knitr-minimal.tex" ISO-8859-15 "C:/Users/tbrooks/Desktop/"
..\..\..\src\support\Systemcall.cpp (273): Systemcall: 'Rscript --verbose --no-save --no- restore "C:/Program Files (x86)/LyX 2.0/Resources/scripts/lyxknitr.R" "C:/Users/tbrooks/AppData/Local/Temp/lyx_tmpdir.Hp6600/lyx_tmpbuf2/""knitr-minimal.Rnw" "C:/Users/tbrooks/AppData/Local/Temp/lyx_tmpdir.Hp6600/lyx_tmpbuf2/""knitr-minimal.tex" ISO-8859-15 "C:/Users/tbrooks/Desktop/"' finished with exit code 1
Error: Cannot convert file
----------------------------------------
An error occurred while running:
Rscript --verbose --no-save --no-restore "C:/Program Files (x86)/LyX
2.0/Resources/scripts/lyxknitr.R"
"C:/Users/tbrooks/AppData/Local/Temp/lyx_tmpdir.Hp6600/lyx_tmpbuf2/""knitr-m...
15:34:26.700: Error while previewing format: pdf2
如果我使用下面从Yihui Xie链接的两个示例,它们都无法在LyX中编译为PDF.如果我将Rnw
文件带入R studio并尝试将其编译为pdf,则该文件适用于在此处找到的knitr-intro.Rnw
(链接),但是当我尝试从LyX文件
If I use two examples linked below from Yihui Xie they both fail to compile to PDF in LyX. If I bring the Rnw
file into R studio and try to compile it to pdf, it works for the knitr-intro.Rnw
found here (link), but fails on the opts_chunk
when I try knitr-minimal.Rnw
created from the LyX file (here).
任何帮助都会得到感激
更新: Yihui的以下回答部分有用.
UPDATE: Yihui's answer below is partially helpful.
它通过更改为knitr解决了Rstudio问题.
It solved the Rstudio issue, by changing to knitr.
它还部分解决了LyX问题.我确实在LyX中有一个指向R的路径,实际上我有以下路径:C:\ Program Files \ R \ R-3.0.1 \ bin其中有R和Rscript可执行文件,但鉴于它是我需要的64位安装再往下走到C:\ Program Files \ R \ R-3.0.1 \ bin \ x64.
It also partially solved the LyX issue. I did have a path to R in LyX, in fact I had this path: C:\Program Files\R\R-3.0.1\bin where there are R and Rscript executables, but given it is a 64 bit install i needed to go one further down to C:\Program Files\R\R-3.0.1\bin\x64.
我现在可以运行R块,但是在编译某些示例时仍然遇到困难.我可以编译knitr-minimal.lyx
,但不能编译knitr-graphics.lyx
.我猜想这可能与字体或tikzDevice有关.我会报告.谢谢
I can now run R chunks, however I am still having trouble compiling some of the examples. I can compile knitr-minimal.lyx
, but not knitr-graphics.lyx
. I'm guessing this might have something to do with font or the tikzDevice. I will report back. Thanks
UPDATE2:实际上tikzDevice不适用于R 3.0.1,因此可以解释该演示的失败.通过R中的extrafonts
在文件中添加了字体之后,我又重新开始工作.谢谢!
UPDATE2: In fact tikzDevice is not available for R 3.0.1, so that explains the failure of that demo. After adding the fonts in my file through extrafonts
in R, I'm back in business. Thanks!
推荐答案
From the message log, I guess R is not in your PATH
(also see here).
对于RStudio的问题,我相信是因为您没有选择knitr
作为编织方法(默认情况下使用Sweave).
For the problem with RStudio, I believe that is because you did not select knitr
as your weaving method (by default it uses Sweave).
这篇关于编织Lyx问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!