The equation exceed the margin, and I want to wrap the equation while aligning the equal sign, the following is my original codes:

 \begin{eqnarray}\label{ 7}
  \beta_{ij}^{js-js}\mid z_{ij}  &=  \left(1 -\left(\frac{n -2}{\lVert \boldsymbol{z_j}\rVert^2-\frac{2(n-2)\sum_iz_{ij}^2}{\lVert \boldsymbol{z_{i}}\rVert^2}+\frac{(n-2)^2\sum_iZ_{ij}^2}{\lVert \boldsymbol{z_i}\rVert^4}} +\frac{\text{p}-2}{\lVert \boldsymbol{z_{i}} \rVert^2}  -\frac{\left(n -2\right)\left(\text{p}-2\right)}{\lVert \boldsymbol{z_{i}} \rVert^2 \left(\lVert \boldsymbol{z_j}\rVert^2-\frac{2(n-2)\sum_iz_{ij}^2}{\lVert \boldsymbol{z_{i}}\rVert^2}+\frac{(n-2)^2\sum_iZ_{ij}^2}{\lVert \boldsymbol{z_i}\rVert^4}\right)} \right)z_{ij} 
    \\&=\left(1 -\left(\frac{n -2}{\lVert \boldsymbol{z_j}\rVert^2-k_j} +\frac{\text{p}-2}{\lVert \boldsymbol{z_{i}} \rVert^2} - \frac{\left(n -2\right)\left(\text{p}-2\right)}{\lVert \boldsymbol{z_{i}} \rVert^2 \left(\lVert \boldsymbol{z_j}\rVert^2-k_j\right)} \right)\right) z_{ij} 


The result that I want

enter image description here

I tried \right\\ \left before the cutting position, but I didn't get the desire result. I also try the following solution I checked online, but still not work in my case. Could anyone offer me a help? Thank you.

 y & = & x \\
& & {} + x1 \\
& & {} + x2
  • 2
    You should never use eqnarray it is completely obsoleted by the amsmath package which you must also have loaded as you have split defined. – David Carlisle May 14 '17 at 20:35

You could use equation and \begin{aligned}[b] (as @Mico kindly suggested), this is under the assumption you want only a single number for the equation. With the [b] option the eqn number is printed on the bottom line

  \beta_{ij}^{js-js}\mid z_{ij}  &=
    \Biggl(1 -\Biggl(\frac{n -2}{\lVert \boldsymbol{z_j} \rVert^2 - \frac{2(n-2)\sum_iz_{ij}^2}{\lVert \boldsymbol{z_{i}}\rVert^2}+\frac{(n-2)^2\sum_iZ_{ij}^2}{\lVert \boldsymbol{z_i}\rVert^4} } + 
    \frac{\mathrm{p}-2}{\lVert \boldsymbol{z_{i}} \rVert^2} \\
     &\qquad-\frac{(n -2)(\mathrm{p}-2)}{\lVert \boldsymbol{z_{i}} \rVert^2 \Bigl(\lVert \boldsymbol{z_j}\rVert^2  -\frac{2(n-2)\sum_iz_{ij}^2}{\lVert \boldsymbol{z_{i}}\rVert^2}+\frac{(n-2)^2\sum_iZ_{ij}^2}{\lVert \boldsymbol{z_i}\rVert^4}\Bigr)} \Biggr)  \Biggr) z_{ij}
    &=\biggl(1 -\biggl(\frac{n -2}{\lVert \boldsymbol{z_j}\rVert^2-k_j} +\frac{\text{p}-2}{\lVert \boldsymbol{z_{i}} \rVert^2} - \frac{(n -2)(\mathrm{p}-2)}{\lVert \boldsymbol{z_{i}} \rVert^2 (\lVert \boldsymbol{z_j}\rVert^2-k_j)} \biggr)\biggr) z_{ij} 


enter image description here

What I did, except using the aforementioned environment is:

  1. aligned the second row with a \qquad space, in order to give it an "indent", which is what I think you wanted

  2. Got rid of left and right which were abused (it's best to manually scale the parentheses with commands such as biglbigr and so on, to have better spacing and scaling). you could tweak it if you want

  3. I replaced text with mathrm (text gives the current font)

  • 3
    It seems kind of odd to place the equation number on the middle line. Consider replacing the split environment with an aligned[b] environment? – Mico May 14 '17 at 21:13
  • 2
    @Mico if I manage to correct it I'll do it now thanks, you're right – Moriambar May 14 '17 at 21:27
  • 1
    Congrats on passing the 4K rep mark! – Mico May 14 '17 at 21:43
  • 2
    there's a closing parenthesis missing in the first equation, and the initial paren in the same equation should be larger, the same size as the one preceding the fraction. – barbara beeton May 14 '17 at 22:15
  • 1
    @barbarabeeton I'll try and correct this as soon as I come home from work, which will be in around 12 hours, thanks – Moriambar May 15 '17 at 6:16

Never use eqnarray.

With some simplifications and changes in the input, notably

  • \norm{...} instead of \lVert...\rVert
  • \bm instead of \boldsymbol; also \bm{z_j} and similar have been changed to \bm{z}_j because the subscript should not be bold
  • \text{p} became p; if you really need it upright, it should be \mathrm{p}
  • the complicated denominator in the third summand in the top equation has been set as a product
  • useless \left and \right removed
  • some \, for spacing the big parentheses added

I left \label{7}, although I suggest a more meaningful name. In any case \label{ 7} is dubious, as it requires \ref{ 7} which is awkward.




\beta_{ij}^{js-js}\mid z_{ij}  
                 \frac{2(n-2)\sum_i z_{ij}^2}{\norm{\bm{z}_{i}}^2}+
                 \frac{(n-2)^2\sum_i Z_{ij}^2}{\norm{\bm{z}_i}^4}
        \frac{(n-2)(p-2)}{\norm{\bm{z}_{i}}^2 (\norm{\bm{z}_j}^2-k_j)}
    \biggr) z_{ij} 


enter image description here


I replaced eqnarray by align and adjusted some of the markup. (the use of \boldsymbol still looks a bit suspect.

enter image description here




 \begin{align}\label{zz}% don't use numbers as labels.
  \beta_{ij}^{js-js}\mid z_{ij}  &= \Bigl(1 -
\bigl(\frac{n -2}{\lVert \boldsymbol{z_j}\rVert^2-\frac{2(n-2)\sum_iz_{ij}^2}{\lVert \boldsymbol{z_{i}}\rVert^2}+\frac{(n-2)^2\sum_iZ_{ij}^2}{\lVert \boldsymbol{z_i}\rVert^4}} +\frac{\mathrm{p}-2}{\lVert \boldsymbol{z_{i}} \rVert^2}\notag\\
  -\frac{(n -2)(\mathrm{p}-2)}{\lVert \boldsymbol{z_{i}} \rVert^2 (\lVert \boldsymbol{z_j}\rVert^2-\frac{2(n-2)\sum_iz_{ij}^2}{\lVert \boldsymbol{z_{i}}\rVert^2}+\frac{(n-2)^2\sum_iZ_{ij}^2}{\lVert \boldsymbol{z_i}\rVert^4})}
    \\&=(1 -(\frac{n -2}{\lVert \boldsymbol{z_j}\rVert^2-k_j} +\frac{\mathrm{p}-2}{\lVert \boldsymbol{z_{i}} \rVert^2} - \frac{(n -2)(\mathrm{p}-2)}{\lVert \boldsymbol{z_{i}} \rVert^2 (\lVert \boldsymbol{z_j}\rVert^2-k_j)} )
\Bigr) z_{ij} 

Whatever else you do, don't use eqnarray -- it's badly deprecated.

I suggest using a single align environment, not using a split environment, replacing all \boldsymbol directives with \bm (from the bm package), and defining a \norm macro to cut down on all the \lVert and \rVert directives. For extra legibility, consider using square brackets in addition to round parentheses. And, rather than \text{p}, write \mathrm{p}, and don't overuse \left and \right.

enter image description here

\beta_{ij}^{js-js} \bigm| z_{ij}  
&=  \left[1 -\left(
 \frac{n -2}{\norm{\bm{z_j}}^2
  \right.\right. \notag\\
  &\qquad\quad -\left.\left.\frac{(n-2)(\mathrm{p}-2)}{\norm{\bm{z_{i}}}^2
  \Bigl( \norm{\bm{z_j}}^2
  +\frac{(n-2)^2\sum_iZ_{ij}^2}{\norm{\bm{z_i}}^4} \Bigr)} 
  \right)\!\right] z_{ij}\notag\\[2ex]
&=\biggl[1 -\biggl(\frac{n -2}{\norm{\bm{z_j}}^2-k_j} 
  (\norm{\bm{z_j}}^2-k_j)} \biggr)\biggr] z_{ij} \label{eq:7}

with multlined from mathtools and consider some suggestion from above answers:

enter image description here


\beta_{ij}^{js-js}\Big| z_{ij}
    & = \begin{multlined}[t][0.7\linewidth]
        \left[1 -
        \left(\frac{n -2}
                -\frac{2(n-2)\sum_i z_{ij}^2}
                      {\lVert \boldsymbol{z_{i}}\rVert^2}
                +\frac{(n-2)^2\sum_i Z_{ij}^2}
                      {\lVert \boldsymbol{z_i}\rVert^4}
              } \right)z_{ij}
        \end{multlined}                     \notag  \\[1ex]
    & = \left[(1 -\left(\frac{n - 2}
            + \frac{\mathrm{p}-2}
                   {\lVert \boldsymbol{z_{i}} \rVert^2}
            - \frac{\left(n -2\right)\left(\mathrm{p}-2\right)}
    \right] z_{ij}

  • 1
    If you use \sum\limits, you should also enlarge quite a few of the parentheses. – Mico May 14 '17 at 21:15
  • 1
    @Mico, you have right, I remove \limits. – Zarko May 14 '17 at 22:35
  • 1
    the size of the opening bracket and parenthesis in the first line doesn't match the size of the closing parenthesis and bracket on the next line. – barbara beeton May 15 '17 at 2:05
  • 1
    @barbarabeeton, yes, they are :( the paranthesis in denomitar are to big, they should be \Big instead \bigg. corrected. – Zarko May 15 '17 at 2:33

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.