emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Best way of including tikz into latex (pdf and beamer) export wi


From: Russell Adams
Subject: Re: [O] Best way of including tikz into latex (pdf and beamer) export with preview?
Date: Thu, 19 May 2016 15:07:58 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, May 19, 2016 at 10:25:09AM +0100, Myles English wrote:
> > What is the best way of including tikz into org for latex export
> > (beamer and pdf), and to have preview as well?

I have used R in the past to generate two outputs for a given graph,
one PNG and one PDF from a source block in my Org file.

Then immediately under the source block I would put a commented out
file link so that Org's inline image display would show it to me. Then
I used the latex include command beneath to include the PDF for the
final output.

This let me preview and have high quality output.

Sample code:

#+BEGIN_SRC R :session *R-Buffer* :tangle myfile.R :exports none :results none 
silent :var basename="playerAging"
  doublePlot = function (base, plotFunc,
                         pngopts = c( width = 1024, height = 500 ),
                         pdfopts = c( width = 10, height = 7.5, paper =
                         'usr')
                         ) {

    # basename from org-babel
    myPng = paste(base,"png",sep=".")
    myPdf = paste(base,"pdf",sep=".")

    png(myPng, pngopts )
    plotFunc()
    dev.off()
    pdf(myPdf, pdfopts)
    plotFunc()
    dev.off()
  }

  doublePlot(base=basename, plotFunc = function() {
    plot(players$last_save,players$age,main="Player Age vs Last Login")
    grid(col="gray",lty=2)
  })
#+END_SRC

# [[file:playerAging.png]]

#+LATEX: \includegraphics[width=\textwidth]{playerAging.pdf}\newpage




------------------------------------------------------------------
Russell Adams                            address@hidden

PGP Key ID:     0x1160DCB3           http://www.adamsinfoserv.com/

Fingerprint:    1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



reply via email to

[Prev in Thread] Current Thread [Next in Thread]