1

I have installed MikTex and Rstudio to use R sweave. I wrote the most basic code on R sweave. I have used it on another Windows laptop but while using it on another windows laptop in the exact same manner, it does not compile the PDF. They are both Windows 10, 64-bit systems. This is my code:

\documentclass{article}

\begin{document}
\SweaveOpts{concordance=TRUE}
Hello WOrld!


\end{document} 

This the end error that it returns if I set Weaver to Sweave in Global options:

Writing to file s2.tex Processing code chunks with options ...

You can now run (pdf)latex on 's2.tex' Running pdflatex.exe on s2.tex...failed Error running C:/Users/HPAIO~1/AppData/Local/Programs/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code -1073740791)

If Weaver is set to knitr, then error is this: Loading required package: knitr

processing file: s2.Rnw |......................................................................| 100% ordinary text without R code

output file: s2.tex

[1] "s2.tex" Warning message: In remind_sweave(if (in.file) input, sweave_lines) : It seems you are using the Sweave-specific syntax in line(s) 4; you may need Sweave2knitr("s2.Rnw") to convert it to knitr Running pdflatex.exe on s2.tex...failed Error running C:/Users/HPAIO~1/AppData/Local/Programs/MiKTeX/miktex/bin/x64/pdflatex.exe (exit code -1073740791)

When I click of "View Log", it shows a pop up of "The system cannot find the file specified"

The only difference I see between the computer that ran sweave without issues is that \SweaveOpts {Concordance=TRUE} was not a default line there. But I do not know what that implies, if anything.

Thanks in anticipation.

1
  • 2
    You cannot use \SweaveOpts {Concordance=TRUE} with knitr, it is only for Sweave. This line is not generated in the another computer because it use knitr by default.
    – Fran
    Feb 5, 2021 at 10:04

1 Answer 1

3

The solution that has worked for me has been to completely uninstall MikTex and install an older version (MiKTeX64-2.9.7269-basic) and not update Miktex or the packages. At first run, it gave me an error because could not find some packages and I installed them manually (for example 'grfext', which I downloaded from CTAN org, run the .dtx from my latex editor and it installed).

---> Win 10 64bits RStudio 1.4953

3
  • Ribnikov's solutions worked. I kept install packages on the fly and removed \SweaveOpts {Concordance=TRUE while weaving using knitr in the global settings. Thanks to both!
    – radhika
    Feb 9, 2021 at 8:40
  • There is a thread here: github.com/rstudio/rstudio/issues/9019, I would like to know how to solve without downgrading miktex!
    – fsbmat
    Jun 11, 2021 at 1:52
  • I just spent two days trying to figure out the same issue after updating R and RStudio. The only thing that has worked to allow me to compile pdfs was to follow Ribnikov's example and download an older MikTex version.
    – user41509
    Aug 25, 2021 at 18:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .