R 从命令行更改Swave驱动程序

R 从命令行更改Swave驱动程序,r,latex,sweave,R,Latex,Sweave,我当前用于编织的Makefile看起来像: SUFFIXES: .tex .pdf .Rnw MAIN = lecture INCLUDES = chapter1.tex chapter2.tex ... all: $(INCLUDES) $(MAIN).pdf $(MAIN).pdf: $(INCLUDES) $(MAIN).tex .Rnw.tex: R CMD Sweave $*.Rnw .tex.pdf: pdflatex $*.tex <

我当前用于编织的
Makefile
看起来像:

SUFFIXES: .tex .pdf .Rnw
MAIN = lecture
INCLUDES = chapter1.tex chapter2.tex ...

all: $(INCLUDES) $(MAIN).pdf

$(MAIN).pdf: $(INCLUDES) $(MAIN).tex

.Rnw.tex:
        R CMD Sweave $*.Rnw

.tex.pdf:
        pdflatex $*.tex


<snip>
后缀:.tex.pdf.Rnw 主讲 INCLUDES=第1.tex章第2.tex章。。。 全部:$(包括)$(主).pdf $(MAIN).pdf:$(包括)$(MAIN).tex .Rnw.tex: R CMD swave$*.Rnw .tex.pdf: pdflatex$*.tex
假设我想将swave驱动程序更改为使用包(比如)。这样做的最佳方式是什么?

您可以像我们为Rcpp*软件包所做的那样。以下是RcppGSL:

RcppGSL.pdf: RcppGSL/RcppGSL.Rnw
    cp -f RcppGSL/RcppGSL.Rnw .
    $(RSCRIPT) --vanilla -e "require(highlight); \
                             driver <- HighlightWeaveLatex(boxes = TRUE); \
                             Sweave( 'RcppGSL.Rnw', driver = driver ); "
    $(RSCRIPT) -e "tools::texi2dvi( 'RcppGSL.tex', pdf = TRUE, clean = FALSE )"
    bibtex RcppGSL
    $(RSCRIPT) -e "tools::texi2dvi( 'RcppGSL.tex', pdf = TRUE, clean = TRUE )"
    cp RcppGSL/RcppGSL-fake.Rnw RcppGSL.Rnw
RcppGSL.pdf:RcppGSL/RcppGSL.Rnw
cp-f RcppGSL/RcppGSL.Rnw。
$(RSCRIPT)——香草-e“需要(突出显示)\

非常感谢驱动程序。我只需要将
R CMD swave…
更改为
Rscript…
,一切都会正常工作。我不使用R到pdflatex,我只需要额外的
Makefile
后缀命令,这意味着(我认为),我可以避免“伪造”目录。