5

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}
\setmainfont{Adobe Garamond Pro}

% egreg code
\DeclareSymbolFont{garamondOperators}{OT1}{"Adobe Garamond Pro"}{m}{n}
\SetSymbolFont{garamondOperators}{bold}{OT1}{"Adobe Garamond Pro"}{b}{n}

\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.

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

1 Answer 1

3

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.

enter image description here

2
  • 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
    Commented Nov 26, 2016 at 16:09
  • @Rations The lmodern package should not be loaded along with fontspec.
    – egreg
    Commented Nov 26, 2016 at 16:11

You must log in to answer this question.

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