From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/106510 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: Can I share METAPOST vardefs over multiple pages? Date: Fri, 13 Mar 2020 12:53:46 +0100 Message-ID: <5C2B251F-E800-4146-B939-D43C278E2308@rna.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: multipart/mixed; boundary="===============3560208663261036656==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="46987"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Mar 13 12:54:21 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jCitR-000C4o-2r for gctc-ntg-context-518@m.gmane-mx.org; Fri, 13 Mar 2020 12:54:21 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 7128F1828DA; Fri, 13 Mar 2020 12:53:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jpPelxiNrEdQ; Fri, 13 Mar 2020 12:53:49 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 703101828DB; Fri, 13 Mar 2020 12:53:49 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 910B51828D9 for ; Fri, 13 Mar 2020 12:53:48 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tppBsMdeJ7gg for ; Fri, 13 Mar 2020 12:53:48 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=213.125.118.53; helo=mail.rna.nl; envelope-from=gerben.wierda@rna.nl; receiver= Original-Received: from mail.rna.nl (mail.rna.nl [213.125.118.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id EC45D182381 for ; Fri, 13 Mar 2020 12:53:47 +0100 (CET) Original-Received: from hermione.rna.nl (hermione.rna.nl [192.168.2.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.rna.nl (Postfix) with ESMTPSA id 23A2335B132A for ; Fri, 13 Mar 2020 12:53:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1584100427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=8JXjHcJXcvHah4A1GYKtyZg1xq+C+rV9/mutWilfzdE=; b=NhTpJKaY9bu7Y/ag0FcOL8Te4bRYElwFJYvfmmi0ofLfIxnnrvjmxVTi8kgIiMSHPm2okI 1a3bsqbvKYzMRJjmelkfPBz9wtsY51yVCSGWWTkFsqVQYY/HktlWvitVTbOFYBf4eArEHt tokul5/7Q2KT/t/+1D2VcUEiG18uQmvimB5+pJuJSrU2bvmMKj37ABmQhQakMinLcd16/m iyuymMLZyaDIb6wkLkvh2LcEFPOyOXsIsz69gjNIvXzP6m7mvRRRj9rXazMyW8e5IyEO2Z Fyl9bLPR+BYlRTloLqxT1S4xuQP4imHN1fMBr6HuGqh5QdiXmI3agZuO0MqadQ== X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:106510 Archived-At: --===============3560208663261036656== Content-Type: multipart/alternative; boundary="Apple-Mail=_D602C466-45A5-4339-9CDD-C555925918E0" --Apple-Mail=_D602C466-45A5-4339-9CDD-C555925918E0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Suppose I have this code: \startMPpage vardef MyShape(expr w, h) =3D save pth; path pth ; save pic; picture pic; pth =3D fullsquare xysized (w, h); pic :=3D image ( draw pth; % all kind of stuff here ); setbounds pic to pth; pic enddef ; picture s ; s :=3D MyShape(4cm, 2cm); draw s; drawdot center leftboundary s withpen pencircle scaled 2 withcolor = green; drawdot center rightboundary s withpen pencircle scaled 2 withcolor = blue; drawdot point .25 along topboundary s withpen pencircle scaled 2 = withcolor yellow; drawdot .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor = magenta; drawdot origin withpen pencircle scaled 2 withcolor red; \stopMPpage Can I reuse that varied across follow-up MPPages? G --Apple-Mail=_D602C466-45A5-4339-9CDD-C555925918E0 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii Suppose I have this code:

\startMPpage

vardef MyShape(expr w, h) =3D
   save pth; path pth ;
   save pic; picture pic;
   pth =3D fullsquare xysized (w, h);
   pic :=3D image (
       draw pth;
       % all kind of stuff = here
   );
   setbounds pic to pth;
   pic
enddef ;

picture s ; s :=3D MyShape(4cm, 2cm);

draw s;

drawdot center = leftboundary  s withpen pencircle scaled 2 withcolor green;
drawdot center rightboundary s withpen pencircle scaled 2 = withcolor blue;
drawdot point .25 along topboundary s = withpen pencircle scaled 2 withcolor yellow;
drawdot = .25[llcorner s, lrcorner s] withpen pencircle scaled 2 withcolor = magenta;
drawdot origin  withpen pencircle scaled 2 = withcolor red;

\stopMPpage

Can I reuse that varied across follow-up MPPages?

G
= --Apple-Mail=_D602C466-45A5-4339-9CDD-C555925918E0-- --===============3560208663261036656== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============3560208663261036656==--