[luatex] scanning for undefined command names

Hans Hagen pragma at wxs.nl
Wed Oct 26 14:03:39 CEST 2016


On 10/26/2016 1:39 PM, David Carlisle wrote:
> This is following up a user query at
>
>
> http://tex.stackexchange.com/q/335994/
>
> The following (plain) luatex logs
>
> [par]
> [par]
> []
> []
>
> that is the input \UNDEFINED is scanned (and removed) as a token but
> given the name as empty string not "UNDEFINED" .
>
> It isn't exactly clear from the manual that this would be the case, is
> that intentional? (and if so is there any way to get "UNDEFINED"
> without scanning letter by letter and checking catcodes "by hand" ?
>
> David
>
> \directlua{texio.write_nl("[" .. token.scan_csname() .. "]")}\par
> \directlua{texio.write_nl("[" .. token.get_next().csname .. "]")}\par
> \directlua{texio.write_nl("[" .. token.scan_csname() .. "]")}\UNDEFINED
> \directlua{texio.write_nl("[" .. token.get_next().csname .. "]")}\UNDEFINED

there is no token \UNDEFINED so it cannot be reported as such, but you 
can check with

\directlua{texio.write_nl("[" .. token.get_next().cmdname .. "]")}\UNDEFINED

which gives you [undefined_cs]

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the luatex mailing list