TransWikia.com

Error compiling .Rnw in TeXstudio (knitr with PdfLaTeX)

TeX - LaTeX Asked by Can on January 21, 2021

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!

2 Answers

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%.

Answered by Speravir on January 21, 2021

install tinytex in RStudio using tinytex::install_tinytex()

tools-->global option--->Sweave
check : knitr
check : pdfLaTeX
check : Use tinytex when compiling.tex files                                          

If not work, then uninstall ur miktex in ur computer and it' will work After that reinstall miktex...

Answered by jin-young Go on January 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP