Problem with mathematical text in xelatex

Use \setmathrm:

\documentclass{article}

\usepackage{unicode-math}

\setmainfont{Kohinoor Devanagari}[Script=Devanagari,Mapping=velthuis]

\setmathfont{STIX2Math.otf}[Scale=MatchUppercase]
\setmathrm{STIX2Math.otf}[Scale=MatchUppercase]

\begin{document}

saMkriyaa $\bigtriangledown$ jo $x\bigtriangledown y=x \sin y$  dvaaraa paribhaa.sit hai|
\(\sin^2\theta+\cos^2\theta=1\)

\end{document}

enter image description here

Change back the Devanagari font, I used one on my system.


That’s because the operator font is by default \mathrm, which is by default \rmfamily, which you set to map Latin letters to Devanagari.

Like egreg said, you can fix this with \setmathrm, although unicode-math also has a \setoperatorfont command. For example, to use sans-serif operator names with the Latin script:

\setmathsf{NewComputerModernSans}[Scale=MatchLowercase] % For example.
\setoperatorfont\mathsf

Tags:

Xetex