[luatex] inserting elements after line break

Paul Isambert zappathustra at free.fr
Mon Jan 3 00:11:22 CET 2011

Selon Khaled Hosny <khaledhosny at eglug.org>:

> On Sun, Jan 02, 2011 at 10:15:11PM +0100, Arno Trautmann wrote:
> > Hi all,
> >
> > I thought this would be a quite easy task with luaTeX, but I didn't
> > manage to do it:
> > I want to insert something (say, a rule) after a paragraph has been
> > broken. So my first attempt was to register a function to
> > post_linebreak_filter, but if I try to tex.print() something in that
> > function it just doesn't do anything.
> By that stage tex has already processed its input and converted it to
> node list, so you have to insert nodes here not tex input.

Plus, quoting the manual (p.108) about tex.print() and friends:

"The result of using these functions from inside callbacks is undefined at the

Indeed you must add nodes, not input. A rule is easy enough, but for text you
have to think you're TeX and build a function that turns a string into a list of
nodes (that doesn't exist out of the box). See here for a starter:


(Note that I made an error in my code, see Taco's message.)


More information about the luatex mailing list