From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Beffara Subject: Choosing image format according to export backend Date: Wed, 15 May 2013 19:38:23 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:48734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ucfew-0006Tv-5S for emacs-orgmode@gnu.org; Wed, 15 May 2013 13:38:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ucfeu-0002kr-VX for emacs-orgmode@gnu.org; Wed, 15 May 2013 13:38:38 -0400 Received: from plane.gmane.org ([80.91.229.3]:58173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ucfeu-0002iu-Nd for emacs-orgmode@gnu.org; Wed, 15 May 2013 13:38:36 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ucfes-0006g9-1h for emacs-orgmode@gnu.org; Wed, 15 May 2013 19:38:34 +0200 Received: from 192.33.214.222 ([192.33.214.222]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 May 2013 19:38:34 +0200 Received: from vbeffara by 192.33.214.222 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 15 May 2013 19:38:34 +0200 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: emacs-orgmode@gnu.org 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 found this piece of code on stackoverflow: #+begin_src emacs-lisp :exports results :results value raw (case (and (boundp 'backend) backend) (nil "") (latex "[[file:traps.pdf]]") (html "[[file:traps.png]]")) #+end_src That works, but I was not able to make it recognize captions and such (except by pasting them in both options or otherwise modifying the lisp code above). Plus the markup is a bit heavy. Is there a simpler way? [One thing I thought about was to keep only one of them in the markup, and modifying the output for the other backend. I kind of know how to do that within LaTeX by redefining the \includegraphics command but it feels ... well ... not elegant. Maybe using a hook during one of the exports?] Cheers, -- Vincent