On Windows you could just put this into sweave.bat, say, and then place that anywhere in your path (or in the current directory):
set infile=%~sdpn1 set infile=%infile:\=/% cmd Rcmd Sweave %infile%.Rnw pdflatex %infile%.tex start %infile%.pdf On 10/13/06, Thomas Harte <[EMAIL PROTECTED]> wrote: > below is a very simple bash script to run Sweave from a cygwin terminal, run > pdflatex on > the generated .tex file, and then view the resulting .pdf output. > > i usually use cygwin when i am (forced to be on) Windoze, but i found a few > issues > with paths that this script works around. > > pdfview, used in the script, is simply: > > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > $ cat /usr/local/bin/pdfview > #!/bin/bash.exe > > if [ $# -eq 1 ] > then > /c/Program\ Files/Adobe/Acrobat\ 6.0/Reader/AcroRd32.exe `cygpath -w > -a -s "$1"` > else > /c/Program\ Files/Adobe/Acrobat\ 6.0/Reader/AcroRd32.exe > fi > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > mutatis mutandis for your own Adobe Reader. > > > here is the script: > >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > #!/bin/bash.exe > # rnw.sh [.Rnw file] > # > # $1 must be a .Rnw file > # > RNWFILE=$1 > PWD=`pwd` > FILEBASE=`basename $1 .Rnw` > TEXFILE=$FILEBASE.tex > PDFFILE=$FILEBASE.pdf > > echo " \ > library(\"utils\"); \ > setwd(\"`cygpath -m $PWD`\"); \ > Sweave(\"$RNWFILE\") \ > " \ > | /c/R/R-2.3.1/bin/Rterm.exe --no-save --no-restore > > # the resulting .tex file contains an annoying "c:" ... > # replace it with the pdflatex-friendly "/c" : > sed -e 's/c:/\/c/g' --in-place $TEXFILE > > # now run text processing > pdflatex $TEXFILE > pdfview $PDFFILE & > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
