emacs-orgmode
[Top][All Lists]

## Re: [O] Embedding diagrams in Org

 From: Eduardo Ochs Subject: Re: [O] Embedding diagrams in Org Date: Wed, 18 Feb 2015 13:51:30 -0200

On Wed, Feb 18, 2015 at 12:19 PM, Eric S Fraga <address@hidden> wrote:
> 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
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.1, Org
> release_8.3beta-843-ga5f1a3.dirty

Hi Eric,

I tested your example - with C-c C-e l o' to export to LaTeX and open
the PDF file -, and the ellipse in the middle of the sentence appeared,
but the block

#+begin_src latex :results latex raw :exports results
\begin{tikzpicture}
\node[red!50!black] (a) {A};
\node (b) [right of=a] {B};
\draw[->] (a) -- (b);
\end{tikzpicture}
#+end_src

did not make its way to the t.tex file... I asked for help in the
#org-mode channel at freenode, as I am an Org newbie, and found a fix.
Your example is one of the best one I've seen so far of diagrams-
in-Org-for-newbies, but it seems to be at least one micro-bug from
perfect, as it supposes that the person trying it has already enabled
latex support in babel!

Here is an idea to make your example more newbie-friendly: add the

# Note that you may have to add latex support to babel
# to make the tikzpicture block work...
# see: (info "(org)Languages")
#
# To disable to question "Evaluate this latex code block on your system?",
# see: (info "(org)Code evaluation security")
# try: (setq org-confirm-babel-evaluate nil)

Cheers =),
Eduardo Ochs
`