I am using both \mathscr
and \mathcal
to different meanings and expecting different characters to appear.
I recently switched to XeTeX and started using new fonts (TeX Gyre Pagella in this example) with the packages fontspec
and unicode-math
. As suggested by the answer to this question, I override \mathcal
and \mathscr
with characters coming from a different font (XITS-math).
Unfortunately this has the effect of mangling the setting of a (seemingly) unrelated math symbol : the nth root.
\documentclass{minimal}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
% Math font overrides ----
\setmathfont[range={\mathcal,\mathbfcal},
StylisticSet=1,Extension=.otf,BoldFont=*bold]{xits-math}
\setmathfont[range=\mathscr,Extension=.otf,BoldFont=*bold]{xits-math}
\begin{document}
Some math letters:
\[ \mathbb{C} \mathcal{C} \mathscr{C} \mathfrak{C} \]
Here's a big $n$-th root:
\[ F_k(x,y,z) = \sqrt[n]{\sum_{i=1}^{k} f_i^n} \,. \]
\end{document}
This code produces the following result:
All Cs are different, but the n is too close from the radical symbol (√).
Commenting out the math font overrides yield the correct result for the nth root (but \mathcal
and \mathscr
now produce identical characters):
My questions are then
- Why does overriding
\mathscr
and\mathcal
affects the setting of the nth root ? - How can I avoid this problem ? (or do I have to change fonts ?)
\sqrt[n\;]
to improve the looks...\setmathfont
overwrites the math fontdimens, and the one from xits are not suitable for pagella. There is no good solution for this problem, see e.g. tex.stackexchange.com/a/375243/2388.unicode-math
avoids overriding math fontdimens not relevant for\mathcal
,\mathscr
range?