[ESS] Combining sweave and pdflatex into one helper function

Marius Hofert marius.hofert at math.ethz.ch
Wed Jul 18 09:45:47 CEST 2012


I saw the post of Dirk and Eddelbuettel. My setting I used so far to get Sweave
with AUCTeX to work was this:

;; see http://thread.gmane.org/gmane.emacs.ess.general/2406
(setq TeX-file-extensions
           '("Snw" "Rnw" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo" "dtx"))
(add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))
(add-to-list 'auto-mode-alist '("\\.Snw\\'" . Snw-mode))

;; linking ESS with AUCTeX
;; - from http://thread.gmane.org/gmane.emacs.ess.general/2406 and
;;   adapted from http://blog.nguyenvq.com/2009/05/31/emacs-auctex-rubber-sweave/
;; - for syntax of TeX-command-list, see C-h v TeX-command-list
;; - added --encoding=utf-8 (alternative: use \usepackage[utf8]{inputenc})
(add-hook 'Rnw-mode-hook
	  (lambda ()
	    (add-to-list 'TeX-command-list
			 '("Sweave" "R CMD Sweave --encoding=utf-8 %s"
			   TeX-run-command nil t :help "Run Sweave") t)
	    (add-to-list 'TeX-command-list
			 '("Stangle" "R CMD Stangle --encoding=utf-8 %s"
			   TeX-run-command nil t :help "Run Stangle") t)
	    (setq TeX-command-default "Sweave")))

This gives the option 'Sweave' on C-c C-c. I recently saw the new variable
ess-swv-plug-into-AUCTeX-p and set it via: (setq ess-swv-plug-into-AUCTeX-p t)

However, on C-c C-c there is no option 'Sweave'. What am I missing?



ETH Zurich
Dr. Marius Hofert
RiskLab, Department of Mathematics
HG E 65.2
Rämistrasse 101
8092 Zurich

Phone +41 44 632 2423

More information about the ESS-help mailing list