From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/109405 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sylvain Hubert Newsgroups: gmane.comp.tex.context Subject: Re: embed metapost figure into document Date: Tue, 10 Nov 2020 01:23:52 +0100 Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0539682116317192841==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23741"; mail-complaints-to="usenet@ciao.gmane.io" To: "Jairo A. del Rio" , mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Nov 10 01:24:30 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 1kcHSY-00063h-MK for gctc-ntg-context-518@m.gmane-mx.org; Tue, 10 Nov 2020 01:24:30 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id BE23F1A9D3F; Tue, 10 Nov 2020 01:24:07 +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 lhcSO_2-01p6; Tue, 10 Nov 2020 01:24:06 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CEC3B1A9D93; Tue, 10 Nov 2020 01:24:06 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id BDB1D1A9D93 for ; Tue, 10 Nov 2020 01:24:05 +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 g9nvSLmHzBVU for ; Tue, 10 Nov 2020 01:24:04 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.166.53; helo=mail-io1-f53.google.com; envelope-from=champignoom@gmail.com; receiver= Original-Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 96FEC1A9D3F for ; Tue, 10 Nov 2020 01:24:04 +0100 (CET) Original-Received: by mail-io1-f53.google.com with SMTP id r9so11793687ioo.7 for ; Mon, 09 Nov 2020 16:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=YHv5TGWp09f3nzOwDAp59204zzHa9Er/qadZItE4UzY=; b=giyhSukYMGjco7BDGjX20yZxrKIUWOwFOONAcqrvG9l4yiPkjlW0Tsx8ZLGqH5tRdm 63cSa+DgWp2sR1jaAlRC9ui3mUMlhZiOED1avuS7Hlelp8jgWllSqyenJp99aXRWptPi J7bbK4141OsO6G+6WxSCCchR/wo//hyx6ZFN41jPR5qWlsNhNXCeeoAWcNqaUUaKGG0P 9q9lBo5PJFLjTb3x7X1ZIfqSWI/aP6c4Cx5zVaZSomzKIY3t1JMWyEjNvRpUskp32qnV tgTZ+9kNM/8b1qtwwvrZxDmDup1Zg0BuTC+lfIphcli143SZ+uT/Z8Q9Pymwcc0o8FDH 6Srg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=YHv5TGWp09f3nzOwDAp59204zzHa9Er/qadZItE4UzY=; b=XsNb1csJ2tIXdidzrw85q1CrtP2IhiELCy4GQO4xPb6yTVg85+qrLHskFEWp130NCe PKVDdAIskiqVpZeKAmKx+pB4bwbcJCvZQ8JR3arOCIe3hbcbxQbzxQpy8UR8HQOX7Nw8 KagDHi6DKNzQro8rQ5/wgnxVk6y30+r5W+uUG0Kz51kIGAw/KGxcin6U70oWfmhSFE4m 3GVvqIoSvPhB9oCOJQ5dWjrkQ/z1uT/TBokc8AB8sFTV2yaHUtnnvzFWMnCFUJzz0XHi 0WaDrCT3ytc5itfy8huA3NTbb6vB+z8nVDjcZl3+UqYcD4YVkSr4f7jrDmVxlXwrX4A+ t6Sg== X-Gm-Message-State: AOAM532fQW0pb513U65/1inVbMCSmJrcwMuoHIqjzDqMQKyOmsLm/WF0 2UZ8wvN47P+48ffLA6+6IL3kWlridYlP7KyNANA= X-Google-Smtp-Source: ABdhPJzjB9NE6tOisHSliHiOH5uFcJsex7cKwu+IM7yecgaKDwaCp0PwJfBV1wb9nm4+dCwy5BSqzQOPtX41YbtyPpo= X-Received: by 2002:a5d:9c02:: with SMTP id 2mr12099812ioe.28.1604967843145; Mon, 09 Nov 2020 16:24:03 -0800 (PST) In-Reply-To: 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:109405 Archived-At: --===============0539682116317192841== Content-Type: multipart/alternative; boundary="0000000000002aa8fe05b3b5b20d" --0000000000002aa8fe05b3b5b20d Content-Type: text/plain; charset="UTF-8" On Mon, 9 Nov 2020 at 23:40, Jairo A. del Rio wrote: > Hi, Sylvain. > > LuaMetaTeX and LuaTeX, the engines used by ConTeXt nowadays, use an > embedded library, so external compilations/files are not necessary. Just > out of curiosity, wouldn't it be easier to use a ConTeXt environment? E.g.: > > \starttext > \startMPcode %\startuseMPgraphic{} if you want to reuse your graphic > with \useMPgraphic{} > draw fullcircle scaled cm > %withcolor black % black is default > ; > \stopMPcode %\stopuseMPgraphic > \stoptext > > More info here: > https://wiki.contextgarden.net/MetaFun_-_MetaPost_in_ConTeXt > To actually answer your question, if you actually want to load a Metapost > graphic externally generated, you should have something like: > > %nice.mp > %"begin ... endfig", as well as "end" are important > beginfig (1); > draw fullcircle scaled cm > %withcolor black > ; > endfig; > end > > so when you compile it via > > mpost nice.mp > > (obviously supposing you have Metapost installed) you'll get a file called > nice.1 and > > \starttext > > \externalfigure[nice.1][width=4cm] > > \stoptext > > will work. However, as you can see, ConTeXt deals with such minutiae for > you and extends Metapost capabilities too, so the second alternative is not > the ConTeXt way to go. > > I hope it helps. > > Jairo :) > Hi Jairo, Thank you very much for the suggestion and the thorough explanation. I extracted the metapost code to a new file because I felt it would be a bit lengthy and noisy to stay with the text content. But you're right, an extra compilation step is not any better. I should probably use \component figure.tex, in place of \externalfigure[figure.1] Sylvain --0000000000002aa8fe05b3b5b20d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, 9 Nov 2020 at 23:40, Jairo A. del Rio <jairoadelrio6@gmail.com> wrote:
=
Hi, Sylvain.

LuaMetaTeX and LuaTeX, the engines= used by ConTeXt nowadays, use an embedded library, so external compilation= s/files are not necessary. Just out of curiosity, wouldn't it be easier= to use a ConTeXt environment? E.g.:

\starttext
\star= tMPcode %\startuseMPgraphic{<name>} if you want to reuse your graphic= with \useMPgraphic{<name>}
=C2=A0=C2=A0=C2=A0 draw fullcircl= e scaled cm
=C2=A0=C2=A0=C2=A0 %withcolor black % black is defaul= t
=C2=A0=C2=A0=C2=A0 ;
\stopMPcode %\stopuseMPgraphic
\stoptext

More info here: http= s://wiki.contextgarden.net/MetaFun_-_MetaPost_in_ConTeXt
To actuall= y answer your question, if you actually want to load a Metapost graphic ext= ernally generated, you should have something like:

%"be= gin ... endfig", as well as "end" are important
beginfig (1);
draw fullcircle scaled cm
%withcolor black
;
e= ndfig;
end

so when you compile it via

mpost nice.mp

(obviously supposing you have Metapost installed) you'll get a= file called nice.1 and

\starttext

\externalfigur= e[nice.1][width=3D4cm]

\stoptext

<= /div>

will work. However, as you can see, ConTeXt deals = with such minutiae for you and extends Metapost capabilities too, so the se= cond alternative is not the ConTeXt way to go.

I hope it= helps.

Jairo :)

Hi Jairo,

Tha= nk you very much for the suggestion and the thorough explanation.

I extracted the metapost code to a new file because I felt = it would be a bit lengthy and noisy to stay with the text content.

But you're right, an extra compilation step is not any= better. I should probably use \component figure.tex, in place of \external= figure[figure.1]

Sylvain
--0000000000002aa8fe05b3b5b20d-- --===============0539682116317192841== 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== --===============0539682116317192841==--