2
votes

LyX Version 2.1.1 R version 3.1.0 (2014-04-10) -- "Spring Dance" Platform: x86_64-w64-mingw32/x64 (64-bit) MikTex ver 2.9

I have just installed LyX and cannot get plots in the output. I can get basic knitr examples with no plots to complie to a pdf.

If I View[Ctrl-R] the file knitr-minimal.lyx from within LyX I get the above error message, "LaTeX Error: File `figure/minimal-boring-plots1' not found." with description: " ...\linewidth]{figure/minimal-boring-plots1}

I could not locate the file with any of these extensions: .png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPEG,.JBIG2,.JB2"

However, if I save the knitr-minimal.Rnw file to my R work directory, then run the R script: require(knitr) rnwfile <- "knitr-test.Rnw" knit(rnwfile)

This will produce a TeX file, knitr-minimal.tex, in my work directory, that MikTeX compiles correctly to a pdf with plots included.

I assume I have something setup incorrectly in LyX:(

Any help would be appreciated.

Thanks bob

1
What version of knitr are you using? If you are using version 1.6, can you try using version 1.5? To do that, do remove.packages(knitr) in R (confirm that it is removed by trying to load it), and then install cran.r-project.org/src/contrib/Archive/knitr/knitr_1.5.tar.gzscottkosty
Thanks @scottkosty. I was using knitr version 1.6. When I try to install knitr 1.5 and get an error message:> utils:::menuInstallLocal() Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) : cannot open the connection This a problem with our zip program. I'll try to work on itouldphart

1 Answers

4
votes

My bad. The problem was in the setup of LyX. Instead of allowing the default working directory in the LyX setup I choose the one I wanted to use and some combination of LyX, knitr, and laTeX could not deal with that. After I reset the working directory to the temp directory the packages can now communicate and a pdf with plots was produced. Sorry for the inconvenience. bob