yihui / lyx-R

support for R in LyX (Sweave and knitr, ...)
http://yihui.name/knitr/demo/lyx/
28 stars 11 forks source link

lyx pgfSweave on mac #5

Closed floswald closed 12 years ago

floswald commented 12 years ago

hi yihui,

in the unlikely case this is still of interest for anybody, I was succesful in hooking up lyx to pgfsweave on my mac. I didnt' get very far with the line for the converter in the preferences file as posted on your blog, i.e. R -q -e "library(pgfSweave);pgfSweave('yourfile.Rnw')"

this may be specific to my machine, but pgfSweave() failed each single time.

instead i wrote into my lyx preferences:

\converter "literate" "latex" "R CMD pgfsweave -n $$i" ""

and that did the trick. one has to create a link into /Library/Frameworks/R.framework/Resources/bin/pgfsweave from /Library/Frameworks/R.framework/Resources/library/pgfSweave/exec/pgfsweave-script.R for pgfsweave if not installed from source.

by the way: i was a bit too quick with confirming success on the knitr front: I can just run a standard Sweave output with lyx. something seems not to be working. looking forward to new developments!

cheers flo

yihui commented 12 years ago

No no, please ignore everything in the web on the configuration of (pgf)Sweave in LyX, including my own blog posts and even the LyX wiki. What I can tell you at the moment are:

  1. Sweave is fairly easy to use in LyX 2.0.2 now; the PDF manual is at https://github.com/downloads/yihui/lyx/sweave.pdf
  2. pgfSweave is not too complicated to configure in LyX if you do not want tikz externalization, but it can be more complicated than you imagined if you do; I have a hackish R script but I do not want to post it;
  3. it is easier for knitr to work with LyX (see the PDF manual and http://yihui.github.com/knitr/demo/lyx/), and knitr has all the features of pgfSweave
floswald commented 12 years ago

Hi Yihui, you were right (of course). This works very well with lyx. Two things that were not clear to me:

1) the sweave module needs to be loaded 2) but i don't enter R code selecting the "chunk" environment, but plain tex

I kind of missed that in your video.

cheers flo

yihui commented 12 years ago

Both issues have been addressed in the manual: https://github.com/downloads/yihui/lyx/sweave.pdf

The video is outdated somehow. I may do another one after LyX 2.0.3 is released, in which you will see both the Sweave module and the knitr module; I have finally done what I wished to do in LyX.

floswald commented 12 years ago

that's great! although I have to say I'm more than happy with knitr at the moment, it's awesome. cheers

On 28 January 2012 04:24, Yihui Xie < reply@reply.github.com

wrote:

Both issues have been addressed in the manual: https://github.com/downloads/yihui/lyx/sweave.pdf

The video is outdated somehow. I may do another one after LyX 2.0.3 is released, in which you will see both the Sweave module and the knitr module; I have finally done what I wished to do in LyX.


Reply to this email directly or view it on GitHub: https://github.com/yihui/lyx/issues/5#issuecomment-3698143

yihui commented 12 years ago

Just a quick note: LyX 2.0.3 will be released soon, and knitr will be officially supported there. The announcement has not been made yet, but binaries and sources are already in FTP:

ftp://ftp.lyx.org/pub/lyx/bin/2.0.3/ ftp://ftp.lyx.org/pub/lyx/stable/2.0.3/

see http://yihui.name/knitr/demo/lyx/

floswald commented 12 years ago

i might say this is as good as it gets. thanks for letting me know!

On 29 February 2012 20:28, Yihui Xie < reply@reply.github.com

wrote:

Just a quick note: LyX 2.0.3 will be released soon, and knitr will be officially supported there. The announcement has not been made yet, but binaries and sources are already in FTP:

ftp://ftp.lyx.org/pub/lyx/bin/2.0.3/ ftp://ftp.lyx.org/pub/lyx/stable/2.0.3/

see http://yihui.name/knitr/demo/lyx/


Reply to this email directly or view it on GitHub: https://github.com/yihui/lyx/issues/5#issuecomment-4244839