From mboxrd@z Thu Jan 1 00:00:00 1970 From: Robert Klein Subject: Re: English and Dutch version of a Graphviz picture Date: Wed, 5 Sep 2018 09:00:43 +0200 Message-ID: <20180905090043.1df2c3f0@lt70.mpip-mainz.mpg.de> References: <20180901170406.6f7f6a7d@happy.intern.roklein.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxRoA-0001Dq-TX for emacs-orgmode@gnu.org; Wed, 05 Sep 2018 03:00:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fxRo5-0005U4-T0 for emacs-orgmode@gnu.org; Wed, 05 Sep 2018 03:00:58 -0400 Received: from mout.kundenserver.de ([212.227.17.24]:51701) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fxRo3-0005P1-Td for emacs-orgmode@gnu.org; Wed, 05 Sep 2018 03:00:52 -0400 In-Reply-To: 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" To: Cecil Westerhof Cc: emacs-orgmode@gnu.org Hi Cecil, On Sun, 2 Sep 2018 15:27:29 +0200 Cecil Westerhof wrote: > 2018-09-01 17:04 GMT+02:00 Robert Klein : >=20 > > On Sat, 1 Sep 2018 12:38:54 +0200 > > Cecil Westerhof wrote: > > =20 > > > I have the following: > > > #+BEGIN_SRC dot :file Graphviz/habitLoop.png :cmdline -Kfdp -Tpng > > > digraph habitLoop { > > > bgcolor =3D steelblue > > > edge [penwidth =3D 4.0 ] > > > node [fontcolor =3D white, fontsize =3D 60, style =3D filled] > > > > > > spur [pos =3D "4,4!" color =3D red] > > > habit [pos =3D "7,1!" color =3D darkgreen] > > > reward [pos =3D "1,1!" color =3D blue] > > > > > > spur:e -> habit:n > > > habit:w -> reward:e > > > reward:n -> spur:w > > > > > > copyright [ > > > pos =3D "4,.75!" > > > color =3D steelblue, > > > fontcolor =3D black, > > > fontsize =3D 14, > > > label =3D "=C2=A9 Cecil > > > Westerhof\nTimeManagement@Decebal.nl", shape =3D plaintext > > > ] > > > > > > spur [label =3D "Spur"] > > > habit [label =3D "Habit"] > > > reward [label =3D "Reward"] > > > } > > > #+END_SRC > > > > > > But I also want to have a Dutch version. So I also have: > > > #+BEGIN_SRC dot :file Graphviz/gewoonteLoop.png :cmdline -Kfdp > > > -Tpng digraph habitLoop { > > > bgcolor =3D steelblue > > > edge [penwidth =3D 4.0 ] > > > node [fontcolor =3D white, fontsize =3D 60, style =3D filled] > > > > > > spur [pos =3D "4,4!" color =3D red] > > > habit [pos =3D "7,1!" color =3D darkgreen] > > > reward [pos =3D "1,1!" color =3D blue] > > > > > > spur:e -> habit:n > > > habit:w -> reward:e > > > reward:n -> spur:w > > > > > > copyright [ > > > pos =3D "4,.75!" > > > color =3D steelblue, > > > fontcolor =3D black, > > > fontsize =3D 14, > > > label =3D "=C2=A9 Cecil > > > Westerhof\nTimeManagement@Decebal.nl", shape =3D plaintext > > > ] > > > > > > spur [label =3D "Prikkel"] > > > habit [label =3D "Gewoonte"] > > > reward [label =3D "Beloning"] > > > } > > > #+END_SRC > > > > > > The only difference are the three label statements. Can this be > > > done more efficient? Because now I need to do updates at two > > > places. That is an accident waiting to happen. > > > =20 > > > > > > There's a complicated solution (like, using variables from tables) > > at > > https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-dot.html > > > > In your case you might want to use noweb (see > > https://orgmode.org/org.html#Noweb-reference-syntax). Then your > > code might look like this: > > > > #+Name: habitloop-main > > #+BEGIN_SRC dot > > bgcolor =3D steelblue > > edge [penwidth =3D 4.0 ] > > node [fontcolor =3D white, fontsize =3D 60, style =3D filled] > > > > spur [pos =3D "4,4!" color =3D red] > > habit [pos =3D "7,1!" color =3D darkgreen] > > reward [pos =3D "1,1!" color =3D blue] > > > > spur:e -> habit:n > > habit:w -> reward:e > > reward:n -> spur:w > > > > copyright [ > > pos =3D "4,.75!" > > color =3D steelblue, > > fontcolor =3D black, > > fontsize =3D 14, > > label =3D "=C2=A9 Cecil > > Westerhof\nTimeManagement@Decebal.nl", > > shape =3D plaintext > > ] > > #+END_SRC > > > > > > #+BEGIN_SRC dot :file gewoonteLoop.png :cmdline -Kfdp -Tpng :noweb > > yes digraph habitLoop { > > <> > > spur [label =3D "Prikkel"] > > habit [label =3D "Gewoonte"] > > reward [label =3D "Beloning"] > > } > > #+END_SRC > > > > #+RESULTS: > > [[file:gewoonteLoop.png]] > > > > #+BEGIN_SRC dot :file habitLoop.png :cmdline -Kfdp -Tpng :noweb yes > > digraph habitLoop { > > <> > > spur [label =3D "Spur"] > > habit [label =3D "Habit"] > > reward [label =3D "Reward"] > > } > > #+END_SRC > > =20 >=20 > I tried this, but I did not get it to work. Maybe something in my > configuration is wrecking havoc on me. I have to play with it a bit > more I am afraid. Did you C-c C-c on the two smaller snippets (not on the main-loop part)? Best regards Robert >=20 > > Note, for better looks I put the whole surrounding block in the > > language-specific parts (the =E2=80=9Cdigraph=E2=80=9D-line could be in= the > > =E2=80=9Chabitloop-main=E2=80=9D block, too). > > > > > > When your code gets more involved this can get ugly, fast. Then > > you'll probably have to go the elisp way. > > =20 >=20 > For the moment I do not think it will get more involved very soon, > but you never know. Maybe the elisp route is not a bad idea. >=20