[NTG-context] Metapost + metaObjet connector label on arcs

Maurice Diamantini Maurice.Diamantini at ensta.fr
Fri Oct 22 18:35:54 CEST 2004

Le 22 oct. 04, à 14:24, Eckhart Guthöhrlein a écrit :

> You can attach named paths to objects and then labels these. Here is my
> first try, seems to work:

Thank very much Eckhart, I read the metaObj manual, but I
didn't realised showing that one can attached a labelObj
to arbitrary objects (just for Matrix and trees).

Now it works !
It is my first Metapost figure (I am switching
from pstricks).
As graph (in the sens nodes + arcs, not curve functions)
will be frequentjy used (at least by me).

I am thinking about some highlevel  class (using MetaObj)
- class Node for creating node
- class Arc for connecting nodes.
The goal is that the data (coordinate, various labels, ...)
will be as simple as possible.
Also it should be easy to pick the Node and Arc class,
and personnalide them gor its own graph.

For now, I'm trying to anderstand how the label options
A new problem is that the label sep is to big from thes arcs, and
I'm not able to ajust it. The "labshift" option doesn't seem
to work with ncarc, althought it works for the nodes.

is one of the Metapost lists still alive?

Here is the full exemple (with only 2 nodes)
I don use the inline context feature because it
doesnt work for me, and I have to work on several
workstation, so I still stay (for now) with the indenpendent
I'm sorry for the "latex" line on a context list, but
Metafun is not clean installed (texlive 2003), I wanting
for the next texlive... And I hope context will be install
by default with Metafun

Thank you very much.

-- Maurice Diamantini,

verbatimtex   % -*-latex-*-

input mp-tool ; % some initializations and auxiliary macros
input mp-spec ; % macros that support special features
input metaobj.mp ; % suffixe non indispensable ?

beginfig(1) ;

     % For now node positions will be hardcoded
     numeric u; u=1cm;
     % % verbatimtex \small etex;

     setCurveDefaultOption("arcangle", 25);
     % building nodes of the graph. Nodes are object that arc will be 
able to
     % refere to.
     % Later, I will have to build my own Class "Activity" with some 
     % parameters (labels above and under the circle, ...)
     newCircle.n0(btex \large 0 etex) "circmargin(0.1u)";
     ObjLabel.n0(btex b0 etex)  "labshift((0, -.5u))";
     ObjLabel.n0(btex u0 etex)  "labshift((0, .5u))";
     n0.c = z0;

     newCircle.n1(btex  \large 1 etex) "circmargin(0.1u)";
     ObjLabel.n1(btex b1 etex)  "labshift((0, -.5u))";
     ObjLabel.n1(btex u1 etex)  "labshift((0, .5u))";
     n1.c = z1;

     % build some Arcs, with various label or other parameters
     % I'll have to make some vardef fonction for that.
     % For now, all arcs related stuffs are in th esame place
     % - Howto reduce the label separation ? ("labshift" doen't work)

     ncarc.n0(n0)(n1)  "name(n0_n1)";
     ObjLabel.n0(btex $\times$ etex) "labpathname(n0_n1)",
     ObjLabel.n0(btex $0\rightarrow 1$ etex)
                             "labshift((0, -0.5u))",
                             "labdir(bot)" ;

     ncarc.n1(n1)(n0)  "name(n1_n0)";

     ObjLabel.n1(btex $\times$ etex) "labpathname(n1_n0)",
     ObjLabel.n1(btex $1\rightarrow 0$ etex)
                             "labdir(top)" ;

     drawObj(n0, n1);

endfig ;
end .

More information about the ntg-context mailing list