[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX] RE: ESS (Sweave) and AucTeX "integration" - problem in 11.84

From: Kiermeier, Andreas \(PIRSA - SARDI\)
Subject: [AUCTeX] RE: ESS (Sweave) and AucTeX "integration" - problem in 11.84
Date: Wed, 20 Jun 2007 13:41:13 +0930

Hi again,

I thought it might be worthwhile to upgrade to AucTeX 11.84 - just to
make sure it still works. And wouldn't you know it, it doesn't quite.
The "LatexSweave" command is now broken. 

I get the following error message:
Running `LatexSweave' on `article' with ``pdflatex  "
This is pdfeTeX, Version 3.141592-1.30.6-2.2 (MiKTeX 2.5)
entering extended mode
! I can't find file `-interaction=nonstopmode'.
<to be read again> 
<*>  -interaction=nonstopmode\input
Please type another input file name: 

The problem seems to go away by turning interactive mode on (C-c C-t
C-j), but I don't really think I want this.

So, some investigative work reveals a change in TeX-expand-list, namely:

In 11.83 it was:
    ("%(mode)" (lambda ()
                 (if TeX-interactive-mode

In 11.84 it now is:
    ("%(mode)" (lambda ()
                 (if TeX-interactive-mode
                   " -interaction=nonstopmode")))

Customizing TeX-expand-list back to the way it was under 11.83 seems to
fix the problem.

I'm running Miktex 2.5 and haven't been able to find any reported
problems with pdflatex.

Any thoughts would be greatly appreciated.



-----Original Message-----
From: Kiermeier, Andreas (PIRSA - SARDI) 
Sent: Wednesday, 20 June 2007 09:22
To: 'address@hidden'
Subject: ESS (Sweave) and AucTeX "integration"

Dear all, 

I posted this message to the ESS mailing list yesterday and received a
suggestion that this may also be of interest to members of this list (so
apologies for cross-posting).

Being a lisp neophyte I suspect that there are improvements which could
be made. In particular, I would be interested in improving the "compile
cycle" (e.g. Sweave -> Latex ->Bibtex -> Latex -> View). I read that
AucTeX tries to guess the next command, which has always worked well for
me, except for here (its different to what AucTeX is used to).

Any suggestions would be greatly welcome.



-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Kiermeier,Andreas (PIRSA - SARDI)
Sent: Tuesday, 19 June 2007 11:06
To: address@hidden
Subject: [ESS] ESS (Sweave) and AucTeX integration

Hi folks,

David Whiting has previously published a set of functions which a very
useful for sweaving and consequent latex-ing. The only thing that has
not satisfied me (which is not a reflection on David's efforts) is that
they are somewhat separate from AucTeX (some hard-coding is involved).

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

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

Both of these commands can also be invoked when pressing C-c C-c inside
a documentation chunk in the .Rnw file - this is similar to the way you
would process a .tex file.

Note: Sweaving is done by invoking the script inside the \bin
folder of your R installation (comes with R).

Note: latex or pdflatex is invoked based on whether "PDF Mode" is
enable" (see "TeX Options" under the "Commands" menu).

Note: Once the .tex file has been successfully and fully processed (you
may need to run bibtex and latex several times - in the usual way), a
further press of C-c C-c will prompt you for "View" which will give you
the default viewer (pdf or dvi) - all in the usual AucTeX compile cycle.

I have only tried this under the following configuration:
* Windows XP (SP2)
* GNU Emacs 22.1.1 (i386-mingw-nt5.1.2600) of 2007-06-02 on RELEASE
* AucTeX 11.83
* ESS 5.3.4

Any comments are welcome.



Dr Andreas Kiermeier
Senior Statistician
Food Innovation & Safety
South Australian Research & Development Institute
33 Flemington Street, Glenside, SA, 5065

Ph:     +61 8 8207 7884
Fax:    +61 8 8207 7854
If you would like to correspond with me in a secure way, using public
key encryption, please contact me directly for details of my GPG public
key or visit the SARDI website, where you can download my public key
from my personal staff page.

The information in this e-mail and attachments (if any) may be
confidential and/or legally privileged. If you are not the intended
recipient, any disclosure, copying, distribution or action taken is
prohibited. SARDI, The South Australian Research and Development
Institute, is the research division of Primary Industries and Resources

address@hidden mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]