[Tex/LaTex] package siunitx doesnt work with option

siunitx

I'm using the package siunitx for unit-typesetting.
In particular I wanted this expression:

\SI[per=frac,fraction=nice]{2}{\celsius\per\kilo\metre}

unfortunately I get many errors like:

siunitx error: version-1-option
version 1 option 'per' detected

Similarly for fraction

Without the option part it works:

\SI{2}{\celsius\per\kilo\metre}

I'm thinking that is because I'm not using latin but utf8 (inputenc) encoding, but not sure?!
Any advice?

Best Answer

The names of options in siunitx changed a lot between versions 1 and 2, and you are using the names from version 1, while you have version 2 installed. In version 2.x of siunitx you should use per-mode=fraction, not per=frac. Similarly you should use fraction-function=\sfrac instead of fraction=nice. \usepackage{xfrac} is also required.

(Addendum: clemens points out in a comment below that the nice option may have been referring to the nicefrac package and its \nicefrac macro. The output is similar, if you prefer nicefrac, use \usepackage{nicefrac} instead of loading xfrac, and use fraction-function=\nicefrac.)

The manual can be found at for example: http://texdoc.net/texmf-dist/doc/latex/siunitx/siunitx.pdf

\documentclass{article}
\usepackage{siunitx}
\usepackage{xfrac}
\begin{document}

\SI[per-mode=fraction,fraction-function=\sfrac]{2}{\celsius\per\kilo\metre}

\end{document}

enter image description here

Related Question