6

I would like to achieve the following for the number part using the math-rm and parse-number option in siunitx:

$[(12+2)\times n]$

However, I observe that when I turn the math-rm option to \mathnormal, the font of number is changed:

\begin{align*}
\SI[math-rm=\mathnormal, parse-numbers=false]{[(12+2)\times n]}{g.mol^{-1}}&=\SI{420}{g.mol^{-1}} \\
\SI[parse-numbers=false]{[(12+2)\times n]}{g.mol^{-1}}&=\SI{420}{g.mol^{-1}} 
\end{align*}

How can I format the number in the number range as in $[(12+2)\times n]$ but doesn't change the number font in math environment?

1 Answer 1

6

You don't have to use \mathnormal, which changes the math roman font, but \ensuremath.

MWE:

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

\begin{align*}
\SI[math-rm=\ensuremath, parse-numbers=false]{[(12+2)\times n]}{g.mol^{-1}}&=\SI{420}{g.mol^{-1}} \\
\SI[parse-numbers=false]{[(12+2)\times n]}{g.mol^{-1}}&=\SI{420}{g.mol^{-1}}
\end{align*}

\end{document} 

Output:

enter image description here

You must log in to answer this question.

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