I seem to have stumbled upon an inconsistency when using both siunitx
and sansmath
- I need to have the same expressions in roman and sans-serif fonts.
Consider the following example:
\documentclass{article}
%\usepackage{sansmath} %% first without sansmath
\usepackage{siunitx}
\sisetup{detect-all=true}
\begin{document}
Roman: $F_1=\SI{12.34}{kt/m^{3}}$ (outside math mode: \SI{12.34}{kt/m^{3}})
\bigskip
\sffamily sffamily:
$F_1=\SI{12.34}{kt/m^{3}}$ (outside math mode: \SI{12.34}{kt/m^{3}})
\bigskip
%\sansmath plus sansmath:
%$F_1=\SI{12.34}{kt/m^{3}}$ (outside math mode: \SI{12.34}{kt/m^{3}})
\end{document}
So indeed, siunitx
detects the sf-ness (and there is no difference when using math mode). However, the F_1
is still roman.
But if I uncomment the sansmath package, like so:
\documentclass{article}
\usepackage{sansmath} %% first without sansmath
\usepackage{siunitx}
\sisetup{detect-all=true}
\begin{document}
Roman: $F_1=\SI{12.34}{kt/m^{3}}$ (outside math mode: \SI{12.34}{kt/m^{3}})
\bigskip
\sffamily sffamily:
$F_1=\SI{12.34}{kt/m^{3}}$ (outside math mode: \SI{12.34}{kt/m^{3}})
\bigskip
\sansmath plus sansmath:
$F_1=\SI{12.34}{kt/m^{3}}$ (outside math mode: \SI{12.34}{kt/m^{3}})
\end{document}
the result becomes
So now
siunitx
typesets the numbers, but not the letters in the unit, in roman font, even before \sansmath
is used (or if it is not used at all), but not when called without math mode! Redefining math-rm=\mathsf
and the like did not work for me.
As a workaround I could use e.g. $F_1=12.34\,\si{kt/m^{3}}$
, but that screws up some of the nice features of siunitx
(e.g. spacing and automatic change of decimal sign), and the exponent 3
in the unit is still roman. Is there anything smarter, such as a suitable font redefinition?