# [Tex/LaTex] How to input open intervals

math-modespacing

I want to write open and half-open intervals using the following notation:

]a, b[
]a, b]
]-∞, b]


When writing them just like that in the LaTeX source, the spacing doesn't come out right. For example, for this equation:

 $$X = ]-\frac{π}{2}, +\frac{π}{2}[$$


the minus sign is typeset as a binary operator. I can solve this by surrounding the whole value in braces, but then the spacing around the equal sign is still not correct. For other combinations of intervals and operators, different spacing inconsistencies arise.

What is the correct and easy way to input intervals in order to avoid having to take care of this at all?

You can use \left] and \right[ then the brackets are taken as delimiters (and also get resized accordantly to the content):
$$X = \left]-\frac{π}{2}, +\frac{π}{2}\right[$$