From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,MIME_QP_LONG_LINE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from cgl.ntg.nl (Cgl.ntg.nl [5.39.185.202]) by inbox.vuxu.org (Postfix) with ESMTP id 39E1826A04 for ; Mon, 19 Feb 2024 14:33:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id C34734841C6 for ; Mon, 19 Feb 2024 14:33:44 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Authentication-Results: cgl.ntg.nl (amavisd-new); dkim=fail (2048-bit key) reason="fail (message has been altered)" header.d=labonneheure.ch Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p-UhfHsP81bk for ; Mon, 19 Feb 2024 14:33:43 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 2EBFA4841E3 for ; Mon, 19 Feb 2024 14:29:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id BE48F48400E for ; Mon, 19 Feb 2024 14:29:04 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D4AW3nVwGNi7 for ; Mon, 19 Feb 2024 14:29:03 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=45.13.66.34; helo=outbound00.knthost.com; envelope-from=emanuel@labonneheure.ch; receiver= Received: from outbound00.knthost.com (outbound00.knthost.com [45.13.66.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 4DE8048400D for ; Mon, 19 Feb 2024 14:29:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.10.3 outbound01.knthost.com 042DB81887 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=labonneheure.ch; s=default; t=1708349338; bh=fhPsArGaahOLJrlQSWyXvxDS+jgmxxwjTZV4mdMi8lI=; h=From:Subject:Date:To; b=kju4dkyvP0UvR+Jr16w6iZpxcRjTebFHzywjBeaWrUql95HNwNu06HGeF2moYvA94 FsJRnB/oOfcPH857DNuecfY24UwZotiu5Of40kJFN0rIGODk+R01dLSvixjURQmVFa k1Y0Fq7pkdjBrYmn1Y/oVK+yptM0OQPJZp+CeelMdh0wDUb98D89f2gckjnpqjOWWy C+5TrJGq9o0CPBB0D5NUR1ENpfr3/B2ZW/6bS8Q60lVj7XLZjJdNQo1+BErBff+l+N 8N+pLN+SRt9maKwYSn9L+rSqVN5y4kRSdvIPP9t3YybghrF69jryflWMLSn3tmslRA OypkgDKrnspqg== Mime-Version: 1.0 (1.0) Message-Id: Date: Mon, 19 Feb 2024 14:28:43 +0100 To: ntg-context@ntg.nl X-Mailer: iPhone Mail (20G81) Message-ID-Hash: BA4H53Q37H5Z4PDG5K4FNM3FOCOSV3ER X-Message-ID-Hash: BA4H53Q37H5Z4PDG5K4FNM3FOCOSV3ER X-MailFrom: emanuel@labonneheure.ch X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Fwd: Re: Working with layer sets with Metapost List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Emanuel Han via ntg-context Cc: Emanuel Han Content-Type: multipart/mixed; boundary="===============7033793861746107363==" --===============7033793861746107363== Content-Type: multipart/alternative; boundary=Apple-Mail-C69B33B3-6AC8-4D7C-8248-CF70CE8BE9DF Content-Transfer-Encoding: 7bit --Apple-Mail-C69B33B3-6AC8-4D7C-8248-CF70CE8BE9DF Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =EF=BB=BF I just made a strange observation in the output pdf of the attache= d layer_set.tex, which is that when opening it with a pdf viewer like skim o= r macos preview and showing miniatures, all pages except the last one show p= age number 1 (the last showing page number 2).=20 Which was not the case with the output pdf of the attached multipage_metapos= t_mwe-very_simple.tex.=20 How can I change my code to have proper consecutive page numbering in a pdf v= iewer? > On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context wrote: > I think I could solve all the problems. Attached the finalized working exa= mple. I created the https://wiki.contextgarden.net/MetaPost#Layer_sets_as_in= dividual_pages entry with it. Feel free to modify. >=20 > Cheers > Emanuel >=20 > On Feb. 16 2024, at 7:56 am, Mikael Sundqvist wrote: > Hi, >=20 > not sure I get what you are missing. But you can try >=20 > setbounds currentpicture to (fullsquare scaled 200) ; >=20 > in base. And then do >=20 > \dorecurse{5}{ > \startTEXpage[offset=3D1DK] > \useMPgraphic{layerset#1} > \stopTEXpage > } >=20 > if that is the looping you are after. >=20 > /Mikael >=20 > On Fri, Feb 16, 2024 at 6:54=E2=80=AFAM Emanuel Han via ntg-context > wrote: > > > > Resp. the solution should be such that each generated PDF page has the s= ame dimension, the same background colour and a page number and the metapost= content on each page has the same scaling factor. > > > > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context wrote: > > > > Dear Mikael, > > > > I actually need to keep the \dorecurse mechanism of the mwe (from line 4= 4 on), because I need the "setbounds currentpicture to TheFrame" and also be= cause I need page numbering inside the MPpage, as done with draw textext(dec= imal(currentime)). > > > > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurs= e, assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.? > > > > Emanuel > > > > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context wrote: > > > > Dear Mikael, > > thanks a lot! > > this seems to be the solution! And it looks beatiful enough to me =F0=9F= =98=84 > > I'll try to port all my layers to this new method and see if I run into n= ew problems again =F0=9F=98=85 > > > > Emanuel > > > > > > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist wrote: > > > > Hi > > > > On Thu, Feb 15, 2024 at 1:03=E2=80=AFAM Emanuel Han via ntg-context > > wrote: > > > > > > Dear list, > > > > > > the attached .tex file is the minimal working example we discussed tod= ay in the online meeting. > > > > > > I realized that the approach of looping through k of p[k] is not fitti= ng my needs, because it's not flexible enough. > > > > > > I need another approach, one which works with layer sets. > > > > > > I would stop using p as an array, because with the layer sets approach= we don't have a fixed order of the layers. > > > > > > So the definition of the layers would be something like > > > > > > picture layerA; > > > layerA:=3Dimage( > > > label("Word 1", z1); > > > ); > > > > > > picture layerW; > > > layerW:=3Dimage( > > > label("Mot 2", z2); > > > ); > > > > > > picture layerM; > > > layerM:=3Dimage( > > > label("Parola 3", z3); > > > ); > > > > > > picture layerC; > > > layerC:=3Dimage( > > > label("Wort 4", z3+z1); > > > ); > > > > > > picture layerY; > > > layerY:=3Dimage( > > > label("Nummer 5", z2+z3); > > > ); > > > > > > picture layerU; > > > layerU:=3Dimage( > > > label("number 6", z2+z1); > > > ); > > > > > > After that, I would define layer sets and layer subsets. This will be d= one manually for each layer set and each layer subset. > > > I don't know the proper syntax to do that. Let's assume we could use a= variable type called "myset". > > > > > > myset layersubsetGamma; > > > layersubsetGamma:=3D{layerU,layerM}; > > > > > > In my logic, the layers will be drawn in the order of their appearance= within the {}. In the example, drawn content of layerM might cover drawn co= ntent of layerU. > > > > > > Contrary to a layer subset, each layer set will result in a PDF page, a= nd thus the layer sets are related to each other by an inner order. That's w= hy I would use an array variable here with []. > > > > > > I don't know how to append a set. In the following example, I assumed t= here would be a function myappend(, ) > > > > > > myset layerset[]; > > > layerset1 :=3D {layerW,layerA}; > > > layerset2 :=3D myappend{layerset1, layerY}; > > > layerset3 :=3D myappend{layerset2, layersubsetGamma}; > > > layerset4 :=3D myappend{layerset2, layerU}; > > > layerset5 :=3D myappend{layerset4, layersubsetGamma}; > > > > > > Finally, I would need each layerset[k] typeset on its own pdf page. An= d of course on each page k, only the layers which appear in the definition o= f the layerset[k] should be drawn on top of each other in the order as they a= ppear in that definition. > > > > > > I'm very curious to hear your suggestions. > > > > > > > Not beautiful, perhaps, but maybe something like this could work? I > > think there is no way out of doing some manual work to tell what you > > want included on each page. > > > > \startuseMPgraphic{base} > > z1 =3D origin ; > > z2 =3D (10,50) ; > > z3 =3D (40,30) ; > > > > picture layerA; > > layerA:=3Dimage( > > label("Word 1", z1); > > ); > > > > picture layerW; > > layerW:=3Dimage( > > label("Mot 2", z2); > > ); > > > > picture layerM; > > layerM:=3Dimage( > > label("Parola 3", z3); > > ); > > > > picture layerC; > > layerC:=3Dimage( > > label("Wort 4", z3+z1); > > ); > > > > picture layerY; > > layerY:=3Dimage( > > label("Nummer 5", z2+z3); > > ); > > > > picture layerU; > > layerU:=3Dimage( > > label("number 6", z2+z1); > > ); > > \stopuseMPgraphic > > > > \startuseMPgraphic{Gamma} > > draw layerU ; > > draw layerM ; > > \stopuseMPgraphic > > > > \startuseMPgraphic{layerset1} > > \includeMPgraphic{base} > > draw layerW ; > > draw layerA ; > > \stopuseMPgraphic > > > > \startuseMPgraphic{layerset2} > > \includeMPgraphic{layerset1} ; > > draw layerY ; > > \stopuseMPgraphic > > > > \startuseMPgraphic{layerset3} > > \includeMPgraphic{layerset2} ; > > \includeMPgraphic{Gamma} ; > > \stopuseMPgraphic > > > > > > \startuseMPgraphic{layerset4} > > \includeMPgraphic{layerset2} ; > > draw layerU ; > > \stopuseMPgraphic > > > > \startuseMPgraphic{layerset5} > > \includeMPgraphic{layerset4} ; > > \includeMPgraphic{Gamma} ; > > \stopuseMPgraphic > > > > \starttext > > > > \startTEXpage[offset=3D1DK] > > \useMPgraphic{layerset1} > > \stopTEXpage > > > > \startTEXpage[offset=3D1DK] > > \useMPgraphic{layerset2} > > \stopTEXpage > > > > \startTEXpage[offset=3D1DK] > > \useMPgraphic{layerset3} > > \stopTEXpage > > > > \startTEXpage[offset=3D1DK] > > \useMPgraphic{layerset4} > > \stopTEXpage > > > > \startTEXpage[offset=3D1DK] > > \useMPgraphic{layerset5} > > \stopTEXpage > > > > \stoptext > > > > /Mikael > > ________________________________________________________________________= ___________ > > If your question is of interest to others as well, please add an entry t= o the Wiki! > > > > maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/nt= g-context.ntg.nl > > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror= ) > > archive : https://github.com/contextgarden/context > > wiki : https://wiki.contextgarden.net > > ________________________________________________________________________= ___________ > > > > ________________________________________________________________________= ___________ > > If your question is of interest to others as well, please add an entry t= o the Wiki! > > > > maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/nt= g-context.ntg.nl > > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror= ) > > archive : https://github.com/contextgarden/context > > wiki : https://wiki.contextgarden.net > > ________________________________________________________________________= ___________ > > > > ________________________________________________________________________= ___________ > > If your question is of interest to others as well, please add an entry t= o the Wiki! > > > > maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/nt= g-context.ntg.nl > > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror= ) > > archive : https://github.com/contextgarden/context > > wiki : https://wiki.contextgarden.net > > ________________________________________________________________________= ___________ > > > > ________________________________________________________________________= ___________ > > If your question is of interest to others as well, please add an entry t= o the Wiki! > > > > maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/nt= g-context.ntg.nl > > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror= ) > > archive : https://github.com/contextgarden/context > > wiki : https://wiki.contextgarden.net > > ________________________________________________________________________= ___________ > __________________________________________________________________________= _________ > If your question is of interest to others as well, please add an entry to t= he Wiki! >=20 > maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-= context.ntg.nl > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) > archive : https://github.com/contextgarden/context > wiki : https://wiki.contextgarden.net > __________________________________________________________________________= _________ > __________________________________________________________________________= _________ > If your question is of interest to others as well, please add an entry to t= he Wiki! >=20 > maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-= context.ntg.nl > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) > archive : https://github.com/contextgarden/context > wiki : https://wiki.contextgarden.net > __________________________________________________________________________= _________ --Apple-Mail-C69B33B3-6AC8-4D7C-8248-CF70CE8BE9DF Content-Type: multipart/mixed; boundary=Apple-Mail-5C6EF6FC-A0EB-4BB9-8FC6-BD61D426D044 Content-Transfer-Encoding: 7bit --Apple-Mail-5C6EF6FC-A0EB-4BB9-8FC6-BD61D426D044 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
=EF=BB=BF I just made a strange observation in the output pdf of the attached= layer_set.tex, which is that when opening it with a pdf viewer like skim or= macos preview and showing miniatures, all pages except the last one show pa= ge number 1 (the last showing page number 2).&nbs= p;

Which was not the case wit= h the output pdf of the attached multipage_metapost_mwe-very_simple.tex.&nbs= p;

How can I change my code to have= proper consecutive page numbering in a pdf viewer?
On Feb. 1= 7 2024, at 11:03 am, Emanuel Han via ntg-context <ntg-context@ntg.nl> w= rote:
I think I could solve all the problems. Attached the finalized worki= ng example. I created the https://wiki.contextgarden.net/MetaPos= t#Layer_sets_as_individual_pages entry with it. Feel free to modify= .

Cheers
Emanuel

On Feb. 16 2024, at 7:56 am, Mikael Sundqvist <mickep@gmail.= com> wrote:
Hi,

not sure I get w= hat you are missing. But you can try

setbounds currentpicture t= o (fullsquare scaled 200) ;

in base. And then do

\dorecurse{5}{
\startTEXpage[offset=3D1DK]
\useMPgraphi= c{layerset#1}
\stopTEXpage
}

if that is th= e looping you are after.

/Mikael

On Fri, Feb 16,= 2024 at 6:54=E2=80=AFAM Emanuel Han via ntg-context
<ntg-conte= xt@ntg.nl> wrote:
>
> Resp. the solution should= be such that each generated PDF page has the same dimension, the same backg= round colour and a page number and the metapost content on each page has the= same scaling factor.
>
> On Feb. 15 2024, at 11:1= 0 pm, Emanuel Han via ntg-context <ntg-context@ntg.nl> wrote:
>
> Dear Mikael,
>
> I actually n= eed to keep the \dorecurse mechanism of the mwe (from line 44 on), because I= need the "setbounds currentpicture to TheFrame" and also because I need pag= e numbering inside the MPpage, as done with draw textext(decimal(currentime)= ).
>
> So, how can I use the \useMPgraphic{layerse= t1} etc. inside the \dorecurse, assuming I name my layersets "layerset1", "l= ayerset2", "layerset3" etc.?
>
> Emanuel
>
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-conte= xt <ntg-context@ntg.nl> wrote:
>
> Dear Mika= el,
> thanks a lot!
> this seems to be the solutio= n! And it looks beatiful enough to me =F0=9F=98=84
> I'll try t= o port all my layers to this new method and see if I run into new problems a= gain =F0=9F=98=85
>
> Emanuel
>
=
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist <m= ickep@gmail.com> wrote:
>
> Hi
>
> On Thu, Feb 15, 2024 at 1:03=E2=80=AFAM Emanuel Han via ntg-co= ntext
> <ntg-context@ntg.nl> wrote:
> >
> > Dear list,
> >
> > the at= tached .tex file is the minimal working example we discussed today in the on= line meeting.
> >
> > I realized that the ap= proach of looping through k of p[k] is not fitting my needs, because it's no= t flexible enough.
> >
> > I need another ap= proach, one which works with layer sets.
> >
> &= gt; I would stop using p as an array, because with the layer sets approach w= e don't have a fixed order of the layers.
> >
>= > So the definition of the layers would be something like
>= >
> > picture layerA;
> > layerA:=3Dimag= e(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=3D= image(
> > label("Mot 2", z2);
> > );
<= div>> >
> > picture layerM;
> > layerM= :=3Dimage(
> > label("Parola 3", z3);
> > );=
> >
> > picture layerC;
> >= layerC:=3Dimage(
> > label("Wort 4", z3+z1);
>= > );
> >
> > picture layerY;
&= gt; > layerY:=3Dimage(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=3Dimage(
> > label("number 6", z2= +z1);
> > );
> >
> > After t= hat, I would define layer sets and layer subsets. This will be done manually= for each layer set and each layer subset.
> > I don't know t= he proper syntax to do that. Let's assume we could use a variable type calle= d "myset".
> >
> > myset layersubsetGamma;
> > layersubsetGamma:=3D{layerU,layerM};
> ><= /div>
> > In my logic, the layers will be drawn in the order of th= eir appearance within the {}. In the example, drawn content of layerM might c= over drawn content of layerU.
> >
> > Contra= ry to a layer subset, each layer set will result in a PDF page, and thus the= layer sets are related to each other by an inner order. That's why I would u= se an array variable here with [].
> >
> > I= don't know how to append a set. In the following example, I assumed there w= ould be a function myappend(<initial set>, <the things what the ini= tial set should be appended with>)
> >
> >= ; myset layerset[];
> > layerset1 :=3D {layerW,layerA};
> > layerset2 :=3D myappend{layerset1, layerY};
> &= gt; layerset3 :=3D myappend{layerset2, layersubsetGamma};
> >= ; layerset4 :=3D myappend{layerset2, layerU};
> > layerset5 := =3D myappend{layerset4, layersubsetGamma};
> >
>= ; > Finally, I would need each layerset[k] typeset on its own pdf page. A= nd of course on each page k, only the layers which appear in the definition o= f the layerset[k] should be drawn on top of each other in the order as they a= ppear in that definition.
> >
> > I'm very c= urious to hear your suggestions.
> >
>
> Not beautiful, perhaps, but maybe something like this could work? I
> think there is no way out of doing some manual work to tell wh= at you
> want included on each page.
>
&= gt; \startuseMPgraphic{base}
> z1 =3D origin ;
> z= 2 =3D (10,50) ;
> z3 =3D (40,30) ;
>
>= ; picture layerA;
> layerA:=3Dimage(
> label("Word= 1", z1);
> );
>
> picture layerW;
> layerW:=3Dimage(
> label("Mot 2", z2);
&= gt; );
>
> picture layerM;
> layerM:=3D= image(
> label("Parola 3", z3);
> );
>= ;
> picture layerC;
> layerC:=3Dimage(
&= gt; label("Wort 4", z3+z1);
> );
>
> p= icture layerY;
> layerY:=3Dimage(
> label("Nummer 5= ", z2+z3);
> );
>
> picture layerU;
> layerU:=3Dimage(
> label("number 6", z2+z1);
> );
> \stopuseMPgraphic
>
>= \startuseMPgraphic{Gamma}
> draw layerU ;
> draw l= ayerM ;
> \stopuseMPgraphic
>
> \star= tuseMPgraphic{layerset1}
> \includeMPgraphic{base}
&g= t; draw layerW ;
> draw layerA ;
> \stopuseMPgraph= ic
>
> \startuseMPgraphic{layerset2}
>= ; \includeMPgraphic{layerset1} ;
> draw layerY ;
>= \stopuseMPgraphic
>
> \startuseMPgraphic{layerset= 3}
> \includeMPgraphic{layerset2} ;
> \includeMPgr= aphic{Gamma} ;
> \stopuseMPgraphic
>
>= ;
> \startuseMPgraphic{layerset4}
> \includeMPgrap= hic{layerset2} ;
> draw layerU ;
> \stopuseMPgraph= ic
>
> \startuseMPgraphic{layerset5}
>= ; \includeMPgraphic{layerset4} ;
> \includeMPgraphic{Gamma} ;
> \stopuseMPgraphic
>
> \starttext
>
> \startTEXpage[offset=3D1DK]
> \useMP= graphic{layerset1}
> \stopTEXpage
>
>= \startTEXpage[offset=3D1DK]
> \useMPgraphic{layerset2}
> \stopTEXpage
>
> \startTEXpage[offset=3D1D= K]
> \useMPgraphic{layerset3}
> \stopTEXpage
=
>
> \startTEXpage[offset=3D1DK]
> \useMPgr= aphic{layerset4}
> \stopTEXpage
>
> \= startTEXpage[offset=3D1DK]
> \useMPgraphic{layerset5}
> \stopTEXpage
>
> \stoptext
>
> /Mikael
> ________________________________________= ___________________________________________
> If your question i= s of interest to others as well, please add an entry to the Wiki!
= >
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/m= ailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma= -ade.nl / https://context.aanhet.net (mirror)
> archive : https= ://github.com/contextgarden/context
> wiki : https://wiki.conte= xtgarden.net
> ________________________________________________= ___________________________________
>
> __________= _________________________________________________________________________
> If your question is of interest to others as well, please add a= n entry to the Wiki!
>
> maillist : ntg-context@nt= g.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
&g= t; webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)=
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> _________________= __________________________________________________________________
>
> _______________________________________________________= ____________________________
> If your question is of interest t= o others as well, please add an entry to the Wiki!
>
= > maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/n= tg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https= ://context.aanhet.net (mirror)
> archive : https://github.com/c= ontextgarden/context
> wiki : https://wiki.contextgarden.net
> _______________________________________________________________= ____________________
>
> _________________________= __________________________________________________________
> If= your question is of interest to others as well, please add an entry to the W= iki!
>
> maillist : ntg-context@ntg.nl / https://m= ailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : htt= ps://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> a= rchive : https://github.com/contextgarden/context
> wiki : http= s://wiki.contextgarden.net
> __________________________________= _________________________________________________
________________= ___________________________________________________________________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.n= l/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-a= de.nl / https://context.aanhet.net (mirror)
archive : https://gith= ub.com/contextgarden/context
wiki : https://wiki.contextgarden.net=
_________________________________________________________________= __________________
____________________________= _______________________________________________________
If your qu= estion is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/= lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / htt= ps://context.aanhet.net (mirror)
archive : https://github.com/cont= extgarden/context
wiki : https://wiki.contextgarden.net
= ____________________________________________________________________________= _______
= --Apple-Mail-5C6EF6FC-A0EB-4BB9-8FC6-BD61D426D044 Content-Type: application/octet-stream; name=multipage_metapost_mwe-very_simple.tex; x-apple-part-url=7FD40835-F4A7-4FB5-83F7-A8E096B2E18A Content-Disposition: attachment; filename=multipage_metapost_mwe-very_simple.tex Content-Transfer-Encoding: 7bit % !TEX TS-program = ConTeXt2021 \startuseMPgraphic{base} picture p[]; path TheFrame ; TheFrame := fullsquare scaled 5in ; %let's define the commonly used geometry elements z1 = (60,40); z2 = (40,90); z3 = (10,70); %let's define some layers with drawn content p1:=image( label("Word 1", z1); ); p2:=image( label("Mot 2", z2); ); p3:=image( label("Parola 3", z3); ); p4:=image( label("Wort 4", z3+z1); ); p5:=image( label("Nummer 5", z2+z3); ); p6:=image( label("number 6", z2+z1); ); \stopuseMPgraphic \starttext \dorecurse{6}{ % Frame \ifnum \recurselevel = 3 %this defines the page which will be skipped. This solution allows only one page to be skipped. \else \startMPpage[pagestate=start] \includeMPgraphic{base} currentime := #1 ; % Just for learning : draw TheFrame withpen pencircle scaled .1in withcolor magenta ; draw textext("T="&decimal(currentime)) shifted(0,2in) withcolor magenta ; boolean b[]; %in the following lines b[] := , we define the images which should not be added to currentpicture: b[3] := true; b[5] := true; for k=1 upto currentime: if known b[k] : else : addto currentpicture also p[k]; fi endfor setbounds currentpicture to TheFrame ; desiredformat := 1080;% In pixels (will be converted by default at 72dpi) currentpicture := currentpicture xysized (desiredformat ,desiredformat ); \stopMPpage \fi } \stoptext --Apple-Mail-5C6EF6FC-A0EB-4BB9-8FC6-BD61D426D044 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit
--Apple-Mail-5C6EF6FC-A0EB-4BB9-8FC6-BD61D426D044 Content-Type: application/octet-stream; name=layer_sets.tex; x-apple-part-url=3E707CFE-76B2-4BA6-8A16-28377C5677CB Content-Disposition: attachment; filename=layer_sets.tex Content-Transfer-Encoding: 7bit % !TEX TS-program = ConTeXt2021 \startuseMPgraphic{base} %Here in the base, we define the components we will use to draw our images numeric u; u = 1cm; numeric framefactor; framefactor = 3.4; path TheFrame ; TheFrame := fullsquare xyscaled (framefactor*u, framefactor*u) ; %Needed to have for every page the same dimensions. Use (sqrt(2)*framefactor*u, framefactor*u) for DIN A Landscape ratio of the dimensions. color stone_color; stone_color = 1/256(199,199,199); color light_teal_color; light_teal_color = 1/256(154,209,189); z1 = (-u,-u) ; z2 = (u,-u) ; z3 = (-u,u) ; z4 = (u,u) ; z5 = (-.5u,0); z6 = (.8u,0); picture layerA; layerA:=image( fill fullsquare scaled u shifted(z1) withcolor stone_color; label("A", z1); ); picture layerW; layerW:=image( fill fullsquare scaled u shifted(z2) withcolor stone_color; label("W", z2); ); picture layerM; layerM:=image( fill fullsquare scaled u shifted(z3) withcolor blue; label("M", z3) withcolor white; ); picture layerC; layerC:=image( fill fullsquare scaled 1.5u shifted(z4) withcolor transparent(1, .8, green); label("C", z4); ); picture layerY; layerY:=image( fill fullsquare scaled 2u shifted(z5) withcolor light_teal_color; label("Y", z5); ); picture layerU; layerU:=image( fill fullsquare rotated 30 scaled 2u shifted(z4) withcolor transparent(1, .5, red); label("U", z4); ); picture layerV; layerV:=image( fill fullsquare rotated 10 scaled 1.4u shifted(z6) withcolor transparent(1, .7, yellow); label("V", z6); ); \stopuseMPgraphic %base \startuseMPgraphic{finishing} %This is needed to clip the graphic to the same frame and to add the page numbering. Both have to happen after drawing the layers. draw TheFrame withpen pencircle scaled .25u withcolor magenta ; draw textext(decimal(\MPvar{mypagenumber})) scaled .1u withcolor magenta ; setbounds currentpicture to TheFrame ; %scaling the page to your preferred dimension: desiredformat := 150;% In pixels (will be converted by default at 72dpi). The shorter dimension of DIN A4 would be 595 pixels. currentpicture := currentpicture xysized (desiredformat ,desiredformat ); %for square pages. If DIN A Landscape, use (sqrt(2)*desiredformat ,desiredformat) \stopuseMPgraphic %finishing \startuseMPgraphic{Gamma} %This is a layer subset which will be used more than once. I call it a layer subset and not a layer set because it doesn't include another MPgraphic. draw layerU ; draw layerM ; \stopuseMPgraphic %Gamma \startuseMPgraphic{layersetpage1} %Each layersetpage will become a page containing the defined layer set. The number corresponds to the page number. Start with number 1. \includeMPgraphic{base} %base has to be included only in layersetpage1. It will be passed on to the next layersetpages via inclusion. draw layerW ; draw layerA ; \stopuseMPgraphic \startuseMPgraphic{layersetpage2} %There should be no gap in the sequence of the numbers of the layersetpages \includeMPgraphic{layersetpage1} ; draw layerV ; \stopuseMPgraphic \startuseMPgraphic{layersetpage3} \includeMPgraphic{layersetpage2} ; \includeMPgraphic{Gamma} ; \stopuseMPgraphic \startuseMPgraphic{layersetpre4} %This is a layer set because it includes another MPgraphic. It will be used more than once, but it will not become a page itself. It's only an intermediate step on the way to the next layersetpage. For that reason, it's not named layersetpage. Because it's coming before the layersetpage4, I call it layersetpre4. If I need another intermediate step stored before layersetpre4, I would call it layersetprepre4. But that's only a naming convention for myself. \includeMPgraphic{layersetpage1} ; draw layerY ; \stopuseMPgraphic \startuseMPgraphic{layersetpage4} \includeMPgraphic{layersetpre4} ; label("special!", (z3+z4)/2) rotated 5 withcolor red; \stopuseMPgraphic \startuseMPgraphic{layersetpage5} \includeMPgraphic{layersetpage3} ; draw layerC ; \stopuseMPgraphic \startuseMPgraphic{layersetpage6} \includeMPgraphic{layersetpre4} ; draw layerC ; \stopuseMPgraphic \starttext \dorecurse{6}{ %This loop starts from 1 until the set number and draws each layersetpage onto its own page. Don't set a number which is higher than the number of your last layersetpage. %By differentiating finishinglayersetpage#1 from layersetpage#1, we can avoid adding \includeMPgraphic{finishing} to each \startuseMPgraphic{layersetpage}. This allows us to apply the scaling of the page to our desiredformat, because the scaling will done only once per \useMPgraphic{}. \startuseMPgraphic{finishinglayersetpage#1} \includeMPgraphic{layersetpage#1} ; \includeMPgraphic{finishing} \stopuseMPgraphic %uncomment if needed: % \setupTEXpage[background=color, backgroundcolor=gray] \startTEXpage \useMPgraphic{finishinglayersetpage#1}{mypagenumber=#1} \stopTEXpage } \stoptext --Apple-Mail-5C6EF6FC-A0EB-4BB9-8FC6-BD61D426D044 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit

--Apple-Mail-5C6EF6FC-A0EB-4BB9-8FC6-BD61D426D044-- --Apple-Mail-C69B33B3-6AC8-4D7C-8248-CF70CE8BE9DF-- --===============7033793861746107363== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________ --===============7033793861746107363==--