On Tue, 3 Mar 2015, Hans Hagen wrote:

On 3/3/2015 6:12 PM, Aditya Mahajan wrote:
2. The metafun alternative is a bit inconvenient. Suppose you want to
draw a bunch of such graphics (words connected by arrows). Then, you
will need to ensure that node names are unique. (Is there a way to get
around that?)

\newcounter\connectedwordcounter

\starttexdefinition unexpanded fromword [#1]#2
    \expandafter\pushmacro\csname cwc>#1\endcsname % nesting hack
    \doglobal\increment\connectedwordcounter
    \setxvalue{cwc>#1}{\connectedwordcounter}%
    \startpositionoverlay{highlightoverlay}
        \setMPpositiongraphic
          {\getvalue{cwc>#1}>f}
          {highlightgraphic}
          {from=\getvalue{cwc>#1}>f,to=\getvalue{cwc>#1}>t}
    \stoppositionoverlay
    \hpos{\getvalue{cwc>#1}>f}{#2}%
\stoptexdefinition

\starttexdefinition unexpanded toword [#1]#2
    \hpos{\getvalue{cwc>#1}>t}{#2}
    \expandafter\popmacro\csname cwc>#1\endcsname % nesting hack
\stoptexdefinition

Thanks.

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
___________________________________________________________________________________

Reply via email to