emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] TikZ to separate file (babel?) possible?


From: Erik Iverson
Subject: Re: [Orgmode] TikZ to separate file (babel?) possible?
Date: Fri, 22 Oct 2010 15:35:53 -0500
User-agent: Thunderbird 2.0.0.23 (X11/20090812)

John,

Does
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.php#sec-4_2
help?  There is a tikz example there.  The :file argument may be all
you're missing, and putting your code in a latex source block.

Here is what I do when I have an R code block that generates
LaTeX code.  Hopefully this can be adapted to your case.

#+srcname: R-latex
#+begin_src R :results silent :exports code
  lf <- function() {
      "\\LaTeX"
  }

  lf()
#+end_src

#+begin_src latex :noweb yes :file (if (and (boundp 'htmlp) htmlp) "latex-logo-html.png" "latex-logo.png") :buffer (if (and (boundp 'htmlp) htmlp) "no" t)
<<R-latex()>>~is a high-quality typesetting system; it includes
features designed for the production of technical and scientific
documentation. <<R-latex()>>~is the de facto standard for the
communication and publication of scientific
documents. <<R-latex()>>~is available as free software.
#+end_src

That messy :file and :buffer arguments needs some explanation.

They are there so that when I eval the code block *in* an org-mode
buffer, with C-c C-c, that an image will be generated to be
inserted into the buffer.  However, this uses my background color
in emacs, which I don't actually want when exported to HTML, that's
what the :buffer argument controls.  Essentially, it's just
what arguments get passed to dvipng (if I recall correctly).

On Latex export, the actual latex code should be included in the
document, so I think all of my use cases are covered.

The only issue is that org-mode doesn't display PDFs generated
from a :file argument in buffer, but you might not care about
that.

If you're an R user, you might also check out the tikzDevice package:
http://r-forge.r-project.org/projects/tikzdevice/

HTH,
--Erik


John Hendy wrote:
Hi,


I've recently gotten into TikZ and love it. It is simply fantastic for creating neat diagrams and other thingies.

One question... I created an org file with a flow chart in it and simply put my TikZ code in between #+begin_latex and #+end_latex. This is fine when the picture is in a document, but what if I want just a .png/jpg/eps/pdf output? Is it possible to use babel or something else so that I can simply generate a picture vs. needing it to be "in" the PDF output?

I can ask the PGF list as well, but this one is far more active and I know some use TikZ here. I ask because sometimes in my notes I'd like to have the code present but also be able to reuse my work elsewhere, like when I have to present using powerpoint. It'd be nice to just grab the picture (like what I do with gnuplot output) rather than generating a pdf just for the TikZ pic, screenshot or gimp it down to size, and then be able to use it.

Does that make sense? It seems like babel would be perfect for this. It already allows all the typical handles -- file output, what to export, etc.

Or does this already exist and I'm ignorant?


Thoughts?
John


------------------------------------------------------------------------

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

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