[luatex] What are user-defined whatsit nodes
mico.loretan at mac.com
Sun Nov 23 16:47:45 CET 2014
Perusing your code in a bit more depth, it looks like yourwhatsit-inserting function is registered with the hyphenate callback. In contrast, selnolig's main function is registered with the ligaturing callback. As such, it shouldn't affect TeX's hyphenation at all, and it certainly shouldn't have the side-effects you mention. Please advise if I'm missing something important in your setup. Best, Mico
>> Am 21.11.2014 um 19:10 schrieb luigi scarso:
>>> On Fri, Nov 21, 2014 at 6:31 PM, Stephan Hennig <sh-list at posteo.net> wrote:
>>> To put it differently, is user-defined whatsits inhibiting ligatures a
>>> bug or intentional?
>> anything non-glyph or non-disc will inhibit ligatures building
> OK, thanks for the clarification!
> These (side-)effects of user-defined whatsits make me wonder what
> use-cases have been in mind when introducing this type of node?
> Attributes seem so much more attractive for squeezing additional
> information into a node list, because they should be handled
> transparently (I think).
> But never mind, I'm currently looking into ways to make TeX smarter with
> regards to ligatures. I've recently found the selnolig package
> utilizing user-defined whatsit nodes for inhibiting selected ligatures.
> Before asking further questions regarding ligatures I just wanted to
> get some clarification about the whatsit approach.
> The selnolig's whatsit approach works, but it's again not free of
> side-effects. It gets in the way with the hyphenation algorithm in that
> the whatsit marks a word boundary causing problems with minimum
> hyphenation length calculation. Note how setting \righthyphenmin=5 in
> the attached example prevents t-t hyphenation in the word 'butterflies.'
> (Let's ignore the fact that the fl ligature is indeed valid in this
> example.) The problem is more serious in German with its many compound
> words. Babel shortcuts like "|, which insert real glue if I recall
> correctly, suffer from the same problem.
> Any ideas how to prevent selected ligatures without causing side-effects?
> Best regards,
> Stephan Hennig
> % -*- coding: utf-8 -*-
> % Declare constants.
> local GLYPH = node.id('glyph')
> local WHATSIT = node.id('whatsit')
> local USER_DEFINED = node.subtype('user_defined')
> local CHAR_f = string.byte('f')
> local CHAR_l = string.byte('l')
> local Ncopy = node.copy
> local Nnew = node.new
> local Ninsert_before = node.insert_before
> local Ntraverse = node.traverse
> % Create user-defined whatsit.
> local what = Nnew(WHATSIT, USER_DEFINED)
> what.user_id = 20141117
> what.type = 100
> what.value = 0
> % Register callback.
> function (head, tail)
> % Iterate over node list.
> for n in Ntraverse(head) do
> if n.id == GLYPH and n.char == CHAR_l then
> local p = n.prev
> if p.id == GLYPH and p.char == CHAR_f then
> Ninsert_before(head, n, Ncopy(what))
> lang.hyphenate(head, tail)
> Subject: Digest Footer
> luatex mailing list
> luatex at tug.org
> End of luatex Digest, Vol 71, Issue 15
More information about the luatex