[luatex] How to define an internal register?
d.p.carlisle at gmail.com
Sat Jan 26 09:49:00 CET 2019
Wouldn't it be easiest just to define it with \newskip to get the tex
input syntax and then access that skip register from lua?
On Sat, 26 Jan 2019 at 05:59, Henri Menke <henrimenke at gmail.com> wrote:
> Dear list,
> I am trying to define a command which behaves like an internal register
> using the `token` library. However, there are some complications. For
> example a register has to be settable using both
> Additionally, if no number is given it should raise a “cannot be used in
> vmode” error or similar. Also it has to be possible to get the value
> using `\the`. Below you can find a minimal example where I have already
> achieved some of these things but others fail miserably.
> Cheers, Henri
> P.S.: I have also attached a much more complex example, so you can see
> that I actually want to emulate pdfTeX's \pdfadjustinterwordglue.
> local value = 0
> function register()
> local str = token.scan_string()
> if str then
> local int = string.gsub(str,"=","")
> value = tonumber(int)
> tex.sprint([[\numexpr]] .. value .. [[\relax]])
More information about the luatex