Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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):

\documentclass{article}
\usepackage{siunitx}
%\sisetup{input-ignore={\protect }}
\begin{document}
\num{60~000}
\end{document}

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?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

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

\documentclass{article}
\usepackage{siunitx}
\sisetup{input-ignore=~,
  input-protect-tokens = ~\approx\dots\ge\geq\gg\le\leq\ll\mp\pi\pm\sim}
\begin{document}
\num{60\,000}
\end{document}
share|improve this answer
    
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 at 9:26
    
Great, thank you. –  Harald Sep 3 at 9:29
    
It's amazing to have such people one the site! –  clabacchio Sep 3 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 at 8:17
    
@JosephWright updated my library today. Works like a charm and makes the workaround unnecessary :) –  Harald Sep 11 at 14:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.