It would seem that hyphenation does not work properly under LuaLaTeX
if the hyphenation points occur at places where TeX inserts ligatures. Consider the following MWE, which (i) provides hyphenation points for seven selected words and (ii) prints them using a very narrow measure (in order to force TeX to use all possible hyphenation points):
% !TEX program = lualatex
\documentclass[letterpaper]{article}
\usepackage[hmargin=4.2in]{geometry}
\setlength\parindent{0pt}
\usepackage[no-math]{fontspec}
\setmainfont{EB Garamond}
\hyphenation{white-space Keynes-ian dwarf-ish calf-like wolf-fish ruff-like roof-top}
\begin{document}
whitespace Keynesian dwarfish calflike wolffish rufflike rooftop
\end{document}
I chose the font "EB Garamond" because it provides the ft
ligature as well as the "standard five" f-ligatures (ff
, fi
, fl
, ffi
, and ffl
). The output of the MWE looks like this:
Observe that the first two words in the list, whitespace
and Keynesian
, are hyphenated correctly. In case you're curious: without help from the \hyphenation
command, TeX would hyphenate these two words as whites-pace
and Key-ne-sian
. Yikes!
However, the five other words are not hyphenated at all despite the fact that explicit hyphenation points are supplied. [Aside: When run under either pdflatex
(without loading the fontspec
package, obviously) or XeLaTeX
, this MWE runs correctly, i.e., the words are hyphenated at the specified hyphenation points.] The thing these words have in common is that they all contain ligatures that cross the specified hyphenation points. This makes me think that LuaLaTeX
replaces various character pairs (or triples) with ligatures before it considers hyphenation possibilities.
What strengthens my belief in the correctness of this diagnosis is that if I use the font "Latin Modern" (which does not contain the "ft" ligature) instead of "EB Garamond", the word "rooftop" is once again hyphenated correctly, whereas the remaining four words with f-ligatures (i.e., dwarfish, calflike, wolffish, and rufflike) still aren't hyphenated at all. Likewise, when I load the font "Aldus LT Std" -- which only has the "fi" and "fl" ligatures, but no "ff", "ffi", "ffl", or "ft" ligatures -- the word "wolffish" is hyphenated as well, whereas "dwarfish", "calflike", and "rufflike" still aren't hyphenated.
Somewhat surprisingly, I've discovered that if I comment out the instruction \usepackage{fontspec}
, hyphenation does work once again in LuaLaTeX
. However, if the fontspec
package is not loaded explicitly, one can't access fonts other than "Computer Modern".
Questions: Has LuaLaTeX's hyphenation algorithm changed recently, and/or has fontspec
changed recently? (Decidedly for the worse, I'm tempted to say...) Alternatively, has the \hyphenation
command become obsolete? If it's the latter, which command should I be using instead to specify hyphenation points?
fontspec
is not loaded, the default font iscmr10
, not Latin Modern. This seems a bug with OpenType fonts: it fails with all ligatures.luaotfload
bug when innode
mode, withRenderer=Basic
(base
mode) fontspec option I get the hyphenation correctly.luaotfload
package) as an answer so that I can upvote it.