From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/60589 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Expansion of TeX macros inside the Lua function Date: Sun, 01 Aug 2010 17:08:24 +0200 Message-ID: <4C558DE8.7070600@wxs.nl> References: <4C554252.7000903@gyza.cz> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1280675313 17035 80.91.229.12 (1 Aug 2010 15:08:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 1 Aug 2010 15:08:33 +0000 (UTC) To: hajtmar@gyza.cz, mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun Aug 01 17:08:32 2010 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 1Ofa9Q-0004pV-31 for gctc-ntg-context-518@m.gmane.org; Sun, 01 Aug 2010 17:08:32 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 1B68AC9E23; Sun, 1 Aug 2010 17:08:31 +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 oe1qR8HIAiMC; Sun, 1 Aug 2010 17:08:26 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BAD34C9DB7; Sun, 1 Aug 2010 17:08:26 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 002A3C9DB7 for ; Sun, 1 Aug 2010 17:08:25 +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 QVB0aeVmZvGa for ; Sun, 1 Aug 2010 17:08:22 +0200 (CEST) Original-Received: from smtp.ziggozakelijk.nl (sc-162.r-213-125-29.schoolconnect.nu [213.125.29.162]) by balder.ntg.nl (Postfix) with ESMTP id BFF57C9CED for ; Sun, 1 Aug 2010 17:08:22 +0200 (CEST) X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.100; Original-Received: from [10.100.1.100] (unverified [10.100.1.100]) by pragma-net.nl (SurgeMail 4.3g4) with ESMTP id 3931-1713362 for multiple; Sun, 01 Aug 2010 17:07:13 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.11) Gecko/20100711 Lightning/1.0b1 Thunderbird/3.0.6 ThunderBrowse/3.3.1 In-Reply-To: <4C554252.7000903@gyza.cz> X-Authenticated-User: hagen@controller-9 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:60589 Archived-At: On 1-8-2010 11:45, Jaroslav Hajtmar wrote: > \ctxlua{pars('\printaction')} > > \blank[big] > > Example 3) > > The third example of my most interesting. Function parameter in example is > a TeX macro \backslash printaction which not expanded, respectively > expanded > only when I printing it to TeX. Parameter of function is still string > "\backslash printaction" in which it is futile to look for a comma > separator. > Comma not be found, although the content of macro face that is so. Is > there a > possibility for this case, as in some way to save to Lua variable > content of > macro (of course expanded)? > > \ctxlua{pars('\\printaction')} currently the tex parsing and expansion code is not available in luatex (future versions might provide some introspection or expansion code, but it's a hairy topic) Anyhow, given that \printaction is defined you can use the token library to see what's in there (you then can sort of reconstruct the content). Another approach is a two-step: function step_1(str) -- str = \whatever tex.print("\ctxlua{step_2('",str,"')}") end It all depends on what you want to do. Why do you want to look into \whatever? Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________