It is a hard job to understand how all 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. MTXrun | current version: 2010.07.30 11:35 Herbert \starttext \section {Anchors and layers} \startbuffer[a] \setMPpositiongraphic{X-1}{mypos:arrow}{to=X-2} \setMPpositiongraphic{X-2}{mypos:arrow}{to=X-3} \stopbuffer \startbuffer[b] 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: \stopbuffer \getbuffer[a,b] \stoptext
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
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 ___________________________________________________________________________________
P.S.
For your conveniance, the minimal example:
\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
\startpositionoverlay{arrow}
\setMPpositiongraphic{X-1}{mypos:arrow}{to=X-2}
\setMPpositiongraphic{X-2}{mypos:arrow}{to=X-3}
\stoppositionoverlay
\defineoverlay[arrow][\positionoverlay{arrow}]
\setupbackgrounds[page][background=arrow]
\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
2016-03-24 18:23 GMT+01:00 Piotr Kopszak
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 ___________________________________________________________________________________
On Thu, Mar 24, 2016 at 6:24 PM, Piotr Kopszak
P.S.
For your conveniance, the minimal example:
\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 \startpositionoverlay{arrow} \setMPpositiongraphic{X-1}{mypos:arrow}{to=X-2} \setMPpositiongraphic{X-2}{mypos:arrow}{to=X-3} \stoppositionoverlay \defineoverlay[arrow][\positionoverlay{arrow}] \setupbackgrounds[page][background=arrow]
\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
context testsuite http://www.pragma-ade.nl/context/latest/cont-tst.7z doc/context/tests/mkiv/metafun/connected-001.tex \startMPdefinitions % I don't know why this does not get loaded automatically. Answer: seldom needed. input mp-abck.mpiv; \stopMPdefinitions \startMPpositiongraphic{mypos:arrow} %if unknown context_apos : input mp-apos.mpiv ; fi ; 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 \startpositionoverlay{arrow} \setMPpositiongraphic{X-1}{mypos:arrow}{to=X-2} \setMPpositiongraphic{X-2}{mypos:arrow}{to=X-3} \stoppositionoverlay \defineoverlay[arrow][\positionoverlay{arrow}] \setupbackgrounds[page][background=arrow] \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 -- luigi
On 3/24/2016 6:24 PM, Piotr Kopszak wrote:
P.S.
For your conveniance, the minimal example:
\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 \startpositionoverlay{arrow} \setMPpositiongraphic{X-1}{mypos:arrow}{to=X-2} \setMPpositiongraphic{X-2}{mypos:arrow}{to=X-3} \stoppositionoverlay \defineoverlay[arrow][\positionoverlay{arrow}] \setupbackgrounds[page][background=arrow]
\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
The interface changed a bit \setupMPvariables [mpos:encircle] [fillcolor=lightgray, filloffset=0pt, linecolor=blue, lineoffset=5pt, linewidth=1pt] \startMPpositiongraphic{mpos:encircle}{linecolor,fillcolor,linewidth,lineoffset} if unknown context_apos : input mp-apos.mpiv ; fi ; \MPgetposboxes{\MPvar{self}}{\MPanchorid} if nofposboxes = 1 : posboxes[1] := posboxes[1] enlarged \MPvar{lineoffset} cornered \MPvar{lineoffset} ; fill posboxes[1] withcolor \MPvar{fillcolor} ; draw posboxes[1] withpen pencircle scaled \MPvar{linewidth} withcolor \MPvar{linecolor} ; fi ; \stopMPpositiongraphic \setupMPvariables [mpos:connect] [linecolor=red, lineoffset=.25ex, linewidth=1pt] \startMPpositiongraphic{mpos:connect}{linecolor,lineoffset,linewidth} if unknown context_apos : input mp-apos.mpiv ; fi ; boxlinewidth := \MPvar{linewidth} ; boxlineoffset := \MPvar{lineoffset} ; def boxlineoptions = withcolor \MPvar{linecolor} enddef ; \MPgetposboxes{\MPvar{from},\MPvar{to}}{\MPanchorid} connect_positions ; \stopMPpositiongraphic \starttext \startpositionoverlay{text-1} \setMPpositiongraphic{connect-1-b}{mpos:connect}{from=connect-1-b,to=connect-1-e} \setMPpositiongraphic{connect-1-e}{mpos:connect}{from=connect-1-b,to=connect-1-e} \stoppositionoverlay \startpositionoverlay{text-1} \setMPpositiongraphic{encircle-1}{mpos:encircle}{self=encircle-1} \stoppositionoverlay test \hpos{connect-1-b}{START} \dorecurse{10}{\input ward} \hpos{encircle-1}{\strut HERE} \dorecurse{10}{\input ward} \hpos{connect-1-e}{STOP} test \stoptext
2016-03-24 18:23 GMT+01:00 Piotr Kopszak
: 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Aditya Mahajan
-
Hans Hagen
-
Herbert Voss
-
luigi scarso
-
Piotr Kopszak