[R] Working comfortably with (X)Emacs + Sweave
Dirk Eddelbuettel
edd at debian.org
Wed Apr 30 19:41:18 CEST 2003
On Wed, Apr 30, 2003 at 07:11:01PM +0200, Tamas Papp wrote:
> I would appreciate if people told me how they solve these problems or
> have found any other way to make Xemacs more comfortable. A
> "call sweave and then latex on this file in one go" and "show the DVI
> that was produced from this Rnw file" command would be very
> useful. Emacs init.el files and similar would help a lot, too.
Excellent question. Below is my pedestrian answer. I edit in XEmacs,
and then call this shellscript. You could also bind it to what gets
called from latex/auctex when you 'compile' the input file.
Dirk
#!/bin/bash -e
function errorexit () {
echo "Error: $1"
exit 1
}
function filetest () {
if [ ! -f $1 ]; then
errorexit "File $1 not found"
fi
return 0
}
if [ "$#" -lt 1 ]; then
errorexit "Need to specify argument file"
fi
BASENAME=$(basename $1 .Rnw)
RNWFILE=$BASENAME.Rnw
filetest $RNWFILE
echo "library(tools); Sweave(\"$RNWFILE\")" \
| Rterm --no-save --no-restore --slave
LATEXFILE=$BASENAME.tex
filetest $LATEXFILE && pdflatex $LATEXFILE
PDFFILE=$BASENAME.pdf
filetest $PDFFILE && acroread
--
Don't drink and derive. Alcohol and algebra don't mix.
More information about the R-help
mailing list