I am using pdflatex to create a scientific document and I'd like to know if there is a way to change the font of numbers in math equations to a sans serif type.

Right now with the following font settings the combination of serif numbers and sans serif units looks weird imo.


enter image description here

I found this solution but is this the best way to do it ?


The simplest PDFLaTeX-compatible approach is to load mathastext, which uses your text font for letters and numerals in math mode. Another is to load a sans-serif math font, such as the newtxsf package.

If you are allowed to use XeLaTeX or LuaLaTeX, they give you more choices.

  • Thank you, I will use the newtxsf package although it converts the complete math font to sans serif not only the numbers but I guess that looks cleaner than using a mixture of both types... – LaTeX_Ghost Oct 4 '18 at 12:22
  • @LaTeX_Ghost I guessed so too, and I guessed that's what you wanted. If you want to change only numbers, mathastext does have a couple of options for the digits. – Davislor Oct 4 '18 at 19:07
  • @LaTeX_Ghost For example, you could start with newtexsf, then load newtxtext or tgtermes, then \usepackage[nodigits]{mathastext} to replace the letters but not the digits. – Davislor Oct 4 '18 at 21:21

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.