How do I print \frac{4}{3} m/s using the siunitx package?

$\SI{\frac{4}{3}}{m/s}$ gives an error.

  • 3
    The \num and \SI commands have an optional argument, $\SI[parse-numbers=false]{\frac{4}{3}}{\meter/\second}$, but $\frac{4}{3}$ \si{\meter/\second} could be a better approach – user31729 Jan 15 '17 at 17:06
  • 1
    In addition to Boris' answer, note that it might be better to write \SI{3/4}{\meter\per\second}, and have \sisetup{quotient-mode=fraction,per-mode=symbol}. If you decide at some point to use units of the form m s^{-1}, then you just need to remove the per-mode=symbol from the \sisetup. – Torbjørn T. Jan 15 '17 at 21:21
  • @TorbjørnT. I suggest editing Boris' answer to include this information as it is what I was looking for. – Toivo Säwén Feb 18 at 11:04

SIunitx can output fractions if you (1) tell it to do this, and (2) write down input as a/b:

\sisetup{quotient-mode=fraction} % Output a/b as \frac{a}{b}

enter image description here

You can set the quotient mode on a case by case basis:


or change the fraction macro:

\SI[quotient-mode=fraction, fraction-function=\dfrac]{3/4}{\meter/\second} 
% Need amsmath for \dfrac

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.