4
votes

I'd like to include inline images in my org-mode documents, but I really need a png for HTML export and a pdf for LaTeX export for it to look decent. Is there a way to express this?

1
There's a thread on conditional export here: lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg01143.html - Juancho

1 Answers

5
votes

I got an answer in irc that worked well for me.

#+ATTR_LaTeX: width=0.38\textwidth wrap placement={r}{0.4\textwidth}
#+ATTR_HTML: alt="old index mech" title="Old index mech" align="right"
#+begin_src emacs-lisp :exports results :results value raw
(case (and (boundp 'backend) backend)
  (nil "")
  (latex "[[file:img/indexing-old.pdf]]")
  (html "[[file:img/indexing-old.png]]"))
#+end_src

This selects the link based on the backend at export time while still giving me HTML and LaTeX attributes. Seems pretty straightforward.