# Can siunitx use roman when familydefault is set to sans serif? [duplicate]


I have noticed that it can get halfway there if you use \sfseries instead of \familydefault, meaning that text and  will be typeset sans serif, while  can be typeset roman. That solution is a problem for my documents, since I use sans serif for section headings as well.

-
Welcome to TeX.sx!. Virtually the same basic question came up very recently: tex.stackexchange.com/questions/66713/…. I don't blame you for missing this, as the link is much clearer to me than anyone else, but we might consider this question to be a duplicate of that one (same underlying issue). –  Joseph Wright Aug 14 '12 at 19:13
Yes, it looks like this is a duplicate. I made one other change than what your answer described there, so I will answer and close. Thanks! –  Thav Aug 15 '12 at 12:06

## marked as duplicate by Marco Daniel, Brent.Longborough, Martin Schröder, tohecz, JakeAug 15 '12 at 12:52

Joseph pointed me in the right direction with this question Can I make siunitx commands use serif fonts like the rest of the math in beamer?. Beyond adding the \AtBeginDocument as recommended there, I changed text-rm=\rmfamily to text-rm=\sffamily to get sans serif mid text, then removed the mode setting and changed detect-mode=true.

\documentclass[12pt]{article} % use larger type; default would be 10pt
\renewcommand{\familydefault}{\sfdefault}
\usepackage{siunitx}
\sisetup{detect-mode=true,detect-family=false,
detect-display-math=false,detect-shape=false}
\AtBeginDocument{\sisetup{math-rm=\mathrm, text-rm=\sffamily}}

\begin{document}
text where you have \SI{450}{\volt}\\
$\textrm{inline math} \quad \sin^2(x) \quad \SI{450}{\volt}\\ \textrm{textrm V}$
$\textrm{math environment}\quad \SI{450}{\volt}$
\end{document}


-