[NTG-context] using symbols in MetaFun

Taco Hoekwater taco at elvenkind.com
Sun Feb 12 20:03:30 CET 2006


Mojca Miklavec wrote:
> The problem is that I don't know:
> - how to use symbol sets inside MetaFun (verbatimtex \usesymbols[jmn]
> etex doesn't work here)
> - how to enable
>     label(btex \convertnumber{gnuplot}{5} etex, (x,y))
>   to work properly in metafun (no luck with verbatimtex ... etex again)
> 
> Any hints would be appreciated.

I am very much a beginner at metafun, so the following is probably
garbage, but to its defence I can say that it actually achieves the
goal :)

There are two files:

% myenv.tex: contains the symbol definition
\usesymbols[jmn]
\defineconversion
    [gnuplot]
    [$\bullet$,
     $\circ$,
     $\star$,
     x,
     {\symbol[navigation 1][NextJump]}]
% end

% sym.tex: the main file
\environment myenv

\startMPinclusions
def draw_symbol(expr X, Y, Number) =
   label(textext(char 92 & "input myenv " &
                 char 92 & "convertnumber{gnuplot}{" &
                            decimal Number & "}"),(X,Y))
enddef
\stopMPinclusions

\starttext
\startuseMPgraphic
draw_symbol(0,0,3);
\stopuseMPgraphic
\useMPgraphic
\stoptext
% end

I could not figure out how to use a 'verbatimtex' preamble either,
so this loads the myenv definition file for each label. Ugly, but
the best I can manage with my current knowledge.

Cheers,
Taco




More information about the ntg-context mailing list