LyX-Sweave on Ubuntu (Karmic)

Bret Collier sends the following install instructions for LyX-Sweave combination that worked for him on his Ubuntu (Karmic) setup.

Nothing was wrong with your instructions at http://www.bioconductor.org/CRAN/contrib/extra/lyx under install from what I can tell (other than where I put noweb.sty).

Here are the install steps I used (which basically follow the ones you provide on CRAN but I tried to list exactly what I did) to install Lyx 1.6.4 on my Linux Ubuntu Karmic Dual Core 32bit laptop with R v2.10.1 (2009-12-14). Note there are some minor differences with my install routine and what I found at- http://blog.nextbiomotif.com/2009/10/primer-to-sweave-with-lyx.html. Location of Sweave.sty is different.

1: I used Synaptic package manager to install Lyx and LaTex (tex-live). I updated R using sudo apt-get install and sudo apt-get install r-base before anything else.

2. Find the so-called LyX user directory or LyX library directory via the Help -> About LyX menu within LyX (mine was /usr/share/lyx/)

3. Save the 'preferences' file from CRAN (I saved unedited) into- /usr/share/lyx/

4. I saved all the literate-*.* files from CRAN to the layouts sub-directory of the Lyx user directory- /usr/share/lyx/layouts/

5. I put noweb.sty into- /usr/share/texmf/tex/latex/

6. I put Sweave.sty into- /usr/share/texmf/

7. I put any other .sty into- /usr/share/texmf/tex/latex/

8. I used texhash (or sudo texhash) to make sure all the .sty are located.

9. I made sure R was in the path (opened Terminal and typed in "R")

10. I used sudo lyx to open Lyx, then I went Tools->Reconfigure, got the reconfigure successful window, then I closed Lyx

11: Then I opened Lyx and everything was working on the Lyx end.


human mathematics said...

I'm using Ubuntu 10.04 LTS, it's now September 2011. I've spent a HUGE amount of time looking around for the necessary packages -- pgf, pgfSweave, tikzDevice, tiKz, ... it now looks after much research that the problem was using Ubuntu's texlive-full package in the first place. TeX Live package for Debian is only updated to 2009 and most of the helpful changes to Sweave that make it work in LyX are happening in the SVN during mid-2011. So I'm downloading an .iso (1GB) of the Debian 2010 package from http://ftp.ctex.org/mirrors/CTAN/systems/texlive/Images/, hopefully that does the trick. I'll be posting updates to Stack Overflow:


Hopefully someday a person can get Ubuntu + Rstudio + LyX + Sweave running out of the box in under an hour! For me those softwares are the minimum to get work done.

human mathematics said...

So I can say with almost-certainty that Bret Collier's method no longer works for Ubuntu 10.04 users. You have to remove Ubuntu's texlive metapackage and install -- from tug.org -- texlive's own package management program, tlmgr.

Google for net-install on tug.org. That's the first step. As far as getting things to Actually Work ... I'm still not there yet.