* OT: Problem with writing macros into variables in LuaTeX @ 2012-03-18 10:25 Jaroslav Hajtmar 2012-03-18 10:38 ` Hans Hagen 2012-03-18 10:53 ` Wolfgang Schuster 0 siblings, 2 replies; 7+ messages in thread From: Jaroslav Hajtmar @ 2012-03-18 10:25 UTC (permalink / raw) To: mailing list for ConTeXt users 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')}} \def\globvar{\directlua{getglobvar()}} % OK Text -- \puttoglobvar{Text} \globvar % OK $\alpha$ -- \puttoglobvar{$alpha$} \globvar % not working $\alpha$ -- \puttoglobvar{$\alpha$} \globvar % Error ... %\puttoglobvar{$\\alpha$} %\globvar \bye Can you please advise? Thanx Jaroslav Hajtmar ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OT: Problem with writing macros into variables in LuaTeX 2012-03-18 10:25 OT: Problem with writing macros into variables in LuaTeX Jaroslav Hajtmar @ 2012-03-18 10:38 ` Hans Hagen 2012-03-18 10:53 ` Wolfgang Schuster 1 sibling, 0 replies; 7+ messages in thread From: Hans Hagen @ 2012-03-18 10:38 UTC (permalink / raw) To: hajtmar, mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OT: Problem with writing macros into variables in LuaTeX 2012-03-18 10:25 OT: Problem with writing macros into variables in LuaTeX Jaroslav Hajtmar 2012-03-18 10:38 ` Hans Hagen @ 2012-03-18 10:53 ` Wolfgang Schuster [not found] ` <4F65C7F4.1090604@gyza.cz> 1 sibling, 1 reply; 7+ messages in thread From: Wolfgang Schuster @ 2012-03-18 10:53 UTC (permalink / raw) To: hajtmar, mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <4F65C7F4.1090604@gyza.cz>]
* Re: OT: Problem with writing macros into variables in LuaTeX [not found] ` <4F65C7F4.1090604@gyza.cz> @ 2012-03-18 12:40 ` Jaroslav Hajtmar 2012-03-18 13:14 ` luigi scarso [not found] ` <06EE6FAB-E51B-4996-9655-450CF0B05839@googlemail.com> 1 sibling, 1 reply; 7+ messages in thread From: Jaroslav Hajtmar @ 2012-03-18 12:40 UTC (permalink / raw) To: mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OT: Problem with writing macros into variables in LuaTeX 2012-03-18 12:40 ` Jaroslav Hajtmar @ 2012-03-18 13:14 ` luigi scarso 2012-03-18 13:17 ` Jaroslav Hajtmar 0 siblings, 1 reply; 7+ messages in thread From: luigi scarso @ 2012-03-18 13:14 UTC (permalink / raw) To: mailing list for ConTeXt users On Sun, Mar 18, 2012 at 1:40 PM, Jaroslav Hajtmar <hajtmar@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=\Umathchar"7"00"0003B1 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: OT: Problem with writing macros into variables in LuaTeX 2012-03-18 13:14 ` luigi scarso @ 2012-03-18 13:17 ` Jaroslav Hajtmar 0 siblings, 0 replies; 7+ messages in thread From: Jaroslav Hajtmar @ 2012-03-18 13:17 UTC (permalink / raw) To: mailing list for ConTeXt users 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 Hajtmar<hajtmar@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=\Umathchar"7"00"0003B1 > 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <06EE6FAB-E51B-4996-9655-450CF0B05839@googlemail.com>]
[parent not found: <4F65D98F.8020504@gyza.cz>]
[parent not found: <821C6165-2D05-4848-A66C-B00B1862F422@googlemail.com>]
* Re: OT: Problem with writing macros into variables in LuaTeX [not found] ` <821C6165-2D05-4848-A66C-B00B1862F422@googlemail.com> @ 2012-03-18 13:15 ` Jaroslav Hajtmar 0 siblings, 0 replies; 7+ messages in thread From: Jaroslav Hajtmar @ 2012-03-18 13:15 UTC (permalink / raw) To: mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-03-18 13:17 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-03-18 10:25 OT: Problem with writing macros into variables in LuaTeX 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 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).