[luatex] Multi-paragraph insert confuses linebreak filters.

Paul Isambert zappathustra at free.fr
Thu Aug 5 12:52:22 CEST 2010

Selon Taco Hoekwater <taco at elvenkind.com>:

> On 08/05/2010 11:38 AM, Paul Isambert wrote:
> >
> > The problem, as you can see, is that the paragraph of the second insert,
> with
> > the explicit \par command, "thinks" it is in the main vertical list.
> I can (almost/hopefully) explain why that is so: the page builder is
> called from various bits in the input processing, like at the end
> of a \par, or the start of a display, or the end of an \insert or
> \vbox or \hbox, or when a \vskip is encountered at bottom level, etc.
> Such calls trigger the callback handling is there is something that
> is actually added to the vertical list (either main or an insert).
> In some cases, the context is quite clear, like in your first example,
> where it is triggered by the } that ends the \insert. But it is also
> triggered by a \par command, and those are processed independently at
> a different spot in the program, where it is not easy to deduce that
> this is actually in the middle of an isert. In those cases, an empty
> context argument is passed to the callback.

Indeed (don't know why I haven't tested it before), it also happens in

> The reason why you don't see another 'insert' is because at that point,
> there is actually nothing added to the main vertical list.

Which leads me to correct a previous assertion: only the last paragraph of the
insert/box displays the right context, provided it is closed by the insert/box's
ending. (My previous message stated that only the first paragraph was affected
because I'd run tests with only two paragraphs - pretty stupid.)

> I can try to improve the context discovery, but I am not sure whether
> it will work as expected soon: this list addition code was spread
> all over TeX, and not much work has been done yet to reorganize it.

Just so you know the motivation: I want to remove paragraph indent after a
section title with pre_linebreak_filter, because I prefer not to rely on
\everypar. To do so, section commands define the filter to a function which
removes the first box from the first paragraph in the main vertical list (hence
the context), and then sets the filter back to nil. The problem occurred in a 
paragraph with a multi-paragraph footnote (and I don't indent footnotes, so it
took me some time to figure out where the code was called).

By the way, to spot the indent box, and not another box, the only way (as far as
I can see) is to check that it has subtype = 0 (unknown origin) and width =
tex.parindent. Altough I can't see how a box with the same properties could ever
happen, wouldn't it be nice to have more subtypes? I'm thinking about the indent
box and the hbox that TeX produces when it's not happy about how \end was
called. (Oh, sorry, I'm feature-requesting again!)


More information about the luatex mailing list