261

I have an equation contained inside \[...\], which automatically makes a \sum with sub- and superscripts turn big--so that the summation sign looks awkward inside parenthesis. Any idea how to make the parenthesis completely enclose the whole summation?

\documentclass{article}
\begin{document}
We have:
\[ \sum_{i=1}^n i = (\sum_{i=1}^{n-1} i) + n =
\frac{(n-1)(n)}{2} + n = \frac{n(n+1)}{2} \]
\end{document}
yo'
  • 51,322
jamaicanworm
  • 29,114

3 Answers3

385

The usual thing to do is replace ( with \left( and ) with \right), which automatically expand to fit the material between them. Note that every \left... requires a \right... (but the type of bracket may be different, i.e. \left(...\right] also works).

I would typeset your equation as

\begin{equation*}
\sum_{i=1}^n i = \left(\sum_{i=1}^{n-1} i\right) + n =
\frac{(n-1)(n)}{2} + n = \frac{n(n+1)}{2}
\end{equation*}

enter image description here

For manual control of sizes (most of the time you won't need these)

( \big( \Big( \bigg( \Bigg(

produce

enter image description here

qubyte
  • 17,299
  • Thanks! But when I try \left( \sum_{i=1}^{n-1} i \right) + n, the big parenthesis around the sum look very awkward--tall with little curvature. Is this a problem with the way I'm coding it, or might it just be the font (I'm using the Arev font via \usepackage{fouriernc})? – jamaicanworm Dec 20 '11 at 06:33
  • Also, why use \begin{equation*}...\end{equation*} instead of just \[...\]? – jamaicanworm Dec 20 '11 at 06:34
  • 1
    The environment I use is from the amsmath package, so yours is actually more general. I just find [...] to look messy. Alternatively there is the displaymath environment. – qubyte Dec 20 '11 at 06:56
  • 3
    @jamaicanworm: amsmath defines \[...\] to be exactly the same as \begin{equation*}...\end{equation*}. See, literally, the last couple of lines of amsmath.sty. – Werner Dec 20 '11 at 07:26
  • And by "type of bracket" you also mean that they can be "inverted", like: \left]...\right(. – Werner Dec 20 '11 at 07:28
  • 4
    @jamaicanworm The shape of the brackets is down to the font I'm afraid. If you don't like the larger curved brackets, try the square ones \left[...\right]. These often look better for larger equations. Another thing to take into account is that you're enclosing something relatively thin in those brackets. I suspect it will only look more natural when there's more between them (try putting the n to the left of the sum and loosing the brackets altogether). – qubyte Dec 20 '11 at 07:29
  • 17
    I would be a bit careful using \left/right around sums etc. because they often become too large. I tend to recommend users to: Scale the fences (parenteses and such) such that it is clear to the read what they fence in, but not to such an extend that the fences dominate the expression. – daleif Dec 20 '11 at 12:36
  • Out of topic comment: You might have already known it. – kiss my armpit Mar 25 '13 at 23:00
  • @Karl'sstudents Known what? – qubyte Mar 26 '13 at 08:57
  • TUG 2013 conference in Tokyo, click the hyperlink in the "it" above. – kiss my armpit Mar 26 '13 at 09:07
  • 12
    @MarkS.Everitt I disagree with this comment of yours "most of the times you won't need these" about the \big... family of commands. In fact, I personally believe that most of the times one shouldn't use the \left...\right construct; the family of \big... commands produces much better spacing (both vertically and horizontally) in most situations; besides you don't need to match them across lines in a display. – Gonzalo Medina Apr 12 '13 at 20:19
  • You're right. I should have written a comment here. I apologize for that. After some minutes, I will delete this comment and the one in egreg's answer. – Gonzalo Medina Apr 12 '13 at 20:20
  • I've found that second guessing LaTeX is usually the wrong thing to do. In any case I myself only need to manually size a bracket now and then, so the comment is consistent with my experience. – qubyte Apr 13 '13 at 01:58
  • This doesn't seem to work if you use the equation in a multline environment. – khatchad Mar 25 '16 at 16:44
  • @qubyte BRILLIANT. THANKS SO MUCH. [+1] – William Martens Mar 31 '21 at 12:10
  • can \left( discard underbrace text? – alper Sep 25 '22 at 14:57
61

Automatically sized parentheses are obtained with \left and \right, as any LaTeX guide or manual tells.

However, automatic sizing is not good in every case; one of these cases is precisely that of summations with limits above and below: compare the results of

\[
\left( \sum_{i=1}^{n-1} i \right)\biggl(\sum_{i=1}^{n-1} i\biggr)
\]

enter image description here

(the font is that obtained with \usepackage{fouriernc}). In general the second way is to be preferred.

egreg
  • 1,121,712
  • 4
    Do you have a reference explaining why the size is bad on the left sum? – Vincent Guillemot Feb 02 '15 at 10:31
  • 3
    @VincentGuillemot The TeXbook, for instance. – egreg Feb 02 '15 at 10:54
  • 2
    OK, thks. Let me rephrase my comment: the argument "it's prettier" (used in the TeXBook) leaves me a little bit disappointed. Isn't there a more substantial reason hidden behind this aspiration to prettyness? – Vincent Guillemot Feb 02 '15 at 12:51
  • 26
    I find the former to be prettier. – JAB Feb 02 '16 at 15:42
  • Prettier or not, sometimes some publications simply require the right style and then this answer comes so handy! However with today's MikTex I am getting Filefouriernc.sty' not found.` and it looks like just including the package is not enough. This file has to beinstalled manually. – aiag Feb 05 '17 at 17:52
42

One way is using \left and \right, followed by the parenthesis you want to use. These are mostly () [] {} \langle\rangle and |. You can also use a . to have no parenthesis displayed, e.g. when you want an opening, but no closing one.

\left( \frac12 \right)
\quad
\left\langle \frac23 \right.
\quad
\left\{ \frac34 \right]

creates

enter image description here

If you want to control the size manually, use (in ascending order) \big, \Big, \bigg, \Bigg.

( \frac12 \big)
\quad
\Bigg\langle \frac23 \big]
\quad
\Big\{ \frac34 \Bigg.

results in

enter image description here

David
  • 1,575
  • 17
    One should use \bigl in front of the left delimiter and \bigr in front of the right delimiter (similarly for \Bigl-\Bigr and the others). This is important for spacing. – egreg Dec 20 '11 at 07:40
  • 3
    @egreg: When should one use just plain \big and friends? i.e., without the l|r suffix? – morbusg Dec 20 '11 at 10:34
  • 4
    \big and friends can go in front of ordinaries: \big/ or \big|. – egreg Dec 20 '11 at 11:41
  • 5
    @egreg at least as long as \big| is not a part of a pair: \big|-x\big|\neq \bigl|-x\bigr| – daleif Dec 20 '11 at 12:34
  • 1
    I was just looking for a way to adjust { size by the formula inclosed in it. I used \left{. your answer was great. it learned me to use \left\{ instead – Sepideh Abadpour Aug 08 '15 at 10:19