[luatex] Multi-paragraph insert confuses linebreak filters.

Paul Isambert zappathustra at free.fr
Thu Aug 5 11:38:38 CEST 2010

Hello all,

Here's a document:

  what_context = function (head, context)
    if context == "" then
      context = "main"
    texio.write_nl("The context is " .. context)
    return head
  callback.register("pre_linebreak_filter", what_context)
  \directlua{texio.write_nl("<< Start of insert")}%
  \directlua{texio.write_nl("End of insert >>")}%

Hello \Insert{world}

Hello \Insert{world\par}

For each paragraph, it writes the context in which it is typeset to the log. Now
the log looks like this:

<< Start of insert
The context is insert
End of insert >>
The context is main
<< Start of insert
The context is main % !!!
End of insert >>
The context is main

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.

Some observations:
- My changing context = "" into context = "main" is of course immaterial, as is
the \Insert macro - they just (hopefully) make things easier to read.
- Of course, the problem doesn't depend on the type of insert (I've used plain's
\footins here, but the problem occurred in my own footnote inserts, as well as
in any \newinsert).
- \endgraf produces the same result (the contrary would be surprising, but who
knows?), and \vskip too, so the problem seems to stem from explicitly turning to
vertical mode in an insert.
- If the insert contains other paragraphs, they return "insert" as context. So
only the first paragraph is affected.
- The same thing happens with post_linebreak_filter.

I'm using 0.62 rev 3794 - since thanks to the gentle pressure of some people
here and Manuel's precious help I'm now a Subversion- and build-it-yourself

Sorry if I seem to spend my time hunting bugs instead of contributing to the
march forward... (although those bugs tend to appear when I devise macros which
in the back of my mind would fit in a TUGboat paper about some nice things you
can do with LuaTeX)


More information about the luatex mailing list