From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Hendy Subject: Re: Choosing image format according to export backend Date: Wed, 15 May 2013 15:21:23 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39918) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UciCU-0003Ag-0j for emacs-orgmode@gnu.org; Wed, 15 May 2013 16:21:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UciCS-00072a-Mj for emacs-orgmode@gnu.org; Wed, 15 May 2013 16:21:25 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:47072) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UciCS-00072U-F7 for emacs-orgmode@gnu.org; Wed, 15 May 2013 16:21:24 -0400 Received: by mail-lb0-f174.google.com with SMTP id u10so302904lbi.5 for ; Wed, 15 May 2013 13:21:23 -0700 (PDT) In-Reply-To: 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 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. John > > 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 > >