Kerning – How to Allow Line Breaking Without Affecting Kerning

ellipsiskerningline-breaking

I'm trying to get LaTeX to allow a line break after an ellipsis. The problem is that, when I type \allowbreak after \ldots, the kerning between the ellipsis and the next immediate character is messed up. In the MWE below, I have shown many pairs of the kerning between an ellipsis and the next immediate character with and without a line break after the ellipsis. As you can see, adding \allowbreak results in unkerned letterspacing. I want to automatically allow line breaking after an ellipsis without affecting the kerning.

Edit: The kerning is also messed up with the follwing fonts, which I just tested: Verdana Pro, Noto Serif, Roboto Serif, Source Serif Pro

\documentclass{article}
\raggedright
\usepackage{fontspec}
\setmainfont{Source Serif 4}[%Available for free on Google Fonts.
    Kerning=On%
]
\begin{document}
text\ldots{}apple\\
text\ldots{}\allowbreak{}apple\\

text\ldots{}candy\\
text\ldots{}\allowbreak{}candy\\

text\ldots{}banana\\
text\ldots{}\allowbreak{}banana\\

text\ldots{}doughnut\\
text\ldots{}\allowbreak{}doughnut\\

text\ldots{}eggplant\\
text\ldots{}\allowbreak{}eggplant\\

text\ldots{}fish\\
text\ldots{}\allowbreak{}fish\\

text\ldots{}grape\\
text\ldots{}\allowbreak{}grape\\

text\ldots{}henry\\
text\ldots{}\allowbreak{}henry\\

text\ldots{}salmon\\
text\ldots{}\allowbreak{}salmon\\

text\ldots{}tenth\\
text\ldots{}\allowbreak{}tenth\\

text\ldots{}ultra\\
text\ldots{}\allowbreak{}ultra\\

text\ldots{}violet\\
text\ldots{}\allowbreak{}violet\\

text\ldots{}water\\
text\ldots{}\allowbreak{}water\\

text\ldots{}xbox\\
text\ldots{}\allowbreak{}xbox\\

text\ldots{}yellow\\
text\ldots{}\allowbreak{}yellow\\

text\ldots{}zodiac\\
text\ldots{}\allowbreak{}zodiac\\
\end{document}

Best Answer

I don't think that I ever used the ellipsis before a word without a space, but if you really have that you can try \discretionary (I compiled with lualatex):

\documentclass{article}
\raggedright
\usepackage{fontspec}
\setmainfont{Noto Serif}[% replaced
    Kerning=On%
]

\begin{document}
text\ldots{}yellow\\
text\ldots{}\allowbreak{}yellow\\
text\ldots{}\discretionary{}{}{}yellow

\bigskip
\parbox{2mm}
{%
text\ldots{}yellow\\
text\ldots{}\allowbreak{}yellow\\
text\ldots{}\discretionary{}{}{}yellow
}
\end{document}

enter image description here

Related Question