\directlua {
    function followup(n)
        print(tex.box[n].list.width)
        print(tex.box[n].list.height)
        print(tex.box[n].list.depth)
        tex.print(tex.box[n].list.width  .. "\string\\par")
        tex.print(tex.box[n].list.height .. "\string\\par")
        tex.print(tex.box[n].list.depth  .. "\string\\par")
    end
}
\directlua {
    tex.print([[\string\setbox0=\string\hbox{foo}]])
    tex.print([[\string\directlua{followup(0)}]])
}

(credit: H. Hagen)


On Mon, Oct 20, 2014 at 5:16 PM, Andreas Matthias <
[email protected]> wrote:

> Is it possible to call the TeX scanner from within Lua?
>
> I would like to put a string into a box and then work on the node list.
> If the string were available on the TeX side I would
>
>   \setbox0\hbox{...}
>
> and the use it on the Lua side
>
>   tex.box[0]
>
> But what should I do if the string is generated on the Lua side and
> thus no available on the TeX side? Is it possible to call the TeX
> scanner to read this string?
>
>
> Ciao
> Andreas
>
>

\directlua {
    function followup(n)
        print(tex.box[n].list.width)
        print(tex.box[n].list.height)
        print(tex.box[n].list.depth)
        tex.print(tex.box[n].list.width  .. "\string\\par")
        tex.print(tex.box[n].list.height .. "\string\\par")
        tex.print(tex.box[n].list.depth  .. "\string\\par")
    end
}
\directlua {
    tex.print([[\string\setbox0=\string\hbox{foo}]])
    tex.print([[\string\directlua{followup(0)}]])
}

(the code is from H. Hagen)
-- 
luigi

Reply via email to