[luatex] adjusting `hyphenate` callback for single function
Werner LEMBERG
wl at gnu.org
Thu Dec 8 11:10:16 CET 2022
Folks,
being a complete newbie who wants to experiment a little with LuaTeX,
I ask for some help to improve `texinfo.tex` for generating the
documentation of LilyPond.
Within the `@code` macro, I want to do two things.
(a) Hook into the `hyphenate` callback to insert hyphenation
discretionaries based on some constraints.
(b) Hook into `pre_linebreak_filter` (or rather `contribute_filter`?)
to inhibit line breaks before/after a single character if
preceded/followed by a (single) space. In other words, this space
should be replaced with `@tie{}`.
How can I do that? I guess I have to do the following.
(1) Write hooks `code_hyphenate` and `code_pre_linebreak_filter`.
(2) At the beginning of `@code`, append the `code_hyphenate` hook.
(3) At the end of `@code`, remove the `code_hyphenate` hook.
Assuming this is the correct approach I have some questions.
* It's not written explicitly in the LuaTeX manual but I guess that
the argument to the `hyphenate` hook is a single word.
* I couldn't find information in the manual about the order of hooks.
It seems that I have to save the original hook by myself and call it
before/after, right?
* Is there already some code available that I could use as a starting
point?
Werner
More information about the luatex
mailing list.