View Issue Details

IDProjectCategoryView StatusLast Update
0000842luatexluatex bugpublic2015-03-16 19:17
ReportererouxAssigned ToHans Hagen 
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version 
Target VersionFixed in Version0.80.0 
Summary0000842: \hyphenpenalty is not taken into account
DescriptionThe simple (Plain) example

\hyphenpenalty=-10000
ab\discretionary{-}{-}{-}cd
\bye

shows that \hyphenpenalty is not taken into account. See the difference with the output of pdfTeX.
TagsNo tags attached.

Activities

eroux

2015-03-14 17:58

reporter  

patch-bug-842.patch (746 bytes)
Index: source/texk/web2c/luatexdir/tex/linebreak.w
===================================================================
--- source/texk/web2c/luatexdir/tex/linebreak.w	(révision 5187)
+++ source/texk/web2c/luatexdir/tex/linebreak.w	(copie de travail)
@@ -1950,7 +1950,7 @@
                 /* The following code knows that discretionary texts contain
                    only character nodes, kern nodes, box nodes, and rule
                    nodes. */
-                if (second_pass) {
+                if (second_pass || subtype(cur_p) == discretionary_disc) {
                     int actual_penalty = hyphen_penalty;
                     if (subtype(cur_p) == automatic_disc)
                         actual_penalty = ex_hyphen_penalty;

patch-bug-842.patch (746 bytes)

eroux

2015-03-14 17:58

reporter   ~0001328

I've uploaded a patch that seems to fix the issue.

Hans Hagen

2015-03-15 17:10

manager   ~0001329

probably needs checking with pdftex code base

Hans Hagen

2015-03-16 18:19

manager   ~0001332

The issue can be summarized as follows:

  /* This branch differs a bit from older engines because in LuaTeX we
     already have hyphenated the list. This means that we need to skip
     automatic disc nodes. Of better, we need to treat discretionaries
     and explicit hyphens always, even in the first pass. */

So the patch is:

   if (second_pass || subtype(cur_p) <= automatic_disc) {

And a test:

  \hyphenpenalty=-10000
  \exhyphenpenalty=-10000
  ab\discretionary{-}{-}{-}cd \par
  ab-cd \par
  ab\-cd \par

(So it was a side effect of the fact that where tex hyphenates on the fly luatex does it beforehand and the node list therefore already has disc nodes which then need to be ignored in a first pass.)

Issue History

Date Modified Username Field Change
2013-07-08 16:20 eroux New Issue
2015-03-14 17:58 eroux File Added: patch-bug-842.patch
2015-03-14 17:58 eroux Note Added: 0001328
2015-03-15 17:10 Hans Hagen Note Added: 0001329
2015-03-15 17:12 Hans Hagen Assigned To => Hans Hagen
2015-03-15 17:12 Hans Hagen Status new => assigned
2015-03-16 18:19 Hans Hagen Note Added: 0001332
2015-03-16 19:17 Hans Hagen Status assigned => resolved
2015-03-16 19:17 Hans Hagen Resolution open => fixed
2015-03-16 19:17 Hans Hagen Status resolved => closed
2015-03-16 19:17 Hans Hagen Fixed in Version => 0.80.0