From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Beffara Subject: Re: Using different image format given the export backend Date: Mon, 01 Jul 2013 21:22:49 +0200 Message-ID: References: <51D1D253.3010808@lal.in2p3.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utjgn-0006MY-HL for emacs-orgmode@gnu.org; Mon, 01 Jul 2013 15:23:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Utjgm-00016a-BN for emacs-orgmode@gnu.org; Mon, 01 Jul 2013 15:23:05 -0400 Received: from plane.gmane.org ([80.91.229.3]:53889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Utjgm-000163-3b for emacs-orgmode@gnu.org; Mon, 01 Jul 2013 15:23:04 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Utjgi-0001Ez-CA for emacs-orgmode@gnu.org; Mon, 01 Jul 2013 21:23:00 +0200 Received: from xdsl-188-154-68-122.adslplus.ch ([188.154.68.122]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 01 Jul 2013 21:23:00 +0200 Received: from vbeffara by xdsl-188-154-68-122.adslplus.ch with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 01 Jul 2013 21:23:00 +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 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 -- Vincent Beffara