I would like to use a notation for ranges of integers

$[a:b] = \{ a, a+1, \dots, b-1, b \}$.

However, the spacing of $[a:b]$ is often not quite satisfying. The colon : seems to push the glyphs a and b very much to the sides, and there is not much space between the square brackets and the numbers.

Which options do I have to type such an integer range? I am particular concerned about the spacing.

  • 4
    Did you see the posting What commands are there for horizontal spacing? Aside: In math mode, the : symbol is of type mathrel by default. To eliminate the horizontal whitespace that surrounds objects of type mathrel, type either {:} or \mathord{:}.
    – Mico
    Mar 3, 2020 at 7:13
  • 4
    For no space around :, type {:}.
    – CarLaTeX
    Mar 3, 2020 at 7:16

1 Answer 1


This is a bit tricky: a simple \,{:}\, might seem enough, but there would be problems if the right boundary is a negative number. Thus some precautions are needed.




$[a\rg b]$ $[2\rg 5]$ $[-4\rg -2]$


enter image description here

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.