[luatex] Interfere with page breaking to balance pages
Patrick Bergner
mail at patrickbergner.de
Fri Oct 12 18:43:45 CEST 2012
Hi folks,
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.
If this general approach is unfeasible a more problem specific one will
help too (something like playing with the textheight to replicate a
negative \enlargethispage).
What I tried so far:
1) buildpage_filter
The LuaTeX manual states this hook can be used "to do specialized
manipulation of the page building stage like imposition or column
balancing.". Sounds promising. ;-)
What I understood so far: For every page a callback for this hook is
called multiple times and the information about the stage of the page
building process is stored in the "extrainfo" string argument. To get to
the actual content of the page one has to use the virtual tables in
tex.lists, e.g., tex.lists.page_head.
Unfortunately I could not find a combination of page building phase and
tex.lists table that serves me the content of a page once and only once
before it is output.
2) pre_output_filter
A callback for this hook is served with a node pointer, like in
pre_linebreak_filter, so no need for tex.lists. Sadly I was unable to
get a clue what this node pointer actually represents and if it is the
right hook for my purpose as it again is called multiple times per page.
______
This is where I'm stuck currently. Maybe you can give me a heads up
and/or point me in the right direction.
Thank you
Patrick
More information about the luatex
mailing list