[Tex/LaTex] ‘Not element of’ in Latin Modern

latin-modernluatexunicodeunicode-mathxetex

In the following example, the ∉ symbol does not look good.

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}
\begin{document}
This does not show: $\notin$ \\
This does not look good: $\not\in$
\end{document}

MWE output

\not\in works when not loading unicode-math, but unicode-math somehow prevents it from working (?). The Unicode character 0x2209 (\notin) does not seem to be included in the Latin Modern Math font. I know that I can load the Unicode character from another font, but I just want the output to look like \not\in in Computer Modern.

edit: To clarify, I just want the output to look like \not\in without using unicode-math. I want to use unicode-math for reasons not visible in this example.

Best Answer

After last Khaled's comment, here's something that seems to work

\Umathchardef\xnot="3 \symoperators "0338
\AtBeginDocument{
  \renewcommand\not[1]{#1\xnot}
  \renewcommand{\notin}{\not\in}
}

Then

$a\not\in b \notin c$

will work (although the placement doesn't seem to be optimal).

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}

\Umathchardef\xnot="3 \symoperators "0338
\AtBeginDocument{\renewcommand\not[1]{#1\xnot}
\renewcommand{\notin}{\in\xnot}}

\begin{document}

$a \not\in S_{\not\in}$

$a\in\xnot b \notin c$

$a\in b \in c$

\end{document}

enter image description here

A possible improvement is to say

\Umathchardef\xnot="3 \symoperators "0338
\AtBeginDocument{
  \renewcommand\not[1]{#1\mathrel{\mkern1mu}\xnot}
  \renewcommand{\notin}{\not\in}
}

that pushes the slash slightly to the right, so that the upper end is lined up with the terminators of the \in symbol.

enter image description here

Note: this definitely doesn't work with XITS Math or Asana Math, which, however, have the proper symbol.

UPDATE

As of January 2013, the problem seems to be solved; here's the minimal example:

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{Latin Modern Roman}
\setmathfont{Latin Modern Math}

\begin{document}

$a \not\in S_{\not\in}$

$a \notin S_{\notin}$

\end{document}

enter image description here

Both LuaLaTeX and XeLaTeX give the correct result.

FURTHER UPDATES

The code was broken again, but version 0.8j of unicode-math seems to have fixed the issues.