[luatex] inserting

Arno Trautmann Arno.Trautmann at gmx.de
Sat Jun 25 21:20:39 CEST 2011

Hi all,

I'm becoming desparate and I guess it's only a small error I'm making. I
try to (please don't ask why …) to colorize all letters in a document. I
do so by registering the following function in the post_linebreak_filter:

local color_push = node.new(WHAT,COL)
local color_pop = node.new(WHAT,COL)
color_push.cmd = 1
color_pop.cmd = 2

uppercasecolor = function (head)
  for line in node.traverse_id(HLIST,head) do
    for letter in node.traverse_id(GLYPH,line.head) do
        color_push.data = math.random().." .5 .5 rg"
  return head

This works fine /except/ for the first letter of every line except the
first line. So the first line is fine, but for every following line in a
paragraph, the first letter is not colored. I also get warnings

LuaTeX warning: pop empty color page stack 0

so it seems that the color_push does not work in that cases? But I don't
see what I'm doing wrong …
To understand what mistake I'm making, I tried to use

letter = node.first_glyph(line) [or line.head?]

instead of the for loop, but then letter doesn't seem to be a node at all.

I work with LuaLaTeX, luacode and luatexbase, and
This is LuaTeX, Version beta-0.70.1-2011061410 (rev 4277)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://tug.org/pipermail/luatex/attachments/20110625/0abf359c/attachment.bin>

More information about the luatex mailing list