[ESS] ESS (Sweave) and AucTeX integration

Sebastian P. Luque spluque at gmail.com
Tue Jun 19 21:29:22 CEST 2007


On Tue, 19 Jun 2007 11:05:42 +0930,
"Kiermeier, Andreas \(PIRSA - SARDI\)" <Kiermeier.Andreas at saugov.sa.gov.au> wrote:

[...]

> I've played around with AucTeX and ESS a bit today and am happy to
> report that I have come up with an alternative approach, which may be
> useful for some of you.  The only piece of code required in your .emacs
> file is the following.


> (add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode)) (add-to-list
> 'auto-mode-alist '("\\.Snw\\'" . Snw-mode))

> ;; Linking ESS with AucTex (add-hook 'Rnw-mode-hook (lambda ()
> (add-to-list 'TeX-command-list '("Sweave" "R CMD Sweave %s"
> TeX-run-command nil t :help "Run Sweave") t) (add-to-list
> 'TeX-command-list '("LatexSweave" "%l \"%(mode)\\input{%s}\""
> TeX-run-TeX nil t :help "Run Latex after Sweave") t) (setq
> TeX-command-default "Sweave")))

> The first two lines may already be in your .emacs file. Since Snw-mode
> is a synonym (at least for now) to Rnw-mode we only need to modify the
> Rnw-mode-hook.

> The code above adds two new commands to "Command" menu when you visit a
> .Rnw (or .Snw) file. These new commands are * Sweave: Sweave the current
> file and produce a .tex file (the new default for .Rnw files) *
> LatexSweave: Run "latex" or "pdflatex" on the .tex file

[...]

Hi Andreas, thanks for posting this.  I've tried it with GNU Emacs
22.1.50.1 (x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of
2007-06-17 on elegiac, modified by Debian, and AUCTeX 11.83.  I haven't
found any problems with it, and is very convenient!  I'd only suggest
showing these lines to the AUCTeX newsgroup for feedback and improvements.


Cheers,

-- 
Seb




More information about the ESS-help mailing list