Re: graph drawing tool of possible interest
Jim via ntg-context <[email protected]> Sun, 10 May 2026 21:14:03 -0300
| Newsgroups | gmane.comp.tex.context |
|---|---|
| Message-ID | <[email protected]> |
On Sun, May 10, 2026 at 19:33 (-0400), Aditya Mahajan wrote:
> On Sun, 10 May 2026, Jim via ntg-context wrote:
>> At https://github.com/Ndolam/Graphic there is a Qt5-based tool which lets
>> you create graph drawings of a number of built-in graph types, and lets you
>> edit those as well as combine smaller drawings into larger ones. One of
>> its export formats is ConTeXt-style TikZ.
>> [...]
>> A PDF (and .tex file) showing three of the built-in graph types is
>> attached.
>>From one of the examples:
> \placefigure[nonumber]{A (3,3) Dutch windmill}{
> \starttikzpicture[x=1in, y=1in, xscale=1, yscale=1,
> n/.style={fill=white, draw=black, shape=circle,
> minimum size=0.2in, inner sep=0, font={\switchtobodyfont[12pt]},
> line width=0.0061in},
> e/.style={draw=black, line width=0.0061in},
> l/.style={font={\switchtobodyfont[12pt]}}]
> \node (v0) at (-0.5117,0.0000) [n] {$$};
> \node (v1) at (-0.3883,1.5588) [n] {$$};
> \node (v2) at (-0.9000,0.6726) [n] {$$};
> \node (v3) at (0.9000,0.6726) [n] {$$};
> \node (v4) at (0.3883,1.5588) [n] {$$};
> \node (v5) at (0.0000,0.7438) [n] {$$};
> \node (v6) at (0.5117,0.0000) [n] {$$};
> \path (v0) edge[e] node[l] {$$} (v2);
> \path (v0) edge[e] node[l] {$$} (v5);
> \path (v1) edge[e] node[l] {$$} (v4);
> \path (v1) edge[e] node[l] {$$} (v5);
> \path (v2) edge[e] node[l] {$$} (v5);
> \path (v3) edge[e] node[l] {$$} (v6);
> \path (v3) edge[e] node[l] {$$} (v5);
> \path (v4) edge[e] node[l] {$$} (v5);
> \path (v6) edge[e] node[l] {$$} (v5);
> \stoptikzpicture
> }
> Note that
> \placefigure[..]{...}{
> \starttikzpicture
> ...
> \stoptikzpicture
> }
> will introduce a spurious space: Better to use
> \placefigure[..]{...}{%
> \starttikzpicture
> ...
> \stoptikzpicture
> }
> or
> \placefigure[..]{...}
> {\starttikzpicture
> ...
> \stoptikzpicture}
Aditya,
Right you are about the space.
After generating the TikZ code with Graphic, I just added the \placefigures
by hand to display the output, and wasn't as careful as I should have been
(and would have been for a "real" document).
> Plus, I am surprised that
> \path (v0) edge[e] node[l] {$$} (v2);
> actually compiles!
I will admit I was surprised a long time ago when I first saw that $$
compiles; I've been using that for so long I don't know where I originally
saw that it worked. (Maybe TikZ does something heavy-handed to make sure
you don't try to do display math inside a node.) I could output the code
without it, but I wanted to make the TikZ as easy to (post-)edit by hand as
possible. (Which comes at the cost of having spurious math-on/math-off
characters.)
Cheers.
Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________