* How to use .pdf images on Latex export, and .png images on ODT export
@ 2017-01-31 14:16 Giacomo M
2017-01-31 17:00 ` Charles C. Berry
0 siblings, 1 reply; 2+ messages in thread
From: Giacomo M @ 2017-01-31 14:16 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
Dear all,
I was wondering what is the best way to include pdf images on latex
export and png images on odt export (assuming same path, only extension
changes). A macro like this one:
#+MACRO: figext @@latex:.pdf@@@@odt:.png@@
doesn't seem to work.
Thanks,
Giacomo
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How to use .pdf images on Latex export, and .png images on ODT export
2017-01-31 14:16 How to use .pdf images on Latex export, and .png images on ODT export Giacomo M
@ 2017-01-31 17:00 ` Charles C. Berry
0 siblings, 0 replies; 2+ messages in thread
From: Charles C. Berry @ 2017-01-31 17:00 UTC (permalink / raw)
To: Giacomo M; +Cc: emacs-orgmode@gnu.org
On Tue, 31 Jan 2017, Giacomo M wrote:
> Dear all,
>
> I was wondering what is the best way to include pdf images on latex export
> and png images on odt export (assuming same path, only extension changes). A
> macro like this one:
> #+MACRO: figext @@latex:.pdf@@@@odt:.png@@
> doesn't seem to work.
No, it won't work as Babel runs before the exporter handles the snippets.
Something like this should do.
Run this block or put the code in your init file:
#+BEGIN_SRC emacs-lisp
(defun org-pdf-if-latex ()
(if (eq (org-bound-and-true-p
org-export-current-backend)
'latex) "pdf" "png"))
#+END_SRC
This generates pdf for latex and png for all other backends (or no backend
at all).
#+name: pdf-or-png
#+BEGIN_SRC R :exports both :results graphics :file-ext (org-pdf-if-latex)
plot(rnorm(50))
#+END_SRC
See (info "(org) file-ext")
HTH,
Chuck
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-31 17:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31 14:16 How to use .pdf images on Latex export, and .png images on ODT export Giacomo M
2017-01-31 17:00 ` Charles C. Berry
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.