Hello list,
The solution shown here no longer works with recent beta (indeed, it
probably ceased to work some time ago). How should it be corrected?
Best
Piotr
2010-10-24 0:14 GMT+02:00 Aditya Mahajan
On Sat, 23 Oct 2010, Herbert Voss wrote:
It is a hard job to understand how all works ...
I agree. That chapter is confusing if you do not know already how the mechanism works.
I tried to create the first example of the documentation "Page 257 Anchors and layers", but failed with mkii and iv. The page is created, but without the graphical elements. Not using \startbuffer--\stopbuffer makes no difference.
You are simply setting the positions. You also need to tell ConTeXt to do something with the positions.
1. First define a position graphic that does something with the anchors that it is passed.
\startMPpositiongraphic{mypos:arrow} pair c[] ; initialize_box(\MPpos{\MPvar{self}}); c[1] := cxy ; initialize_box(\MPpos{\MPvar{to}}); c[2] := cxy ; drawarrow c[1] -- c[2] withpen pencircle scaled 2bp ; \stopMPpositiongraphic
cxy is the center of the box. See the defn of initialize_box in mp-core.mp for other values. I wish these were better documented.
2. Then define a position overlay that specifies the relation between the anchors.
\startpositionoverlay{arrow} \setMPpositiongraphic{X-1}{mypos:arrow}{to=X-2} \setMPpositiongraphic{X-2}{mypos:arrow}{to=X-3} \stoppositionoverlay
3. Define an overlay that is mapped to MP position overlay.
\defineoverlay[arrow][\positionoverlay{arrow}]
4. Hook the overlay as a page background
\setupbackgrounds[page][background=arrow]
5. Then everything will work.
\starttext
\section {Anchors and layers}
In a previous section we saw that some \hpos{X-1} {words} were \hpos{X-2}{circled} and connected by an \hpos{X-3} {arrow}. As with most things in \CONTEXT, marking these words is separated from declaring what to do with those words. This paragraph is keyed in as:
\stoptext
Aditya ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________