[NTG-context] metafun problem

2010-07-13 Thread Albrecht Kauffmann
Dear ConTeXtuals,

the following MP-inclusion produces fatal error (! TeX capacity
exceeded, sorry [parameter stack size=6000].):

starttext
\startMPcode
label(btex $\underbrace{a}_{b}$ etex,(0,0));
\stopMPcode
\stoptext

I use mkii, but the code should work.
Has anyone an explanation?

With many thanks for any hint
Albrecht
___
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
___


[NTG-context] Custom metaobj object in context

2010-07-13 Thread Stefan Müller

Hi,

I just tried to build my own object in metaobj but for some reason I 
cannot figure out it does not work. I tried the example from the metaobj 
manual in a tex document (it works in a metapost file):


  \startuseMPgraphic{objecttest}
vardef newsegm...@#=
  assignObj(@#,Segment);
  ObjPoint a,b;
  ObjCode @#...@#a=(1cm,2cm);
enddef;
  \stopuseMPgraphic

When processing this with context (MkIV) I get

! Illegal parameter number in definition of \...@mpg@objecttest.
to be read again
   =
argument  vardef newsegm...@##=
  assignObj(@##,Segment); ObjPoint 
a,b; Ob...

\dostartuseMPgraphic ...leuseMPgraphic {#1}{#2}{#3
  }}
l.7 \stopuseMPgraphic

My first wild guess is that it has something to do with the evil 
@-symbol. But even if this is the case I don't know what to do to fix 
this. Any help appreciated and thank you very much in advance.


Stefan.
___
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
___


Re: [NTG-context] Custom metaobj object in context

2010-07-13 Thread Hans Hagen

On 13-7-2010 6:01, Stefan Müller wrote:

Hi,

I just tried to build my own object in metaobj but for some reason I
cannot figure out it does not work. I tried the example from the metaobj
manual in a tex document (it works in a metapost file):

\startuseMPgraphic{objecttest}
vardef newsegm...@#=
assignObj(@#,Segment);
ObjPoint a,b;
ObjCode @#...@#a=(1cm,2cm);
enddef;
\stopuseMPgraphic

When processing this with context (MkIV) I get

! Illegal parameter number in definition of \...@mpg@objecttest.
to be read again
=
argument vardef newsegm...@##=
assignObj(@##,Segment); ObjPoint a,b; Ob...
\dostartuseMPgraphic ...leuseMPgraphic {#1}{#2}{#3
}}
l.7 \stopuseMPgraphic

My first wild guess is that it has something to do with the evil
@-symbol. But even if this is the case I don't know what to do to fix
this. Any help appreciated and thank you very much in advance.


no, more with # being special to tex's parser

\string# or \# will probably do


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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
___


[NTG-context] change numeral to string in Metafun

2010-07-13 Thread dalyoung
Dear all,

I'd like to draw boxes with a label in a certain rule.
I define drawbox macro for it.
It receives 3 numbers, (the height of box, x position, y position).
I'd like to label the height of the box in the middle of the box.

I tired 
 label( h ,(3s*u+u, t*u + h*u/2)); %h is a received numeral.
But it is not working. If I change h to letter in label command, it is 
working.

So, I'd like to know how to put received numeral(the height of the box) as a 
label.
Or, how to change the value of a variable to a string.

Here is a working sample code.

\startuseMPgraphic{sample}
numeric u;
u := 0.5cm;

def drawbox (expr h, s, t) =
%numeric h,s,t;
draw unitsquare xyscaled (1cm, h*u) shifted (3*s*u, t*u);
label(1,(3s*u+u, t*u + h*u/2));
enddef;

drawbox (3, 0, 0); 
drawbox (6, 0, 3); 
drawbox (2, 1, 0); 
drawbox (1, 1, 2); 
drawbox (3, 2, 0) 
drawbox (4, 2, 3)

\stopuseMPgraphic

\starttext
\placefigure[here][]{sample}
{\useMPgraphic{sample}}

\stoptext


Thank you.
Dalyoung
___
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
___


Re: [NTG-context] change numeral to string in Metafun

2010-07-13 Thread Wolfgang Schuster

Am 14.07.10 02:19, schrieb dalyoung:

Dear all,

I'd like to draw boxes with a label in a certain rule.
[...]

So, I'd like to know how to put received numeral(the height of the box) as a 
label.
Or, how to change the value of a variable to a string.

[...]

label(1,(3s*u+u, t*u + h*u/2));
   

label(decimal h,(3s*u+u, t*u + h*u/2));

or

label(textext(decimal h),(3s*u+u, t*u + h*u/2));

Wolfgang

___
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
___