1

I'm using the siunitx, i.e. in the preamble of my document I'm including \usepackage{siunitx}.

If I write in my document $\num{1234}$ it works very well, but if I try to use $\SI{\num{1234}}{s}$ I'm getting a syntax error (invalid token).

Why and how can I prevent this?

machinery
  • 694
  • 3
    \SI{1234}{s}$ -- \num is meant for numbers only -- the first argument of \SI is designed to take the unit value –  Jun 25 '16 at 18:25
  • 1
    You dont need to put \num inside \SI. Simply write \SI{1234}{\second}. You don't need $-sign aroubd it either. Use the \sisetup{detect-all}if you wish. – Runar Jun 25 '16 at 18:27
  • @ChristianHupfer: MIght as well write up an answer to get this closed. I thought you can use \SI[parse-numbers=false], but then this seems to apply this option to the \num macro as well so that doesn't work. Related Question: [Use \num macro with \SIparse-numbers=false. – Peter Grill Jul 31 '16 at 09:07
  • @PeterGrill: Well, I could add an answer, but actually, I think, Joseph should do so... I will add one, Joseph can still provide another (better) one ;-) –  Jul 31 '16 at 09:10

1 Answers1

3

Use \SI{1234}{\second} if a unit and the value should be displayed together. Just use \num for the value only and \si{\second} for the unit only.

A combination of \SI{\num....}{} is not useful (and apparently wrong)