From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Cook, Malcolm" Subject: Re: Switch for exported file types when evaluating code blocks Date: Thu, 18 Jul 2013 00:45:36 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzcLp-00032y-1u for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 20:45:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzcLl-0007Qk-So for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 20:45:44 -0400 Received: from smtp01.stowers.org ([12.201.176.61]:50570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzcLl-0007Qc-Mc for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 20:45:41 -0400 In-Reply-To: Content-Language: en-US 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: 'Brett Viren' , "'emacs-orgmode@gnu.org'" >I want graphics files which are exported by evaluated code blocks to be >generated in a format best suited to their intended use. For HTML I >want either PNG or SVG. For LaTeX/PDF I almost always want PDF. For >inline viewing in emacs I want either PNG or SVG. > >To that end I went a'googling and found this idea: > > http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#s= ec-4-3 > >It doesn't work with my copies[1] of emacs and org-mode but I was able >to adapt it. I suck at elisp so this is probably more an accomplishment >to me than it appears to most of you! > >In any case, here is a short org document based on the one I found above >in worg which shows what I ended up with: > > >* COMMENT setup >#+begin_src emacs-lisp :results silent > (defmacro by-backend (&rest body) > `(case (if (boundp 'backend) backend nil) ,@body)) >#+end_src > >* A graph >#+header: :file (by-backend (html "graph.png") (latex "graph.pdf") (t "gr= aph.svg")) >#+header: :export results >#+begin_src dot >digraph Name { > tail -> head; >} >#+end_src [Cook, Malcolm]=20 Brett, Thanks for posting your findings. They almost help me. I am looking for a solution to a similar problem. I tend to work with org-export-babel-evaluate set to nil. Thus, my code bl= ocks are not evaled in the context of an export. Thus at eval time there i= s no way of knowing what the eventual backend is going to be. I think I need an approach that auto converts svg to png on-demand/on-the-f= ly during export. Has anyone come across a variation on this that works as I am suggesting? Thanks!