From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: Re: Embedding diagrams in Org Date: Wed, 18 Feb 2015 19:37:56 +0000 Message-ID: References: <87bnkr8kkg.fsf@wmi.amu.edu.pl> <87d2579uah.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOARm-0007rR-KA for emacs-orgmode@gnu.org; Wed, 18 Feb 2015 14:38:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOARj-0004RQ-Bo for emacs-orgmode@gnu.org; Wed, 18 Feb 2015 14:38:10 -0500 Received: from plane.gmane.org ([80.91.229.3]:53184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOARi-0004R3-Lk for emacs-orgmode@gnu.org; Wed, 18 Feb 2015 14:38:07 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1YOARf-0003Kp-G1 for emacs-orgmode@gnu.org; Wed, 18 Feb 2015 20:38:03 +0100 Received: from global-1-27.nat.csx.cam.ac.uk ([131.111.184.27]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 18 Feb 2015 20:38:03 +0100 Received: from andreas.leha by global-1-27.nat.csx.cam.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 18 Feb 2015 20:38:03 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, Eric S Fraga 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---