[ESS] Integration of Sweave R and ESS

Mathieu Basille basille at ase-research.org
Mon Jan 23 15:35:30 CET 2012


Dear Serdar,

I'm not sure I understood your question perfectly, but I have the following 
code in my .emacs to integrate Sweave with AucTEX:

(setq TeX-file-extensions
       '("Snw" "Rnw" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))
(add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
(add-to-list 'auto-mode-alist '("\\.Snw\\'" . Snw-mode))
(add-hook 'Rnw-mode-hook
(lambda ()
   (add-to-list 'TeX-command-list
	       '("Sweave" "R CMD Sweave %s"
		 TeX-run-command nil (latex-mode) :help "Run Sweave") t)
   (add-to-list 'TeX-command-list
	       '("LatexSweave" "%l %(mode) %s"
		 TeX-run-TeX nil (latex-mode) :help "Run Latex after Sweave") t)
   (add-to-list 'TeX-command-list
	       '("RubberSweave" "rubber -d %s && xpdf '%s.pdf'" TeX-run-command 
nil t) t)
   (setq TeX-command-default "Sweave")))

You can skip the rubber line if you're not using it. What it does is 
allowing the user to Sweave a Rnw document using a plain 'C-c C-c' as one 
would do to compile a LaTeX document.

See here for more details: 
https://sites.google.com/site/andreaskiermeier/essmaterials
(I can see that the code has been updated)

Does this help?
Mathieu.


Le 21/01/2012 09:09, Serdar a écrit :
> Hi,
>
> I'm using ESS under Windows and want to know if there is someone that know
> a good macro for running first Sweave then pdflatex. I have found one on
> the but that uses R CMD Sweave command and due to some restriction I cannot
> load Rtools nor GnuWin or alike to execute similar commands. I it possible
> to run Rnw-file in R first than pdflatex afterwards in one Emacs macro.
>
> Regards Serdar
>
> ______________________________________________
> ESS-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

-- 

~$ whoami
Mathieu Basille, Post-Doc

~$ locate
Laboratoire d'Écologie Comportementale et de Conservation de la Faune
+ Centre d'Étude de la Forêt
Département de Biologie
Université Laval, Québec

~$ info
http://ase-research.org/basille

~$ fortune
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.



More information about the ESS-help mailing list