Hello Patrick, Patrick Bergner <[email protected]> a écrit: > I'm currently working on a project to automate typical manual > typesetting tasks using LuaTeX. One of these is balancing pages, i.e., > making the left and right side of a typical double page in a book equal > in length. > > Manually this is usually achieved by using a negative value for > \enlargethispage on the left side of a double page. > > Now I'm trying to replicate this approach with Lua. What I (generally) > need is the following: > - Get a callback once TeX has all the material to output a page (or > double page). > - Be able to work with the to be placed page content, i.e., getting its > contents/dimensions _and_ be able to move things around between pages.
[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
