[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Embedding diagrams in Org
From: |
Andreas Leha |
Subject: |
Re: [O] Embedding diagrams in Org |
Date: |
Wed, 18 Feb 2015 19:37:56 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (darwin) |
Hi,
Eric S Fraga <address@hidden> writes:
> On Wednesday, 18 Feb 2015 at 13:34, Marcin Borkowski wrote:
>> Hello all,
>>
>> I need to embed some diagrams (graphs of functions, for instance, or
>> trees) in an Org file. Any suggestions on how to do it? In case of
>> ditaa, I can use a source block and the "results" line, and see the
>> image with C-c C-x C-v. Can I do a similar thing with Asymptote? How
>> hard/time-consuming would it be to add support e.g. for tikz or other
>> such tools?
>
> Support for tikz is there implicitly in that there is support for
> LaTeX. I use tikz all the time.
>
> Simple example attached.
>
> I do believe others have used asymptote in the past.
>
> HTH,
> eric
I also use tikz in my org files. I just include a slightly more
involved version of Eric's example to show some of the beauty of org.
This includes a caption for the diagram, and different output formats
for different export routes.
Best,
Andreas
--8<---------------cut here---------------start------------->8---
#+LATEX_HEADER: \usepackage{tikz}
* tikz example
#+name: tikz_example
#+header: :packages '(("" "tikz"))
#+header: :file (by-backend (latex "example_diagram.tikz") (html
"example_diagram.svg") (t "example_diagram.png"))
#+header: :imagemagick yes :iminoptions -density 600 :imoutoptions -geometry 800
#+header: :results file raw
#+header: :fit yes
#+begin_src latex
\begin{tikzpicture}
\node[red!50!black] (a) {A};
\node (b) [right of=a] {B};
\draw[->] (a) -- (b);
\end{tikzpicture}
#+end_src
#+caption: A tikz example diagram with a caption
#+results: tikz_example
[[file:example_diagram.png]]
--8<---------------cut here---------------end--------------->8---