我正在设置一台新的 M1 Silicon Monterey OS Mac,而我想添加到 Texshop 的方便的 Sweave 引擎无法工作。我的 Engines 文件夹中有一个 Sweave.engine 文件,其中包含以下内容:
#!/bin/bash
export PATH=$PATH:/usr/texbin:/usr/local/bin
R CMD Sweave “$1”
pdflatex “${1%.*}“
它创建了下拉菜单,但它似乎对路径不满意(这是我猜测的最好的情况),因为它说找不到文件。同样,在终端中逐行运行我得到:
Mecomputerhere:~ lizzie$ R CMD Sweave “$1”
Error in (function (file, dir = ".", weave = TRUE, latex = TRUE, tangle = TRUE, :
file '“”' not found
Calls: <Anonymous> -> do.call -> <Anonymous>
Execution halted
这是 tex 控制台中的错误:
`Error in (function (file, dir =".", weave = TRUE, latex = TRUE, tangle = TRUE, :
file `”test.Rnw”’ not found
Calls: <Anonymous> -> do. call -> <Anonymous>
Execution halted
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (Tex Live 2022)
(preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
! I can't find file `”test”’.
<*>"test"
我怀疑这是一个基本路径问题(我不擅长路径),因此任何帮助都将不胜感激。提前致谢。
更新:此版本的引擎代码有效:
#!/bin/bash
export PATH=$PATH:/usr/texbin:/usr/local/bin
R CMD Sweave "$1"
pdflatex "${1%.*}"