From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xavier Garrido Subject: Re: Using different image format given the export backend Date: Tue, 02 Jul 2013 08:39:54 +0200 Message-ID: <51D275BA.3020900@gmail.com> References: <51D1D253.3010808@lal.in2p3.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtuFg-0003QL-OZ for emacs-orgmode@gnu.org; Tue, 02 Jul 2013 02:39:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtuFf-0004Le-OH for emacs-orgmode@gnu.org; Tue, 02 Jul 2013 02:39:48 -0400 Received: from mail-wg0-x233.google.com ([2a00:1450:400c:c00::233]:63484) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtuFf-0004La-Hv for emacs-orgmode@gnu.org; Tue, 02 Jul 2013 02:39:47 -0400 Received: by mail-wg0-f51.google.com with SMTP id e11so4474708wgh.30 for ; Mon, 01 Jul 2013 23:39:46 -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@gnu.org Hi Vincent, Thanks for the trick. Until I found something else I will try it ;) Xavier Le 01/07/2013 21:22, Vincent Beffara a écrit : > > Hello, > >> #+CAPTION: Toto figure >> #+NAME: fig::toto >> #+ATTR_LATEX: :width 0.38\textwidth >> #+BEGIN_SRC emacs-lisp :exports results :results value raw >> (case (and (boundp 'backend) backend) >> (nil "") >> (latex "[[file:./toto.pdf]]" >> (html "[[file:./toto.png]]")) >> #+END_SRC > > I do it like this: > > (defun vb-massage-includegraphics (str backend opts) > (replace-regexp-in-string ".png}" ".pdf}" str)) > (add-hook 'org-export-filter-final-output-functions > 'vb-massage-includegraphics) > > And then, simply refer to the png file in the .org file. Then nothing > happens for the html output, but on latex export, the regexp matches the > '}' and includes the .pdf file instead. > > That is extremely ugly, and makes plenty of assumptions, most of all > that the .pdf file exists. And it should probably test for the value of > 'backend'. But for personal use, it is convenient ... > > /v >