[lltx] luatexbase.is_in_callback

Patrick Gundlach patrick at gundla.ch
Thu Jul 21 14:49:17 CEST 2011

Am 21.07.2011 um 14:34 schrieb Arno Trautmann:

> Patrick Gundlach wrote:
>> Am 21.07.2011 um 14:11 schrieb Arno Trautmann:
>>> I'd like to use the post_linebreak_filter to manipulate the node list, but only if a macro appears in that given paragraph.
>> Can you use attributes there? Then you can test whether certain attributes are in a paragraph and apply your code.
> Yes, and I do in fact. But I'm not sure how this solves my problem here? Maybe I'll be more precise on what I want to do:
> I've written a function randomcolor that inserts a color whatsit before (push) and after (pull) every glyph in a paragraph, using the post_linebreak_filter. Now I want to provide a command \textrandomcolor{} that does the same, but only with the text in the argument. For this, I use the same function as above, but set an attribute at the beginning of the argument and unset it at the end, and in the function, I test for this attribute. Fine.

That's what I wanted to write.

> However, in a paragraph that does /not/ contain any \textrandomcolor, I don't want the function to loop through all nodes. Let's say, for performance reasons …

Does it really differ (performance wise)?


More information about the lualatex-dev mailing list