Weird behavior of \exceptionpenalty
Hi, in an discussion on TeX StackExchange \exceptionpenalty came up and it's current behavior seems a bit odd and is at odds with the documentation: According to the manual:
Because we introduced penalties in discretionary nodes, the exception syntax now also can take a penalty specification. The value between square brackets is a multiplier for \exceptionpenalty. Here we have set it to 10000 so effectively we get 30000 in the example.
and then shows the example \hyphenation{z{a-}{-b}{z}{a-}{-b}{z}[3]{a-}{-b}{z}[1]{a-}{-b}{z}z} As the text says, it could be expected that this causes a penalty of 30000. But the currently implemented behavior is different: It assigns a penalty of 10000 to the second discretionary. The reason is that the number in square brackets is only used as a multiplier if exception_penalty is higher than 100000 (sic). For any value of \exceptionpenalty lower or equal to 100000, the number is ignored and the value of \exceptionpenalty is used as is. I'm not sure if this is just a bug (maybe 100000 was supposed to be a upper limit and not a lower limit?) or if this is intended to be used as a marker which later gets replaced by some callback and therefore 100000 was intentionally used as a unrealistic penalty value, but I think that at least the documentation should get fixed. I'm happy to provide a patch for this if you tell me what to implement. I basically see the following options: * Just change the manual to describe the implemented behavior. I think that this would be sad since it makes the feature much less useful since having multiples of badness higher than 100000 seems to have few applications, but this could be picked up by callbacks ansd would be the most compatible option. * Decide that The documentation is more important than the implemented behavior and fix the code to implement the documentation, removing the 100000 criterium (or making it an upper limit instead of a lower one) If 100000 becomes an upper limit, it would also be possible to substract 100000 from exception_penalty before using it to allow emulating the old behavior of using a fixed exception_penalty. (Of course, the opposite: Keep the current code but reduce \exceptionpenalty by 100000 first in the multiplication case could also be done, but IMO that would be a weird interface.) * Add a new flag to select between the new and old behavior or add a new bit to \hyphenationmode. Best, Marcel
On 2/24/2022 8:48 PM, Marcel Fabian Krüger wrote:
in an discussion on TeX StackExchange \exceptionpenalty came up and it's current behavior seems a bit odd and is at odds with the documentation: i'll change it to a max check with 10000 (infinite) ... i don't expect many compatibility issues because it actually was just an experiment (i never used it myself after that in context)
Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Marcel Fabian Krüger