[R] latex code in R -> convert to pdf

David Winsemius dwinsemius at comcast.net
Thu Sep 17 14:57:57 CEST 2009


On Sep 17, 2009, at 4:31 AM, Philipp Pagel wrote:

> On Thu, Sep 17, 2009 at 10:08:57AM +0200, Philipp Pagel wrote:
>>>
>>> is it possible to convert latex code to pdf in R (like a
>>> latex-program would do it)?
>>> Is there a package that comes with this capabilities?
>>>
>>>
>>> My problem is that I want to generate tables automatically -
>>> and I can't use a latex editor at that computer ...
>>>
>>>
>>> Besides latex ... are there good ways to generate tables in R?
>>
>> Have a look at Sweave and xtable - I think that's what you want.
>
> Charlies post made me aware that by "latex editor" you may mean that
> there is no LaTeX installation on your machine. In that case Sweave
> and xtable will obviously be of little use. If you have Openoffice on
> that computer package odfWeave may be the solution. If openoffice is
> not available, either, maybe package HTMLUtils would be another option
> (I haven't used it so far, so I may be wrong here).

The Sweave help page has a set of examples  followed by a line that is  
commented out. If one runs the examples and then this line:
tools::texi2dvi("Sweave-test-1.tex", pdf=TRUE)

One gets a) an error message but also 4 files two of which are the  
expected pdf files and two if which are eps file type. I'm not sure  
what the error message is telling me but it is not correct to my eyes  
that it could be called "failure":

Error in tools::texi2dvi("Sweave-test-1.tex", pdf = TRUE) :
   Running 'texi2dvi' on 'Sweave-test-1.tex' failed.



David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list