4

Compile the following example with tex and luatex:

\nopagenumbers
\parindent=0pt
\parskip=0pt
\def\par{\endgraf\hbox to 15em{\hrulefill}}
\hsize=1pt
\hfuzz=15em
1 'supercalifragilisticexpialidocious \par
2 s'upercalifragilisticexpialidocious \par
3 supercalifragilisticexpialidociou's \par
4 supercalifragilisticexpialidocious' \par
\end

With Plain TeX in case 2) zero \lccode stops hyphenation, as it should. Why this is not so in case 3)? How can the rules from The TeXbook (page 454) be applied here?

Why with LuaTeX the word is hyphenated in all cases? Besides, in case 2 hyphenation is different from other cases. In which aspects hyphenation in LuaTeX differs from PlainTeX here?

PlainTeX PlainTeX LuaTeX LuaTeX

3
  • 1
    For case (3) things are clear enough: TeX90 hyphenates up to the \lccode 0 char. The LuaTeX hyphenation approach is entirely different from TeX90 (see the LuaTeX manual), so I don't thin a difference is a surprise.
    – Joseph Wright
    Commented Oct 13, 2015 at 7:37
  • 3
    The different hyphenation is imho to be expected: upercali... is a different word then supercali.... But I don't know if is it a bug or a feature that luatex restarts hyphenation after the quote char. Imho this is a question for the luatex mailing list. Commented Oct 13, 2015 at 7:45
  • @Ulrike: feature. Commented Oct 30, 2015 at 19:27

2 Answers 2

1

This old question is still unanswered so I give one for the questions about plain TeX.

The TeXbook states on page 454:

TeX looks for potentially hyphenatable words by searching ahead from each glue item that is not in a math formula. The search bypasses characters whose \lccode is zero, or ligatures that begin with such characters; it also bypasses whatsits and implicit kern items, i.e., kerns that were inserted by TeX itself because of information stored with the font. If the search finds a character with nonzero \lccode, or if it finds a ligature that begins with such a character, that character is called the starting letter.

Applied to the four cases the starting letter is always s. In case 1 TeX bypasses the right quote.

Next it is explained how TeX finds the end of the word:

If a suitable starting letter is found, let it be in font f. Hyphenation is abandoned unless the \hyphenchar of f is a number between 0 and 255, inclusive. If this test is passed, TeX continues to scan forward until coming to something that's not one of the following three "admissible items": (1) a character in font f whose \lccode is nonzero; (2) a ligature formed entirely from characters of type (1); (3) an implicit kern. The first inadmissible item terminates this part of the process; the trial word consists of all the letters found in admissible items. Notice that all of these letters are in font f.

In case 1 the word ends with the blank (all letters are in the same font), so TeX finds the trial word supercalifragilisticexpialidocious. In the second case the right quote stops the search and the trial word is s. Similar, case 3 finds supercalifragilisticexpialidociou and case 4 supercalifragilisticexpialidocious. Therefore cases 1 and 4 have identical words.

Then the TeXbook explains that the number of letters in the word must be at least the sum of \lefthyphenmin and \righthyphenmin (which is 5 in plain TeX) to hand the word over to the hyphenation process. Therefore in case 2 no hyphenation is tried.

The rest of the word of case 2 does not qualify for hyphenation as TeX looks for a starting letter after a glue item. Of course, if \hskip0pt is inserted after the right quote in case 2, i.e., s'\hskip0ptupercalifragilisticexpialidocious \par, TeX shows the hyphens it can insert in this rest: up-er-cal-ifrag-ilis-tic-ex-pi-ali-do-cious. This is identical to the result that is shown in case 2 for LuaTeX.

3

LuaTeX has never claimed full back compatibility with TeX and, in particular, its hyphenation algorithm is quite different from the original one.

For instance, TeX never tries hyphenation for character strings that don't follow glue, whereas LuaTeX happily does so.

Similarly, a character with zero \lccode ends the word being formed, which will subject to hyphenation; then, after the character, LuaTeX will start forming a new word. If you try

\nopagenumbers
\parindent=0pt
\hsize=1pt
\hfuzz=15em

supercalifragilisticexpialidocious'supercalifragilisticexpialidocious 

\end

(yes, without the initial space before the long word) the result will be

enter image description here

as expected. Or, perhaps, unexpected, depending on your approach. LuaTeX is not the same as TeX in all aspects.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .