0

I am planning on writing my document using opensans font and want to use the siunitx package. My minimal code is given below:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[default,oldstyle,scale=0.95]{opensans}
\usepackage[alsoload=synchem,%
            range-phrase=--,%
            repeatunits=false%
            ]{siunitx}  
\sisetup{range-units=single}
\sisetup{separate-uncertainty}
\sisetup{detect-family}
\sisetup{detect-weight}
\sisetup{detect-all}
\begin{document}
The temperature measured was \SI{14(1)}{\kelvin} and was observed between time points \SIrange{34}{90}{\second}.

\SI{1.45(20)e-4}{\Molar}

There are 365 days in a year. And I want \SI{2.6(4)e3}{\hectare} land allocation.
\end{document}

As instructed in the siunitx manual (page 17 and 19), the \sisetup{detect-family} and/or \sisetup{detect-weight} and/or \sisetup{detect-all} should make the numbers and units in the required font. But it does not. Any suggestions on how to fix this?

This is my Output: My output

P.S: I have seen this: Math font changing and siunitx?, but I am not sure it directly solves my problem.

Font choice not respected in siunitx posts \sisetup{detect-all} as the solution, but as you can see in my code, I have included it and it doesn't seem to work.

EDIT1: I use pdflatex and TexMaker as my frontend.

1 Answer 1

3

You may have noticed that normal math also uses a different font (for example $14\pm 1$). This is because the opensans package only changes the text font. siunitx uses the math font by default.

As a solution you can use the mathastext package that uses the current text font for math.

MWE:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[default,oldstyle,scale=0.95]{opensans}
\usepackage[alsoload=synchem,%
            range-phrase=--,%
            repeatunits=false%
            ]{siunitx}  
\sisetup{range-units=single}
\sisetup{separate-uncertainty}
\usepackage{mathastext}
\begin{document}
The temperature measured was \SI{14(1)}{\kelvin} and was observed between time points \SIrange{34}{90}{\second}.

\SI{1.45(20)e-4}{\Molar}

There are 365 days in a year. And I want \SI{2.6(4)e3}{\hectare} land allocation.
\end{document}

Result:

enter image description here

1
  • Explained succinctly, works brilliantly!
    – Miloop
    Commented Apr 23, 2021 at 12:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .