From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell Adams Subject: Re: Best way of including tikz into latex (pdf and beamer) export with preview? Date: Thu, 19 May 2016 15:07:58 +0200 Message-ID: <20160519130757.GD30134@cardamom.adamsinfoserv.com> References: <87mvnmcscq.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Nh3-0003L1-LQ for emacs-orgmode@gnu.org; Thu, 19 May 2016 09:08:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3Ngz-00078E-EC for emacs-orgmode@gnu.org; Thu, 19 May 2016 09:08:49 -0400 Received: from kefka.asoshared.com ([65.99.237.198]:26776) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3Ngz-0006uw-7x for emacs-orgmode@gnu.org; Thu, 19 May 2016 09:08:45 -0400 Received: from [62.189.175.18] (port=34596 helo=localhost) by kefka.asoshared.com with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA256:128) (Exim 4.87) (envelope-from ) id 1b3NgI-00087p-2a for emacs-orgmode@gnu.org; Thu, 19 May 2016 09:08:02 -0400 Content-Disposition: inline In-Reply-To: <87mvnmcscq.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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 RLAdams@AdamsInfoServ.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3