How do I print \frac{4}{3} m/s using the siunitx package?
$\SI{\frac{4}{3}}{m/s}$ gives an error.
How do I print \frac{4}{3} m/s using the siunitx package?
$\SI{\frac{4}{3}}{m/s}$ gives an error.
SIunitx can output fractions if you (1) tell it to do this, and (2) write down input as a/b:
\documentclass{minimal}
\usepackage{siunitx}
\begin{document}
\sisetup{quotient-mode=fraction} % Output a/b as \frac{a}{b}
\SI{3/4}{\meter/\second}
\end{document}
You can set the quotient mode on a case by case basis:
\SI[quotient-mode=fraction]{3/4}{\meter/\second}
or change the fraction macro:
\SI[quotient-mode=fraction, fraction-function=\dfrac]{3/4}{\meter/\second}
% Need amsmath for \dfrac
\numand\SIcommands 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 – Jan 15 '17 at 17:06\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 theper-mode=symbolfrom the\sisetup. – Torbjørn T. Jan 15 '17 at 21:21