texmaker上的knitr错误

texmaker上的knitr错误,r,knitr,texmaker,R,Knitr,Texmaker,我第一次尝试让knitr在texmaker上运行,我紧随其后,在Windows7上运行。但是,在编译时,我会得到以下错误堆栈: Process started Error in readLines(if (is.character(input2)) { : cannot open the connection Calls: <Anonymous> -> knit -> readLines In addition: Warning message: In readLin

我第一次尝试让knitr在texmaker上运行,我紧随其后,在Windows7上运行。但是,在编译时,我会得到以下错误堆栈:

Process started

Error in readLines(if (is.character(input2)) { : cannot open the connection Calls: <Anonymous> -> knit -> readLines

In addition: Warning message: In readLines(if (is.character(input2)) { : cannot open file 'try_easy.Rnw': No such file or directory

Execution halted

Process exited with error(s)
进程已启动
读线错误(如果是.character(input2)){:无法打开连接调用:->knit->readLines
此外:警告消息:在readLines(if(is.character(input2)){:无法打开文件“try_easy.Rnw”:没有这样的文件或目录
停止执行
进程已退出,但出现错误
我尝试用谷歌搜索它,但只找到了对linux/unix的引用,这对我的案例没有帮助。以下是我的简短测试文档:

\documentclass[a4paper]{article}


\begin{document}

<<a>>=
x=rnorm(100)
<<b>>=
<<a>>
mean(x)
@

\end{document}
\documentclass[a4paper]{article}
\开始{document}
=
x=rnorm(100)
=
平均值(x)
@
\结束{document}
这是我第一次使用stackoverflow,所以如果您需要更多信息或者我做错了什么,请告诉我。非常感谢

更新 各位好,


我设法找出了我的错误。为了将来的谷歌搜索者,我将文件保存为
.tex
,而不是
.rnw
。保存为
rnw
解决了这个问题。因为我无法回答自己的问题,所以我在这里编辑它。

当文件保存为
.tex
而不是
.rnw
,就会发生这个错误,因为编译器不知道他应该“编译”具有
.tex
句柄的文件,除非您专门设置了他。

您的区块很奇怪。我会删除
=
,谢谢您的评论。我删除了“=”,错误消息没有改变。我想建议您RStudio使用LaTeX、R和knitr。我同时使用Texmaker和RStudio。但是,我只使用Texmaker,我可以f我只生产LaTeX文件。在我看来,RStudio对于*.Rnw文件更方便。看一看:最近的版本有一些很大的变化,你也可以使用git或subversion的版本控制。