From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Iverson Subject: [babel] strategies for generating multiple graphics files from same code block Date: Mon, 09 Aug 2010 16:04:12 -0500 Message-ID: <4C606D4C.1030904@ccbr.umn.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=39120 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OiZWF-00081Q-3p for emacs-orgmode@gnu.org; Mon, 09 Aug 2010 17:06:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OiZW5-0001yQ-Pn for emacs-orgmode@gnu.org; Mon, 09 Aug 2010 17:04:18 -0400 Received: from walleye.ccbr.umn.edu ([128.101.116.11]:1366) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OiZW5-0001y2-Gp for emacs-orgmode@gnu.org; Mon, 09 Aug 2010 17:04:17 -0400 Received: from tadpole.ccbr.umn.edu (tadpole.ccbr.umn.edu [128.101.116.26]) by walleye.ccbr.umn.edu (8.9.3p2/8.9.3) with ESMTP id QAA01168 for ; Mon, 9 Aug 2010 16:04:15 -0500 (CDT) Received: from iron.ccbr.umn.edu (iron.ccbr.umn.edu [128.101.116.194]) by tadpole.ccbr.umn.edu (8.9.3/8.9.3) with ESMTP id QAA04832 for ; Mon, 9 Aug 2010 16:04:13 -0500 (CDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode Hello, I'm using org-mode to write R code and generate figures. I have multiple files generated per code block, one png and one PDF. This is so that I can display the graphic: 1) Inline in my org-mode buffer (png) 2) Upon export to HTML, viewable in the browser (png) 3) Included in a separate PDF, *not* from exporting my org-mode file. For this, I would like a PDF version of the graphic to be generated, and pdflatex can use it (pdf) So, for points 1 and 2 above, no problem. * Figure 1 Here is the first figure. #+begin_src R :file figure1.png :width 960 :exports both :tangle fig1.R plot(1,1) #+end_src For point 3, I use tangling to write the source code to a file. I notice that the graphical code is wrapped by the export process by a call to png() and dev.off(). My question, is there any facility to have the tangled code generate a PDF, instead of PNG? I still need the png for goals 1 and 2, but the pdf for goal 3. Anyone else have any other strategies for realizing all 3 of my goals? I suppose one would be to define a named code block, and use the noweb syntax: Define the plot #+srcname: fig-test #+begin_src R plot(1,1) #+end_src Tangle, but don't export #+begin_src R :file figure1.pdf :exports none :tangle fig1.R :noweb yes <> #+end_src Export, but don't tangle #+begin_src R :file figure1.png :exports both :noweb yes <> #+end_src This is not too bad, but maybe there's an alternative approach? Thanks! Erik Iverson