Latin text not hyphenated at all with LuaLaTeX and polyglossia

I recently noticed that there are numerous under- and overfull hboxes in the document I'm working on. Further inspection revealed that such problems almost always arose when there was Latin text involved; seemingly, LaTeX doesn't see any hyphenation points, so it can't break lines and paragraphs end up looking ugly.

This is a MWE:

\documentclass{article}

\usepackage{polyglossia}

\setdefaultlanguage{english}
\setotherlanguage[variant=classic]{latin}

\begin{document}
\showhyphens{\textenglish{amusing}}
\showhyphens{\textlatin{instigare}}
\end{document}


Compiling this code with LuaLaTeX yields a log file; here are the relevant fragments:

[][] \EU2/lmr/m/n/10 amus-ing
[][] \EU2/lmr/m/n/10 instigare

Omitting the variant option of the Latin language (variant=classic) does not change the result.

I have left out some things, such as the font setup, which, from what I have seen in my investigations, is involved in the matter (don't know why, though). However, I hope the example provided is enough — if it isn't, please, ask. For the record, this question seems somewhat relevant, although I haven't been able to extrapolate the results to my case.

EDIT: This is another MWE aimed at XeLaTeX, under which -as pointed out by egreg- it seems to work:

\documentclass{article}

\usepackage{polyglossia}
\usepackage{xltxtra}

\setdefaultlanguage{english}
\setotherlanguage[variant=classic]{latin}

\begin{document}
\showhyphens{\textenglish{amusing}}
\showhyphens{\textlatin{instigare}}
\end{document}


In the corresponding log file:

\EU1/lmr/m/n/10 amus-ing
[]\EU1/lmr/m/n/10 in-sti-gare

• A bug in the loading of the hyphenation patterns with LuaLaTeX? I get the expected result with XeLaTeX (using the \showhyphens version provided by xltxtra). – egreg Jun 21 '15 at 13:04
• I added \setotherlanguage{italian} just for a check; if I run with lualatex -recorder, I see that hyph-it.pat.txt is read in, but there's no entry for the corresponding file for Latin. The same if I call Latin without the variant=classic option. – egreg Jun 21 '15 at 13:13
• @egreg Thank you. It indeed works with XeLaTeX. I added a modified MWE following your comment. – Kalrish Jun 21 '15 at 13:13
• @egreg These are, I believe, the relevant files in the polyglossia package: gloss-latin.ldf and gloss-italian.ldf. I barely understand them, but at the top of the Latin one, there are a couple of lines commented out which seem relevant to the matter. – Kalrish Jun 21 '15 at 13:16
• Very interesting finding! This seems really a bug in gloss-latin.ldf. Up to now I'm able to get hyphenation with \setotherlanguage{latin} (no variant=classic option). Stay tuned. – egreg Jun 21 '15 at 13:22

It's a bug in gloss-latin.ldf that doesn't advertise the pattern file name for LuaLaTeX.

Workaround: do it yourself.

\documentclass{article}

\usepackage{polyglossia}

\setdefaultlanguage{english}
\setotherlanguage[variant=classic]{latin}
\setotherlanguage{italian}

\makeatletter
\def\latin@language{%
\language=\l@classiclatin
\xpg@set@language@luatex@ii{classiclatin}%
}
\makeatother

\begin{document}

\message{\the\language -->}\showhyphens{amusing}

\begin{otherlanguage*}{latin}
\message{\the\language -->}\showhyphens{instigare}
\end{otherlanguage*}

\begin{otherlanguage*}{italian}
\message{\the\language -->}\showhyphens{istigare}
\end{otherlanguage*}
\end{document}


Here's the output on the terminal; note that 54 is exactly the number assigned to the classic Latin hyphenation patterns.

0-->
Underfull \hbox (badness 10000) in paragraph at lines 16--16
[][] \EU2/lmr/m/n/10 amus-ing
54-->
Underfull \hbox (badness 10000) in paragraph at lines 19--19
[][] \EU2/lmr/m/n/10 in-sti-gare
51-->
Underfull \hbox (badness 10000) in paragraph at lines 23--23
[][] \EU2/lmr/m/n/10 isti-ga-re


I have fixed the bug in Polyglossia with this commit and will make an upload to CTAN shortly. Many thanks to Enrico for investigating and suggesting a workaround.

• Working here (TL '15, polyglossia v1.40.1) when I set "variant=classic", but still broken for ="modern" and ="medieval" or for not setting a variant at all. – Florian Aug 2 '15 at 11:31
• @Florian I’ve just pushed a fix to master on GitHub if you want to try it out; otherwise I’ll make an upload to CTAN in the next few days anyway. – Arthur Reutenauer Aug 2 '15 at 23:29