From: "Denis B. Roegel" <Denis.Roegel@loria.fr>
Cc: ntg-context@ntg.nl
Subject: Re: Labeling a tree with MetaObj.
Date: Mon, 2 Jul 2001 21:23:00 +0200 [thread overview]
Message-ID: <20010702212300.A13559@bar.loria.fr> (raw)
In-Reply-To: <Pine.GSO.4.05.10107021102590.21094-101000@sumak>; from ktarik@Bilkent.EDU.TR on Mon, Jul 02, 2001 at 11:11:07AM +0300
On Mon, Jul 02, 2001 at 11:11:07AM +0300, Tarik Kara wrote:
> I would like to draw the tree diagram shown at the attachement with
> MetaObj. I can label the terminal nodes and the edge labeled "o". But I
> had no luck with the nodes label "1", "2", and the other edges. Any
> succestions is appreciated. Thanks in advance.
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
next prev parent reply other threads:[~2001-07-02 19:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-30 11:41 Problem to create PDF File Karsten Hachmeister
2001-06-30 12:09 ` Berend de Boer
2001-06-30 14:28 ` Karsten Hachmeister
2001-06-30 17:21 ` Re[2]: " Giuseppe Bilotta
2001-07-02 8:11 ` Labeling a tree with MetaObj Tarik Kara
2001-07-02 8:15 ` Hans Hagen
2001-07-02 19:23 ` Denis B. Roegel [this message]
2001-07-02 21:13 ` Tarik Kara
2001-07-02 21:27 ` Denis B. Roegel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010702212300.A13559@bar.loria.fr \
--to=denis.roegel@loria.fr \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).