2

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.

\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[scaled]{uarial}
\renewcommand{\familydefault}{\sfdefault}

enter image description here

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

  • I don't recommend the uarial package. See https://tex.stackexchange.com/questions/309100/arial-font-baseline-for-letters-i-and-l. – Ulrike Fischer Oct 04 '18 at 07:15

1 Answers1

1

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.

Davislor
  • 44,045
  • 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 04 '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 04 '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 04 '18 at 21:21