# siunitx error: “invalid-number”

Very reduced example:

\documentclass[a4paper]{article}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage{siunitx}

\begin{document}
\begin{aligned} n(O2)&=\SI{\frac{0,3}{2}}{\mol}\qquad\qquad &n(Fe3O4)&=\SI{0,3}{\mol} % <- this line \end{aligned}
\end{document}


However I end up with

siunitx error: "invalid-token-in-number"
n(O2)&=\SI{\frac{0,3}{2}}{\mol}


Any clue on what's my problem here?

• I don't think you can use frac as an input number. You can probably ask it not to parse the number part in this case, consult the manual. Also you might want to look at the mhchem package to format the Fe3O4. – daleif Nov 18 '18 at 18:31
• \frac is not a number as far as siunitx's parsing goes. You can disable the parsing rules for that single instance using parse-numbers=false. – Skillmon Nov 18 '18 at 18:31
• Using chemfig but removed it to be easier readable @daleif – writzlpfrimpft Nov 18 '18 at 18:33

For anyone wondering: Either use

\sisetup{parse-numbers = false}


(thanks to Skillmon) or

\sisetup{quotient-mode = fraction}


and input the number as \SI{3/4}{\mol}.

• You can also use this as an optional argument to \SI if you don't want to disable parsing globally (so \SI[parse-numbers=false]{\frac{0.3}{2}}{\mol}). – Skillmon Nov 18 '18 at 18:35

The error message indicates that siunitx means a number written in decimal notation and not fractional.

\documentclass[a4paper]{article}
\usepackage{amsmath, amsthm, amssymb, mathtools}
\usepackage{siunitx}

\begin{document}
\begin{aligned} n(O2)&=\SI{.15}{\mol}\qquad\qquad &n(Fe3O4)&=\SI{0.3}{\mol} % <- this line \end{aligned}
\end{document}