[R] Sweave Makefile issue
Luc Villandré
villandl at dms.umontreal.ca
Thu Dec 17 21:19:25 CET 2009
Dear R-specialists,
I am trying to create a Makefile that will first convert all my .Rnw
files into .tex files and then, that will run the LaTeX compiler to
produce a pdf document. This issue has been discussed before. Hence,
I've basically adapted a Makefile I found at
http://n4.nabble.com/R-Sweave-R-and-complex-latex-projects-td810020.html#a810023
to make it compatible with a Windows XP environment. You will find my
version of it at the end of this message.
However, it's not doing what I expect it to do. Instead of only using
pdfTeX on "total_article.tex" (which is the file with the necessary
headers and \include's), it tries to convert all my tex files into pdf,
which of course cannot be done since only total_article.tex has the
necessary structure to be understood by the compiler.
What's wrong then with this Makefile (I am using GNU Make 3.81)?
I will be grateful for any help you can provide.
_________________________________________________
MASTER = total_article.pdf
# the master document depends on all of the tex files
Rfile = prepareScript.R
RNWFILES = $(wildcard *.Rnw)
TEXFILES = $(wildcard *.tex)
DEPENDS = $(patsubst %.Rnw,%.tex,$(RNWFILES)) $(TEXFILES)
RERUN = "(There were undefined references|Rerun to get
(citations|cross-references|the bars) (correct|right)|Table widths have
changed. Rerun LaTeX.|Linenumber reference failed)"
RERUNBIB = "No file.*\.bbl|Citation.*undefined"
all : $(MASTER)
$(MASTER) : $(DEPENDS)
%.tex : %.Rnw
SWEAVE '$<'
%.pdf : %.tex
@pdflatex $<
@egrep -c $(RERUNBIB) $*.log && (bibtex $*;pdflatex $<); true
@egrep $(RERUN) $*.log && (pdflatex $<) ; true
@egrep $(RERUN) $*.log && (pdflatex $<) ; true
clean:
@del *.aux *.log *.bbl *.blg *.brf *.cb *.ind *.idx *.ilg \
*.inx *.ps *.dvi *.toc *.out *.lot *~ *.lof *.ttt *.fff \
*.eps *.pdf
@del -f $(patsubst %.Rnw,%.tex,$(RNWFILES))
script :
Rcmd BATCH $(Rfile)
--
*Luc Villandré*
/Biostatistician
MUHC-MCH Research Institute/
More information about the R-help
mailing list