[luatex] Interfere with page breaking to balance pages

Patrick Bergner mail at patrickbergner.de
Tue Oct 16 18:23:04 CEST 2012


> Hello Patrick,
> 
> [a lot snipped]
> 
> Instead of callbacks, I'd recommend kicking in at shipout time with
> whatever can do that in LaTeX (e.g. everyshi, I think), and add some
> \directlua code manipulating the content of "tex.box.outputbox". Of
> course you also need to cancel shipout every other page, since you can't
> write a left page to the PDF before it has been compared to the right
> one. Unfortunately, I don't know how to do that in LaTeX. I wrote a
> paper on the subject, but I'm not sure it will help since it deals
> neither with LaTeX nor LuaTeX (I didn't use the former anymore, and I
> didn't use the latter yet, when the paper was written), but perhaps
> you'll find some ideas: http://tug.org/TUGboat/tb31-1/tb97isambert.pdf
> 
> Best,
> Paul

Hello Paul,

thank you very much for your response. I heard about the
\EveryShipout{\directlua{...}} hack before (I call it a hack because it
requires more than LuaTeX's own capabilities), but was hoping to get
around it.

Using "everyshi" I was able to retrieve the page content via
tex.box[255]. I was, however, neither able to cancel the shipout of left
pages nor able to ship out both left and right pages after balancing them.

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). 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).

A more Lua-esque solution (i.e., pure Lua with a hook for
luatexbase.add_to_callback) would still be preferred. Maybe someone else
has a clue?

Thank you again
Patrick


More information about the luatex mailing list