【问题标题】:Error with knitr on texmakertexmaker 上的 knitr 错误
【发布时间】:2014-07-09 12:46:17
【问题描述】:

我第一次尝试让 knitr 在 texmaker 上运行,我关注 this documentation 并且我在 Windows 7 上。但是,当我编译时,我得到以下错误堆栈:

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)

我试图用谷歌搜索它,但只找到了对 linux/unix 的引用,这对我的情况没有帮助。以下是我的简短测试文档:

\documentclass[a4paper]{article}


\begin{document}

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

\end{document}

这是我第一次使用 stackoverflow,如果您需要更多信息或者我做错了什么,请告诉我。非常感谢。

更新 大家好,

我设法找出了我的错误。为了将来的谷歌搜索,我将文件保存为.tex,而不是.rnw。另存为rnw 解决了它。由于我无法回答自己的问题,因此我在此处对其进行编辑。

【问题讨论】:

  • 你的块很奇怪。我会删除&lt;&lt;b&gt;&gt;= &lt;&lt;a&gt;&gt;
  • 感谢您的评论。我删除了 '>=>' 并且错误消息没有改变。
  • 我想推荐你使用 RStudio 来使用 LaTeX、R 和 knitr。我同时使用 Texmaker 和 RStudio。但仅限 Texmaker,如果我只制作 LaTeX 文件。从我的角度来看,RStudio 对于 *.Rnw 文件更方便。看看:rstudio.com最近的版本有很大的变化,你也可以用git或subversion来控制版本。

标签: r knitr texmaker


【解决方案1】:

当文件保存为.tex 而不是.Rnw 时会发生此错误,因为编译器不知道他应该“编织”具有.tex 句柄的文件,除非您特别设置他就这样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-28
    • 1970-01-01
    相关资源
    最近更新 更多