[Top][All Lists]

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

Re: [O] Choosing image format according to export backend

From: Eric Schulte
Subject: Re: [O] Choosing image format according to export backend
Date: Fri, 09 Aug 2013 09:36:41 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Carsten Dominik <address@hidden> writes:

> On 15.5.2013, at 22:21, John Hendy <address@hidden> wrote:
>> On Wed, May 15, 2013 at 12:38 PM, Vincent Beffara <address@hidden> 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?


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))

#+Caption: Normal random data.
#+RESULTS: rnorm

* 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))
Eric Schulte
PGP: 0x614CA05D

reply via email to

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