5

My MWE

\documentclass[varwidth, border=0.2in]{standalone}
\usepackage{mathtools}
\usepackage{unicode-math}
\setmathfont[]{TeX Gyre Pagella Math}
\setmathfont[range={cal}]{Latin Modern Math}
\begin{document}
  The distribution of $\mathbf{X}$ is $\mathcal{P}\{\mathbf{X} = k\}$.
\end{document}

produces

enter image description here

Note the absence of the \mathcal{P} character. Confusingly, if I comment out \usepackage{mathtools}, it appears to work:

enter image description here

EDIT: I took the advice from the duplicate bug — it works, but only partly. Now I'm losing \mathscr characters, although I have the \mathcal characters back:

\documentclass[varwidth, border=0.2in]{standalone}
\usepackage{mathtools}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Pagella Math}
\setmathfont[range={cal}]{Latin Modern Math}
\setmathfont[range={scr}]{TeX Gyre Pagella Math} %% Added this line
\begin{document}
  The distribution of $\mathbf{X}$ is $\mathcal{P}\{\mathbf{X} = k\}$,
  in the collection $\mathscr{P}$.
\end{document}

enter image description here

I've tried setting the math fonts in many different ways, but one of the two alphabets is always disappearing.

EDIT: The closest I've come to a workaround is to load amsmath, then unicode-math, then mathtools. (Yes, I understand this is counter the documentation of unicode-math.) That works in that I'm able to see all my characters. Unfortunately, changing the font with \small, for example, changes all boldface math characters to non-boldface. Not ideal.

0

3 Answers 3

2

This link may help you: https://tex.stackexchange.com/a/315137/115042

In order to solve the problem you have to load the math font again. I think it's some kind of overload between the packages.

\documentclass[varwidth, border=0.2in]{standalone}
\usepackage{mathtools}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont{XITS Math}[
  range = \mathcal,
]
\setmathfont{Latin Modern Math}[
  range = \mathscr
]
\begin{document}
  The distribution of $\mathbf{X}$ is $\mathcal{P} \{\mathbf{X} = k\}$.
\end{document}

Using the code above I get the follow result:

enter image description here

2
  • 1
    So what about getting the original \mathcal{P}, not the script-like one \mathscr{P}?
    – Werner
    Sep 26, 2016 at 6:11
  • This script-like look in the above is, I think, correct — at least, it matches the appearance of \mathcal{P} in XITS when I run a standalone test.
    – Derek
    Sep 26, 2016 at 15:07
1

I don't know if this is a good option for you, but if you are only using \mathbf in a limited way e.g. for vectors, etc., then setting mathbf=sym might be a reasonable workaround.

\RequirePackage{luatex85}
\documentclass[border=10pt]{standalone}
\usepackage{mathtools}
\usepackage[mathbf=sym]{unicode-math}
\setmathfont{TeX Gyre Pagella Math}
\setmathfont{Latin Modern Math}[range={cal}]
\begin{document}
  The distribution of $\mathbf{X}$ is $\mathcal{P}\{\mathbf{X} = k\}$, in the collection $\mathscr{P}$.
\end{document}

<code>mathbf=sym</code>

Not the answer you're looking for? Browse other questions tagged .