Fixing mathit spacing with unicode-math

This is the consequence of a bad decision in unicode-math: they named \mathit the normal math italic letters, instead of respecting the LaTeX convention of referring to them as \mathnormal; \mathit should choose the text italic font, in order to make unicode-math a drop-in replacement.

I wouldn't expect different output when unicode-math is loaded or not; but this simple example shows the bug:

\documentclass{article}
%\usepackage{unicode-math}

\begin{document}

$\mathit{different}$

$different$

\end{document}

If the line with unicode-math is commented out, we get

enter image description here

If I uncomment the line, I get

enter image description here

which is definitely wrong.

Workaround:

Define a new math alphabet:

\documentclass{article}
\usepackage{unicode-math}

\DeclareMathAlphabet{\Lmathit}{\encodingdefault}{\familydefault}{m}{it}

\begin{document}

$\Lmathit{different}$

$different$

\end{document}

If you use lhs2TeX, you can add

\renewcommand{\Conid}[1]{\Lmathit{#1}}
\renewcommand{\Varid}[1]{\Lmathit{#1}}

after loading it.

This shouldn't raise the Too many math alphabets error; if it does, then add the code you find between \makeatletter and \makeatother in https://tex.stackexchange.com/a/100428/4427