# Change font of math operators to fontspec font

I'm trying to change the font of math operators (\sin, \limsup, etc.) to Adobe Garamond Pro, which I'm loading via fontspec for use with LuaTeX. I've tried modifying this code by egreg as follows:

\documentclass[letter]{article}
\usepackage{fontspec}

% egreg code

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

% Test code
\begin{document}
$\sup$

sup
\end{document}


The math operators display in Computer Modern even when I enclose the font name with quotation marks. Do I need to import Adobe Garamond Pro and assign it its own name within the preamble in order for it to be recognizable by \DeclareSymbolFont?

EDIT: It turns out that the problem was caused by my use of lmodern in conjunction with fontspec. Without lmodern, everything works flawlessly.

• Please provide an actual compilable file. This one should be pretty short, but should still start at \documentclass and end at \end{document}. – jon Nov 26 '16 at 6:26
• @jon I've updated the example. – Rations Nov 26 '16 at 6:43

You need no special code:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Futura} % a very distinctive one

\begin{document}

Math: $\sup$

Text: sup

\end{document}


I changed the font because I don't have Adobe Garamond Pro, but it's the same.

• You're right. It turns out that my problem was caused by the lmodern package, which I had loaded at the top of the preamble. Do you know why this might be? – Rations Nov 26 '16 at 16:09
• @Rations The lmodern package should not be loaded along with fontspec. – egreg Nov 26 '16 at 16:11