I am stuck with configuring siunitx to my liking.
Using LuaLaTex and fontspec I want siunitx to print numbers and units in normal text font when in text. When in math mode I want it to print numbers in serif math font and units in sans serif text font. No matter what I change, it always affects both typesettings, inside and outside of math mode.
Her is my MWE:
\documentclass[a4paper, 10pt, german]{scrartcl}
\usepackage{polyglossia}
\setdefaultlanguage[spelling=new]{german}
\setotherlanguage{english}
\usepackage{fontspec}
\setmainfont{Tex Gyre Heros}[Scale=0.91]
\setsansfont{Tex Gyre Heros}[Scale=0.93, LetterSpace=0, WordSpace=0.96]
\setmonofont{TeX Gyre Cursor}[Scale=0.95]
\usepackage{microtype}
\usepackage{mathtools}
\usepackage{unicode-math}
\usepackage{siunitx}
\sisetup{%detect-all,
math-rm=\mathsf,
text-rm=\sffamily,
binary-units=true, %use binary units
per-mode=fraction, %\per inserts fraction
output-decimal-marker={,} %comma as decimal sperator
}
\begin{document}
In text I want siunitx to print sans serif text font: 1000kV, \SI{1000}{\kilo\volt}
In math mode I want it to print numbers in serif math font: $1000kV, \SI{1000}{\kilo\volt}$
\end{document}
Which gives this output:
What am I doing wrong here?
\SI
is encountered in math mode. What about the units, though: should they use sans serif or serif?siunitx
:) (See github.com/josephwright/siunitx/commit/…, which is for exactly this case.)