Code : Tout sélectionner
\documentclass{article}
\usepackage{luacode,lipsum}
\begin{luacode}
color_push = node.new(node.id("whatsit"),node.subtype("pdf_colorstack"))
color_pop = node.new(node.id("whatsit"),node.subtype("pdf_colorstack"))
color_push.command = 1
color_pop.command = 2
function ecolor(head)
for line in node.traverse_id(node.id("hhead"),head) do
for n in node.traverse_glyph(line.head) do
if node.has_attribute(n,luatexbase.attributes.uppercasecolorattr) then
if (n.char == string.byte("e") or n.char == string.byte("E")) then
color_push.data = "255 0 0 rg"
line.head = node.insert_before(line.head,n,node.copy(color_push))
node.insert_after(line.head,n,node.copy(color_pop))
end
end
end
end
return head
end
luatexbase.add_to_callback("post_linebreak_filter",ecolor,"ecolor")
\end{luacode}
\begin{document}
\lipsum[1-1]
\end{document}