emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Cook, Malcolm" <MEC@stowers.org>
To: 'Brett Viren' <bv@bnl.gov>,
	"'emacs-orgmode@gnu.org'" <emacs-orgmode@gnu.org>
Subject: Re: Switch for exported file types when evaluating code blocks
Date: Thu, 18 Jul 2013 00:45:36 +0000	[thread overview]
Message-ID: <D4772401B9D976478C0895769BE3E79216E8E8@MBSRV02.sgc.loc> (raw)
In-Reply-To: <ir4mwpkhmb2.fsf@lycastus.phy.bnl.gov>

>I want graphics files which are exported by evaluated code blocks to be
 >generated in a format best suited to their intended use.  For HTML I
 >want either PNG or SVG.  For LaTeX/PDF I almost always want PDF.  For
 >inline viewing in emacs I want either PNG or SVG.
 >
 >To that end I went a'googling and found this idea:
 >
 >  http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html#sec-4-3
 >
 >It doesn't work with my copies[1] of emacs and org-mode but I was able
 >to adapt it.  I suck at elisp so this is probably more an accomplishment
 >to me than it appears to most of you!
 >
 >In any case, here is a short org document based on the one I found above
 >in worg which shows what I ended up with:
 >
 >
 >* COMMENT setup
 >#+begin_src emacs-lisp :results silent
 >  (defmacro by-backend (&rest body)
 >    `(case (if (boundp 'backend) backend nil) ,@body))
 >#+end_src
 >
 >* A graph
 >#+header: :file (by-backend (html "graph.png") (latex "graph.pdf") (t "graph.svg"))
 >#+header: :export results
 >#+begin_src dot
 >digraph Name {
 >        tail -> head;
 >}
 >#+end_src
[Cook, Malcolm] 

Brett,

Thanks for posting your findings.  They almost help me.

I am looking for a solution to a similar problem.

I tend to work with org-export-babel-evaluate set to nil.  Thus, my code blocks are not evaled in the context of an export.  Thus at eval time there is no way of knowing what the eventual backend is going to be.

I think I need an approach that auto converts svg to png on-demand/on-the-fly during export.

Has anyone come across a variation on this that works as I am suggesting?

Thanks!

  reply	other threads:[~2013-07-18  0:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-17 22:08 Switch for exported file types when evaluating code blocks Brett Viren
2013-07-18  0:45 ` Cook, Malcolm [this message]
2013-07-18  2:02   ` Suvayu Ali
2013-07-18  4:02     ` Nick Dokos
2013-07-18 19:06       ` Cook, Malcolm
2013-07-19  1:02         ` Nick Dokos
2013-07-19 10:23           ` Suvayu Ali
2013-07-19 15:19             ` Cook, Malcolm
2013-07-19 15:22           ` Cook, Malcolm

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=D4772401B9D976478C0895769BE3E79216E8E8@MBSRV02.sgc.loc \
    --to=mec@stowers.org \
    --cc=bv@bnl.gov \
    --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).