Carsten Dominik <carsten.domi...@gmail.com> writes: > On 15.5.2013, at 22:21, John Hendy <jw.he...@gmail.com> wrote: > >> On Wed, May 15, 2013 at 12:38 PM, Vincent Beffara <vbeff...@ens-lyon.fr> >> wrote: >>> Dear list, >>> >>> I would like to have the same org file export to both PDF (through >>> LaTeX) and HTML. The problem I have is images: for printing, PDF images >>> would be best but for display in a browser, it is much better to have a >>> PNG file rather than a link to the PDF. So what I need is for the >>> exporter to choose the image differently according to the backend. >> >> I know this is more of a request for coding help, but just wanted to >> add my vote that this would be great. I don't use html *that* much, >> but having the option would be awesome, and the replacement of all >> *.pdf links with *.png (and typically re-running R code to generate >> .png version, or running imagemagick on the dir to create them) is >> typically too much of a barrier so I just stick with PDF/Beamer. >> >> I'd love something like this. >
This was very recently discussed with respect to latex code, and conditional pdf or svg export. Could the following solution be adapted to your R code blocks? http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#sec-4-3 e.g. something like the following,
#+Title: Conditional export * Conditional Export Test Here's a tree, exported to both html and pdf. #+name: rnorm #+headers: :exports results #+headers: :results graphics #+begin_src R :file (by-backend (latex "rnorm.pdf") (t "rnorm.png")) plot(rnorm(100), rnorm(100)) #+end_src #+Caption: Normal random data. #+RESULTS: rnorm [[file:rnorm.png]] * COMMENT setup This function could be added to the user's =.emacs= init file. #+begin_src emacs-lisp :results silent (setq org-babel-latex-htlatex "htlatex") (defmacro by-backend (&rest body) `(case (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body)) #+end_src
-- Eric Schulte http://cs.unm.edu/~eschulte PGP: 0x614CA05D