如何在组织模式下为不同的导出使用不同的图像格式?

Dus*_*tin 4 image-processing org-mode

我想在我的组织模式文档中包含内联图像,但我真的需要一个用于 HTML 导出的 png 和用于 LaTeX 导出的 pdf 以使其看起来不错。有没有办法表达这一点?

Dus*_*tin 5

我在 irc 得到了一个对我很有效的答案。

#+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
Run Code Online (Sandbox Code Playgroud)

这将在导出时根据后端选择链接,同时仍为我提供 HTML 和 LaTeX 属性。看起来很简单。

  • 需要额外设置吗?对我来说,这只在导出的文档中打印“nil”。 (2认同)