How to input open intervals

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[\)

Result


While I'm a little late to the party, here goes for a slightly more concise solution:

\usepackage{xparse}

\NewDocumentCommand{\INTERVALINNARDS}{ m m }{
    #1 {,} #2
}
\NewDocumentCommand{\interval}{ s m >{\SplitArgument{1}{,}}m m o }{
    \IfBooleanTF{#1}{
        \left#2 \INTERVALINNARDS #3 \right#4
    }{
        \IfValueTF{#5}{
            #5{#2} \INTERVALINNARDS #3 #5{#4}
        }{
            #2 \INTERVALINNARDS #3 #4
        }
    }
}

which allows you to do:

\begin{align*}
    \interval[{a,b}] &&           && \\
    \interval[{a,b}) && \text{or} && \interval[{a,b}[ \\
    \interval({a,b}] && \text{or} && \interval]{a,b}] \\
    \interval({a,b}) && \text{or} && \interval]{a,b}[
\end{align*}

to obtain something like: Interval open / closed example

Or to use manual or automatic resizing:

\begin{equation*}
    \interval[{a,\infty})[\Bigg] \quad \text{or} \quad
        \interval*[{-\frac{\pi}{2},\frac{\pi}{2}}]
\end{equation*}

to obtain:

enter image description here

Edit: Added the changes suggested by egreg (this was my answer, was just unregistered at the time).


The interval package takes care of the spacing and the scaling of the brackets.

Edit. An example code:

\documentclass{article}
\usepackage{interval}

\begin{document}

    \[ \interval[scaled]{-\frac{\pi}{2}}{\frac{\pi}{2}}\qquad\interval[scaled=\bigg]{-\frac{\pi}{2}}{\frac{\pi}{2}} \]%

\end{document} 

enter image description here