[Tex/LaTex] Sweave: run a bat file in Windows 7


When I run a RNW file inside RStudio compilation is working. But when I try to run the same RNW file through a BAT file, compilation is not working. I am a Win 7 user, using MixTex…

Actually my aim is to work on a LaTeX editor like TeXMaker and compile a RNW files through a BAT file. After compilation I would like to get a PDF file…

On Rstudio I create a file named "main.Rnw" then I simply press on "Compile PDF" then I get a nice PDF output.

But on texmaker I created the same "main.Rnw" but when I create my a "run.bat" file on the same directory, nothing is working. My "run.bat" contains:

Sweave main.Rnw

I don't find a solution to my issue…

My "main.Rnw" code:

\usepackage{lipsum} % for lorem ipsum text
\title{Test sweave}

%fake text

%just a boxplot text
test <- c(-10,8,6,4,2,0,2,4,6,8,10)

%fake text


enter image description here

Best Answer

I do not think there is such a thing as Sweave.exe in R under Windows. There is only R CMD Sweave.

The other way is to define a custom command as illustrated here: http://yihui.name/knitr/demo/editors/ (it is using knitr instead of Sweave, but the basic idea is the same)