From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/106544 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: Re: Can I share METAPOST vardefs over multiple pages? Date: Mon, 16 Mar 2020 11:12:19 +0100 Message-ID: <916B32A2-2C23-4BF3-BD82-0FA03B30770D@rna.nl> References: <5C2B251F-E800-4146-B939-D43C278E2308@rna.nl> <07cacfef-08ed-0a40-2013-d25a5a0575b0@xs4all.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="===============3294726028315824226==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="2630"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Mar 16 11:12:57 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 1jDmjx-0000Zn-4u for gctc-ntg-context-518@m.gmane-mx.org; Mon, 16 Mar 2020 11:12:57 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E51F018299F; Mon, 16 Mar 2020 11:12:33 +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 uOHiHxo18h1x; Mon, 16 Mar 2020 11:12:28 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id ED7C1182988; Mon, 16 Mar 2020 11:12:27 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D15E318296D for ; Mon, 16 Mar 2020 11:12:26 +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 TB_lw8L-Zq89 for ; Mon, 16 Mar 2020 11:12:22 +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 E382518296C for ; Mon, 16 Mar 2020 11:12:21 +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 11DBA35CFFC4; Mon, 16 Mar 2020 11:12:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1584353540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rS+yvpyuo0sCJsXAbbjvQlzQPonp5l2z70vLfycnxWE=; b=F77xicPD7ZXjkuAN7zgq9J6RXW91hyRSekt2rMIedmXH9TODKtrY2bQh1xYgmK+t4i+O0x 8xp1tVFXVPYVvumHjZY7P6jtvnyLmnuPu1kewVitV7XIUveMFkjdqCBCvgxY9IKk5W36YH iRVv9dFaA17687D3yi8kc4tEdoyQuGOWr/1qEYn5cLu6JZMJ8E/5hiI524MBOo7U86gVbD SavqQYnMqg8RZVTKVllsRkTI1OZAdYC6OPiOsmEJjruEyp4MUkVsiIlU5georn+7oM+Plm c7tSa26qTXS1+7H/Db9FoDkaGBUv+U2buKeThlsUpezk3eOrFRusQeLGues+cA== In-Reply-To: <07cacfef-08ed-0a40-2013-d25a5a0575b0@xs4all.nl> 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:106544 Archived-At: --===============3294726028315824226== Content-Type: multipart/alternative; boundary="Apple-Mail=_A67C6849-2D8B-4DA5-8823-1349F3D16F9E" --Apple-Mail=_A67C6849-2D8B-4DA5-8823-1349F3D16F9E Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 This worked when I was just doing METAPOST. Now, I am using my lua code = to produce the METAPOST code that produces the pictures. And the picture = itself is put in a file for METAPOST as follows: File test4-mplib-run-001.mp: % begin graphic: n=3D0 ; beginfig(1) ; defaultfont:=3D"name:dejavuserif*default"; = CurrentLayout:=3D"article"; def OverlayLineColor=3Dblack enddef; def = OverlayColor =3Dblack enddef; ;picture pic; x:=3D80.000; y:=3D200.000; = w:=3D133.000; h:=3D53.000;pic :=3D ApplicationComponentLogo( w, h, = typeString) shifted (x, -y); draw pic;picture pic; x:=3D273.000; = y:=3D253.000; w:=3D133.000; h:=3D53.000;pic :=3D Function( w, h, = typeString) shifted (x, -y); draw pic;picture pic; x:=3D380.000; = y:=3D133.000; w:=3D133.000; h:=3D53.000;pic :=3D Service( w, h, = typeString) shifted (x, -y); draw pic;path p; p :=3D = (200.000,-227.000)--(333.000,-227.000)--(333.000,-273.000); draw p;path = p; p :=3D (393.000,-253.000)--(393.000,-180.000); draw p;;; endfig ; % end graphic This apparently is tried to get run through METAPOST separately and that = clearly doesn=E2=80=99t work, because ApplicationComponentLogo isn=E2=80=99= t defined. This is the result of the following setup: \starttext \startMPdefinitions (or inclusions, no difference) % ApplicationComponentLogo is defined here with a vardef \stopMPdefinitions \ctxlua{foo(=E2=80=9Cfilename=E2=80=9D)} % produces a series of % context.startMPpage { instance =3D = "doublefun=E2=80=9D } % several of: % context( METAPOST statements in = a string) % context.stopMPpage() \stoptext How do I get my MPdefinitions available in those METAPOST runs? G > On 13 Mar 2020, at 14:59, Hans Hagen wrote: >=20 > On 3/13/2020 2:33 PM, Aditya Mahajan wrote: >> On Fri, 13 Mar 2020, Taco Hoekwater wrote: >>> Hi, >>>=20 >>>=20 >>>=20 >>>> On 13 Mar 2020, at 12:53, Gerben Wierda = wrote: >>>>=20 >>>> Suppose I have this code: >>>>=20 >>>>=20 >>>> Can I reuse that varied across follow-up MPPages? >>>=20 >>> Sure, put the vardef inside \startMPinclusions: >> or \startMPdefinitions ... \stopMPdefinitions (don't remember what is = the difference between inclusions and definitions, now). > definitions: once > inclusions : every time >=20 > ----------------------------------------------------------------- > 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! >=20 > 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 > = __________________________________________________________________________= _________ --Apple-Mail=_A67C6849-2D8B-4DA5-8823-1349F3D16F9E Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 This = worked when I was just doing METAPOST. Now, I am using my lua code to = produce the METAPOST code that produces the pictures. And the picture = itself is put in a file for METAPOST as follows:

File test4-mplib-run-001.mp:

% begin graphic: n=3D0

; beginfig(1) ; = defaultfont:=3D"name:dejavuserif*default"; CurrentLayout:=3D"article"; = def OverlayLineColor=3Dblack enddef; def OverlayColor =3Dblack enddef; = ;picture pic; x:=3D80.000; y:=3D200.000; w:=3D133.000; h:=3D53.000;pic = :=3D ApplicationComponentLogo( w, h, typeString) shifted (x, -y); draw = pic;picture pic; x:=3D273.000; y:=3D253.000; w:=3D133.000; h:=3D53.000;pic= :=3D Function( w, h, typeString) shifted (x, -y); draw pic;picture pic; = x:=3D380.000; y:=3D133.000; w:=3D133.000; h:=3D53.000;pic :=3D Service( = w, h, typeString) shifted (x, -y); draw pic;path p; p :=3D = (200.000,-227.000)--(333.000,-227.000)--(333.000,-273.000); draw p;path = p; p :=3D (393.000,-253.000)--(393.000,-180.000); draw p;;; endfig = ;
% end graphic

This apparently is tried to get run through = METAPOST separately and that clearly doesn=E2=80=99t work, = because ApplicationComponentLogo isn=E2=80=99t defined. = This is the result of the following setup:

\starttext
\startMPdefinitions (or inclusions, no = difference)
% ApplicationComponentLogo is defined here with a = vardef
\stopMPdefinitions
\ctxlua{foo(=E2=80=9Cfilename= =E2=80=9D)} = % produces a series of
%   =  context.startMPpage { instance =3D "doublefun=E2=80=9D = }
= %    several of:
% context( = METAPOST statements in a string)
= %    context.stopMPpage()
\stoptext

How do I get my = MPdefinitions available in those METAPOST runs?

G

On 13 = Mar 2020, at 14:59, Hans Hagen <j.hagen@xs4all.nl> wrote:

On = 3/13/2020 2:33 PM, Aditya Mahajan wrote:
On Fri, 13 Mar 2020, Taco Hoekwater wrote:
Hi,



On 13 Mar 2020, at 12:53, Gerben Wierda <Gerben.Wierda@rna.nl> wrote:

Suppose I have this code:


Can I reuse that varied across follow-up MPPages?

Sure, put the vardef inside = \startMPinclusions:
or \startMPdefinitions = ... \stopMPdefinitions (don't remember what is the difference between = inclusions and definitions, now).
definitions: = once
inclusions : every time

---------------------------------------------------------------= --
=             &n= bsp;           &nbs= p;            =     Hans Hagen | PRAGMA ADE
=             &n= bsp;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
_______________________________________________________________= ____________________

= --Apple-Mail=_A67C6849-2D8B-4DA5-8823-1349F3D16F9E-- --===============3294726028315824226== 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== --===============3294726028315824226==--