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


Reply via email to