4

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?

6

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

2

You can load the v1 options with

\documentclass{article}
\usepackage[version-1-compatibility]{siunitx}
\begin{document}

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

\end{document}

or could supply a v1 option at load time so the file works with both v1 and v2, for example

\documentclass{article}
\usepackage[per = frac]{siunitx}
\begin{document}

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

\end{document}

However, I would strongly recommend using the v2 options as detailed by Torbjørn T.: there are good reasons for the option name changes.

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.