[Tex/LaTex] Which Unicode math fonts support \setminus

fontsmath-modesymbolsunicode-math

What can i put into \setmathfont{<...>.otf} for the unicode-math package to make it all work (with XeLaTeX or LuaLaTeX)?

There are several suggestions on the GitHub page of unicode-math, but the first option is commercial, and the second and the third do not work with the following example:

% !TEX TS-program = xelatex

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{latinmodern-math.otf}
% \setmathfont{texgyrepagella-math.otf}
% \setmathfont{xits-math.otf}

\begin{document}
$X\setminus Y$
\end{document}

I do not get the \setminus character in the output.

The \setminus character is also missing if i do not set a math font at all (i do not know which font is used in this case). It works with xits-math, but i do not like it.

Is it expected by the way that the \setminus character is left blank without giving any warning?

Best Answer

It's quite strange that the symbol is missing in Latin Modern Math, TeX Gyre Termes Math and TeX Gyre Pagella and it's probably worth a bug report.

You can supplement single symbols with the range option to \setmathfont:

\documentclass{article}
\usepackage{unicode-math}
%\setmathfont{Latin Modern Math} % default
\setmathfont[range=\setminus]{Asana Math}

\begin{document}
$X\setminus Y$
\end{document}

enter image description here

A different possibility is to use \backslash made into a binary operator:

$X \mathbin{\backslash} Y$

that gives

enter image description here

In this case

\renewcommand{\setminus}{\mathbin{\backslash}}

would make \setminus doing what's expected. However, the redefinition must be issued at begin document, because unicode-math prepares its internal math symbol tables at that moment.

\documentclass{article}
\usepackage{unicode-math}
%\setmathfont{Latin Modern Math} % default

\AtBeginDocument{% to do this after unicode-math has done its work
  \renewcommand{\setminus}{\mathbin{\backslash}}%
}

\begin{document}
$X\setminus Y$
\end{document}
Related Question