71

When using siunitx, by default, \SIrange{0}{10}{\celsius} will render 0 °C to 10 °C.

Is there any general way to change the default rendering of ranges to 0--10 °C (i.e., using an en dash instead of "to").

user2473
  • 3,108
  • 1
    Its is not recommended to change this setting according to the siunitx documentation: Physical quantities could be misinterpret as negative values if written in this way. As the quantity is a single mathematical entity, writing the values with an en-dash followed by a single unit is also incorrect. As a result, using the word ‘to’ is strongly recommended. – mab0189 May 19 '23 at 20:41

1 Answers1

100

The relevant option is range-phrase. This is explained in section 4.6 Lists, products and ranges of the documentation.

\documentclass{article}
\usepackage{siunitx}
\begin{document}

\sisetup{range-phrase=,--,}
\SIrange{0}{10}{\celsius} \end{document}

tanGIS
  • 1,645
  • 15
  • 32
Jake
  • 232,450
  • 10
    Ah, dunno how I skipped over that! While we're on the subject, is there a way to eliminate the first °C after generating the 0 °C--10 °C in order to render 0--10 °C? Thanks for your answer! – user2473 Feb 07 '12 at 06:01
  • 65
    range-units=single – Jake Feb 07 '12 at 06:02
  • 7
    If you want to apply this to individual instances of \SIrange, you can also use \SIrange[range-phrase=--]{0}{10}{\celsius} instead of \sisetup, which applies globally. – hertzsprung May 22 '19 at 11:00
  • It is better to add a small non-breaking space before and after the dash. Source: Forssman u. de Jong: Detailtypografie – tanGIS Jan 21 '24 at 13:44
  • @Jake: Because of the reasons given by @mab0189 in the comment of the question they changed the behaviour so range-units=single will return (2 to 4) °C as of 2024 – tanGIS Jan 21 '24 at 13:53