[luatex] Interfere with page breaking to balance pages

Stephan Hennig mailing_list at arcor.de
Wed Oct 17 15:44:58 CEST 2012


Am 16.10.2012 18:23, schrieb Patrick Bergner:

> Using "atbegshi" I was unable to retrieve the page content as it is only
> accessible using \AtBeginShipoutBox (...and I don't know how to use it
> from the Lua side).

For me the following works

\directlua{
  function myfunc(box)
    texio.write_nl('box = ' .. box)
  end
}

\AtBeginShipout{%
  \directlua{myfunc(\the\AtBeginShipoutBox)}%
}

But I'm not a TeX expert and I don't know when that might go wrong.


> The package does provide a \AtBeginShipoutDiscard command to discard
> shipout though (...although, again, I don't know how to use it from
> the Lua side).

tex.print('\AtBeginShipoutDiscard')


> A more Lua-esque solution (i.e., pure Lua with a hook for
> luatexbase.add_to_callback) would still be preferred.

I, too, think a pre-shipout callback is missing to access a completely
rendered page.  Unsurprisingly, variable tex.lists.page_head (see sec.
'Special lists' in luatexref-t.pdf) as well as tex.box[255] are nil in
buildpage_filter when extrainfo == 'after_output'.  And when extrainfo
isn't 'after_output', you never know if the page has already been
completed.  Am I missing something?

Best regards,
Stephan Hennig



More information about the luatex mailing list