I want to use a character replacement function from Lua in LuaTeX. The following is a first attempt and an adaptation from an example in chickenize
, but it doesn't work for content inside boxes in TeX logo nor ligatures. What is the right way to implement such a replacement?
\documentclass{article}
\usepackage{luacode}
\begin{luacode*}
local glyph_id = node.id("glyph")
function everything_is_e(head)
for n in node.traverse(head) do
if n.id == glyph_id then
n.char = 101
end
end
return head
end
luatexbase.add_to_callback("pre_linebreak_filter",everything_is_e,"replace every character by e")
\end{luacode*}
\begin{document}
\textbf{\input knuth}
\end{document}
I made the same question with an unregistered account and I cannot access to my original question anymore so I'm asking again.
e
? Or just (cat11) letters? – Steven B. Segletes Jul 18 '20 at 0:59e
or another character, wherever it be in the document. – user220694 Jul 18 '20 at 1:09hlist
s and now TeX is replaced by "eee" with a funny lowerede
but ligatures remain the same. Also\fbox
es don't change. – user220694 Jul 18 '20 at 1:49