2

I'm using the unicode-math package with LuaLaTeX (TeXlive 2017). I'm trying to set the math font for the \setminus character as in this answer, because it doesn't exist in the Latin Modern math font.

With the following MWE:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\begin{document}
\[ \pi \in \mathbb{R} \setminus \mathbb{Q} \]
\end{document}

I get this result:

result with no second setmathfont

As expected, the \setminus character doesn't appear, and I have the Latin Modern font.

But now if I try this:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range=\setminus]{XITS Math} % This changed
\begin{document}
\[ \pi \in \mathbb{R} \setminus \mathbb{Q} \]
\end{document}

I get this:

enter image description here

The \setminus character now appears, but the mathbb font changed! And if I try with random letters (or the \pi character above), I see that the "normal" font remains Latin Modern. What happened?

  • The bug has been fixed with unicode-math version 0.8j, released 2018-01-07. – egreg Jan 10 '18 at 12:07
3

It is one of the side effects of the range option - it is a bit buggy. Reset things to your main font afterwards. I would also use \symbb instead of \mathbb -- it is the more modern and semantic correct command:

\documentclass{article}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range=\setminus]{XITS Math} % This changed
\setmathfont[range=\int]{Latin Modern Math} % This changed
\begin{document}
\[ \pi \in \symbb{R} \setminus \symbb{Q} \]
\end{document}

enter image description here

  • Thanks. What's the difference between mathbb and symbb? I couldn't find anything online. – Najib Idrissi Jul 25 '17 at 13:21
  • 2
    The sym** commands take the glyph from the relevant unicode block of the current math font, while the math** commands (can) use a different font (even a textfont). So I would use \sym** for all normal single glyphs variables from the set [a-Z]. – Ulrike Fischer Jul 25 '17 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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