4

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.

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}
0

As far as I know there are two ways to use bracket splitting in latex equations

  1. As it was mentioned by Mico one can use the fixed size notation. For example, \biggl[ ...splitting... \biggr].
  2. Another way is using auto size notation with \vphantom element for sizing

    \begin{align}
         E = &\left(
             a + b + c \vphantom{\frac{a}{b}}   \right. \\
             &\left. + \frac{a}{b} 
             \right)
    \end{align}
    

    enter image description here

Here one need to find the highest element in equation (the \frac{a}{b} in the second line in the example) and add the phantom element of equal height to another line of the equation with using \vphantom

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