From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/106710 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: Re: Puzzle (for me) Date: Wed, 1 Apr 2020 16:25:33 +0200 Message-ID: References: <70E2F74B-F0F9-4A78-8EB0-006DE7467A9A@rna.nl> <20200331235356.lxyidvwd2hgactl6@worklaptop> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: multipart/mixed; boundary="===============2708790207921728620==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="100118"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Wed Apr 01 16:26:15 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 1jJeJq-000PvS-FV for gctc-ntg-context-518@m.gmane-mx.org; Wed, 01 Apr 2020 16:26:14 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 3D5ED182F5E; Wed, 1 Apr 2020 16:25:40 +0200 (CEST) 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 YIJ4i404wi6a; Wed, 1 Apr 2020 16:25:38 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 1598D182F63; Wed, 1 Apr 2020 16:25:38 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 7C36C182F64 for ; Wed, 1 Apr 2020 16:25:36 +0200 (CEST) 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 5A9VjjTcO_aQ for ; Wed, 1 Apr 2020 16:25:35 +0200 (CEST) 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 6CDC3182F5B for ; Wed, 1 Apr 2020 16:25:35 +0200 (CEST) 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 F210A36862EA for ; Wed, 1 Apr 2020 16:25:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1585751133; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=r/B5SM5EBTQtAvIrlds/ZMtonBlsN2Pu9+ospp++Dq4=; b=fzcXE57p94aDwjKweFbvfFOMngE6bN/TkbmV2VxRmEaISlit4Ggugua0Cvn+7v5r4q7uIq sI/1dehk6q6KJWiED1S2rQKlCqdnYu02YReVUDKO1nCcNWsVR9BxyIxxMPUlgUW7IQ4nm3 4U3vIV0cS6fD6il59fDMVWiJGM+xDKbVkwsh54pFnfB0dEjj828QJijpKgWPkMOvi6bY5G HqtOkXd6m4cc3eeAxuSxNygQaiLUDUPL5IACBn3BoUXB3YcOPxEUe4QGL5x3q7CGNvKcSv gbjQJKfZKcw9WlA7wuIBzeCS8/XS1E3Z7Ej9Auy5mhic6tgl2q/mzajZBe6HgQ== In-Reply-To: <20200331235356.lxyidvwd2hgactl6@worklaptop> X-Mailer: Apple Mail (2.3445.104.14) 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:106710 Archived-At: --===============2708790207921728620== Content-Type: multipart/alternative; boundary="Apple-Mail=_E39BBA7E-B93A-49DD-BF39-9AA592F99EEC" --Apple-Mail=_E39BBA7E-B93A-49DD-BF39-9AA592F99EEC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 1 Apr 2020, at 01:53, Henri Menke wrote: >=20 > On 01/04/20, 01:20, Gerben Wierda wrote: >> I have a string with double quotes that needs to become a text in a = box in METAPOST. METAPOST is used to create an image consisting of boxes = and connections. >>=20 >> Basically, the approach is now something like this: >>=20 >> TeX: calls Lua code with \ctxlua{filename} >> Lua: context.startMPpage >> Lua: read XML. String in XML in filename read by Lua >> Here we know the dimensions in which the string must be typeset and = wrapped around because that is also in the XML >> Lua: A context() call contains METAPOST code that calls a METAPOST = vardef (=E2=80=98draw box=E2=80=99) with the string as argument >> METAPOST: Draws box and call TeX to typeset string using textext(), = returns picture object >> TeX: Typeset string >>=20 >> In short: >> TeX, calls >> Lua, reads XML and executes context( MP code) that gets executed = on stopMPpage >> MP code calls TeX which typesets the string >>=20 >> But, if the string contains double quotes (=E2=80=9D) this will fail = in METAPOST because the double quotes in the string will be printed in = METAPOST code that is created by Lua and thus mess up METAPOST. >>=20 >> So, what can I do? >=20 > To get a double quote in a MetaPost string like this >=20 > "embedded " double quote" > ^ > |___ oeps >=20 > use the ditto variable which expands to a string containing the double > quote character like so >=20 > "embedded " & ditto & " double quote=E2=80=9D That is great! Thanks. G >=20 > Cheers, Henri >=20 >>=20 >> G >> = __________________________________________________________________________= _________ >> 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 >> = __________________________________________________________________________= _________ > = __________________________________________________________________________= _________ > 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=_E39BBA7E-B93A-49DD-BF39-9AA592F99EEC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 1 Apr 2020, at 01:53, Henri Menke <henrimenke@gmail.com> wrote:

On 01/04/20, 01:20, Gerben = Wierda wrote:
I = have a string with double quotes that needs to become a text in a box in = METAPOST. METAPOST is used to create an image consisting of boxes and = connections.

Basically, the approach is now = something like this:

TeX: calls Lua code = with \ctxlua{filename}
Lua: context.startMPpage
Lua: read XML. String in XML in filename read by Lua
 Here we know the dimensions in which the string must be = typeset and wrapped around because that is also in the XML
Lua: A context() call contains METAPOST code that calls a = METAPOST vardef (=E2=80=98draw box=E2=80=99) with the string as = argument
METAPOST: Draws box and call TeX to typeset = string using textext(), returns picture object
TeX: = Typeset string

In short:
TeX, = calls
Lua, reads XML and executes context( MP code) that gets = executed on stopMPpage
MP code calls TeX which typesets = the string

But, if the string contains = double quotes (=E2=80=9D) this will fail in METAPOST because the double = quotes in the string will be printed in METAPOST code that is created by = Lua and thus mess up METAPOST.

So, what can = I do?

To get a double quote in a MetaPost string like = this

   "embedded " double quote"
          &nb= sp;  ^
          &nb= sp;  |___ oeps

use the ditto variable which expands to a string containing = the double
quote = character like so

   "embedded " & ditto & " double = quote=E2=80=9D

That is great! Thanks.

G


Cheers, Henri


G
_______________________________________________________________= ____________________
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
_______________________________________________________________= ____________________
_______________________________________________________________= ____________________
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=_E39BBA7E-B93A-49DD-BF39-9AA592F99EEC-- --===============2708790207921728620== 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== --===============2708790207921728620==--