I'm writing some topology up, and I prefer to use the notation ]a,b[ to denote an open interval as opposed to (a,b), since the ( and ) symbols tend to be over used in this subject.

Is there a preferred practice for writing [ and ] as mathematical symbols as opposed to delimiters? While in my editor, I notice they are highlighted in red as unpaired delimiters. I also figure if ever want to go through and automatically change my notation of open interval, I would not want to change all [ and ] to ) and (, which would greatly mess things up.

  • Similar question: How to input open intervals. Sep 1, 2011 at 7:23
  • Minor comment on the editor matching: if you put \newcommand{\lb}{[}\newcommand{\rb}{]} (note the order!) early on and use \lb and \rb instead of [ and ] then the editor won't get confused. The order of the definitions should ensure that it doesn't think that there are any open groups. Sep 1, 2011 at 9:12
  • 1
    minor quibble ... although the aspect of the brackets is reversed, when they indicate an open interval, they are still delimiters, not ordinary symbols. imperative distinction, otherwise the spacing can be compromised. Sep 1, 2011 at 19:58

3 Answers 3


It is advisable to define a command to handle such notation preferences. As you said, if you ever change your mind in the future, it would be a headache to make sure all your changes were incorporated.

Consequently, I would recommend something like (in LaTeX2e):

\newcommand{\ointerval}[1]{\ensuremath{\left]#1\right[}}% \ointerval{<interval>} -> ]#1[

and use

The open interval \ointerval{a,b} looks better than $(a,b)$.

In future, a change to \ointerval will spread throughout the document. For example, if you wanted to modify (say) the delimiters to ) (, this change will propagate on the next compile.

The choice of using extensible delimiters \left] and \right[ is highlighted by viewing it in comparison to other possible delimiters under different scenarios:

Delimiter choice

Your editor might still recognize unmatched brackets (] and [) since it is hardwired to math left to right, not right to left. However, it removes clutter from your editor view and improves flexibility.

  • 11
    actually, \left] and \right[ will improve the spacing with respect to the interval argument, even if the vertical size isn't changed. alternatively, \mathopen{]} and \mathclose{[} (which don't adjust the height), although \left and \right take care of that automatically. (ref: texbook, p.155) Aug 31, 2011 at 19:18
  • 1
    Just to complement barbara's comment: See exercise 18.14 (page 171) and the discussion to its answer (page 322) of the TeXbook. Aug 31, 2011 at 19:32
  • 1
    @Werner: you should really edit your answer to incorporate barbara's suggestion of using \mathopen{]} and \mathclose{[}. It's a shame to use a macro for an interval if it doesn't at least produce the right spacing (e.g. \ointerval{-1,1} will put too much space around the minus sign). Sep 1, 2011 at 7:22
  • @Philippe: Thanks for highlighting a case that showed poor spacing. I've updated my answer with some motivation.
    – Werner
    Sep 1, 2011 at 7:51

The mathtools package offers an easy-to-use structure for such expressions.

\usepackage{mathtools}   % loads »amsmath«



For details refer to the package manual.


Here is a version that will automatically re-size the brackets depending on the parameters. So if you decide to switch notations this will just require changing this definition to use ) instead of ]. It also has the added benefit that it allows for changing the , separator to something else such as a : in the future if that is desired.

By default a small space gets added following the comma. But some prefer that this extra space not be added. If that is your preference, you can use the commented version of the the 2 parameter version which includes a curly braces around the comma {,} as per Mico's suggestion.

%\newcommand*{\Interval}[2]{\left]#1{,}#2\right[}% Eliminate extra space following the ,
%\newcommand*{\Interval}[1]{\left]#1\right[}% Use this id you prefer using 1 parameter instead of 2


enter image description here

  • Thanks Peter. Mind if I ask why you use \vphantom? I've never used those types of commands before.
    – yunone
    Aug 31, 2011 at 18:35
  • @Peter: The use of \vphantom here is not necessary, since the extensible \left and \right operators don't care about matching the brackets, just the respective \left and \right pairing.
    – Werner
    Aug 31, 2011 at 18:37
  • 1
    this does the same! \left]\frac{a}{b},c\right[
    – user2478
    Aug 31, 2011 at 18:47
  • 2
    and there is also no need for 2 parameters, one is enough
    – user2478
    Aug 31, 2011 at 18:54
  • 1
    @Mico, @Peter: the only context in which the comma shouldn't be followed by a small space in when you use it as a decimal separator (as in French). It's not a matter of personal preference but of readability (there's a reason why Knuth made \mathpunct atoms always have a small space after them). So you should not use {,} here. Sep 1, 2011 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .