From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/97581 Path: news.gmane.org!.POSTED!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: How to use tex.print in ctxlua Date: Sun, 19 Mar 2017 17:56:41 +0100 Message-ID: <58CEB849.1020003@gmail.com> References: <0979F9B7-E5B4-400D-A93D-273892C9DCE2@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2192929443162952521==" X-Trace: blaine.gmane.org 1489942658 9878 195.159.176.226 (19 Mar 2017 16:57:38 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 19 Mar 2017 16:57:38 +0000 (UTC) User-Agent: Postbox 5.0.11 (Macintosh/20170302) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Mar 19 17:57:34 2017 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpe90-0001R7-Di for gctc-ntg-context-518@m.gmane.org; Sun, 19 Mar 2017 17:57:26 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 663F584302; Sun, 19 Mar 2017 17:56:58 +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 E_Hu63H5iMqt; Sun, 19 Mar 2017 17:56:57 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id BA1EE842EE; Sun, 19 Mar 2017 17:56:57 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E8082842EB for ; Sun, 19 Mar 2017 17:56:55 +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 E-INDxnmxzTK for ; Sun, 19 Mar 2017 17:56:54 +0100 (CET) Original-Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id D7D40842E4 for ; Sun, 19 Mar 2017 17:56:44 +0100 (CET) Original-Received: by mail-wm0-f43.google.com with SMTP id 196so15048934wmm.1 for ; Sun, 19 Mar 2017 09:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=ZbNBovF/QkLsaAlM1kj/L8QmhjSpbUGZBVHlDzN0ri8=; b=g1WqgjFGMTQoAz8bLuB+HoOas0vNH/rtqRymfo/QyigTTV3jKcVSzLVN2EtO6+BQUj R0O7UdMfKt82ur1SeJTlWNFR2J3heKkuSxL+3APFBIt4ENpLprvjjW2QCMB6zwlf7IRD kwRjsRhkC3cyuEsijSCJ9c3juhvqiblDETuAso0QWtVDQ/MdoUUT0O69If/+eTxxxUfM CoYCIGvc6c+BqrYWrX9gKzFh2uAOc5HKydGDrxnOOlcgQD8hi7WW5eQUSvaFDEDc5S+x av8et2n2liy8JOdlrACvUQaV0byE21b94NDCdBI9JvPumRtyP1Y6TSAV+J9p7FXXTqHK 8XSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=ZbNBovF/QkLsaAlM1kj/L8QmhjSpbUGZBVHlDzN0ri8=; b=QYRJPnbBDB6R3QizgwID2XRriVJTVyt2CPThS+h9+fvaLr+rEOwGiRuSwLjoschfGZ VK1k+YpvqrI3SSafMNvhqOZgS0UuHtXF672Mz416LfRjju2rRUhjeMUTDsX2fLVZF4IE 9QU32U/AwtuWxrk54oVGlDPwMoJAklecXPwaTcDJWf/pb4OHYxoL8Gtmu4Xg2xTJT2ys pfAXegzzoP3diKnZHUh/GgvLv9GSb/JQYrVH3e4HvLUNftaYhON9e0XumKJgvm2cLez6 f7GlJts7+FkXrraFwoeLOVjkp8vlVmo3lFNOFDbR/uA8cliRS0rEf1wh0nNhggaQzWrE wAcQ== X-Gm-Message-State: AFeK/H1Eobh0naa9xSo16HSlxIqmXO8YIlAsko5k3ij01dHrcaMbAH9cuK0ROTA/YNsrRA== X-Received: by 10.28.229.78 with SMTP id c75mr7225766wmh.20.1489942604303; Sun, 19 Mar 2017 09:56:44 -0700 (PDT) Original-Received: from keima.localdomain (x2f26b8b.dyn.telefonica.de. [2.242.107.139]) by smtp.gmail.com with ESMTPSA id 60sm17628384wrg.60.2017.03.19.09.56.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Mar 2017 09:56:43 -0700 (PDT) In-Reply-To: <0979F9B7-E5B4-400D-A93D-273892C9DCE2@gmail.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 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.org gmane.comp.tex.context:97581 Archived-At: This is a multi-part message in MIME format. --===============2192929443162952521== Content-Type: multipart/alternative; boundary="------------000703050909050801040406" This is a multi-part message in MIME format. --------------000703050909050801040406 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit > Otared Kavian > 19. März 2017 um 17:46via Postbox > > Hi Aditya, > > Thanks, as Thomas, Pablo and you mentioned the right way is to use > context() instead of tex.print() > Actually I just saw that one can also concatenate with context() as in: > > context("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par") > > which is equivalent to > tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par") You can use the string.formatters function for this. \starttext \startluacode local string_a = "12" local string_b = "23" context(string.formatters["(%s,%s)"](string_a,string_b)) \stopluacode \stoptext Wolfgang --------------000703050909050801040406 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
19. März 2017 um 17:46 via Postbox
Hi Aditya,

Thanks, as Thomas, Pablo and you mentioned the right way is to use context() instead of tex.print()
Actually I just saw that one can also concatenate with context() as in:

context("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")

which is equivalent to
tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")
You can use the string.formatters function for this.

\starttext

\startluacode

local string_a = "12"
local string_b = "23"

context(string.formatters["(%s,%s)"](string_a,string_b))

\stopluacode

\stoptext

Wolfgang
--------------000703050909050801040406-- --===============2192929443162952521== 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 X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============2192929443162952521==--