OT: Problem with writing macros into variables in LuaTeX
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
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 -----------------------------------------------------------------
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
participants (3)
-
Hans Hagen
-
Jaroslav Hajtmar
-
Wolfgang Schuster