Changes

Jump to navigation Jump to search
undefined TeX commands in Lua snippets
end
</pre></code>
 
== Undefined Commands in Lua Comments ==
 
Lua code invoked inside TeX doesn’t allow TeX undefined commands ''even inside comments''.
 
<texcode>
\starttext
\startluacode
--\undefinedcommandfromme
\stopluacode
Hello
\ctxlua{--\undefinedcommandfromme}
\stoptext
</texcode>
 
To get the sample above working (as [https://mailman.ntg.nl/pipermail/ntg-context/2023/107611.html explained by Hans]), you would need a fallback definition:
 
<texcode>
\ifdefined\undefinedcommandfromme \else \let\undefinedcommandfromme\relax \fi
</texcode>
 
{{cmd|undefinedcommandfromme}} gets only defined (as {{cmd|relax}}, to do nothing), if and only if it is undefined.
= Calling TeX from Lua =
139

edits

Navigation menu