ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Conflict between MetaPost (LMTX) and cmarrows
@ 2021-04-26  4:59 Jairo A. del Rio
  2021-04-26  6:49 ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Jairo A. del Rio @ 2021-04-26  4:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2070 bytes --]

The following:

\starttext

\startMPinitializations

input cmarrows;

setup_cmarrows(arrow_name = "texarrow"; parameter_file = "cmr6.mf";
macro_name = "nicearrow");

\stopMPinitializations

\startMPpage


nicearrow (origin -- (1cm*left));

\stopMPpage

\stoptext

compiles perfectly with ConTeXt MkIV. With LMTX, however, the following
happens:

metapost > initializing instance 'metafun:1' using format 'metafun' and
method 'default'

metapost > loading 'metafun' as 'metafun.mpxl' using method 'default'

metapost > initializing number mode 'scaled'

metapost > message : Loading cmarrows 2006/12/18, v0.9

metafun > log > overloading immutable 'eps'

metafun > log >

metafun > log > error: Equation cannot be performed (numeric=pair)

metafun > log >

metapost > log >

metapost > log > <to be read again>

metapost > log > ;

metapost > log > <for((6.58641,1.4944))> z_[incr.n]:=(EXPR0);

metapost > log > ENDFOR

metapost > log > <argument>
...nt(length(path))of(path),z2,point.ttt.of(path),z9-(0,3rule_thickness#),point.tt.of(path)-3rule_thickness#*(unitvector(direction.tt.of(path))rotated90):z_[incr.n]:=z;endfor

metapost > log > ;transform.T...

metapost > log > hide->exitif.numeric.begingroup(TEXT0)

metapost > log > ;endgroup;

metapost > log >
mapto->begingroup.hide(numeric.n;n:=0;numeric.x,x_[],y,y_[];for.z=(TEXT2):z_[incr.n]:=z;endfor;transform.T;z_2=z_1transformed.T;z_4=z_3transformed.T;z_6=z_5transformed.T;)

metapost > log > T.endgroup

metapost > log >
nicearrow__sgbxww->...(z0,point(length(EXPR2))of(EXPR2),z2,point.ttt.of(EXPR2),z9-(0,3rule_thickness#),point.tt.of(EXPR2)-3rule_thickness#*(unitvector(direction.tt.of(EXPR2))rotated90))

metapost > log > ;fi.save.f,s...

metapost > log > <to be read again>

metapost > log > ;

metapost > log > <*> nicearrow (origin -- (1cm*left));

metafun > log >

metafun > log > I'm sorry, but I don't know how to make such things equal.
(See the two

expressions just above the error message.)

metafun > log >

metapost > log > ;

metapost > log >

What's happening? Is that intended or a bug?

Jairo

[-- Attachment #1.2: Type: text/html, Size: 6063 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict between MetaPost (LMTX) and cmarrows
  2021-04-26  4:59 Conflict between MetaPost (LMTX) and cmarrows Jairo A. del Rio
@ 2021-04-26  6:49 ` Hans Hagen
  2021-04-26  7:59   ` Jairo A. del Rio
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2021-04-26  6:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jairo A. del Rio

On 4/26/2021 6:59 AM, Jairo A. del Rio wrote:
> The following:
> 
> \starttext
> 
> \startMPinitializations
> 
> input cmarrows;
> 
> setup_cmarrows(arrow_name = "texarrow"; parameter_file = "cmr6.mf"; 
> macro_name = "nicearrow");
> 
> \stopMPinitializations
> 
> \startMPpage

> metafun > log > error: Equation cannot be performed (numeric=pair)
I don't know, but from the message it looks like some 'local' variables 
is not saved and defined. I'm surprised that loading some mf file works 
at all (because it also assumes some mf related definitions). I also hav 
eno clue if such a package adopts 'core' metafun code (and mpiv metafun 
is different from mpii).

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict between MetaPost (LMTX) and cmarrows
  2021-04-26  6:49 ` Hans Hagen
@ 2021-04-26  7:59   ` Jairo A. del Rio
  2021-04-26  8:56     ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Jairo A. del Rio @ 2021-04-26  7:59 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1350 bytes --]

El lun, 26 de abr. de 2021 a la(s) 01:49, Hans Hagen (j.hagen@xs4all.nl)
escribió:

> On 4/26/2021 6:59 AM, Jairo A. del Rio wrote:
> > The following:
> >
> > \starttext
> >
> > \startMPinitializations
> >
> > input cmarrows;
> >
> > setup_cmarrows(arrow_name = "texarrow"; parameter_file = "cmr6.mf";
> > macro_name = "nicearrow");
> >
> > \stopMPinitializations
> >
> > \startMPpage
>
> > metafun > log > error: Equation cannot be performed (numeric=pair)
> I don't know, but from the message it looks like some 'local' variables
> is not saved and defined. I'm surprised that loading some mf file works
> at all (because it also assumes some mf related definitions). I also hav
> eno clue if such a package adopts 'core' metafun code (and mpiv metafun
> is different from mpii).
>

It's a generic, "pure" MetaPost package:

https://www.ctan.org/pkg/cmarrows

Fonts are in /fonts/source/public in a TeX Live distribution, in case it
helps.

Hans
>
>
> -----------------------------------------------------------------
>                                            Hans Hagen | PRAGMA ADE
>                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>         tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>

Jairo

[-- Attachment #1.2: Type: text/html, Size: 2284 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict between MetaPost (LMTX) and cmarrows
  2021-04-26  7:59   ` Jairo A. del Rio
@ 2021-04-26  8:56     ` Hans Hagen
  2021-04-27  7:23       ` Jairo A. del Rio
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2021-04-26  8:56 UTC (permalink / raw)
  To: Jairo A. del Rio; +Cc: mailing list for ConTeXt users

On 4/26/2021 9:59 AM, Jairo A. del Rio wrote:
> 
> 
> El lun, 26 de abr. de 2021 a la(s) 01:49, Hans Hagen (j.hagen@xs4all.nl 
> <mailto:j.hagen@xs4all.nl>) escribió:
> 
>     On 4/26/2021 6:59 AM, Jairo A. del Rio wrote:
>      > The following:
>      >
>      > \starttext
>      >
>      > \startMPinitializations
>      >
>      > input cmarrows;
>      >
>      > setup_cmarrows(arrow_name = "texarrow"; parameter_file = "cmr6.mf";
>      > macro_name = "nicearrow");
>      >
>      > \stopMPinitializations
>      >
>      > \startMPpage
> 
>      > metafun > log > error: Equation cannot be performed (numeric=pair)
>     I don't know, but from the message it looks like some 'local' variables
>     is not saved and defined. I'm surprised that loading some mf file works
>     at all (because it also assumes some mf related definitions). I also
>     hav
>     eno clue if such a package adopts 'core' metafun code (and mpiv metafun
>     is different from mpii).
> 
> 
> It's a generic, "pure" MetaPost package:
> 
> https://www.ctan.org/pkg/cmarrows <https://www.ctan.org/pkg/cmarrows>

that doesn't make it immune from clashes in used variables with differnt 
types ... metafun is more than plain mp so more can clash

> Fonts are in /fonts/source/public in a TeX Live distribution, in case it 
> helps.
i have a rather minimal tex setup so i can't run that (i'm not going to 
clutter my system now)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict between MetaPost (LMTX) and cmarrows
  2021-04-26  8:56     ` Hans Hagen
@ 2021-04-27  7:23       ` Jairo A. del Rio
  2021-04-27 12:35         ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Jairo A. del Rio @ 2021-04-27  7:23 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2217 bytes --]

So, should I share relevant files? AFAIK only cmarrows and .mf files in the
cm source folder are involved. I hope you can check it if a solution is
possible and not too demanding. Thanks beforehand.

Regards,

Jairo

El lun, 26 de abr. de 2021 a la(s) 03:56, Hans Hagen (j.hagen@xs4all.nl)
escribió:

> On 4/26/2021 9:59 AM, Jairo A. del Rio wrote:
> >
> >
> > El lun, 26 de abr. de 2021 a la(s) 01:49, Hans Hagen (j.hagen@xs4all.nl
> > <mailto:j.hagen@xs4all.nl>) escribió:
> >
> >     On 4/26/2021 6:59 AM, Jairo A. del Rio wrote:
> >      > The following:
> >      >
> >      > \starttext
> >      >
> >      > \startMPinitializations
> >      >
> >      > input cmarrows;
> >      >
> >      > setup_cmarrows(arrow_name = "texarrow"; parameter_file =
> "cmr6.mf";
> >      > macro_name = "nicearrow");
> >      >
> >      > \stopMPinitializations
> >      >
> >      > \startMPpage
> >
> >      > metafun > log > error: Equation cannot be performed (numeric=pair)
> >     I don't know, but from the message it looks like some 'local'
> variables
> >     is not saved and defined. I'm surprised that loading some mf file
> works
> >     at all (because it also assumes some mf related definitions). I also
> >     hav
> >     eno clue if such a package adopts 'core' metafun code (and mpiv
> metafun
> >     is different from mpii).
> >
> >
> > It's a generic, "pure" MetaPost package:
> >
> > https://www.ctan.org/pkg/cmarrows <https://www.ctan.org/pkg/cmarrows>
>
> that doesn't make it immune from clashes in used variables with differnt
> types ... metafun is more than plain mp so more can clash
>
> > Fonts are in /fonts/source/public in a TeX Live distribution, in case it
> > helps.
> i have a rather minimal tex setup so i can't run that (i'm not going to
> clutter my system now)
>
> Hans
>
> -----------------------------------------------------------------
>                                            Hans Hagen | PRAGMA ADE
>                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>         tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>

[-- Attachment #1.2: Type: text/html, Size: 3379 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict between MetaPost (LMTX) and cmarrows
  2021-04-27  7:23       ` Jairo A. del Rio
@ 2021-04-27 12:35         ` Hans Hagen
       [not found]           ` <CAKyqqaagVc0srydKXTp_WTZq6fJZ3pV3ftfL8TeiC4R0-yu9_A@mail.gmail.com>
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2021-04-27 12:35 UTC (permalink / raw)
  To: Jairo A. del Rio; +Cc: mailing list for ConTeXt users

On 4/27/2021 9:23 AM, Jairo A. del Rio wrote:
> So, should I share relevant files? AFAIK only cmarrows and .mf files in 
> the cm source folder are involved. I hope you can check it if a solution 
> is possible and not too demanding. Thanks beforehand.
you can make a minimal failure example but I gues sthat the solution has 
to be in the mf macros (as there is where some pair/numeric clash happens)

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict between MetaPost (LMTX) and cmarrows
       [not found]           ` <CAKyqqaagVc0srydKXTp_WTZq6fJZ3pV3ftfL8TeiC4R0-yu9_A@mail.gmail.com>
@ 2021-04-27 17:00             ` Hans Hagen
  2021-04-27 17:06               ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2021-04-27 17:00 UTC (permalink / raw)
  To: Jairo A. del Rio, mailing list for ConTeXt users

On 4/27/2021 6:31 PM, Jairo A. del Rio wrote:
> Hi, Hans. I've attached the relevant files.
> 
> Jairo
> 
> El mar, 27 de abr. de 2021 a la(s) 07:35, Hans Hagen (j.hagen@xs4all.nl 
> <mailto:j.hagen@xs4all.nl>) escribió:
> 
>     On 4/27/2021 9:23 AM, Jairo A. del Rio wrote:
>      > So, should I share relevant files? AFAIK only cmarrows and .mf
>     files in
>      > the cm source folder are involved. I hope you can check it if a
>     solution
>      > is possible and not too demanding. Thanks beforehand.
>     you can make a minimal failure example but I gues sthat the solution
>     has
>     to be in the mf macros (as there is where some pair/numeric clash
>     happens)

indeed, as i mentioned, some variable is not set up right

you need to patch (probably in all these arrow files)

     save x,y,x_,y_;

to

     save x,y,x_,y_,z_;

and (in mapto)

            numeric x,x_[],y,y_[];

to

            numeric x,x_[],y,y_[];
            pair z_[];


Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Conflict between MetaPost (LMTX) and cmarrows
  2021-04-27 17:00             ` Hans Hagen
@ 2021-04-27 17:06               ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2021-04-27 17:06 UTC (permalink / raw)
  To: Jairo A. del Rio, mailing list for ConTeXt users

Hi,

you can't assume fuzzy scratch variables as used in

   def flex(text t) =           % t is a list of pairs
     hide(n_:=0; for z=t: z_[incr n_]:=z; endfor
     dz_:=z_[n_]-z_1)
     z_1 for k=2 upto n_-1: ...z_[k]{dz_} endfor ...z_[n_] enddef;
   newinternal n_; pair z_[],dz_;

to be official .. in mpxl we use names like

   temp_pair_z

i.e. a temp_ namespace (as well as a mfun_ one) for all these 
potentially clashing short names

you could do

   newinternal n_; pair z_[],dz_;

at the top of your file (because we don't use them) but stil ...

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-27 17:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26  4:59 Conflict between MetaPost (LMTX) and cmarrows Jairo A. del Rio
2021-04-26  6:49 ` Hans Hagen
2021-04-26  7:59   ` Jairo A. del Rio
2021-04-26  8:56     ` Hans Hagen
2021-04-27  7:23       ` Jairo A. del Rio
2021-04-27 12:35         ` Hans Hagen
     [not found]           ` <CAKyqqaagVc0srydKXTp_WTZq6fJZ3pV3ftfL8TeiC4R0-yu9_A@mail.gmail.com>
2021-04-27 17:00             ` Hans Hagen
2021-04-27 17:06               ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).