# Changing the operator font with unicode-math loaded

How could I change the operator font to, let's say, the sans serif style, with the unicode-math package loaded?

The following code only works without that package:

\documentclass{article}
%\usepackage{unicode-math}
\DeclareSymbolFont{sfoperators}{OT1}{cmss}{m}{n}
\SetSymbolFont{sfoperators}{bold}{OT1}{cmss}{b}{n}
\makeatletter
\renewcommand{\operator@font}{\mathgroup\symsfoperators}
\makeatother

\begin{document}
$\sin x$
\end{document}


I believe that the right way to use a sans serif font for operators with the unicode-math package is the following:

\documentclass{article}

\usepackage{unicode-math}

\ExplSyntaxOn
\makeatletter
\renewcommand{\operator@font}{\um_switchto_mathsf:}
\makeatother
\ExplSyntaxOff

\begin{document}
$\sin{x}$
\end{document}


This will not work unless you use the unicode-math package. Moreover, you'll have to use xelatex or lualatex.

In the next version of unicode-math there'll be an interface for this:

\setmathfontface\mathfoo{texgyrechorus-mediumitalic.otf}
\setoperatorfont\mathfoo


Please speak up if you think there might be a better way to do this :)