8

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}
0

3 Answers 3

3

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.

5

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 :)

0
3

As of 2021, you can either change the operator font to something other than \mathrm with, for example,

\setoperatorfont\mathsf

or you can change the \mathrm font with \setmathrm. If you use \mathrm within \boldmath, you might also need to \setboldmathrm.

You must log in to answer this question.

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