From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/4916 Path: main.gmane.org!not-for-mail From: Tarik Kara Newsgroups: gmane.comp.tex.context Subject: Re: Labeling a tree with MetaObj. Date: Tue, 3 Jul 2001 00:13:32 +0300 (EET DST) Sender: owner-ntg-context@let.uu.nl Message-ID: References: <20010702212300.A13559@bar.loria.fr> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1035395548 29822 80.91.224.250 (23 Oct 2002 17:52:28 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 17:52:28 +0000 (UTC) Cc: ntg-context@ntg.nl Original-To: "Denis B. Roegel" In-Reply-To: <20010702212300.A13559@bar.loria.fr> Xref: main.gmane.org gmane.comp.tex.context:4916 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:4916 Thank you very much for the nice package and the answer to my problem. One small comment: It would be nice if one could also use ObjLabel.ntreepos(Obj(t))(btex $o$ etex) "labpathid(1)","labdir(lft)"; In addition to ObjLabel.Obj(t)(btex $o$ etex) "labpathid(1)", "labdir(lft)"; Just for the sake of symmetry between a tree and its subtrees: The same idea as to get the "treeroot" function to work with an empty argument. Thanks again. I loved the package. Looking forward to see what Hans will do about the interface (though I am still having problems with using ConText) Tar{\i}k On Mon, 2 Jul 2001, Denis B. Roegel wrote: > > Below is a solution. I didn't bother to get the same dimensions > as you, though. > > I have used the (unfortunately) undocumented treeroot macro, which I should > actually extend a bit. > > I know this solution looks complex and that's why a TeX (or ConTeXt) interface > is really needed! :-) > > Feel free to post other queries. I'll use them for the next version > of the metaobj manual. However, I am not sure everybody is interested > in this group, so it might be a better idea to post the questions > on the metafont/metapost mailing list, even though I doubt anybody else > than I will answer for some time... > > Denis > > % Example requested by Tarik Kara. > % A useful inspiration was the figure on page 109 of the metaobj manual. > % D. Roegel, 2 July 2001 > input metaobj > > setCurveDefaultOption("arrows","draw"); > setObjectDefaultOption("Tree")("hideleaves")(true); > > def mytc=new_Circle_("")("filled(true)") enddef; > > labeloffset:=2bp; % 3bp is the default in plain.mp > > beginfig(1); > t:=T_(mytc)(mytc,T_(mytc)(mytc,mytc)("hbsep(2cm)"))("hbsep(2cm)"); > Obj(t).c=origin; > % |ObjLabel| should appear after an object is positionned (this is not > % clearly stated in the manual); one can always move the object afterwards; > % this constraint appears when |ObjLabel| is used on subtrees, since > % |ObjLabel| temporarily attaches the object; when it unties it, links > % to the embedding object(s) are lost. > ObjLabel.ntreepos(Obj(t))(1)(btex $(0,2)$ etex) "labcard(s)"; > ObjLabel.ntreepos(Obj(t))(2,1)(btex $(-1,0)$ etex) "labcard(s)"; > ObjLabel.ntreepos(Obj(t))(2,2)(btex $(1,1)$ etex) "labcard(s)"; > % the |treeroot| function should also work for an empty second argument, > % but this is currently not the case, so one has to use |obj| and |root| > % in order to dig into the object; it will be corrected in the next version > % of metaobj. > ObjLabel.obj(Obj(t)root)(btex $1$ etex) "labcard(n)"; > ObjLabel.treeroot(Obj(t))(2)(btex $2$ etex) "labcard(ne)"; > ObjLabel.Obj(t)(btex $o$ etex) "labpathid(1)", "labdir(lft)"; > ObjLabel.Obj(t)(btex $e$ etex) "labpathid(2)", "labdir(rt)"; > ObjLabel.ntreepos(Obj(t))(2)(btex $f$ etex) "labpathid(1)", "labdir(lft)"; > ObjLabel.ntreepos(Obj(t))(2)(btex $a$ etex) "labpathid(2)", "labdir(rt)"; > draw_Obj(t); > endfig; > > end >