TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a document where the main font is Gotham Book. So in my preamble I have:

\setmainfont{Gotham Book}

As the fontspec manual describes, this sets the math roman font to also be Gotham Book. But the math italic font remains from the Computer Modern family.

I know that \setmathrm will change the math roman font, and there are cousins \setmathtt, \setmathsf, and \setboldmathrm. But there's no \setmathit.

What am I missing?

share|improve this question
It seems that mathspec is replaced by unicode-math. commands like \setmathrm are very limited. – Leo Liu Feb 14 '11 at 13:55
@Leo mathspec still has its place. unicode-math goes a little overboard with assuming that you actually have a unicode maths font. – Will Robertson Feb 14 '11 at 14:31
Thank you, Will. – Leo Liu Feb 14 '11 at 14:52
A plain LaTeX solution: The mathastext package. – Seamus Feb 14 '11 at 16:47
up vote 11 down vote accepted

If you do not wish to otherwise change your maths symbols, the best solution is to use the mathspec package:

Hello $a+\mathrm{b}=c$

Here, Georgia will be used for the body text and \mathrm, and Georgia Italic will be used for the italic math glyphs.

The unicode-math package (which I kinda wrote) can also do this, but it's somewhat overkill for your purposes and has the additional downside that you need to also load a Unicode mathematics font. Here's an example:

\setmathfont[range=\mathit]{Georgia Italic}
Hello $a+b=c$

Note that mathspec will not run (yet) on LuaTeX, so if you need a LuaLaTeX solution then you'll need to use unicode-math for now.

share|improve this answer
Thanks, @Will. Do I not need \setmathrm as well? It seems like with my Gotham Book example where the main font is sans serifed it didn't change the operator font without it. – Matthew Leingang Feb 14 '11 at 14:56
@Matthew Yes, \setmathrm is probably a good idea as well, but that's not what your original question at the top of the page asks :) – Will Robertson Feb 14 '11 at 14:59
\setmainfont with fontspec was changing the math roman font automatically. I didn't mention it because it was doing the thing I wanted anyway, and I was not aware of mathspec. But \setmainfont with mathspec does not change the math roman font without an additional call to \setmathrm. – Matthew Leingang Feb 14 '11 at 15:31

Thanks to Will and Leo for pointing out the mathspec package. So now I use:

\usepackage{mathspec} %loads fontspec as well
\setmainfont{Gotham Book}
\setmathrm{Gotham Book}
\setmathfont(Digits,Latin){Gotham Book}

This snippet may need optimization, but works.

share|improve this answer
I was 19 seconds too slow :) – Will Robertson Feb 14 '11 at 14:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.