[Tex/LaTex] Change the font of \mathrm and functions such as \cos \sin, \sup

fonts

My document has ptm as \rmdefault and math is typeset using MTpro2. I would like to change the font of the upright characters for mathematics to match the font used in the body of the document. For example, anything written as \mathrm{cos} or \cos should use the same font as the body of the document.

That way I could stop using \text{cos} whenever I want upright letters in the math which matches the font used for the body, which is annoying.

How can I do that?

Best Answer

Doing \renewcommand{\rmdefault}{ptm} is not sufficient for the purposes of math.

Load mathptmx before mtpro2 or, even better, newtxtext:

\documentclass{article}

\usepackage{mathptmx}
\let\hbar\relax % a fix for not getting a spurious error
\usepackage[lite]{mtpro2}
\usepackage{amsmath}

\begin{document}
$\cos$

$\mathrm{cos}$

$\text{cos}$
\end{document}

The following is my recommended version with newtxtext:

\documentclass{article}
\usepackage{newtxtext}
\usepackage[lite]{mtpro2}
\usepackage{amsmath}

\begin{document}
$\cos$

$\mathrm{cos}$

$\text{cos}$
\end{document}

enter image description here

Related Question