[Tikzdevice-bugs] Single file with tikzDevice

Cameron Bracken cameron.bracken at gmail.com
Sun Dec 6 17:34:46 CET 2009


Interesting Idea.  This should work with plain Sweave.  It is not very
efficient and would be very slow for large files since it must write
out then read in then write out.

\documentclass{article}
\usepackage{tikz}
\usepackage[nogin]{Sweave}
\begin{document}
\begin{figure}[ht]
\centering
<<inline,echo=F,results=tex>>=

  require(tikzDevice)
  tf <- tempfile()
  tikz(tf,width=5,height=5)
    x <- rnorm(100)
    plot(x)
  #Suppress "null device 1" from being printed
  dummy <- dev.off()
  cat(readLines(tf),sep='\n')

@
\caption{caption}
\label{fig:inline}
\end{figure}
\end{document}


-Cameron



On Sun, Dec 6, 2009 at 9:02 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
> I would like to create a single file that has my latex and tikzDevice output
> as opposed to outputting the tikZ output into a separate file and using
> \input .  The latex would be generated using cat statements in R.
>
> Can that be done?  If so, can you provide a small example.
>
>


More information about the Tikzdevice-bugs mailing list