[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Options for HTML & PDF export
From: |
Christophe Rhodes |
Subject: |
Re: [O] Options for HTML & PDF export |
Date: |
Thu, 19 May 2011 13:28:16 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
<address@hidden> writes:
> On 5/18/11 4:19 PM, "Nick Dokos" <address@hidden> wrote:
>>What is the problem with PNG exactly? I've never had any problems
>>incorporating them into a PDF. It is a bitmap format, so it will not
>>suffer extreme changes in magnification without some ugliness of course,
>>but other than that I don't know of any problems.
>
> That is exactly the problem =). It does include itself into the document,
> it just doesn't look very nice. Since these are data-based graphics
> coming from R, their lines should be nice & crisp, but they end up looking
> pretty fuzzy.
For what it's worth, I've been experimenting with the tikzDevice R
graphics device. I have in the preamble of my current document
#+srcname: orgrsetup
#+begin_src R :session *R* :exports none :results none
library(tikzDevice)
org.device <- function(name, ext) {
file <- sprintf("%s.%s", name, ext)
switch(ext,
"png"=png(file, width=480, height=384),
"tikz"=tikz(file, width=5, height=4))
}
org.raw <- function(name, ext) {
file <- sprintf("%s.%s", name, ext)
switch(ext,
"png"=sprintf("[[file:%s]]", file),
"tikz"=sprintf("#+LaTeX: \\input{%s}", file))
}
#+end_src
and then I use
#+begin_src R :session *R* :exports results :results value raw :var
name="filename" :var ext=(csr-org-export-babel-graphics-extension)
org.device(name, ext)
# draw the picture here
dev.off()
org.raw(name,ext)
#+end_src
where csr-org-export-babel-graphics-extension returns "tikz" if the
backend is latex, and png otherwise. This (with a bit more work on the
R side) gives me scalable graphics with fonts matching the PDF
document's fonts going through LaTeX, and acceptable-quality HTML.
(Which is something I've been looking for for the last six years, so I'm
quite pleased at the moment :-)
I hope this helps to provide some ideas.
Cheers,
Christophe