Some very simple cld - loading a module
Dear gang,
The following, simple MWE gives an undefined control sequence error:
=======
% \usemodule[translate]
% \enableinputtranslation
\startluacode
-- context.usemodule({translate})
context.usemodule{translate}
context.enableinputtranslation()
context.darkgreen()
\stopluacode
\startTEXpage[offset=1em]
\translateinput[Hermes][Idris]
Hermes
\disableinputtranslation
Hermes
\stopTEXpage
=======
tex error > tex error on line 14 in file ./test-luacode.tex: Undefined control sequence
Hamid,Idris schrieb am 18.08.2023 um 17:30:
Dear gang,
The following, simple MWE gives an undefined control sequence error:
======= % \usemodule[translate] % \enableinputtranslation \startluacode -- context.usemodule({translate}) context.usemodule{translate}
context.usemodule({ "first" }) or context.usemodule{ "first" }
context.enableinputtranslation() context.darkgreen() \stopluacode
\startTEXpage[offset=1em]
\translateinput[Hermes][Idris]
Hermes
\disableinputtranslation
Hermes
\stopTEXpage ======= tex error > tex error on line 14 in file ./test-luacode.tex: Undefined control sequence
\translateinput [Hermes][Idris] ======= The reason for the error is that the module is not being loaded. Toggling back to context syntax, of course, works.
Reference: ConTeXt Lua Documents by Hans Hagen, page 22. The following analogous code works:
\startluacode context.startchapter{first} \stopluacode
It doesn't work or at least it does not what you expect, the examples in the manual pass strings ( "..." ) wherever text is expected while you pass a lua variable to the commands. Passing variables only work when the variable itself refers to a string, e.g. translate = "translate" Wolfgang
Wolfgang: Many thanks for the fix and for the detailed explanation, which was very helpful!
Best wishes
Idris
--
Professor Idris Samawi Hamid
Department of Philosophy
Colorado State University
Fort Collins, CO 80523
On Aug 18, 2023, 10:56 AM -0600, Wolfgang Schuster
participants (2)
-
Hamid,Idris
-
Wolfgang Schuster