I´ve been trying to get the minimal Demofile for knitr running and compiling in TeXstudio, but I keep getting errormessages.
Here´s the info, mybe somebody can help me out about what I´m doing wrong:
I´m compiling this example file from the knitr website:
\documentclass{article}
\begin{document}
Here is a code chunk.
<<foo, fig.height=4>>=
1+1
letters
chartr('xie', 'XIE', c('xie yihui', 'Yihui Xie'))
par(mar=c(4, 4, .2, .2)); plot(rnorm(100))
@
You can also write inline expressions, e.g. $\pi=\Sexpr{pi}$, and \Sexpr{1.598673e8} is a big number.
\end{document}
I have this added in my Builds as a user command in TeXstudio:
knitr:knitr "C:/Program Files/R/R-3.0.2/bin/Rscript.exe" -e "library(knitr, lib.loc='C:/Users/User/Documents/R/win-library/3.0'); knit2pdf('%.Rnw')"
(based on the info here http://yihui.name/knitr/demo/editors/#comment-784855735 and here http://yihui.name/knitr/demo/editors/ )
Now when compiling I get the error
Couldn´t start Build & View:PdfLaTeX:"C:Program Files (x86)/MikTeX 2.9/miktex/bin/pdflatex.exe" -synctex=1 - interaction=nonstopmode "002-minimal".tex .
and when I hit Ok, it says:
Logfile not found!
TeXstudio works fine with simple .tex-documents.
So what am I missing here?
Thanks in advance!
Best Answer
As can be seen in comments the solution was to add the R program folder to the system path, which corresponds to environment variable
%PATH%
.