Dear list,

Recently I answered a question on TeX.SX where it was necessary to go
through an already typeset vbox and examine it line by line.  Therefore
I used the macro \eatlines from Viktor Ei­jkhout's "TeX by Topic", here
a version tailored to my needs:

\def\eatlines{%
  \setbox\scratchbox=\lastbox
  \ifvoid\scratchbox\else
    \unskip\unpenalty
    {\eatlines}%
    \setbox\scratchbox=\hbox{\unhbox\scratchbox}%
    % Do something with scratchbox, e.g. examine width
  \fi
}

It is then used like

\vbox{ ... some content ... \par\eatlines}

The macro goes through all hboxes (lines) in the vertical list until
there is none left (\ifvoid) and unpacks each hbox into a new one.

I was wondering, can the same thing be done in Lua (with probably less
and more readable code)?

Kind regards,
Henri
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to