Re: [NTG-context] Metapost and MPlib

2009-11-04 Thread batela

Another incompatibility between metapost and mkiv.

I try to run this code but i found  a error with some garbage.


Please try to run the file in attach. The error coming from the  
curvelabel function.




teste2.tex
Description: TeX document
___
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] Metapost and MPlib

2009-11-04 Thread Aditya Mahajan

On Wed, 4 Nov 2009, batela wrote:


Another incompatibility between metapost and mkiv.

I try to run this code but i found  a error with some garbage.

Please try to run the file in attach. The error coming from the  curvelabel 
function.


* Change # to \#.
* Don't redefine pt!

See the attached file.

Aditya

\starttext





\startMPcode



path Cb[];



vardef courbe[](expr a,b,nb)(text texte)=

 path $;

 for i:=0 upto nb :

 x...@[i]:=(a+i*(b-a)/nb);

 x:=...@[i];

 y...@[i]:=texte;

 endfor ;

 Cb@:=(x...@.0*x.u,y...@.0*y.u)

 for i:=1 upto nb :

   ..(x...@[i]*x.u,y...@[i]*y.u)

 endfor;

 Cb@:=Cb@ shifted (z.origine*cm);

 $=Cb@;

$

enddef;



vardef cadre(expr q,r)=

  z.so=q;

  z.ne=r;

  path limite;

  limite:=z.so*cm--(x.ne*cm,y.so*cm)--z.ne*cm--(x.so*cm,y.ne*cm)--cycle;

  extra_endfig := clip currentpicture to limite;  extra_endfig;

enddef;

vardef origine(expr p)=

  x.origine=xpart(p);

  y.origine=ypart(p);

enddef;

vardef unites(expr q,r)=

  x.u:=q*cm;

  y.u:=r*cm;

enddef;





vardef depart(expr q,r,p,s,t)=

  cadre(q,r);

  origine(p);

  unites(s,t);

enddef;



vardef origine(expr p)=

  x.origine=xpart(p);

  y.origine=ypart(p);

enddef;



vardef unites(expr q,r)=

  x.u:=q*cm;

  y.u:=r*cm;

enddef;



vardef curvela...@\#(expr a)(suffix pos)=

  save se;

  picture se;

  numeric t;

%show a;

  pair pp,tangent;

  if str pos = :

t:=0.5*length c...@\#

  else :

t:=pos*length c...@\#;

%show t;

  fi;

  pp:=point t of c...@\#;

  tangent:=unitvector(direction t of c...@\#);

  se=image(

label(a rotated angle(tangent), pp+2mm*(tangent rotated 90));

);

  se

enddef;





depart((-3,-3.5),(2.5,3.5),(0,0),2,2);

draw courbe1(-1,1,100,x*x) withcolor blue;

draw curvelabel1(btex $x^2$ etex, 0.9);



\stopMPcode





\stoptext

___
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] Metapost and MPlib

2009-11-03 Thread Taco Hoekwater


batela wrote:
 Dear Sirs
 
 I would like to include some macros from
 http://melusine.eu.org/syracuse/poulecl/macros in my luatex documents.
 Every time i try to include a new example (from papier.mp, par example)
 i found this old error message:;  texnum.mp Unable to make mpx file.
 
 init_numbers(btex $-$ etex,  btex$$etex, btex ${\times}$10etex

The mplib core (and luatex, by extension) does not have support
for btex ... etex constructs, but I think there is special code
in context mkiv to handle such cases?

Best wishes,
Taco
___
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] Metapost and MPlib

2009-11-03 Thread Hans Hagen

batela wrote:


Em 03/11/2009, às 8:43, Taco Hoekwater escreveu:




batela wrote:

Dear Sirs

I would like to include some macros from
http://melusine.eu.org/syracuse/poulecl/macros in my luatex documents.
Every time i try to include a new example (from papier.mp, par example)
i found this old error message:;  texnum.mp Unable to make mpx file.

init_numbers(btex $-$ etex,  btex$$etex, btex ${\times}$10etex


The mplib core (and luatex, by extension) does not have support
for btex ... etex constructs, but I think there is special code
in context mkiv to handle such cases?



thanks, but i'm afraid that I'm not able to find the solution. Perhaps 
some day anybody will be able to play with syrasuse macros in luatex 
documents.


as the whole site is a mix of french and latex and i'm not fluent in 
either of them ... can you give a small example?


what happens if you don't load the mpnum package (or whatever it's called)


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 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
___


Re: [NTG-context] Metapost and MPlib

2009-11-03 Thread batela


Em 03/11/2009, às 8:43, Taco Hoekwater escreveu:




batela wrote:

Dear Sirs

I would like to include some macros from
http://melusine.eu.org/syracuse/poulecl/macros in my luatex documents.
Every time i try to include a new example (from papier.mp, par 
example)

i found this old error message:;  texnum.mp Unable to make mpx file.

init_numbers(btex $-$ etex,  btex$$etex, btex ${\times}$10etex


The mplib core (and luatex, by extension) does not have support
for btex ... etex constructs, but I think there is special code
in context mkiv to handle such cases?



thanks, but i'm afraid that I'm not able to find the solution. Perhaps 
some day anybody will be able to play with syrasuse macros in luatex 
documents.



___
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] Metapost and MPlib

2009-11-03 Thread batela


Em 03/11/2009, às 6:24, Hans Hagen escreveu:


batela wrote:

Em 03/11/2009, às 8:43, Taco Hoekwater escreveu:



batela wrote:

Dear Sirs

I would like to include some macros from
http://melusine.eu.org/syracuse/poulecl/macros in my luatex 
documents.
Every time i try to include a new example (from papier.mp, par 
example)

i found this old error message:;  texnum.mp Unable to make mpx file.

init_numbers(btex $-$ etex,  btex$$etex, btex ${\times}$10etex


The mplib core (and luatex, by extension) does not have support
for btex ... etex constructs, but I think there is special code
in context mkiv to handle such cases?
thanks, but i'm afraid that I'm not able to find the solution. 
Perhaps some day anybody will be able to play with syrasuse macros in 
luatex documents.


as the whole site is a mix of french and latex and i'm not fluent in 
either of them ... can you give a small example?


what happens if you don't load the mpnum package (or whatever it's 
called)



In the file papiers2.mp I have  deactivated  input format  (changed to 
%input format)


In the modules donymodule.mp and geometriesyr16.mp I changed all the 
btex   something etex constructs to  something .


In the modules papiers2.mp and donymodule.mp I have deactivated the 
init_numbers function (init_numbers changed to %init_numbers )


Now all seems to work.

thanks

Jorge

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