[luatex] fine grained discretionary's penalty

Hans Hagen pragma at wxs.nl
Sun Mar 15 10:19:58 CET 2015


On 3/14/2015 7:25 PM, Élie Roux wrote:
>> 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?

i'll check it but as we now need to keep experimental and trunk a bit in 
sync it will be end-of-month before something might show up in expermental

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the luatex mailing list