[ESS] Snw files are not weaved by C-c C-c from AucTeX-mode

Markus Jäntti markus.jantti at iki.fi
Tue Aug 1 20:24:58 CEST 2006


Dear Jens and List:

this maybe related to the what auctex and reftex think of as being valid 
file extensions. In this particular case, in fact, auctex.

In a somewhat different context -- discussing how to get multifile 
documents to work properly -- I wrote an email to the auctex list, 
pasted in below. You should, in particular, check that the variables 
reftex-file-extensions and TeX-file-extensions are set such that they 
pick up the correct kind of file.

I work on Debian Linux using emacs. Note also that getting this to work 
required some changes to be made to reftex, and it still does not work 
quite as it should. All the same, you should be able to get this to work 
  by setting the extensions.

Hope this helps.

Regards,

markus

---------------------------------------------------------------
-------- Original Message --------
Subject: Re: [AUCTeX] Problems with path?
Date: Sat, 25 Mar 2006 14:41:30 +0200
From: Markus Jäntti <markus.jantti at iki.fi>
Organization: Abo Akademi University
To: Carsten Dominik <dominik at science.uva.nl>
CC: Fredrik Karlsson <dargosch at gmail.com>, auctex at gnu.org
References: 
<376e97ec0603232336v7770a168s2a8f4ba3a4a8a953 at mail.gmail.com>	 
<be1f1c4670d928bd011b2df3f4f55405 at science.uva.nl>

Hi -- I have now written a little documentation on this topic, included
below here. Note that for some reason, the variable TeX-master does not
get properly set from the %%% Local Variables in the foo.Rnw noweb file,
but if set manually to the correct value, things work as they should.

I am quite happy to modify the below text so that it is better suited
for the RefTeX documentation structure.

Regards,

Markus
====SNIP==============
markus.jantti at iki.fi/2006-03-25

Using RefTeX and AUCTeX with noweb files (in my example, those for the
Sweave package in the statistical program R) in emacs generally works
(see the Sweave FAQ,
http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html). However, a
multifile document with pieces consisting of noweb files may give you
some problems. In particular, RefTeX used to be unable to parse such
multifile documents correctly before the the included files were
created as .tex files, as opposed to the .nw or .Rnw files that are
actually edited.

Thus, suppose you have a document, master.tex,

\documentsstyle{article}

\begin{document}

\include{foo}
\include{bar}

\end{document}

foo.Rnw and bar.Rnw are the Sweave files. Parsing master.tex *before*
the foo.tex and bar.tex files have been generated is going to lead to
problems, as is parsing the whole document from within the buffer in
which you are editing foo.Rnw.

With the newest version of RefTeX, available at
http://staff.science.uva.nl/~dominik/Tools/reftex/, it is possible to
do this properly. This is what you should do:

- download the latest version of RefTeX from
   http://staff.science.uva.nl/~dominik/Tools/reftex/
- install it in a directory where emacs will find it (the default
   works for me; verify the correct RefTeX gets loaded by issuing from
   within emacs M-x locate-library RET reftex)
- set the following variables (if you are using pure noweb, .nw
    instead of .Rnw below should do the trick).


;; for RefTeX
.(setq reftex-file-extensions  '(("tex" . (".Rnw" ".tex" ".ltx"))
                                                     ("bib" . (".bib"))))

(setq reftex-try-all-extensions t)
;; for AUCTeX

(setq TeX-file-extensions
       '("Rnw" "tex" "ltx" "sty" "cls" "ltx" "texi" "texinfo"))

- now: while the above AUCTeX setting should work, it does not. You
   need to explicitly set TeX-master to whatever value you want it to
   be, in my example "master" bvy issuing the command

   M-x set-variable RET TeX-master RET "master"

   This *regardless* of what the "Local variables" say, such as:

   %%% Local Variables:
   %%% TeX-master: "master"
   %%% End:

   I have been unable to get this to work otherwise, but with this
   addition it works as it should:

These instructions have been tested with

- GNU Emacs 21.4.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
  of 2005-10-03 on trouble, modified by Debian

- RefTeX: 4.31 (latest off the web site)

- AUCTeX: 11.82

====SNIP==============


jens.scheidtmann at bayerbbs.com wrote:
> Dear list,
> 
> Today I installed ESS 5.3.1 on GNU Emacs 21.3.50.1 on W2K.
> Before that I already had installed AUCTeX 11.13 with RefTeX, which was/is
> working smoothly.
> 
> I have downloaded example-1.Snw from the Sweave download area here:
> http://www.ci.tuwien.ac.at/~leisch/Sweave/
> 
> On loading the .Snw file, the mode line shows "LaTeX Ref Fill Noweb NWFL" on
> documentation chunks and "ESS[S] [R] noweb" on code chunks.
> C-h m (Describe Buffer Modes) shows that "LaTeX" stems from AucTeX, so it seems
> the correct modes are started.
> 
> By C-c C-j I am able to execute single lines in R 2.3.1. Or even chunks by using
> the respective menu entries.
> 
> C-c C-c LaTeX on a documentation chunk starts LaTeX (MikTeX), but the following
> error message occurs:
> 
> ---snip---
> Running `LaTeX' on `example-1.Snw' with ``latex --src-specials
> \nonstopmode\input{example-1.Snw.tex}''
> This is e-TeX, Version 3.141592-2.1 (MiKTeX 2.4)
> entering extended mode
> LaTeX2e <2001/06/01>
> Babel <v3.7m> and hyphenation patterns for english, french, german, ngerman, du
> mylang, nohyphenation, loaded.
> 
> 
> ! LaTeX Error: File `example-1.Snw.tex' not found.
> ...
> ----
> 
> I can weave from the R Buffer using:
>> Sweave("example-1.Snw")
> 
> Processing the resulting LaTeX file through Emacs/AucTeX again works.
> 
> Can somebody familiar with ESS / noweb please comment on this?
> Did I miss some obvious configuration items?
> If, yes, which ones?
> Do you need more information?
> 
> Thanks in advance,
> 
> Jens
> 
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
> 


-- 
Markus Jantti
Abo Akademi University
markus.jantti at iki.fi
http://www.iki.fi/~mjantti




More information about the ESS-help mailing list