From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Choosing image format according to export backend Date: Fri, 09 Aug 2013 09:36:41 -0600 Message-ID: <87zjsq3mgm.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7omr-0001KQ-2M for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 11:39:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7omm-0001pw-J6 for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 11:39:33 -0400 Received: from mail-pd0-x236.google.com ([2607:f8b0:400e:c02::236]:47345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7omm-0001pi-C8 for emacs-orgmode@gnu.org; Fri, 09 Aug 2013 11:39:28 -0400 Received: by mail-pd0-f182.google.com with SMTP id r10so57450pdi.27 for ; Fri, 09 Aug 2013 08:39:27 -0700 (PDT) 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: Vincent Beffara Cc: emacs-orgmode --=-=-= Content-Type: text/plain Carsten Dominik writes: > On 15.5.2013, at 22:21, John Hendy wrote: > >> On Wed, May 15, 2013 at 12:38 PM, Vincent Beffara wrote: >>> Dear list, >>> >>> I would like to have the same org file export to both PDF (through >>> LaTeX) and HTML. The problem I have is images: for printing, PDF images >>> would be best but for display in a browser, it is much better to have a >>> PNG file rather than a link to the PDF. So what I need is for the >>> exporter to choose the image differently according to the backend. >> >> I know this is more of a request for coding help, but just wanted to >> add my vote that this would be great. I don't use html *that* much, >> but having the option would be awesome, and the replacement of all >> *.pdf links with *.png (and typically re-running R code to generate >> .png version, or running imagemagick on the dir to create them) is >> typically too much of a barrier so I just stick with PDF/Beamer. >> >> I'd love something like this. > This was very recently discussed with respect to latex code, and conditional pdf or svg export. Could the following solution be adapted to your R code blocks? http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#sec-4-3 e.g. something like the following, --=-=-= Content-Type: text/x-org Content-Disposition: inline; filename=conditional-export.org #+Title: Conditional export * Conditional Export Test Here's a tree, exported to both html and pdf. #+name: rnorm #+headers: :exports results #+headers: :results graphics #+begin_src R :file (by-backend (latex "rnorm.pdf") (t "rnorm.png")) plot(rnorm(100), rnorm(100)) #+end_src #+Caption: Normal random data. #+RESULTS: rnorm [[file:rnorm.png]] * COMMENT setup This function could be added to the user's =.emacs= init file. #+begin_src emacs-lisp :results silent (setq org-babel-latex-htlatex "htlatex") (defmacro by-backend (&rest body) `(case (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body)) #+end_src --=-=-= Content-Type: text/plain -- Eric Schulte http://cs.unm.edu/~eschulte PGP: 0x614CA05D --=-=-=--