I am working on setting up a new M1 Silicon Monterey OS Mac and my handy-dandy Sweave engine that I like to add to Texshop does not work. I have a Sweave.engine file in my Engines folder with the following:
#!/bin/bash
export PATH=$PATH:/usr/texbin:/usr/local/bin
R CMD Sweave “$1”
pdflatex “${1%.*}“
It creates the drop down menu, but it seems unhappy about the path (as best I can guess) as it says it cannot find the file. Similarly running line by line in Terminal I get:
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
Here's the error in the tex console:
`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"
I suspect this is a basic path issue (I am bad at paths) so any help would be much appreciated. Thanks in advance.
Update: This version of the engine code works:
#!/bin/bash
export PATH=$PATH:/usr/texbin:/usr/local/bin
R CMD Sweave "$1"
pdflatex "${1%.*}"
sweaveon the.Rnwfile? The error you're getting looks like what happens when you run it on a.texfile. Mysweaveengine is identical, and works fine on MacOS 12.3. Your second command fails because you need to provideR CMD Sweavewith an actual.Rnwfilename, not"$1"which is a script variable. – Alan Munn Apr 28 '22 at 20:41R CMD Sweave “$1”In your engine? I assumed that“$1”was some sort of expression to point to whatever the current file was. – user18967339 Apr 28 '22 at 23:18R CMD Sweave test.Rnwfrom the directory that contains the file? – Alan Munn Apr 29 '22 at 00:52Output file: test.tex– user18967339 Apr 29 '22 at 02:36