What's the correct way to typeset the following to get the normal spacing you would expect were you to, for example, write the terms out by hand.


\[ \left( \prod_{i=1}^m X_i \right)^n \]
\[ O\left(\frac{1}{n}\right) \]

Which looks like this:

enter image description here

In the first case the space to the exponent 'n' is too large. In the latter case the space between the 'O' and the open bracket is too large.

  • 1
    I don't think the spacing looks that bad actually... You could manually adjust the spacing by adding a negative hspace. \[ O\hspace*{-.25em}\left(\frac{1}{n}\right) \] and the same for the exponent. – Roelof Spijker Oct 12 '11 at 10:09
  • Regarding the space between the 'O' and the '(', this is discussed at great length in Spacing around \left and \right. – Hendrik Vogt Jun 27 '12 at 19:45

There are a number of ways to address spacing issues. In the first example you give, reproduced in the first gather* line in the code below, both the right large parenthesis and the exponent n indeed seem to be spaced too loosely.

Inserting a "negative thinspace", \!, before each of these two items (line 2) does eliminate the earlier looseness. Unfortunately, the overall expression now looks a bit cramped. In my view, the real culprits for making the expression in line 1 look unsatisfactory are (i) the near-collision between the opening (left) parenthesis and the subscript term below the product symbol and (ii) parentheses that are too tall relative to what they contain; see pp. 148-9 of the TeXbook for an explanation of this second point. In line 3 below, I therefore (a) insert a positive thinspace, \, after the opening parenthesis and (b) use \biggl and \biggr parentheses, as they are slightly smaller (and also a tiny bit less wide!) than those produced by \left( and \right). I think the result now looks both balanced and neither too loose nor too tight. :-)

The second example you provide is affected by the automatic additional spacing that's inserted when TeX creates \left- and \right parentheses. Switching to \biggl and \biggr parentheses, as in line 4 below, eliminates this excess space. If you do not wish to give up the convenience of automatic sizing of parentheses generated by \left-\right pairs, you could instead insert a negative thinspace, \!, between the O and the \left(.

\begin {gather*}
 \left( \prod_{i=1}^m X_i \right)^n  \\       %% "line 1"
\intertext{less space on \emph{right}:}
 \left( \prod_{i=1}^m X_i \!\right)^{\!n} \\  %% "line 2"
\intertext{more space on \emph{left}, biggl-biggr parens:}
 \biggl(\,\prod_{i=1}^m X_i\biggr)^n \\       %% "line 3"
\intertext{Left-right vs.\ biggl-biggr parentheses}
 O\left(\frac{1}{n}\right) \qquad O\biggl(\frac{1}{n}\biggr)  %% "line 4"

enter image description here

  • Accepted. However the O{\left(\frac{1}{n}\right)} answer below is surprising, simple and elegant. – Raphael Oct 18 '11 at 14:55

use it this way:


\[ \left( \prod_{i=1}^m X_i \right)^{\mkern-5mu n} \]
\[ O{\left(\frac{1}{n}\right)} \]

with {...} you do not get the delimiterspace. The exponent is correct but you can use \mkern to get it nearer to the parenthesis

  • @Herbet, That's really great, thanks. I have to ask, where is the {...} feature that you then don't get the delimiterspace documented? – Raphael Oct 12 '11 at 10:35
  • 2
    @Raphael Clifford: in the TeXbook, everything in math in {...} is like a so called math atom. See also mirror.ctan.org/info/math/voss/mathmode/Mathmode.pdf – user2478 Oct 12 '11 at 10:38

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.