# Color highlighting with soul package does not work well with ligatures

The picture below says it all. Color highlighting with the soul package prevents a correct rendering of the ff ligature. Is there a way to fix this?

\documentclass{article}
\usepackage{color, soul}
\begin{document}
off -- offer \hl{off -- offer}
\end{document}


EDIT

cfr's answer below demonstrates that the problem disappears if the words are boxed with \mbox. This will, however, break hyphenation and line-breaking, features that I would like to retain.

• You could just box the individual words. That would break hyphenation, but not line-breaking, I guess.
– cfr
Apr 4, 2015 at 19:46

Boxing the text to be highlighted avoids the problem:

\documentclass{article}
\usepackage{xcolor, soul}
\begin{document}
off -- offer \hl{\mbox{off -- offer}}
\end{document}


• But the only reason I'm using soul's \hl command over color's \colorbox command is that the former allows line breaks. \mbox would take that function away again :( Apr 4, 2015 at 19:41
• @Sverre Well, you didn't say that in the question!
– cfr
Apr 4, 2015 at 19:44
• I know, but it's hard to predict in advance that the proposed solution will destroy something else in your document. I prefer to ask simple questions rather than say "here is a problem I have, and here are a thousand other things I do in my document that anyone trying to solve my problem will need to consider" :) Apr 4, 2015 at 19:46
• @Sverre Fair enough. I'm not complaining. Just that you have to expect that answers may not always solve the actual problem in that case, since it is impossible to guess what additional desiderata you may have in mind :).
– cfr
Apr 4, 2015 at 19:48
• For sure - I am always aware of that possible problem. But I prefer to deal with that problem when and if it arises. So I'll edit the question accordingly now. Apr 4, 2015 at 19:51