[R] makefile for sweave

Charles C. Berry cberry at tajo.ucsd.edu
Tue Sep 8 22:35:34 CEST 2009


On Tue, 8 Sep 2009, Welma Pereira wrote:

> Hello, I have the following makefile. The problem is that the bibliography
> doesn t work. Any help would be appreciated! I really don t don t what to
> do..:-(
>
>
>
> # The sources of the report (tex, Rnw and other files (e.g. bib, idx))
> TEX_CMPS = Report problem
> RNW_CMPS = prop1 prop2 ExeExps
> OTHER =  Report.bib
>
> # The name of the report to produce
> all: Report.pdf
>
> code: $(RNW_CMPS:=.R)
>
> clean:
>    rm -f  *.log *.dvi *~
>
> # On what does the report depends?
> Report.pdf: $(TEX_CMPS:=.tex) $(RNW_CMPS:=.tex) ${OTHER} makefile
>    TEXINPUTS=${TPUTS} pdflatex $<
>    TEXINPUTS=${TPUTS} pdflatex $<

IIRC

 	R CMD texi2dvi -p <target.tex>

takes care of finding sweave.sty and running latex thru all the iterations 
needed to build cross-references and a usable pdf.

Try

 	R CMD texi2dvi --help

at the shell prompt.

HTH,

Chuck

>
>    rm *.log
> #    mv *.aux  $(dir $<)
>
> # How to build the tex files from the Rnw (Sweave) files
> %.tex: %.Rnw
>    echo "library(utils); options(width=60);  Sweave('$<')" | ${R_PRG}
> --no-save --vanilla
>    mv $(notdir $*.tex)  $(dir $<)
>
>
> # How to build the R code files from the Rnw (Sweave) files
> %.R: %.Rnw
>    echo "library(utils); Stangle('$<')" | ${R_PRG} --no-save --vanilla
>
> %.bib:
>    TEXINPUTS=${TPUTS} pdflatex $<
>    bibtex $<
>
> %.aux:
>    TEXINPUTS=${TPUTS} pdflatex $<
>    bibtex $<
>
> %.idx:
>    TEXINPUTS=${TPUTS} pdflatex $<
>    makeindex $<
>
> cheers!
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901




More information about the R-help mailing list