Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use the following Sweave template to get R output into LaTeX.

\documentclass[a4paper]{article}
\SweaveOpts{pdf=TRUE, png=FALSE, eps=FALSE, echo=FALSE, prefix=FALSE, width=6, height=6, res=300}

\title{Title}
\author{Author}

\begin{document}

\maketitle


<<>>=
data(airquality)

\begin{center}
<<label=FigureLabel, fig=TRUE, include=FALSE>>=
boxplot(Ozone ~ Month, data = airquality)
@

\begin{figure}[h]
  \centering
  \includegraphics[width=17cm, height=17cm]{FigureLabel}
  \caption{Caption}
  \label{fig:figLabel}
\end{figure}

\end{document}

This Sweave template produces R graphs in PDF format. With png=TRUE in SweaveOpts I can also get R graphs in PNG format.

Now I'm inclined to use TikZDevice and pgfSweave. As I know TikZDevice and pgfSweave produce TeX documents only not PDF. I wonder if there is a way to get figures in PDF and PNG format using SweaveOpts in some way. Thanks in advance for your help.

share|improve this question

1 Answer 1

Try knitr, a "drop-in replacement" for Sweave. With standard settings, it produces a .tex file with TikZ code that is then compiled to PDF and included in your document, automagically.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.