# xcolor breaking ligatures

In some behind the scenes work for spacing reasons, the pieces of a syllable get split up in gregoriotex and then reassembled for printing. Normally this works fine, but we're running into some ligature problems when styling is involved. The results can be seen in the following MWE:

\documentclass{article}
\usepackage{xcolor}

\begin{document}
\Huge
{\color{red}f}{\color{red}i}

{\color{red}fi}

{\itshape f}{\itshape i}

{\itshape fi}
\end{document}


In the first example, the fact that the "f" and the "i" have color applied to them separately, the ligature (shown in the second line) between them doesn't show (even though the color is the same). On the other hand, this doesn't happen for \itshape. Is there a way for the color example to work more like the italics example?

LuaTeX tag is used because the gregoriotex package (into which any solution is destined to be inserted) is only compatible with Lua(La)TeX.

the normal color command inserts whatsits and this breaks ligatures. You can use luacolor instead:

\documentclass{article}
\usepackage{luacolor,xcolor}

\begin{document}
\Huge
{\color{red}f}{\color{red}i}

{\color{red}fi}

{\itshape f}{\itshape i}

{\itshape fi}
\end{document}


• Works fine for LuaLaTeX, but not for LuaTeX. As we generally try to maintain gregoriotex as compatible with both, is there a LuaTeX equivalent for luacolor? – rpspringuel May 21 at 19:55
• I don't know one, it would be certainly possible to write one, but you would have to find someone to do it. – Ulrike Fischer May 21 at 20:13
• Wish I had someone’s contact information. Unfortunately it got lost in a computer upgrade years ago. 😋 – rpspringuel May 22 at 23:51
• I'm running into some problems with color changes not happening inside discretionaries. I'm still working on isolating a simple MWE, should I post it here or ask a new question once I manage to get the MWE? – rpspringuel May 28 at 19:34
• always ask a new question. – Ulrike Fischer May 28 at 20:01