emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Using different image format given the export backend


From: Vincent Beffara
Subject: Re: [O] Using different image format given the export backend
Date: Mon, 01 Jul 2013 21:22:49 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (darwin)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]