15

For the following example,

\hsize =2in

shelf{}ful shelf{}ful shelf{}ful
rot{}ten rot{}ten
shelf{}ful shelf{}ful shelf{}ful

shelf{}ful shelf{}ful
rot{}ten rot{}ten
shelf{}ful shelf{}ful

\bye

The result is as followings:

enter image description here

My questions is: in the first paragraph, why the first shelfful is without ligature, but the other shelfful are with ligatures?

  • 3
    TeX doesn't hyphenate the first word of a paragraph. – Ulrike Fischer Oct 28 '14 at 10:00
  • @UlrikeFischer What does that mean? A little more info would be welcome. – Manuel Oct 28 '14 at 10:04
  • @Manuel: It means what it says: The braces are obviously lost when TeX tries to find hyphenation points which it doesn't do on the first work of a paragraph. – Ulrike Fischer Oct 28 '14 at 10:10
  • @UlrikeFischer Mmm… I don't get it. There are two paragraphs, and only in the first one all but the first {} seem to do nothing, since the ff are ligatured. – Manuel Oct 28 '14 at 10:15
  • 6
    The TeXBook (TeX3 version, not TeX2 edition) explicitly warns against using {} to break ligatures for precisely this reason, the {} is lost if the word is reconstituted after a hyphenation trial. – David Carlisle Oct 28 '14 at 10:25
19

The TeXBook has this exercise:

exercise Sometimes you run into a rare word like 'shelfful' that looks better as shelf{}ful without the ff ligature. How can you fool TeX into thinking that there aren't two consecutive f's in such a word?

answer {shelf}ful or shelf{}ful, etc.; or even shelf\/ful, which yields a shelf/ful instead of a shelf{\kern0pt}ful. In fact, the latter idea---to insert an italic correction---is preferable because TeX will ^reinsert the ff ligature by itself after hyphenating shelf{}ful. Appendix H points out that ligatures are put into a hyphenated word that contains no explicit kerns, and an italic correction is an explicit kern.) But the italic correction may be too much (especially in an italic font); shelf{\kern0pt}ful is often best.

Note here that "after hyphenating" should be read as "after trying to hyphenate" If TeX attempts to hyphenate a word it essentially splits it up at the possible break points to add discretionary hyphens. If then hyphenation is not used at that point the word is reconstituted without those hyphenation points, but the original {} information is lost by then and ligatures will be formed in the reconstituted word.

TeX (not luatex) never attempts to hyphenate the first word of a paragraph (essentially a bug that was classified as a feature to keep TeX stable) and also it does not attempt to hyphenate any words in a paragraph if it can break the paragraph into lines and keep within \pretolerance badness. So whether f{}f actually breaks an ff ligature is rather variable depending on the whole paragraph, not just the word where {} is used.

  • 2
    Even more important not to use {} when LuaTeX is involved, as it deliberately doesn't follow the same approach as 'classical' TeX (but there are Lua-based ways to suppress ligatures in defined words). – Joseph Wright Oct 28 '14 at 10:35
  • Actually the question does come from my reading of this exercise of the TeXbook. I think after hyphenating shelf{}ful is misleading for first learners since it is the same when TeX hyphenating other words. Could you update your answer with more details about your comment below the original question? That would benifit other people. – Z.H. Oct 28 '14 at 10:58
  • @Z.H. better?.. – David Carlisle Oct 28 '14 at 11:06
  • 1
    @JosephWright Could you please elaborate on the Lua-based ways to suppress ligatures in defined words? Do you have anything else in mind than the selnolig package? – Stephan Hennig Oct 28 '14 at 17:22
  • @StephanHennig - Is there something about the selnolig package you'd like to see changed? – Mico Oct 29 '14 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.