emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christophe Rhodes <csr21@cantab.net>
To: emacs-orgmode@gnu.org
Subject: Re: Options for HTML & PDF export
Date: Thu, 19 May 2011 13:28:16 +0100	[thread overview]
Message-ID: <87zkmiyivz.fsf@cantab.net> (raw)
In-Reply-To: C9F9A3DC.2CB40%ken.williams@thomsonreuters.com

<Ken.Williams@thomsonreuters.com> writes:

> On 5/18/11 4:19 PM, "Nick Dokos" <nicholas.dokos@hp.com> 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

  reply	other threads:[~2011-05-19 12:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <C9F99F46.2CB3E%ken.winliams@thomsonreuters.com>
2011-05-18 21:07 ` Options for HTML & PDF export Ken.Williaos
2011-05-18 21:19   ` Nick Dokos
2011-05-18 21:28     ` Ken.Williams
2011-05-19 12:28       ` Christophe Rhodes [this message]
2011-05-19  9:45   ` Sebastien Vauban
2011-05-20 19:47 Ken.Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zkmiyivz.fsf@cantab.net \
    --to=csr21@cantab.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).