From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: best ways to generate simple diagrams? Date: Tue, 7 May 2019 13:22:45 -0400 Message-ID: References: <87ftpq33r4.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000cd67f805884f773b" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:33105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hO3nw-00032O-AS for emacs-orgmode@gnu.org; Tue, 07 May 2019 13:23:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hO3nv-0002uS-30 for emacs-orgmode@gnu.org; Tue, 07 May 2019 13:23:00 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:35089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hO3nu-0002u0-SN for emacs-orgmode@gnu.org; Tue, 07 May 2019 13:22:59 -0400 Received: by mail-pf1-x436.google.com with SMTP id t87so8421078pfa.2 for ; Tue, 07 May 2019 10:22:58 -0700 (PDT) In-Reply-To: <87ftpq33r4.fsf@ucl.ac.uk> 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" Cc: Org Mode --000000000000cd67f805884f773b Content-Type: text/plain; charset="UTF-8" These are all great. I am struggling to some extent through the docs for all these tools. Eric, for the most part I'm very happy with graphviz & plantufml but I would be interested in trying latex as well. Since I'm mostly exporting to html and its derivatives (markdown mostly), I don't think epxort blocks work for my purposes. I thought that a latex src block with :exports results would work, but rather than a rendered graph I end up with a .png of the latex instructions themselves. Here's what I am trying: #+begin_src latex :exports results :file latex-dh.png \begin{tikzpicture}[node distance=4cm,minimum size=2cm] \node[draw,fill=blue!20!white] (humanities) {Humanities}; \node[draw,fill=blue!20!white] (tools) [right of=humanities] {\parbox{3cm}{Computing \\ Tools and \\ Methodologies}} edge [->,out=270,in=270,very thick,red] (humanities) edge [<-,out=90,in=90,very thick,red] (humanities); \end{tikzpicture} #+end_src Can you see my error and/or reproduce the issue? Thanks all of you! On Tue, May 7, 2019 at 7:25 AM Fraga, Eric wrote: > On Monday, 6 May 2019 at 14:17, Matt Price wrote: > > So, I'm finding more and more that I want to include simple diagrams in > my > > course materials. At present I am generating them as svg's using > Inkscape, > > but that feels really tiresome to me. I would much rather make them > > programmatically, preferably including the source code as an org-mode > block. > > You have had recommendations for graphviz (dot etc.) and plantuml > already. Those are very good suggestions and I use them all the > time. For more general drawings, and given that you want something > programmatic, I would also suggest tikz (in LaTeX) as it's very powerful > (but then harder to do some simple things that graphiz/plantuml will do > very easily). > > #+begin_export latex > \begin{tikzpicture}[node distance=4cm,minimum size=2cm] > \node[draw,fill=blue!20!white] (humanities) {Humanities}; > \node[draw,fill=blue!20!white] (tools) [right of=humanities] > {\parbox{3cm}{Computing \\ Tools and \\ Methodologies}} > edge [->,out=270,in=270,very thick,red] (humanities) > edge [<-,out=90,in=90,very thick,red] (humanities); > \end{tikzpicture} > #+end_export > > -- > Eric S Fraga via Emacs 27.0.50, Org release_9.2.3-327-g3375f0 > --000000000000cd67f805884f773b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
These are all great.=C2=A0 I am stru= ggling to some extent through the docs for all these tools.=C2=A0 Eric, for= the most part I'm very happy with graphviz & plantufml but I would= be interested in trying latex as well.=C2=A0 Since I'm mostly exportin= g to html and its derivatives (markdown mostly), I don't think epxort b= locks work for my purposes.=C2=A0 I thought that a latex src block with :ex= ports results would work, but rather than a rendered graph I end up with a = .png of the latex instructions themselves. Here's what I am trying:

#+begin_src latex :exports results :file latex-dh.png=
\begin{tikzpicture}[node distance=3D4cm,minimum size=3D2cm]
=C2=A0 = \node[draw,fill=3Dblue!20!white] (humanities) {Humanities};
=C2=A0 \node= [draw,fill=3Dblue!20!white] (tools) [right of=3Dhumanities] {\parbox{3cm}{C= omputing \\ Tools and \\ Methodologies}}
=C2=A0 edge [->,out=3D270,in= =3D270,very thick,red] (humanities)
=C2=A0 edge [<-,out=3D90,in=3D90,= very thick,red] (humanities);
\end{tikzpicture}
#+end_src

Can you see my error and/or reproduce the issue? Thanks a= ll of you!


On Tue, May 7, 2019 at 7:25 AM Fraga, Eric <e.fraga@ucl.ac.uk&g= t; wrote:
On Mon= day,=C2=A0 6 May 2019 at 14:17, Matt Price wrote:
> So, I'm finding more and more that I want to include simple diagra= ms in my
> course materials. At present I am generating them as svg's using I= nkscape,
> but that feels really tiresome to me. I would much rather make them > programmatically, preferably including the source code as an org-mode = block.

You have had recommendations for graphviz (dot etc.) and plantuml
already.=C2=A0 Those are very good suggestions and I use them all the
time.=C2=A0 For more general drawings, and given that you want something programmatic, I would also suggest tikz (in LaTeX) as it's very powerfu= l
(but then harder to do some simple things that graphiz/plantuml will do
very easily).

#+begin_export latex
\begin{tikzpicture}[node distance=3D4cm,minimum size=3D2cm]
=C2=A0 \node[draw,fill=3Dblue!20!white] (humanities) {Humanities};
=C2=A0 \node[draw,fill=3Dblue!20!white] (tools) [right of=3Dhumanities] {\p= arbox{3cm}{Computing \\ Tools and \\ Methodologies}}
=C2=A0 edge [->,out=3D270,in=3D270,very thick,red] (humanities)
=C2=A0 edge [<-,out=3D90,in=3D90,very thick,red] (humanities);
\end{tikzpicture}
#+end_export

--
Eric S Fraga via Emacs 27.0.50, Org release_9.2.3-327-g3375f0
--000000000000cd67f805884f773b--