emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Switch for exported file types when evaluating code blocks


From: Cook, Malcolm
Subject: Re: [O] Switch for exported file types when evaluating code blocks
Date: Thu, 18 Jul 2013 00:45:36 +0000

>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 via email to

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