views:

270

answers:

2

I'm using GNU/Linux distro (Arch, if that's relevant), Emacs v23.2.1, ESS v5.9 and AucTeX v11.86.

I want to setup AucTeX to recognize .Rnw files, so I can run LaTeX on .Rnw files with C-c C-c and get .dvi file automatically. I reckon it's quite manageable by editing .emacs file, but I still haven't got a firm grasp on Elisp.

Yet another problem is quite annoying - somehow, LaTeX is not recognizing \usepackage{Sweave} in preambule, so I actually need to copy Sweave.sty file (in my case located in /usr/share/R/texmf/Sweave.sty) to directory where .Rnw file is located (and I'm becoming more frustrated by the fact that this is common bug on Windows platforms!)

My question boils down to two problems:

  • how to make LaTeX recognize \usepackage{Sweave} (without copying Sweave.sty to "home" folder each time) [Edit: managed to do this; see comment after Dirk's answer]
  • how to setup AucTeX to compile .Rnw files to .dvi
+3  A: 

That's two different questions.

For the first one, my Debian R packages make sure that there is a soft link from the $RHOME/share/texmf/ directory into the TeX file system tree, e.g. as /usr/share/texmf/tex/latex/R.

For the second question: dunno. I tend to run Sweave via a small shell script I crafted years ago even though I do all the editing in Emacs.

Dirk Eddelbuettel
Thanks for info on the first one. I managed to do it just by putting `Sweave.sty` file in `/usr/share/texmf-dist/tex/latex/Sweave`, hence updating the database from `texconfig`. So that leaves me with #2. Btw, I saw your script on SO, and I'm thinking about binding a bash command to run on .Rnw as a workaround 'till I figure out how to do the AucTeX part.
aL3xa
+3  A: 
aL3xa