In Short: I can change the math font, but it is not working for numbers.

My document has a few formulae but only basic alphanumeric characters with very limited symbols (square root being the only particular character outside of the most common)

I have looked at the following questions:

And have gotten this far using the mathastext package (I'm on v1.3w):

enter image description here

I have made sure to load mathastext after fontspec.

But, while letters show as expected, numbers still have serifs.


  • I am compiling with LuaLatex due to other packages in the mix


    \center{Body Text}

2 Answers 2


You have to load fontspec with the no-math option.

%    Path=fonts/,
%    Extension=.ttf
\setmainfont{Impact} % a random distinctive font on my system



\begin{center}Body Text\end{center}


By the way, the command \center exists but

  • it has no argument
  • it should only be used implicitly via the center environment

enter image description here

  • Thank you, this worked perfectly. The \center was just to create the sample image, I should have removed it from my MWE, apologies for any confusion it may have caused.
    – agryson
    Jul 1, 2020 at 10:11

You could also load


And set the fonts to something like (if you’ve added a Rubik.fontspec file to your project directory):

\defaultfontfeatures{ Scale=MatchUppercase, Ligatures=TeX }
\setmathfont{Fira Math}

You can add to this any other characters the Rubik font contains, either with a hex code like "FF, a macro name, or a backtick literal. You can also do ranges, so if the font supports all of Latin-1, you could write range={up,"20-"FF}.

If the font you select does not have Greek letters, use instead:

  • I have seen "fone" into your answer and after I have understood that the word is font 😄
    – Sebastiano
    Jul 2, 2020 at 12:12
  • Nice, if I understand correctly, this would give me total granularity to have a specific character or set of characters in a specific font for formulae ? (That's much more than I need for this specific case but a nice tool to keep in the bag for later. - Thanks!)
    – agryson
    Jul 2, 2020 at 20:37
  • @agryson Yes. You can also apply any other transformation from fontspec, such as changing their color.
    – Davislor
    Jul 2, 2020 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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