[Tex/LaTex] How to change the default font of math operators

fontsmath-mode

How to change the default font of math operators? The problem is that if I use the command \DeclareMathAlphabet\mathrm{U}{eur}{b}{n}, only new defined operators will be changed in terms of its font. For the operators like \sin or \sup, no changes will take place.

\documentclass[english]{report}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsthm,amssymb}
\DeclareMathAlphabet\mathrm{U}{eur}{b}{n}

\begin{document}
$$\sin,\sup$$

\end{document}

Best Answer

The usual definition of \sin is

\mathop{\operator@font sin}\nolimits

while \operator@font means

\mathgroup\symoperators

You won't find a definition place for \symoperators, because this is a byproduct of a

\DeclareSymbolFont{operators}...

instruction. So what you need is a new symbol font rather than a math alphabet.

\documentclass{article}

\DeclareSymbolFont{euleroperators}{U}{eur}{m}{n}
\SetSymbolFont{euleroperators}{bold}{U}{eur}{b}{n}

\makeatletter
\renewcommand{\operator@font}{\mathgroup\symeuleroperators}
\makeatother

\begin{document}
$\sin(\pi/2-\alpha)=\log 1+\cos\alpha$
\end{document}

enter image description here

This will also work when amsmath is loaded and \operatorname or \DeclareMathOperator are used.

If you also want to define a new \matheul command, add

\DeclareSymbolFontAlphabet{\matheul}{euleroperators}

to the commands above. Note that \mathrm will continue to act as before.