contextgarden / luametatex

Temporary/draft repository with luametatex
30 stars 6 forks source link

how to treat every 'startMPxxx/stopMPxxx' as a single file? #3

Closed walkthetalk closed 1 year ago

walkthetalk commented 1 year ago

if I write multiple 'startMPxxx/stopMPxx' (the content of which are same) in same tex, it will result in redefine. how to treat every 'startMPxxx/stopMPxxx' as a single mp file?

hanshagen commented 1 year ago

On 3/31/2023 9:43 AM, Yi Qingliang wrote:

if I write multiple 'startMPxxx/stopMPxx' (the content of which are same) in same tex, it will result in redefine. how to see every 'startMPxxx/stopMPxxx' as a single mp file? I'm not sure what you aim at but you can do:

\startuseMPgraphic{xxx} ... \stopuseMPgraphic

\useMPgraphic{xxx}

and inside some graphic:

\includeMPgraphic{xxx}

There are also reusable and unique variants, see metafun manual.

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

walkthetalk commented 1 year ago
\startMPcode
pair a;
pair b;
a := (3,5);
b = a + (0,7);
\stopMPcode

\startMPcode
pair a;
pair b;
a := (3,5);
b = a + (0,9);
\stopMPcode

like it. I wan't to treat every start/stop as a single file. In current implementation, the second one will define something which has same name as first one. and it will conflict.

hanshagen commented 1 year ago

On 4/2/2023 4:45 AM, Yi Qingliang wrote:

|\startMPcode pair a; pair b; a := (3,5); b = a + (0,7); \stopMPcode \startMPcode pair a; pair b; a := (3,5); b = a + (0,9); \stopMPcode |

like it. I wan't to treat every start/stop as a single file. In current implementation, the second one will define something which has same name as first one. and it will conflict.

One could reset the MP instance but that is pretty inefficient. Alternatively one can have a dedicates instance that for instance starts out with little. There are a few context subsystems that do that.

It all depends on what features users want to have available.

(Even then, one can best "save a, b")

Best ask these questions/solutions on the context mailing list.

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

adityam commented 1 year ago

It is better to use the mailing list for questions related to ConTeXt (the macro package)