# [NTG-context] MPenvironment \def gives "Parameters must be numbered consecutively"

Mojca Miklavec mojca.miklavec.lists at gmail.com
Fri Sep 29 18:29:05 CEST 2006

On 9/29/06, Sanjoy Mahajan wrote:
> This test file (beta 2006.09.28):
>
> ============ 1.tex ============================
> \starttext
> \startMPenvironment
> \def\2#1#2{\vbox{\halign{\hfil##\hfil\cr #1\cr #2\cr}}}
> \stopMPenvironment

A lesson that I learned while trying to implement a few functions for gnuplot:
never try to do tricky stuff like definitions inside
MPenvironement, because it is parsed and changed slightly.

I would also prefer if definitions and other commands inside
MPenvironement would work as they were supposed to, but exactly this
was one reason more why I like \sometxt so much now. You can create a
definition anywhere in your TeX document and then use it inside
\sometxt:

\def\a{abc}

\starttext
\startMPcode
label(\sometxt{\a},origin);
\stopMPcode
\stoptext

Would that kind of approach satisfy your needs?

(that being just another point of view from what Hans pointed out;
Hans's approach might also be useful; although I admit that I will
soon start mixing up all the different MP commands: MPinclusions,
MPextensions, preambles, environment ... )

Mojca

PS: that should go into another thread and is not that urgent since I
found an ugly workaround, but anyway: is there a chance to access
dimensions such as PageWidth, OverlayWidth ... and others inside
MPextensions/inclusions? OverlayWidth is defined just behind the
extensions/inclusions, which basically means that I can use it inside
a graphic, but not inside macros defined in MPextensions. Any remedy
for that?


More information about the ntg-context mailing list