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

cls59 chuck at sharpsteen.net
Thu Sep 17 10:20:30 CEST 2009

Martin Batholdy 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?

Unfortunately you're out of luck if you're seeking a direct path from LaTeX
code generated in R to pdf without passing through a LaTeX compiler.
Re-implementing the pdfTeX compiler in R would be a monumental undertaking
as the TeX macro-expansion language is pretty hairy-- low-level TeX can make
the worst Perl screen-vomit look tame by comparison.

And that's just TeX-- throw in a pile of LaTeX macro packages and the
difficulty shoots up another order of magnitude or two.

Martin Batholdy wrote:
> 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?

There's the xtable package which can perform some automagical formatting of
R objects to LaTeX code. If you don't have access to LaTeX at a workstation,
you could try using xtable's HTML output mode-- then use Word or OpenOffice
to open the HTML file and copy the table.

There are also a few utilities out there that can perform a conversion from
TeX to HTML-- they might be worth Googling if xtable's HTML output isn't
working for you.

Good luck!


Charlie Sharpsteen
Environmental Resources Engineering
Humboldt State University
View this message in context: http://www.nabble.com/latex-code-in-R--%3E-convert-to-pdf-tp25486430p25487067.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list