emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] [babel] Including TikZ diagrams as figures in export


From: Jeffrey Horn
Subject: [Orgmode] [babel] Including TikZ diagrams as figures in export
Date: Sun, 20 Feb 2011 18:03:53 -0500

Hey orgsters,

I'm having a hard time fitting TikZ into my workflow. I spent a little time 
learning TikZ recently and have all the diagrams working in a tex file.

Now, I'd like to integrate them into an org document. I'd like:
1) To use babel to handle the TikZ source
2) To wrap the resulting drawing in a figure environment for automatic 
numbering and centering
3) To be able to refer to the figure elsewhere in the document
4) (optional) To be able to seamlessly export to both LaTeX and HTML

I don't really care about 4 right now, but the others are frustrating me a bit. 
I expected this would do what I wanted:

#+caption: This is a figure.
#+label: fig:ref
#+begin_src latex
<<TikZ source goes here>>
#+end_src 

No dice. I get all sorts of unresolved references, no figures, no centering. 
I'm guess the exporter doesn't know how to integrate TikZ graphics with the 
#+caption and #+label options. I could create a separate file for holding my 
diagrams and use babel to spit them out as files, or just use LaTeX and forget 
about org, but I'd rather not.

So I googled around, thought I had an answer, then tried this:

#+source: a-name
#+begin_src latex
<<TikZ source goes here>>
#+end_src 

#+caption: This is a figure.
#+label: fig:ref
#+begin_src emacs-lisp :var path=a-name :results latex 
(format "input{%s}" path) #+end_src 




I'm not getting what I expect. What do I need to do differently?

And somewhat unrelated, is ":results" now deprecated in favor of ":exports"? 
What about ":file"? I'm sufficiently new to babel that these all seem like they 
could be taken care of with a single header argument with many options...

Thanks for the help!

-- 
Jeffrey Horn
http://www.failuretorefrain.com/jeff/

Sent with Sparrow




reply via email to

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