Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Basically, I have the following latex code:

\begin{align*}
+ \left(    \left[ \sum_i y_i x_i(r) - \frac{1}{n}\sum_i y_i \sum_i x_i(r) \right]  \left[  \sum_i x_i^2(r) - \frac{1}{n} \left( \sum_i x_i(r)\right)^2\right]^{-2}  \left[ \sum_i \frac{d^2 x^2_i(r)}{dr^2} -  \frac{2}{n} \left[  \left( \sum_i \frac{d x^2_i(r)}{dr}  \right)^2 + \left( \sum_i x_i(r)\right) \left( \sum_i \frac{d^2 x_i(r)}{dr^2}\right) \right]\right]   \right) \\
\;\;\;)
\end{align*}

The problem is that this is too long to fit in one line. However, if I split it, an error occurs saying that there is no \right) to match the \left( on the same line.

I tried breqn. It didnt work at all.

Please help me out, as I am very tired of getting errors.

share|improve this question
3  
Use a closing \right. on the first line and and opening \left. on the second line. The \left, \right have to occur in pairs on one line of an equation. But you really should consider using fixed sizes provided by \big(, bigg(, etc. –  Peter Grill Jun 3 at 19:44
    
good advice in the second answer to How to make \left, \right pairs of delimiter work over multiple lines? –  barbara beeton Jun 3 at 20:04

1 Answer 1

Some suggestions

  • Since there's no (obvious) alignment point once the long equation is split into two separate parts, a multline* environment (or even a gather* environment) may be a more natural choice than align*.

  • To highlight the fact that the material on the two lines is connected multiplicatively, it may be worth adding a \times symbol at the start of the second line.

  • With the material at hand, the \left and \right directives tend to produce math "fences" that are unnecessarily large, and as a result your readers might see mostly fences and have a hard time taking in what the fences enclose. You may want to use \biggl and \biggr for all inner round parentheses as well as for three of the four pairs of square brackets, and \Biggl and \Biggr only for the outermost two pairs of fences.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{multline*}
\Biggl\{\biggl[ \sum_i y_i x_i(r) 
- \frac{1}{n}\sum_i y_i \sum_i x_i(r) \biggr]  
\biggl[  \sum_i x_i^2(r) - \frac{1}{n} 
\biggl( \sum_i x_i(r)\biggr)^{\!2}\,\biggr]^{-2}\\
{}\times\Biggl[ \sum_i \frac{d^2 x^2_i(r)}{dr^2} -  
\frac{2}{n} \biggl[ \biggl(\sum_i \frac{d x^2_i(r)}{dr}  \biggr)^{\!2} 
+ \biggl( \sum_i x_i(r)\biggr) 
\biggl( \sum_i \frac{d^2 x_i(r)}{dr^2}\biggr) 
\biggr] \Biggr]   \Biggr\} \\
\end{multline*}
\end{document}

Just for comparison, here's the same equation but with all explicit fence-sizing instructions replaced with \left and \right directives. (Note the addition of \right. right before \\ and of \left. at the start of the next line. These instructions are necessary so the left and right directives are "balanced" on every line of the displaymath material.) In addition to observing that the fences are now much larger than in the first example, do also observe that the pairs of square brackets on the first line aren't the same size -- not great!

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{multline*}
\left\{\left[ \sum_i y_i x_i(r) 
- \frac{1}{n}\sum_i y_i \sum_i x_i(r) \right]  
\left[  \sum_i x_i^2(r) - \frac{1}{n} 
\left( \sum_i x_i(r)\right)^2\,\right]^{-2} \right.\\
\left. {}\times\left[ \sum_i \frac{d^2 x^2_i(r)}{dr^2} -  
\frac{2}{n} \left[ \left(\sum_i \frac{d x^2_i(r)}{dr}  \right)^2 
+ \left( \sum_i x_i(r)\right) 
\left( \sum_i \frac{d^2 x_i(r)}{dr^2}\right) 
\right] \right]   \right\} \\
\end{multline*}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.