[luatex] fine grained discretionary's penalty
Élie Roux
elie.roux at telecom-bretagne.eu
Sat Mar 14 19:25:50 CET 2015
> Also, for a quite complex project, I need to assign different penalties
> to discretionaries of the same paragraph. I've asked on [3], but it
> doesn't seem possible with PdfTeX. Is there currently a way to do so in
> LuaTeX (by hacking the nodes)? If not, would it be doable, like by
> adding a 'penalty' field to disc nodes, with \hyphenpenalty (or any
> other relevant value) assigned to it be default, but changeable?
Attached is a patch for this feature. It is very small and
non-intrusive: it basically just sets a new "penalty" field to disc
nodes, always set to 0. If the field value is 0 while line breaking, it
is ignored and the penalty associated to the disc is hyphenpenalty or
exhyphenpenalty. But if the field value is non-zero, then line breaking
uses it as the penalty associated to the disc. The value needs to be set
in a pre_linebreak_filter callback.
Attached is also a small Plain TeX example demonstrating the new feature.
It would be a huge help for me as it unlocks totally new possibilities.
What do you think?
Thank you,
--
Elie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new_disc_penalty.patch
Type: text/x-patch
Size: 5646 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20150314/1e70b5eb/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mwe.tex
Type: application/x-tex
Size: 413 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20150314/1e70b5eb/attachment-0001.tex>
More information about the luatex
mailing list