# [Dev-luatex] how to hook luatex last shipout

Hans Hagen pragma at wxs.nl
Thu Feb 4 17:56:42 CET 2010

On 4-2-2010 17:35, Paweł Jackowski wrote:
> Dear collegues,
>
> I'm trying to hook the moment when luatex has just finished \shipout of
> the very last page and there is nothing more to typeset. First thought
> was to use buildpage_filter when it is called with "end" keyword. But
> seemingly the callback is called on occurance of \end, while there still
> may be quite some main list material to be written out. Even if there
> are no insertions, the remaining material may still generate quite some
> pages. Can one propose some way to hook "the last shipout/output is
> over" moment without macros such as \bye?

luatex can never know when the last shipout occurs (the last call to the
output routine can result in multiple shipouts and macro packages can
call \shipout any time, so you need to register the last page number and
use that information; only the macro package knows when and what

you could abuse the stop_run callback for some purposes

Hans

-----------------------------------------------------------------