Re: [NTG-context] OT: Problem with writing macros into variables in LuaTeX
On 18-3-2012 11:25, Jaroslav Hajtmar wrote: Hello Gurus. Sorry for OT, but I solve one problem in parallel in ConTeXt and pure LuaTeX too and I got into trouble. I have a problem in LuaTEX with putting macro name into global variables and their re-listing. In ConTeXt, the problem is not with it. do \show\alpha in both variants and see what the difference in definiton is ... it might matter 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 ___
Re: [NTG-context] OT: Problem with writing macros into variables in LuaTeX
Am 18.03.2012 um 11:25 schrieb Jaroslav Hajtmar: Hello Gurus. Sorry for OT, but I solve one problem in parallel in ConTeXt and pure LuaTeX too and I got into trouble. I have a problem in LuaTEX with putting macro name into global variables and their re-listing. In ConTeXt, the problem is not with it. Here is my minimal LuaTeX example: \directlua{function put2globvar(parameter) globvar=parameter end} \directlua{function getglobvar() tex.print(globvar) end} \def\puttoglobvar#1{\directlua{put2globvar('#1')}} Untested: \def\puttglobvar#1{\directlua{put2globvar([==[\detokenize{#1}]==])} You can also try to replace \detokenize with \unexpanded (in ConTeXt \normalunexpanded). 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 ___
Re: [NTG-context] OT: Problem with writing macros into variables in LuaTeX
Thanx Wolfgang. Great - now it works. Hans' advice with \show command I'm not able to understand and implement it. One more thanx Jaroslav Hajtmar Dne 18.3.2012 12:33, Jaroslav Hajtmar napsal(a): Thanx Wolfgang. Great - now it works. Hans' advice with \show command I'm not able to understand and implement it. One more thanx Jaroslav Hajtmar Dne 18.3.2012 11:53, Wolfgang Schuster napsal(a): Am 18.03.2012 um 11:25 schrieb Jaroslav Hajtmar: Hello Gurus. Sorry for OT, but I solve one problem in parallel in ConTeXt and pure LuaTeX too and I got into trouble. I have a problem in LuaTEX with putting macro name into global variables and their re-listing. In ConTeXt, the problem is not with it. Here is my minimal LuaTeX example: \directlua{function put2globvar(parameter) globvar=parameter end} \directlua{function getglobvar() tex.print(globvar) end} \def\puttoglobvar#1{\directlua{put2globvar('#1')}} Untested: \def\puttglobvar#1{\directlua{put2globvar([==[\detokenize{#1}]==])} You can also try to replace \detokenize with \unexpanded (in ConTeXt \normalunexpanded). 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 ___
Re: [NTG-context] OT: Problem with writing macros into variables in LuaTeX
On Sun, Mar 18, 2012 at 1:40 PM, Jaroslav Hajtmar hajt...@gyza.cz wrote: Thanx Wolfgang. Great - now it works. Hans' advice with \show command I'm not able to understand and implement it. context \\starttext\\show\\\alpha\\stoptext shows \alpha=\Umathchar703B1 The same command in luatex maybe shows a different thing . -- luigi ___ 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 ___
Re: [NTG-context] OT: Problem with writing macros into variables in LuaTeX
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 ___
Re: [NTG-context] OT: Problem with writing macros into variables in LuaTeX
Thanks Luigi for the explanation - I understand now... Jaroslav Hajtmar Dne 18.3.2012 14:14, luigi scarso napsal(a): On Sun, Mar 18, 2012 at 1:40 PM, Jaroslav Hajtmarhajt...@gyza.cz wrote: Thanx Wolfgang. Great - now it works. Hans' advice with \show command I'm not able to understand and implement it. context \\starttext\\show\\\alpha\\stoptext shows \alpha=\Umathchar703B1 The same command in luatex maybe shows a different thing . ___ 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 ___