From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/106664 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Gerben Wierda Newsgroups: gmane.comp.tex.context Subject: What alternative for scantokens( "btex " & texcommands & " etex")? Date: Sun, 29 Mar 2020 15:06:06 +0200 Message-ID: <722EEA11-6B20-4EB9-ABD0-1E98E7369677@rna.nl> 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="===============2813495261457920493==" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="71108"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Mar 29 15:06:25 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 1jIXdw-000IQg-QD for gctc-ntg-context-518@m.gmane-mx.org; Sun, 29 Mar 2020 15:06:24 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 1E7F0182E50; Sun, 29 Mar 2020 15:06:11 +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 sj9zZ7Mrv0Sj; Sun, 29 Mar 2020 15:06:10 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 36A01182E56; Sun, 29 Mar 2020 15:06:10 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 9F2C0182E50 for ; Sun, 29 Mar 2020 15:06:08 +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 HltSBDi_bPI9 for ; Sun, 29 Mar 2020 15:06:08 +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 F2DBA182E4F for ; Sun, 29 Mar 2020 15:06:07 +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 6B0A9366267A for ; Sun, 29 Mar 2020 15:06:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rna.nl; s=dkim_rsa2048; t=1585487167; 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=1Bx7j6UR8VNSWEeZYVJ7uan+mck26DTBmzX9zRBSfkU=; b=NFEJPCk2+B4QLzJ54/2YFonS9jiPHYvv0lyGAMEKio6rzTQdOnwIWsBjR92k4sLnECFCfS fM/AjAmqmOvLn3wbauZFTGn92ZJy3cQFlrS6XmP1h8RFD9r01bsQjV1hiNfRw65ddgccCB LQud1bDsIf22oAnf/F9059LE1iAUvv/sS/8tHmuHyR8QlM+ywV9pH9xFRV+zX8zVvsfsYi tdFDRqrwLVBecMUzmQ0aGBUrowUtSncydxc5nQe+x+7f8iXpf7fSA3no6F2sHv8ZCEKBvJ b9S+ak+wupLH5tgLy9DSCPrM6Ht3+FxiU1e6MUafAiz7FiPC12lmAzVnho0YgQ== 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:106664 Archived-At: --===============2813495261457920493== Content-Type: multipart/alternative; boundary="Apple-Mail=_8EF5D93D-1A15-4A9E-B93E-106CAE17CB36" --Apple-Mail=_8EF5D93D-1A15-4A9E-B93E-106CAE17CB36 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I=E2=80=99m trying in METAPOST to build a command to pass on to ConTeXt = using btex/etex. picture p; p :=3D scantokens( "btex " & texcommands & " etex=E2=80=9D); with texcommands a variable that holds a string of TeX commands = doesn=E2=80=99t work. The METAPOST parser complains about not finding = etex. I=E2=80=99m using MetaFun actually. An example string in texcommands would in the end be something like string texcommands; texcommands :=3D "\type-{Hello}, [World]!-"; Minimum example of my vardef that fails (the outcommented alternative to = the scantokens line works and typesets =E2=80=9C{Hello}, [World]!=E2=80=9D= ): vardef makeTeXLabel( expr w, h, name) =3D show "NAME:", name; save p; picture p ; save s; string s; s :=3D "btex " & name & " etex"; show "SCAN:", s; p :=3D scantokens s; %p :=3D btex p :=3D btex \type-{Hello}, [World]!- etex; p enddef; Log: metapost log > >> "NAME:" metapost log > >> "My Application (Component)" metapost log > >> "SCAN:" metapost log > >> "btex My Application (Component) etex" metapost log > ! No matching 'etex' for 'btex'.. metapost log > =20 metapost log > ; metapost log > makeTeXLabel->...x";show"SCAN:",s;p:=3Dscantokens.s; metapost log > = save.b;path.b;b:=3Dboundingb... metapost log > ...(53),("My Application (Component)")) Thanks in advance, G= --Apple-Mail=_8EF5D93D-1A15-4A9E-B93E-106CAE17CB36 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 I=E2=80= =99m trying in METAPOST to build a command to pass on to ConTeXt using = btex/etex.

picture p; p :=3D scantokens( "btex " & texcommands = & " etex=E2=80=9D);

with texcommands a variable that holds a string of = TeX commands doesn=E2=80=99t work. The METAPOST parser complains about = not finding etex.

I=E2=80=99m using MetaFun actually.

An example string in texcommands would = in the end be something like

string = texcommands;
texcommands :=3D "\type-{Hello}, [World]!-";

Minimum = example of my vardef that fails (the outcommented alternative to the = scantokens line works and typesets =E2=80=9C{Hello}, = [World]!=E2=80=9D):

vardef makeTeXLabel( expr w, h, name) = =3D
  show = "NAME:", name;
  save p; = picture p ;
  save s; = string s;
  s :=3D = "btex " & name & " etex";
  show "SCAN:", s;
  p :=3D scantokens s;
  %p :=3D btex   p :=3D btex = \type-{Hello}, [World]!- etex;
  = p
enddef;

Log:

metapost log    > >> = "NAME:"
metapost log    > >> "My Application = (Component)"
metapost log    > >> = "SCAN:"
metapost log    > >> "btex My Application = (Component) etex"
metapost log    > ! No matching 'etex' for = 'btex'..
metapost log    > <to be read = again> 
metapost log    >        =             ;
metapost = log    > = makeTeXLabel->...x";show"SCAN:",s;p:=3Dscantokens.s;
metapost = log    >               =                     =                 = save.b;path.b;b:=3Dboundingb...
metapost log    > = <argument> ...(53),("My Application = (Component)"))

Thanks = in advance,

G
= --Apple-Mail=_8EF5D93D-1A15-4A9E-B93E-106CAE17CB36-- --===============2813495261457920493== 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== --===============2813495261457920493==--