ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jaroslav Hajtmar <hajtmar@gyza.cz>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: OT: Problem with writing macros into variables in LuaTeX
Date: Sun, 18 Mar 2012 14:15:18 +0100	[thread overview]
Message-ID: <4F65DFE6.50002@gyza.cz> (raw)
In-Reply-To: <821C6165-2D05-4848-A66C-B00B1862F422@googlemail.com>

Thanks Wolfgang,
these are very valuable tips for me for the future. I put them to 
special document for later use. Thanks again for the valuable advice.
Jaroslav Hajtmar



Dne 18.3.2012 14:00, Wolfgang Schuster napsal(a):
> Am 18.03.2012 um 13:48 schrieb Jaroslav Hajtmar:
>
>    
>> >  Thanx Wolfgang.
>> >  
>> >  Thanks for the tip. I do too, but I did not know how to get into Lua code that the macro.
>>      
> The one thing you have to know, when you pass a macro from TeX to Lua it is expanded.
>
> \def\foo{FOO}
>
> \directlua{myfuntion("\foo")}
>
> In this example the Lua function gets “FOO” as input and not “\foo” because the argument of \directlua is expanded, to prevent you need a function which prevents expansion.
>
> \directlua{myfunction("\string\foo")}
>
> Works only for the command after \string.
>
> \directlua{myfunction("\detokenize{\foo}")
>
> Converts \foo into tokens and Lua sees now \foo.
>
> \directlua{myfunction("\unexpanded{\foo}")
>
> Prevents the argument to be expanded and Lua gets \foo (there are differences compared with \detokenize but I forgot them)
>
> Wolfgang
>    

___________________________________________________________________________________
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
___________________________________________________________________________________


      parent reply	other threads:[~2012-03-18 13:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-18 10:25 Jaroslav Hajtmar
2012-03-18 10:38 ` Hans Hagen
2012-03-18 10:53 ` Wolfgang Schuster
     [not found]   ` <4F65C7F4.1090604@gyza.cz>
2012-03-18 12:40     ` Jaroslav Hajtmar
2012-03-18 13:14       ` luigi scarso
2012-03-18 13:17         ` Jaroslav Hajtmar
     [not found]     ` <06EE6FAB-E51B-4996-9655-450CF0B05839@googlemail.com>
     [not found]       ` <4F65D98F.8020504@gyza.cz>
     [not found]         ` <821C6165-2D05-4848-A66C-B00B1862F422@googlemail.com>
2012-03-18 13:15           ` Jaroslav Hajtmar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F65DFE6.50002@gyza.cz \
    --to=hajtmar@gyza.cz \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).