emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jeffrey Horn <jrhorn424@gmail.com>
To: Org-mode ml <emacs-orgmode@gnu.org>
Subject: [babel] Including TikZ diagrams as figures in export
Date: Sun, 20 Feb 2011 18:03:53 -0500	[thread overview]
Message-ID: <18FA37FD52964B6B892AAD0C99965D83@gmail.com> (raw)

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	other threads:[~2011-02-20 23:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-20 23:03 Jeffrey Horn [this message]
2011-02-21  1:56 ` [babel] Including TikZ diagrams as figures in export Erik Iverson
2011-02-21 15:11   ` Jeff Horn
2011-02-21 16:57     ` Eric Schulte
2011-02-21 19:27       ` Jeff Horn
2011-02-21 16:44   ` Andreas Leha
2011-02-21 19:29     ` Jeff Horn

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=18FA37FD52964B6B892AAD0C99965D83@gmail.com \
    --to=jrhorn424@gmail.com \
    --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).