2

I had some code that compiled previous but just installed latest miktex and I get errors now. They involve the use of token. It seems token.command_name no longer exists. In the old help it was there but in the new help it is gone. I can't seem to find anyone mentioning how to migrate to what is new(which I can't find)

lualatex: attempt to call field command_name a nil value

Again, this code worked fine before and was a deeply used command(so it is not on my side of the code).

Any ideas what happened and what to do about it? I need to wrap tex commands such as defining, existence, etc tex macros on the lua side.

6

In recent LuaTeX (>=0.95.0) some functions of the token library have been removed and promoted to properties of the token itself. In older LuaTeX the following worked

\directlua{
  local t = token.create("relax")
  local csname = token.command_name(t)
  tex.sprint(csname)
}
\bye

With recent LuaTeX however, we need to replace token.command_name(t) by t.cmdname.

\directlua{
  local t = token.create("relax")
  local csname = t.cmdname
  tex.sprint(csname)
}
\bye
1

A look in the newest LuaTeX manual suggests that command_name was removed. Take a look at pages 169–170 of the manual: they mention cmdname. Is its functionality what you are looking for?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.