[R] makefile for sweave

Duncan Murdoch murdoch at stats.uwo.ca
Thu Nov 26 18:51:42 CET 2009


On 26/11/2009 9:14 AM, Wolfgang Raffelsberger wrote:
> Dear all,
>
> I can't get texi2dvi working right. Basically I'd like to convert a .lex 
> to .pdf without having to fiddle with the issue Sweave.sty not being in 
> my current directory (as this was sugested in other posts on this list).
>
> When I'm in the R-Gui I can get the help via
> ?texi2dvi
> (So I conclude its installed.)
>   

Bad conclusion.  That tells you that the R function texi2dvi() is 
installed.  That function tries to run the system level command 
texi2dvi; that's the part that is failing.  As Sundar said, this may 
just be because you don't have your PATH set to include the directory 
it's in.

Duncan Murdoch
> However, when I try to use it to concert a .tex to .pdf I get trouble ...
>
> For example :
> A)
> The file "test02.r" contains :
> Sweave("Sweave_test01.rnw")
> library(tools)
> texi2dvi("Sweave_test01.tex", pdf =T)
>
> Now, when I run on the linux command line :
> R --vanilla -q < test02.r
>
> I get :
>  > Sweave("Sweave_test01.rnw")
> Writing to file Sweave_test01.tex
> Processing code chunks ...
>  1 : term hide (label=chunk_ini)
>  2 : term verbatim eps pdf (label=Fig01)
>  3 : term tex (label=packageVersionInfo)
> Loading required package: xtable
>
> You can now run LaTeX on 'Sweave_test01.tex'
>  > library(tools)
>  > texi2dvi("Sweave_test01.tex", pdf =T)
> Error in texi2dvi("Sweave_test01.tex", pdf = T) :
>   Running 'texi2dvi' on 'Sweave_test01.tex' failed.
> Messages:
> sh: texi2dvi: command not found
> Execution halted
>
>
> B)
> In a previous message on this list I found the following command line(s) 
> suggested, but I my case it won't work
>
> star5_R_test_> R CMD texi2dvi --help
> /usr/local/lib64/R/bin/Rcmd: line 62: exec: texi2dvi: not found
>
> similarly, when execute (as sugested) I get the same error message
>
> star5_R_test_> R CMD texi2dvi -p Sweave_test01.tex
> /usr/local/lib64/R/bin/Rcmd: line 62: exec: texi2dvi: not found
>
>
> I don't understand how can a command can be present (= installed) and 
> still not being found as the error messages suggest ?
>
> For completeness :
>  > sessionInfo()
> R version 2.10.0 (2009-10-26)
> x86_64-unknown-linux-gnu
>
> locale:
> [1] C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base    
>
> other attached packages:
>  [1] xtable_1.5-6         mouse4302probe_2.5.0 AnnotationDbi_1.8.1
>  [4] mouse4302cdf_2.5.0   MASS_7.3-3           fdrtool_1.2.5      
>  [7] limma_3.2.1          affyPLM_1.22.0       preprocessCore_1.8.0
> [10] gcrma_2.18.0         affy_1.24.2          Biobase_2.6.0      
>
> loaded via a namespace (and not attached):
> [1] Biostrings_2.14.3 DBI_0.2-4         IRanges_1.4.4     RSQLite_0.7-3   
> [5] affyio_1.14.0     splines_2.10.0    tools_2.10.0
>
>
>
> Thank's in advance,
> Wolfgang
>
>
> Charles C. Berry a écrit :
> > 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
> >
> > ______________________________________________
>  
> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
> Wolfgang Raffelsberger, PhD
> Laboratoire de BioInformatique et Génomique Intégratives
> IGBMC,  
> 1 rue Laurent Fries,  67404 Illkirch  Strasbourg,  France
> Tel (+33) 388 65 3300         Fax (+33) 388 65 3276
> wolfgang.raffelsberger (at) igbmc.fr
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list