Matthijs Kooijman wrote:
Hi Hans,

thanks for the instant reply :-) I haven't tried your suggestion yet, but I've
got a few questions first.

function document.step_one(str)
Would there be any danger of overwriting an existing box by doing this? I'm
not quite sure how this boxing thing works...

well, you can allocate a box for that purpose

I guess this indirection is needed to force the \setbox command to be
expanded? I guess tex.sprint doesn't expand its arguments immediately, so just
putting document.step_two(0) instead of the entire tex.sprint("\\ctxlua...
won't work...

I'm using this from inside a pretty printer, so I'd have to think a bit about
how to set this up so things run inside the right context and stuff, but I
guess that should work out. Still slightly more complicated that a direct "How
wide is this thing" function, though.

function document.step_two(n)
    tex.sprint("width: ",tex.wd[0])
I gues you mean tex.wd[n] here, but whatever :-)

\ctxlua{document.step_one("test {\\bf test} test")}

Why is this \box0 needed? Just to show the test test test output? AFAICS, the
width of the box will be displayed always, even without this?

just try ..


                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 |
If your question is of interest to others as well, please add an entry to the 

maillist : /
webpage  : /
archive  :
wiki     :

Reply via email to