Le 02/06/2011 12:25, Christophe Jorssen a écrit :
2011/6/2 Paul Isambert<[email protected]>:I wanted to try some hack with token.create/token.expand, but I found that: \def\A{1} \directlua{ local A = token.create("A") token.expand(A) } produces an "Undefined control sequence" error. Which is all the more surprising as if the token is fed to TeX in the token_filter callback, as in the stupid example below, the control sequence is fine: \def\A{1} \directlua{ callback.register("token_filter", function () callback.register("token_filter", nil) return token.create("A") end) } Have I misunderstood something or should I pay a visit to the bug tracker?I did exactly the same thing (well, the first part, I don't understand the second with the callback yet...) and got the same error but I felt ashamed of posting it here thinking I may have missed something trivial. So thank you Paul :-)
You're welcome. But nobody should refrain from posting here, even simple questions (which aren't necessarily so trivial as they seem) can be answered.
By the way, I would highly appreciate some basic usage examples ot the token_filter callback and the token library.
If you're a TUG member, you can have a look at my paper in the last TUGboat: https://www.tug.org/members/TUGboat/tb32-1/tb100isambert.pdf. Note that the example of use is pretty stupid, you can do things much more easily with tex.print (something I realized only later in a post by Ulrike on this list).
Anyway, I'll try to write something in the wiki, although I don't have any convincing example of use (I haven't investigated the matter much).
Best, Paul
