0

Very reduced example:

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

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

However I end up with

siunitx error: "invalid-token-in-number"
n(O2)&=\SI{\frac{0,3}{2}}{\mol}
                               \qquad\qquad &n(Fe3O4)&=\SI{0,3}{\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
  • 1
    \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
1

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}.

  • 1
    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
0

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

siunitx

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.