[luatex] behavior of buildpage_filter ?

Frank Mittelbach frank.mittelbach at latex-project.org
Sun Apr 3 21:48:23 CEST 2016

Am 11.03.16 um 14:35 schrieb Hans Hagen:
> On 3/10/2016 8:56 PM, Frank Mittelbach wrote:
>> Am 10.03.16 um 20:33 schrieb Hans Hagen:
>>> indeed, this is a known issue and it's on my list to look into that (one
>>> can check for the location, at least that's what i do as a way out for
>>> now); we probably need an additional callback but not for the next
>>> release (as one might need to adapt code due to a break in
>>> compatibility)
>> ok good, so much the better if it is already known. yeah one can program
>> around it, even though it is again a bit painful :-)
> indeed and i must admit that when i ran into it long ago that it took me
> a while to realize that i needed to ignore those; anyway, i checked what
> i had in mind with this ...
> ... it's pre_box, box, pre_adjust and adjust which are the ones in post
> line break and these are not followed by an actual break which happens a
> bit later with its own call ...
> ... i'll move these four to a new callback contribute_filter
> (but for now, you'd better check for these 4 cases)

Hi Hans,

looks like the issue is not just resolved by looking for pre_box, box, 
pre_adjust and adjust and ignoring those.

If you typeset a \vbox on the main vertical list then one gets 2 calls 
to buildpage_filter and both are with context "box". The first one seems 
to be the internal one during the actual build of the box and the second 
one a real buildpage but claiming the wrong context (or the first one 
claims the one context depending on what "box" is supposed to mean.

Above you said you have a workaround checking for "location". Can you 
tell me what you mean by this?


here is the test file for the bug/issue explained above:

require "ltluatex.lua"
function buildpage ( context )
   print ( "************* buildpage at: " .. context .. " at " .. 
   if context == "pre_box" or
%     context == "box"     or
      context == "pre_adjust" or
      context == "adjust"
     print(" -- context ignored --")
   elseif tex.lists.contrib_head then
       print("Contrib before:")
       for n in node.traverse(tex.lists.contrib_head) do
        if n.id == 12 then
          print("  id=" .. n.id .. " penalty=" .. n.penalty)
          print("  id=" .. n.id)
   return true
luatexbase.add_to_callback("buildpage_filter", buildpage, "new buildpage 

\input tufte

\penalty 66
\vbox{test }
\penalty 77



the vbox becomes visible only by looking into contrib_head even though 
the context claims to be "box"

************* buildpage at: penalty at 30
Contrib before:
  id=12 penalty=66
************* buildpage at: box at 31
************* buildpage at: box at 31
Contrib before:
************* buildpage at: penalty at 32
Contrib before:
  id=12 penalty=77

More information about the luatex mailing list