From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/69918 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Optimal way to defining of macros in Luacode in ConTeXt Date: Tue, 12 Jul 2011 17:50:16 +0200 Message-ID: <787FA49A-87C4-4207-910D-E2A0F58EEE69@googlemail.com> References: <4E1C6883.30300@gyza.cz> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1310485840 23189 80.91.229.12 (12 Jul 2011 15:50:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 12 Jul 2011 15:50:40 +0000 (UTC) To: hajtmar@gyza.cz, mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Jul 12 17:50:35 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QgfEJ-0000vp-In for gctc-ntg-context-518@m.gmane.org; Tue, 12 Jul 2011 17:50:35 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 59B31CAE3A; Tue, 12 Jul 2011 17:50:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id pvxSAQdm9GXu; Tue, 12 Jul 2011 17:50:29 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 89C41CADEE; Tue, 12 Jul 2011 17:50:29 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 0FCF3CADEE for ; Tue, 12 Jul 2011 17:50:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id FiLyozfCcKxd for ; Tue, 12 Jul 2011 17:50:24 +0200 (CEST) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 1F144CADE7 for ; Tue, 12 Jul 2011 17:50:24 +0200 (CEST) Original-Received: from mail-fx0-f42.google.com (mail-fx0-f42.google.com [209.85.161.42]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p6CFoNpC012227 for ; Tue, 12 Jul 2011 17:50:23 +0200 Original-Received: by fxe23 with SMTP id 23so4904338fxe.15 for ; Tue, 12 Jul 2011 08:50:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=8Z0Xmj2zSRmytYwFM3iFptnL5PgF4nY2j+Ji39F5K5s=; b=u8jbnbgc/gjzAIFwfVelld4+B8tmg4DDGTaCloJ7QcgWsYVkBFTw9QCH//ImEXq8vV iiVKpX1u+eVzz9JD8Bo7/N2mXlsNCoDyU8u2VJiIuHwUXA6zUz3qrkIHYxhL78NcHrs1 S6w6M07SgnFFLjYYb9x/62nbP4sf9/QykyEnM= Original-Received: by 10.223.145.144 with SMTP id d16mr92830fav.100.1310485823070; Tue, 12 Jul 2011 08:50:23 -0700 (PDT) Original-Received: from [192.168.2.31] (p5B0EEA91.dip.t-dialin.net [91.14.234.145]) by mx.google.com with ESMTPS id q16sm425370fag.14.2011.07.12.08.50.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 12 Jul 2011 08:50:22 -0700 (PDT) In-Reply-To: <4E1C6883.30300@gyza.cz> X-Mailer: Apple Mail (2.1084) X-Bayes-Prob: 0.0005 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.161.42; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0rF73On7o - 8107cefbdf2b - 20110712 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:69918 Archived-At: Am 12.07.2011 um 17:30 schrieb Jaroslav Hajtmar: > Hello ConTeXist. > = > How best (optimally) in Lua code in ConTeXt define own ConTeXt macros? > = > I was used recently LuaTeX syntax (for example) : > tex.sprint(tex.ctxcatcodes,'\\def\\mymacro\{arg of mymacro\}') > = > But someone advised me that I use the better syntax: > context('\\def\\Mymacro\{arg of mymacro\}') > or context("\\def\\test#1{#1}") etc... > = > Exist other (best or most optimal) way to do? You can use =93context.setvalue=94. To convert numbers in different formats you can use the \convertnumber command. \starttext \startluacode context.setvalue("One","1") context.setvalue("Two","2") \stopluacode \define\Three{3} \One:\Two:\Three \blank \startluacode context.define({2},"\\CMDA","[One:#1,Two:#2]") \stopluacode \define[2]\CMDB{[One:#1,Two:#2]} \CMDA{1}{2} \CMDB{1}{2} \blank \convertnumber{R}{1400} \stoptext Wolfgang ___________________________________________________________________________= ________ If your question is of interest to others as well, please add an entry to t= he Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-cont= ext webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________= ________