josephwright/siunitx

Automatically convert comparator `~` to `\sim`

Closed this issue · 2 comments

Just like \ll, \gg, \le and \ge, \sim is recognized as a comparator by default, i.e. it is in the initial value of input-comparators. Unlike the others, the "ascii version" ~ cannot be input and automatically converted to \sim. It would be nice if that conversion could be added, so I can write \num{~100} instead of \num{\sim 100}. (The usual use of ~ as a non-breaking space is not relevant inside the number parsing macros, I'd say.)

PS: Too minor for a separate report, but there is a space in front of \sim in Table 11 of the user manual (line 1307 of siunitx.tex) which is probably accidental.

I've looked back, and I remember why I didn't do this - two reasons

  1. Unlike e.g. << converting to \ll, we don't need to alter ~ - it remains as a single token so there is no (TeX) saving
  2. ~ is (probably) active, so contrasts with < or similar, which are typically 'other' chars (though babel can impact)

To be clear, neither are blockers to the request - I'm just noting stuff down.