I used to format number grouping with a protected space (~). Now I'm switching to siunitx's \num. According to the package documentation ...

The formatter removes ‘hard’ spaces (\, and ~)

but when I surround my numbers with \num it produces the following error output

! siunitx error: "invalid-token-in-number"
! Invalid token '\protect ' in numerical input.

l.5 \num{60~000}

| Numbers can only contain tokens defined using the 'input-...' options:
| the token '\protect ' is not set up as a valid part of a number.

I tried to include \protect to the input-ignore option but it just changes the invalid token in the error message to \unhbox and \voidb.

Here is a MWE (Miktex v2.9 and siunitx v2.5s):

%\sisetup{input-ignore={\protect }}

Of course, one could just remove the tilde character in each number but how would I include it into the ignored input tokens? Do I misinterpret the package documentation?


That's a mistake in the documentation: currently the standard settings ignore \, but not ~. I'll fix that in a maintenance release: for the moment use

  input-protect-tokens = ~\approx\dots\ge\geq\gg\le\leq\ll\mp\pi\pm\sim}
  • 1
    Logged as github.com/josephwright/siunitx/issues/256 and likely to be actioned by the weekend. I've got a few minor issues to address, one of which means I'll have to bump the version to 2.6. Bother me if CTAN is not updated by Monday! – Joseph Wright Sep 3 '14 at 9:26
  • 1
    It's amazing to have such people one the site! – clabacchio Sep 3 '14 at 14:47
  • A proper fix has now gone to CTAN: should be with users of TeX Live/MiKTeX within a few days. – Joseph Wright Sep 5 '14 at 8:17
  • @JosephWright updated my library today. Works like a charm and makes the workaround unnecessary :) – Harald Sep 11 '14 at 14:24

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.