[ESS] feature request: ess-swv-pdflatex

Patrick Drechsler patrick at pdrechsler.de
Fri May 4 11:19:33 CEST 2007


Hi,

I just noticed that there is no function `ess-swv-pdflatex'. I think
there are two reasons for including this: 

First, for completeness sake (why not have it?). 

Secondly, there are cases where it can enhance the workflow. Here is
an example case:

1. Open a Rnw file.

with ESS 5.3.4:
2a. start R (`M-x R') and switch back to Rnw buffer.
2b. Start Sweave (`M-n s')

with current development version:
2. Start Sweave ('M-n s') (which now automatically starts an R
process, thanks Martin)

3. create a PDF (`M-n P')
4. make some changes to Rnw file.
5. run Sweave

Now, when using XPDF with GNU/Linux it is faster not to close and
restart the XPDF-viewer but instead to run pdflatex again, switch back
to the XPDF-viewer and press `r' (refresh).

A simple function could look like this (I just replace `latex' with
`pdflatex'):

--8<---------------cut here---------------start------------->8---
 ;; NOTE: adding function pdflatex
 (defun ess-swv-pdflatex ()
   "Run PDFLaTeX on the product of Sweave()ing the current file."
   (interactive)
   (save-excursion
     (let* ((namestem (file-name-sans-extension (buffer-file-name)))
	    (latex-filename (concat namestem ".tex"))
	    (tex-buf (get-buffer-create " *ESS-tex-output*")))
       (message "Running PDFLaTeX on '%s' ..." latex-filename)
       (switch-to-buffer tex-buf)
       (call-process "pdflatex" nil tex-buf 1 latex-filename)
       (switch-to-buffer (buffer-name))
       (display-buffer tex-buf)
       (message "Finished running PDFLaTeX" ))))
;; NOTE: remapping keybinding (old: latex; new: pdflatex)
 (define-key noweb-minor-mode-map "\M-nl" 'ess-swv-pdflatex)
--8<---------------cut here---------------end--------------->8---

Cheers

Patrick
-- 
For animals, the entire universe has been neatly divided into things
to (a) mate with, (b) eat, (c) run away from, and (d) rocks.
        -- (Terry Pratchett, Equal Rites)




More information about the ESS-help mailing list