I have changed the whole font settings by using fontspec package.


\setmainfont{Source Sans Pro}[
UprightFont     =Source Sans Pro-Light,
BoldFont        =Source Sans Pro-Semibold,
ItalicFont      =Source Sans Pro-Light Italic,
BoldItalicFont  =Source Sans Pro-Semibold Italic]



 5 km \SI{5}{\km} $\SI{5}{\km}$ $5\text{km}$

enter image description here

But when I type inside \SI environment, I want the font to be the same as in math mode. How can I achieve this?

  • 1
    As always on this site please post a full minimal example that others can copy and test as is without having to add anything. This makes it a lot easier to help you.
    – daleif
    Mar 17, 2018 at 7:12
  • @remco Yes, but how to?
    – Siwei Feng
    Mar 17, 2018 at 7:19
  • Something like that. Adapt it to what you want to expose your ptoblem.
    – Tarass
    Mar 17, 2018 at 7:34

1 Answer 1


The \SI macro in siunitx has optional parameters (list of key-value pairs). One of the keywords is 'mode', with possible values 'text', 'math'. You may have to set 'detect-mode' to false in \sisetup.
If you want to always use the math fonts for your measures/units, then you can use


This is explained in the documentation of the siunitx package. You can also select the math fonts with other package macros. Full exemple (note that I use LuaLatex):

\usepackage{mathpazo} %shows the differences between math and text mode better



  • 1
    mode=math can be used in \sisetup to fix it globally
    – Dai Bowen
    Mar 17, 2018 at 9:27

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.