Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
2  
You get a warning in the log file, not on the terminal. With xelatex on your document as posted I get: Missing character: There is no ⧵ in font [latinmodern-math.otf]/ICU:script=math ;language=DFLT;! –  David Carlisle Oct 23 '13 at 15:33
    
Thanks for the explanation. I am still wondering if i can find a usual-looking font with all common math characters, or if i should change back to amssymb. –  Alexey Oct 23 '13 at 15:47
1  
I had forgotten, but turns out I made a bug report to the font creators, about exactly one year ago, via an email to Boguslaw Jackowski with title \setminus symbol does not show in pdf (Termes, Pagella, Latin Modern). Perhaps a second attempt should be done? –  jfbu Oct 23 '13 at 22:00

3 Answers 3

up vote 9 down vote accepted

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.

share|improve this answer
    
I recalled that, and I found a file from October of last year where I had noted TL2012 \setminus does not show up with TGTermes-Math, TGPagella-math, LatinModern-Math Math I don't think I did bug report as I recalled that two previous bug reports I sent on fonts remained without effect two or three years ago. –  jfbu Oct 23 '13 at 21:53
1  
sorry I did make a bug report to Boguslaw Jackowski on October 27, 2012. –  jfbu Oct 23 '13 at 21:58
    
unicode-math offers an option to specify the slash provided by the font. For example, on page 14, the manual explains how to get slashes with Cambria even though it does not provide all of those specified by unicode. Just before that, it lists the different versions of backward slashes. Yet there seems to be no similar option for telling unicode-math what the font provides in this case. If filing bugs on the fonts is proving unproductive, maybe it would be worth a feature request to whoever maintains unicode-math? –  cfr Mar 25 at 0:35
    
@cfr After rereading that section, my feeling is that there's no agreement on what symbols should mean and how they should be used. –  egreg Mar 25 at 7:32
    
@egreg Perhaps this is an area where unicode-math could offer (or provide an interface) to substitute one slash with another. –  Will Robertson Jul 1 at 0:46

load all math stuff before unicode-math

\documentclass{article}
\usepackage{amssymb}
\usepackage{unicode-math}
\setmathfont{XITSMath}

\begin{document}
$X\setminus Y$
\end{document}
share|improve this answer
    
I get fontspec error: "font-not-found" at \setmathfont{XITSMath}. What should i install? –  Alexey Oct 23 '13 at 21:44
    
In any case, doing \usepackage{amssymb} before \usepackage{unicode-math} does not help. –  Alexey Oct 23 '13 at 21:48
    
@Alexey Why should it help? In amssymb there's no mention of \setminus and unicode-math redefines it to choose U+29F5 REVERSE SOLIDUS OPERATOR. –  egreg Oct 23 '13 at 21:58
    
ok, so this answer was not about getting \setminus back. –  Alexey Oct 23 '13 at 22:27
1  
@Alexey: no, only \smallsetminus is defined by all math otf fonts. And \setminus only by XITS, Asana, and Cambria. However, the otf math font should be loaded after the other "traditional" math stuff. That's what my example shows. –  Herbert Oct 24 '13 at 12:44

It works with

\setmathfont{Asana-Math.otf}

or as noted in the question, with

\setmathfont{xits-math.otf}

as mentioned in comments, if it doesn't work you get a warning in the log, eg with latinmodern:

Missing character: There is no ⧵ in font [latinmodern-math.otf]/ICU:script=math ;language=DFLT;!
share|improve this answer
    
I have notice this, but it looks like a rather incompatible replacement for amssymb with the regular font. Is there no way to make it look like the usual font with unicode-math? –  Alexey Oct 23 '13 at 16:22
    
@Alexey well in principle youjust... need to pull the amsfonts together and re-encode them into a big otf font in Unicode order, I assume that's the way latin-modern is headed but I do not know the details of any work in that area. –  David Carlisle Oct 23 '13 at 16:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.